Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Jun 5, 2024
1 parent f00cf3d commit 24c9220
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 24c9220

Please sign in to comment.