public class Polygon2D extends EdgeTree
Loosely based on the algorithm described in http://www-ma2.upc.es/geoc/Schirra-pointPolygon.pdf.
Modifier and Type | Field and Description |
---|---|
protected Polygon2D |
holes
tree of holes, or null
|
Modifier | Constructor and Description |
---|---|
protected |
Polygon2D(double minLat,
double maxLat,
double minLon,
double maxLon,
double[] lats,
double[] lons,
Polygon2D holes) |
protected |
Polygon2D(Polygon polygon,
Polygon2D holes) |
Modifier and Type | Method and Description |
---|---|
protected PointValues.Relation |
componentRelate(double minLat,
double maxLat,
double minLon,
double maxLon)
Returns relation to the provided rectangle for this component
|
protected PointValues.Relation |
componentRelateTriangle(double ax,
double ay,
double bx,
double by,
double cx,
double cy)
Returns relation to the provided triangle for this component
|
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
|
createTree, internalComponentRelate, pointInTriangle, relate, relateTriangle
protected final Polygon2D holes
protected Polygon2D(double minLat, double maxLat, double minLon, double maxLon, double[] lats, double[] lons, Polygon2D holes)
public boolean contains(double latitude, double longitude)
See https://www.ecse.rpi.edu/~wrf/Research/Short_Notes/pnpoly.html for more information.
protected PointValues.Relation componentRelate(double minLat, double maxLat, double minLon, double maxLon)
EdgeTree
componentRelate
in class EdgeTree
protected PointValues.Relation componentRelateTriangle(double ax, double ay, double bx, double by, double cx, double cy)
EdgeTree
componentRelateTriangle
in class EdgeTree
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.