diff --git a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/DimensionLocation.java b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/DimensionLocation.java index 6aa32b286d..bcdc421ac2 100644 --- a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/DimensionLocation.java +++ b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/DimensionLocation.java @@ -14,6 +14,13 @@ import org.locationtech.jts.geom.Dimension; import org.locationtech.jts.geom.Location; +/** + * Codes which combine a geometry dimension and a location + * on the geometry. + * + * @author mdavis + * + */ class DimensionLocation { public static final int EXTERIOR = Location.EXTERIOR; diff --git a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSection.java b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSection.java index dd59d7bf50..f707df0109 100644 --- a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSection.java +++ b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/NodeSection.java @@ -95,6 +95,12 @@ public int ringId() { return ringId; } + /** + * Gets the polygon this section is part of. + * Will be null if section is not on a polygon boundary. + * + * @return the associated polygon, or null + */ public Geometry getPolygonal() { return poly; } diff --git a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelateGeometry.java b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelateGeometry.java index 57ad0ef5ae..e84713ad63 100644 --- a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelateGeometry.java +++ b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelateGeometry.java @@ -178,6 +178,12 @@ public boolean hasDimension(int dim) { return false; } + /** + * Gets the actual non-empty dimension of the geometry. + * Zero-length LineStrings are treated as Points. + * + * @return the real (non-empty) dimension + */ public int getDimensionReal() { if (isGeomEmpty) return Dimension.FALSE; if (getDimension() == 1 && isLineZeroLen) @@ -208,6 +214,10 @@ public int locateLineEnd(Coordinate p) { /** * Locates a vertex of a polygon. + * A vertex of a Polygon or MultiPolygon is on + * the {@link Location#BOUNDARY}. + * But a vertex of an overlapped polygon in a GeometryCollection + * may be in the {@link Location#INTERIOR}. * * @param pt the polygon vertex * @return the location of the vertex diff --git a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelatePointLocator.java b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelatePointLocator.java index 35ae78f2e9..f4942e78c3 100644 --- a/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelatePointLocator.java +++ b/modules/core/src/main/java/org/locationtech/jts/operation/relateng/RelatePointLocator.java @@ -152,13 +152,21 @@ public int locateLineEnd(Coordinate p) { * (i.e. a point or on an edge). * * @param p the node point to locate - * @param polygonal + * @param parentPolygonal the polygon the point is a node of * @return the location of the node point */ public int locateNode(Coordinate p, Geometry parentPolygonal) { return DimensionLocation.location(locateNodeWithDim(p, parentPolygonal)); } + /** + * Locates a point which is known to be a node of the geometry, + * as a {@link DimensionLocation}. + * + * @param p the point to locate + * @param parentPolygonal the polygon the point is a node of + * @return the dimension and location of the point + */ public int locateNodeWithDim(Coordinate p, Geometry parentPolygonal) { return locateWithDim(p, true, parentPolygonal); }