Search in sources :

Example 6 with GeoShape

use of org.apache.lucene.spatial3d.geom.GeoShape in project lucene-solr by apache.

the class Geo3dRptTest method testFailureLucene6535.

@Test
public void testFailureLucene6535() throws IOException {
    setupStrategy();
    final List<GeoPoint> points = new ArrayList<>();
    points.add(new GeoPoint(PlanetModel.SPHERE, 18 * DEGREES_TO_RADIANS, -27 * DEGREES_TO_RADIANS));
    points.add(new GeoPoint(PlanetModel.SPHERE, -57 * DEGREES_TO_RADIANS, 146 * DEGREES_TO_RADIANS));
    points.add(new GeoPoint(PlanetModel.SPHERE, 14 * DEGREES_TO_RADIANS, -180 * DEGREES_TO_RADIANS));
    points.add(new GeoPoint(PlanetModel.SPHERE, -15 * DEGREES_TO_RADIANS, 153 * DEGREES_TO_RADIANS));
    final GeoPoint[] pathPoints = new GeoPoint[] { new GeoPoint(PlanetModel.SPHERE, 55.0 * DEGREES_TO_RADIANS, -26.0 * DEGREES_TO_RADIANS), new GeoPoint(PlanetModel.SPHERE, -90.0 * DEGREES_TO_RADIANS, 0.0), new GeoPoint(PlanetModel.SPHERE, 54.0 * DEGREES_TO_RADIANS, 165.0 * DEGREES_TO_RADIANS), new GeoPoint(PlanetModel.SPHERE, -90.0 * DEGREES_TO_RADIANS, 0.0) };
    final GeoShape path = GeoPathFactory.makeGeoPath(PlanetModel.SPHERE, 29 * DEGREES_TO_RADIANS, pathPoints);
    final Shape shape = new Geo3dShape(path, ctx);
    final Rectangle rect = ctx.makeRectangle(131, 143, 39, 54);
    testOperation(rect, SpatialOperation.Intersects, shape, true);
}
Also used : GeoPoint(org.apache.lucene.spatial3d.geom.GeoPoint) GeoShape(org.apache.lucene.spatial3d.geom.GeoShape) Shape(org.locationtech.spatial4j.shape.Shape) GeoShape(org.apache.lucene.spatial3d.geom.GeoShape) ArrayList(java.util.ArrayList) Rectangle(org.locationtech.spatial4j.shape.Rectangle) Test(org.junit.Test)

Example 7 with GeoShape

use of org.apache.lucene.spatial3d.geom.GeoShape in project lucene-solr by apache.

the class Geo3dShapeSphereModelRectRelationTest method testFailure2_LUCENE6475.

@Test
public void testFailure2_LUCENE6475() {
    GeoShape geo3dCircle = GeoCircleFactory.makeGeoCircle(planetModel, 1.6282053147165243E-4 * RADIANS_PER_DEGREE, -70.1600629789353 * RADIANS_PER_DEGREE, 86 * RADIANS_PER_DEGREE);
    Geo3dShape geo3dShape = new Geo3dShape(planetModel, geo3dCircle, ctx);
    Rectangle rect = ctx.makeRectangle(-118, -114, -2.0, 32.0);
    assertTrue(geo3dShape.relate(rect).intersects());
    // thus the bounding box must intersect too
    assertTrue(geo3dShape.getBoundingBox().relate(rect).intersects());
}
Also used : GeoShape(org.apache.lucene.spatial3d.geom.GeoShape) Rectangle(org.locationtech.spatial4j.shape.Rectangle) Test(org.junit.Test)

Aggregations

GeoShape (org.apache.lucene.spatial3d.geom.GeoShape)7 GeoPoint (org.apache.lucene.spatial3d.geom.GeoPoint)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)3 HashSet (java.util.HashSet)2 Query (org.apache.lucene.search.Query)2 XYZBounds (org.apache.lucene.spatial3d.geom.XYZBounds)2 Rectangle (org.locationtech.spatial4j.shape.Rectangle)2 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 Document (org.apache.lucene.document.Document)1 NumericDocValuesField (org.apache.lucene.document.NumericDocValuesField)1 IndexReader (org.apache.lucene.index.IndexReader)1 IndexWriter (org.apache.lucene.index.IndexWriter)1 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)1 LeafReaderContext (org.apache.lucene.index.LeafReaderContext)1 NumericDocValues (org.apache.lucene.index.NumericDocValues)1 Term (org.apache.lucene.index.Term)1 IndexSearcher (org.apache.lucene.search.IndexSearcher)1