public class IsSimpleOp extends Object
Geometry is simple as defined by the OGC SFS specification.
Simplicity is defined for each Geometry type as follows:
isSimple code checks if all polygon rings are simple.
(Note: this means that isSimple cannot be used to test
for all self-intersections in Polygons.
In order to check if a Polygonal geometry has self-intersections,
use Geometry.isValid()).
Lineal geometries the evaluation of simplicity
can be customized by supplying a BoundaryNodeRule
to define how boundary points are determined.
The default is the SFS-standard BoundaryNodeRule.MOD2_BOUNDARY_RULE.
Note that under the Mod-2 rule, closed LineStrings (rings)
have no boundary.
This means that an intersection at the endpoints of
two closed LineStrings makes the geometry non-simple.
If it is required to test whether a set of LineStrings touch
only at their endpoints, use BoundaryNodeRule.ENDPOINT_BOUNDARY_RULE.
For example, this can be used to validate that a collection of lines
form a topologically valid linear network.
By default this class finds a single non-simple location.
To find all non-simple locations, set setFindAllLocations(boolean)
before calling isSimple(), and retrieve the locations
via getNonSimpleLocations().
This can be used to find all intersection points in a linear network.
BoundaryNodeRule,
Geometry.isValid()| Constructor and Description |
|---|
IsSimpleOp(Geometry geom)
Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule
|
IsSimpleOp(Geometry geom,
BoundaryNodeRule boundaryNodeRule)
Creates a simplicity checker using a given
BoundaryNodeRule |
| Modifier and Type | Method and Description |
|---|---|
Coordinate |
getNonSimpleLocation()
Gets the coordinate for an location where the geometry
fails to be simple.
|
static Coordinate |
getNonSimpleLocation(Geometry geom)
Gets a non-simple location in a geometry, if any.
|
List<Coordinate> |
getNonSimpleLocations()
Gets all non-simple intersection locations.
|
boolean |
isSimple()
Tests whether the geometry is simple.
|
static boolean |
isSimple(Geometry geom)
Tests whether a geometry is simple.
|
void |
setFindAllLocations(boolean isFindAll)
Sets whether all non-simple intersection points
will be found.
|
public IsSimpleOp(Geometry geom)
geom - the geometry to testpublic IsSimpleOp(Geometry geom, BoundaryNodeRule boundaryNodeRule)
BoundaryNodeRulegeom - the geometry to testboundaryNodeRule - the boundary node rule to use.public static boolean isSimple(Geometry geom)
geom - the geometry to testpublic static Coordinate getNonSimpleLocation(Geometry geom)
geom - the input geometrypublic void setFindAllLocations(boolean isFindAll)
isFindAll - whether to find all non-simple pointspublic boolean isSimple()
public Coordinate getNonSimpleLocation()
public List<Coordinate> getNonSimpleLocations()
Copyright © 2024. All rights reserved.