Package org.apache.lucene.geo
Class Polygon2D
- java.lang.Object
-
- org.apache.lucene.geo.EdgeTree
-
- org.apache.lucene.geo.Polygon2D
-
public final class Polygon2D extends EdgeTree
2D polygon implementation represented as a balanced interval tree of edges.Loosely based on the algorithm described in http://www-ma2.upc.es/geoc/Schirra-pointPolygon.pdf.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PointValues.Relation
componentRelate(double minLat, double maxLat, double minLon, double maxLon)
Returns relation to the provided rectangle for this componentprotected PointValues.Relation
componentRelateTriangle(double ax, double ay, double bx, double by, double cx, double cy)
boolean
contains(double latitude, double longitude)
Returns true if the point is contained within this polygon.static Polygon2D
create(Polygon... polygons)
Builds a Polygon2D from multipolygon-
Methods inherited from class org.apache.lucene.geo.EdgeTree
createTree, internalComponentRelate, relate, relateTriangle
-
-
-
-
Method Detail
-
contains
public boolean contains(double latitude, double longitude)
Returns true if the point is contained within this polygon.See https://www.ecse.rpi.edu/~wrf/Research/Short_Notes/pnpoly.html for more information.
-
componentRelateTriangle
protected PointValues.Relation componentRelateTriangle(double ax, double ay, double bx, double by, double cx, double cy)
- Overrides:
componentRelateTriangle
in classEdgeTree
-
componentRelate
protected PointValues.Relation componentRelate(double minLat, double maxLat, double minLon, double maxLon)
Returns relation to the provided rectangle for this component- Overrides:
componentRelate
in classEdgeTree
-
-