public class PolygonBuilder
extends java.lang.Object
Polygon
s out of a graph of DirectedEdge
s.
The edges to use are marked as being in the result Area.
Modifier and Type | Field and Description |
---|---|
private GeometryFactory |
geometryFactory |
private java.util.List |
shellList |
Constructor and Description |
---|
PolygonBuilder(GeometryFactory geometryFactory) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Collection dirEdges,
java.util.Collection nodes)
Add a set of edges and nodes, which form a graph.
|
void |
add(PlanarGraph graph)
Add a complete graph.
|
private java.util.List |
buildMaximalEdgeRings(java.util.Collection dirEdges)
for all DirectedEdges in result, form them into MaximalEdgeRings
|
private java.util.List |
buildMinimalEdgeRings(java.util.List maxEdgeRings,
java.util.List shellList,
java.util.List freeHoleList) |
private java.util.List |
computePolygons(java.util.List shellList) |
boolean |
containsPoint(Coordinate p)
Checks the current set of shells (with their associated holes) to
see if any of them contain the point.
|
private EdgeRing |
findEdgeRingContaining(EdgeRing testEr,
java.util.List shellList)
Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
|
private EdgeRing |
findShell(java.util.List minEdgeRings)
This method takes a list of MinimalEdgeRings derived from a MaximalEdgeRing,
and tests whether they form a Polygon.
|
java.util.List |
getPolygons() |
private void |
placeFreeHoles(java.util.List shellList,
java.util.List freeHoleList)
This method determines finds a containing shell for all holes
which have not yet been assigned to a shell.
|
private void |
placePolygonHoles(EdgeRing shell,
java.util.List minEdgeRings)
This method assigns the holes for a Polygon (formed from a list of
MinimalEdgeRings) to its shell.
|
private void |
sortShellsAndHoles(java.util.List edgeRings,
java.util.List shellList,
java.util.List freeHoleList)
For all rings in the input list,
determine whether the ring is a shell or a hole
and add it to the appropriate list.
|
private GeometryFactory geometryFactory
private java.util.List shellList
public PolygonBuilder(GeometryFactory geometryFactory)
public void add(PlanarGraph graph)
public void add(java.util.Collection dirEdges, java.util.Collection nodes)
public java.util.List getPolygons()
private java.util.List buildMaximalEdgeRings(java.util.Collection dirEdges)
private java.util.List buildMinimalEdgeRings(java.util.List maxEdgeRings, java.util.List shellList, java.util.List freeHoleList)
private EdgeRing findShell(java.util.List minEdgeRings)
private void placePolygonHoles(EdgeRing shell, java.util.List minEdgeRings)
private void sortShellsAndHoles(java.util.List edgeRings, java.util.List shellList, java.util.List freeHoleList)
private void placeFreeHoles(java.util.List shellList, java.util.List freeHoleList)
findEdgeRingContaining
method.
(This is the case because any holes which are NOT
properly contained (i.e. are connected to their
parent shell) would have formed part of a MaximalEdgeRing
and been handled in a previous step).TopologyException
- if a hole cannot be assigned to a shellprivate EdgeRing findEdgeRingContaining(EdgeRing testEr, java.util.List shellList)
private java.util.List computePolygons(java.util.List shellList)
public boolean containsPoint(Coordinate p)