Package org.locationtech.jts.geomgraph
Class GeometryGraph
java.lang.Object
org.locationtech.jts.geomgraph.PlanarGraph
org.locationtech.jts.geomgraph.GeometryGraph
A GeometryGraph is a graph that models a given Geometry
- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PointOnGeometryLocatorprivate intprivate BoundaryNodeRuleprivate Collectionprivate booleanprivate Coordinateprivate MapThe lineEdgeMap is a map of the linestring components of the parentGeometry to the edges which are derived from them.private Geometryprivate final PointLocatorprivate booleanIf this flag is true, the Boundary Determination Rule will used when deciding whether nodes are in the boundary or notFields inherited from class org.locationtech.jts.geomgraph.PlanarGraph
edgeEndList, edges, nodes -
Constructor Summary
ConstructorsConstructorDescriptionGeometryGraph(int argIndex, Geometry parentGeom) GeometryGraph(int argIndex, Geometry parentGeom, BoundaryNodeRule boundaryNodeRule) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidvoidAdd an Edge computed externally.private voidaddLineString(LineString line) voidaddPoint(Coordinate pt) Add a point computed externally.private voidAdd a Point to the graph.private voidprivate voidaddPolygonRing(LinearRing lr, int cwLeft, int cwRight) Adds a polygon ring to the graph.private voidaddSelfIntersectionNode(int argIndex, Coordinate coord, int loc) Add a node for a self-intersection.private voidaddSelfIntersectionNodes(int argIndex) computeEdgeIntersections(GeometryGraph g, LineIntersector li, boolean includeProper) computeSelfNodes(LineIntersector li, boolean computeRingSelfNodes) Compute self-nodes, taking advantage of the Geometry type to minimize the number of intersection tests.computeSelfNodes(LineIntersector li, boolean computeRingSelfNodes, boolean isDoneIfProperInt) Compute self-nodes, taking advantage of the Geometry type to minimize the number of intersection tests.voidcomputeSplitEdges(List edgelist) private EdgeSetIntersectorstatic intdetermineBoundary(BoundaryNodeRule boundaryNodeRule, int boundaryCount) This method implements the Boundary Determination Rule for determining whether a component (node or edge) that appears multiple times in elements of a MultiGeometry is in the boundary or the interior of the Geometry
The SFS uses the "Mod-2 Rule", which this function implements
An alternative (and possibly more intuitive) rule would be the "At Most One Rule": isInBoundary = (componentCount == 1)findEdge(LineString line) booleanThis constructor is used by clients that wish to add Edges explicitly, rather than adding a Geometry.private voidinsertBoundaryPoint(int argIndex, Coordinate coord) Adds candidate boundary points using the currentBoundaryNodeRule.private voidinsertPoint(int argIndex, Coordinate coord, int onLocation) intlocate(Coordinate pt) Determines theLocationof the givenCoordinatein this geometry.Methods inherited from class org.locationtech.jts.geomgraph.PlanarGraph
add, addEdges, addNode, addNode, debugPrint, debugPrintln, find, findEdge, findEdgeEnd, findEdgeInSameDirection, getEdgeEnds, getEdgeIterator, getNodeIterator, getNodes, insertEdge, isBoundaryNode, linkAllDirectedEdges, linkResultDirectedEdges, linkResultDirectedEdges, printEdges
-
Field Details
-
parentGeom
-
lineEdgeMap
The lineEdgeMap is a map of the linestring components of the parentGeometry to the edges which are derived from them. This is used to efficiently perform findEdge queries -
boundaryNodeRule
-
useBoundaryDeterminationRule
private boolean useBoundaryDeterminationRuleIf this flag is true, the Boundary Determination Rule will used when deciding whether nodes are in the boundary or not -
argIndex
private int argIndex -
boundaryNodes
-
hasTooFewPoints
private boolean hasTooFewPoints -
invalidPoint
-
areaPtLocator
-
ptLocator
-
-
Constructor Details
-
GeometryGraph
-
GeometryGraph
-
-
Method Details
-
determineBoundary
This method implements the Boundary Determination Rule for determining whether a component (node or edge) that appears multiple times in elements of a MultiGeometry is in the boundary or the interior of the Geometry
The SFS uses the "Mod-2 Rule", which this function implements
An alternative (and possibly more intuitive) rule would be the "At Most One Rule": isInBoundary = (componentCount == 1) -
createEdgeSetIntersector
-
hasTooFewPoints
public boolean hasTooFewPoints()This constructor is used by clients that wish to add Edges explicitly, rather than adding a Geometry. (An example is BufferOp). -
getInvalidPoint
-
getGeometry
-
getBoundaryNodeRule
-
getBoundaryNodes
-
getBoundaryPoints
-
findEdge
-
computeSplitEdges
-
add
-
addCollection
-
addPoint
Add a Point to the graph. -
addPolygonRing
Adds a polygon ring to the graph. Empty rings are ignored. The left and right topological location arguments assume that the ring is oriented CW. If the ring is in the opposite orientation, the left and right locations must be interchanged. -
addPolygon
-
addLineString
-
addEdge
Add an Edge computed externally. The label on the Edge is assumed to be correct. -
addPoint
Add a point computed externally. The point is assumed to be a Point Geometry part, which has a location of INTERIOR. -
computeSelfNodes
Compute self-nodes, taking advantage of the Geometry type to minimize the number of intersection tests. (E.g. rings are not tested for self-intersection, since they are assumed to be valid).- Parameters:
li- the LineIntersector to usecomputeRingSelfNodes- iffalse, intersection checks are optimized to not test rings for self-intersection- Returns:
- the computed SegmentIntersector containing information about the intersections found
-
computeSelfNodes
public SegmentIntersector computeSelfNodes(LineIntersector li, boolean computeRingSelfNodes, boolean isDoneIfProperInt) Compute self-nodes, taking advantage of the Geometry type to minimize the number of intersection tests. (E.g. rings are not tested for self-intersection, since they are assumed to be valid).- Parameters:
li- the LineIntersector to usecomputeRingSelfNodes- iffalse, intersection checks are optimized to not test rings for self-intersectionisDoneIfProperInt- short-circuit the intersection computation if a proper intersection is found- Returns:
- the computed SegmentIntersector containing information about the intersections found
-
computeEdgeIntersections
public SegmentIntersector computeEdgeIntersections(GeometryGraph g, LineIntersector li, boolean includeProper) -
insertPoint
-
insertBoundaryPoint
Adds candidate boundary points using the currentBoundaryNodeRule. This is used to add the boundary points of dim-1 geometries (Curves/MultiCurves). -
addSelfIntersectionNodes
private void addSelfIntersectionNodes(int argIndex) -
addSelfIntersectionNode
Add a node for a self-intersection. If the node is a potential boundary node (e.g. came from an edge which is a boundary) then insert it as a potential boundary node. Otherwise, just add it as a regular node. -
locate
Determines theLocationof the givenCoordinatein this geometry.- Parameters:
pt- the point to test- Returns:
- the location of the point in the geometry
-