public class IsValidOp
extends java.lang.Object
isValid()
method
for Geometry
s.
See the documentation for the various geometry types for a specification of validity.Modifier and Type | Field and Description |
---|---|
private boolean |
isSelfTouchingRingFormingHoleValid
If the following condition is TRUE JTS will validate inverted shells and exverted holes
(the ESRI SDE model)
|
private Geometry |
parentGeometry |
private TopologyValidationError |
validErr |
Modifier and Type | Method and Description |
---|---|
private void |
checkClosedRing(LinearRing ring) |
private void |
checkClosedRings(Polygon poly) |
private void |
checkConnectedInteriors(GeometryGraph graph) |
private void |
checkConsistentArea(GeometryGraph graph)
Checks that the arrangement of edges in a polygonal geometry graph
forms a consistent area.
|
private void |
checkHolesInShell(Polygon p,
GeometryGraph graph)
Tests that each hole is inside the polygon shell.
|
private void |
checkHolesNotNested(Polygon p,
GeometryGraph graph)
Tests that no hole is nested inside another hole.
|
private void |
checkInvalidCoordinates(Coordinate[] coords) |
private void |
checkInvalidCoordinates(Polygon poly) |
private void |
checkNoSelfIntersectingRing(EdgeIntersectionList eiList)
Check that a ring does not self-intersect, except at its endpoints.
|
private void |
checkNoSelfIntersectingRings(GeometryGraph graph)
Check that there is no ring which self-intersects (except of course at its endpoints).
|
private Coordinate |
checkShellInsideHole(LinearRing shell,
LinearRing hole,
GeometryGraph graph)
This routine checks to see if a shell is properly contained in a hole.
|
private void |
checkShellNotNested(LinearRing shell,
Polygon p,
GeometryGraph graph)
Check if a shell is incorrectly nested within a polygon.
|
private void |
checkShellsNotNested(MultiPolygon mp,
GeometryGraph graph)
Tests that no element polygon is wholly in the interior of another element polygon.
|
private void |
checkTooFewPoints(GeometryGraph graph) |
private void |
checkValid(Geometry g) |
private void |
checkValid(GeometryCollection gc) |
private void |
checkValid(LinearRing g)
Checks validity of a LinearRing.
|
private void |
checkValid(LineString g)
Checks validity of a LineString.
|
private void |
checkValid(MultiPoint g)
Checks validity of a MultiPoint.
|
private void |
checkValid(MultiPolygon g) |
private void |
checkValid(Point g)
Checks validity of a Point.
|
private void |
checkValid(Polygon g)
Checks the validity of a polygon.
|
static Coordinate |
findPtNotNode(Coordinate[] testCoords,
LinearRing searchRing,
GeometryGraph graph)
Find a point from the list of testCoords
that is NOT a node in the edge for the list of searchCoords
|
TopologyValidationError |
getValidationError()
Computes the validity of the geometry,
and if not valid returns the validation error for the geometry,
or null if the geometry is valid.
|
boolean |
isValid()
Computes the validity of the geometry,
and returns true if it is valid.
|
static boolean |
isValid(Coordinate coord)
Checks whether a coordinate is valid for processing.
|
static boolean |
isValid(Geometry geom)
Tests whether a
Geometry is valid. |
void |
setSelfTouchingRingFormingHoleValid(boolean isValid)
Sets whether polygons using Self-Touching Rings to form
holes are reported as valid.
|
private Geometry parentGeometry
private boolean isSelfTouchingRingFormingHoleValid
private TopologyValidationError validErr
public IsValidOp(Geometry parentGeometry)
public static boolean isValid(Geometry geom)
Geometry
is valid.geom
- the Geometry to testpublic static boolean isValid(Coordinate coord)
coord
- the coordinate to validatetrue
if the coordinate is validpublic static Coordinate findPtNotNode(Coordinate[] testCoords, LinearRing searchRing, GeometryGraph graph)
null
if none foundpublic void setSelfTouchingRingFormingHoleValid(boolean isValid)
The default (following the OGC SFS standard)
is that this condition is not valid (false
).
This does not affect whether Self-Touching Rings disconnecting the polygon interior are considered valid (these are considered to be invalid under the SFS, and many other spatial models as well). This includes "bow-tie" shells, which self-touch at a single point causing the interior to be disconnected, and "C-shaped" holes which self-touch at a single point causing an island to be formed.
isValid
- states whether geometry with this condition is validpublic boolean isValid()
public TopologyValidationError getValidationError()
private void checkValid(Geometry g)
private void checkValid(Point g)
private void checkValid(MultiPoint g)
private void checkValid(LineString g)
private void checkValid(LinearRing g)
private void checkValid(Polygon g)
private void checkValid(MultiPolygon g)
private void checkValid(GeometryCollection gc)
private void checkInvalidCoordinates(Coordinate[] coords)
private void checkInvalidCoordinates(Polygon poly)
private void checkClosedRings(Polygon poly)
private void checkClosedRing(LinearRing ring)
private void checkTooFewPoints(GeometryGraph graph)
private void checkConsistentArea(GeometryGraph graph)
graph
- ConsistentAreaTester
private void checkNoSelfIntersectingRings(GeometryGraph graph)
graph
- the topology graph of the geometryprivate void checkNoSelfIntersectingRing(EdgeIntersectionList eiList)
private void checkHolesInShell(Polygon p, GeometryGraph graph)
p
- the polygon to be tested for hole inclusiongraph
- a GeometryGraph incorporating the polygonprivate void checkHolesNotNested(Polygon p, GeometryGraph graph)
checkRelateConsistency
)
checkRelateConsistency
)
private void checkShellsNotNested(MultiPolygon mp, GeometryGraph graph)
Preconditions:
private void checkShellNotNested(LinearRing shell, Polygon p, GeometryGraph graph)
The algorithm used relies on the fact that the rings must be properly contained.
E.g. they cannot partially overlap (this has been previously checked by
checkRelateConsistency
)
private Coordinate checkShellInsideHole(LinearRing shell, LinearRing hole, GeometryGraph graph)
null
if the shell is properly contained, or
a Coordinate which is not inside the hole if it is notprivate void checkConnectedInteriors(GeometryGraph graph)