class EdgeRing
extends java.lang.Object
PolygonizeDirectedEdge
s which form
a ring of a polygon. The ring may be either an outer shell or a hole.Modifier and Type | Class and Description |
---|---|
(package private) static class |
EdgeRing.EnvelopeComparator
Compares EdgeRings based on their envelope,
using the standard lexicographic ordering.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List |
deList |
private GeometryFactory |
factory |
private java.util.List |
holes |
private boolean |
isHole |
private boolean |
isIncluded |
private boolean |
isIncludedSet |
private boolean |
isProcessed |
private DirectedEdge |
lowestEdge |
private LinearRing |
ring |
private Coordinate[] |
ringPts |
private EdgeRing |
shell |
Constructor and Description |
---|
EdgeRing(GeometryFactory factory) |
Modifier and Type | Method and Description |
---|---|
private void |
add(DirectedEdge de)
Adds a
DirectedEdge which is known to form part of this ring. |
private static void |
addEdge(Coordinate[] coords,
boolean isForward,
CoordinateList coordList) |
void |
addHole(EdgeRing holeER)
Adds a hole to the polygon formed by this ring.
|
void |
addHole(LinearRing hole)
Adds a hole to the polygon formed by this ring.
|
void |
build(PolygonizeDirectedEdge startDE) |
void |
computeHole()
Computes whether this ring is a hole.
|
static java.util.List |
findDirEdgesInRing(PolygonizeDirectedEdge startDE)
Traverses a ring of DirectedEdges, accumulating them into a list.
|
static EdgeRing |
findEdgeRingContaining(EdgeRing testEr,
java.util.List shellList)
Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
|
private Coordinate[] |
getCoordinates()
Computes the list of coordinates which are contained in this ring.
|
LineString |
getLineString()
Gets the coordinates for this ring as a
LineString . |
EdgeRing |
getOuterHole() |
Polygon |
getPolygon()
Computes the
Polygon formed by this ring and any contained holes. |
LinearRing |
getRing()
Returns this ring as a
LinearRing , or null if an Exception occurs while
creating it (such as a topology problem). |
EdgeRing |
getShell()
Gets the shell for this ring.
|
boolean |
hasShell()
Tests whether this ring has a shell assigned to it.
|
boolean |
isHole()
Tests whether this ring is a hole.
|
boolean |
isIncluded() |
boolean |
isIncludedSet() |
static boolean |
isInList(Coordinate pt,
Coordinate[] pts)
Deprecated.
|
boolean |
isOuterHole()
Tests whether this ring is an outer hole.
|
boolean |
isOuterShell()
Tests whether this ring is an outer shell.
|
boolean |
isProcessed() |
boolean |
isValid()
Tests if the
LinearRing ring formed by this edge ring is topologically valid. |
static Coordinate |
ptNotInList(Coordinate[] testPts,
Coordinate[] pts)
Deprecated.
Use CoordinateArrays.ptNotInList instead
|
void |
setIncluded(boolean isIncluded) |
void |
setProcessed(boolean isProcessed) |
void |
setShell(EdgeRing shell)
Sets the containing shell ring of a ring that has been determined to be a hole.
|
java.lang.String |
toString()
Gets a string representation of this object.
|
void |
updateIncluded()
Updates the included status for currently non-included shells
based on whether they are adjacent to an included shell.
|
private GeometryFactory factory
private java.util.List deList
private DirectedEdge lowestEdge
private LinearRing ring
private Coordinate[] ringPts
private java.util.List holes
private EdgeRing shell
private boolean isHole
private boolean isProcessed
private boolean isIncludedSet
private boolean isIncluded
public EdgeRing(GeometryFactory factory)
public static EdgeRing findEdgeRingContaining(EdgeRing testEr, java.util.List shellList)
public static Coordinate ptNotInList(Coordinate[] testPts, Coordinate[] pts)
testPts
- the Coordinate
s to testpts
- an array of Coordinate
s to test the input points againstCoordinate
from testPts
which is not in pts
,
or null if there is no coordinate not in the listpublic static boolean isInList(Coordinate pt, Coordinate[] pts)
pt
- a Coordinate
for the test pointpts
- an array of Coordinate
s to testtrue
if the point is in the arraypublic static java.util.List findDirEdgesInRing(PolygonizeDirectedEdge startDE)
startDE
- the DirectedEdge to start traversing atpublic void build(PolygonizeDirectedEdge startDE)
private void add(DirectedEdge de)
DirectedEdge
which is known to form part of this ring.de
- the DirectedEdge
to add.public boolean isHole()
true
if this ring is a holepublic void computeHole()
public void addHole(LinearRing hole)
hole
- the LinearRing
forming the hole.public void addHole(EdgeRing holeER)
hole
- the LinearRing
forming the hole.public Polygon getPolygon()
Polygon
formed by this ring and any contained holes.Polygon
formed by this ring and its holes.public boolean isValid()
LinearRing
ring formed by this edge ring is topologically valid.public boolean isIncludedSet()
public boolean isIncluded()
public void setIncluded(boolean isIncluded)
private Coordinate[] getCoordinates()
Coordinate
s in this ringpublic LineString getLineString()
LineString
.
Used to return the coordinates in this ring
as a valid geometry, when it has been detected that the ring is topologically
invalid.LineString
containing the coordinates in this ringpublic LinearRing getRing()
LinearRing
, or null if an Exception occurs while
creating it (such as a topology problem). Details of problems are written to
standard output.private static void addEdge(Coordinate[] coords, boolean isForward, CoordinateList coordList)
public void setShell(EdgeRing shell)
shell
- the shell ringpublic boolean hasShell()
public EdgeRing getShell()
public boolean isOuterHole()
public boolean isOuterShell()
public EdgeRing getOuterHole()
public void updateIncluded()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isProcessed()
public void setProcessed(boolean isProcessed)
isProcessed
- whether the ring has been processed