IsSimpleOp class

Tests whether a Geometry is simple. In general, the SFS specification of simplicity follows the rule:

  • A Geometry is simple if and only if the only self-intersections are at boundary points.

Simplicity is defined for each {@link Geometry} type as follows:

  • Polygonal geometries are simple by definition, so isSimple trivially returns true. (Note: this means that isSimple cannot be used to test for (invalid) self-intersections in Polygons. In order to check if a Polygonal geometry has self-intersections, use {@link Geometry#isValid()}).
  • Linear geometries are simple iff they do not self-intersect at interior points (i.e. points other than boundary points). This is equivalent to saying that no two linear components satisfy the SFS {@link Geometry#touches(Geometry)} predicate.
  • Zero-dimensional (point) geometries are simple if and only if they have no repeated points.
  • Empty geometries are always simple, by definition
For {@link Lineal} geometries the evaluation of simplicity can be customized by supplying a {@link BoundaryNodeRule} to define how boundary points are determined. The default is the SFS-standard {@link BoundaryNodeRule#MOD2_BOUNDARY_RULE}. Note that under the Mod-2 rule, closed LineStrings (rings) will never satisfy the touches predicate at their endpoints, since these are interior points, not boundary points. If it is required to test whether a set of LineStrings touch only at their endpoints, use IsSimpleOp with {@link BoundaryNodeRule#ENDPOINT_BOUNDARY_RULE}. For example, this can be used to validate that a set of lines form a topologically valid linear network.

@see BoundaryNodeRule

@version 1.7

Constructors

IsSimpleOp.withGeom(Geometry inputGeom)
Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule
IsSimpleOp.withGeomAndRule(Geometry inputGeom, BoundaryNodeRule boundaryNodeRule)
Creates a simplicity checker using a given {@link BoundaryNodeRule}

Properties

hashCode int
The hash code for this object.
no setterinherited
inputGeom Geometry
getter/setter pair
isClosedEndpointsInInterior bool
getter/setter pair
nonSimpleLocation Coordinate?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addEndpoint(Map endPoints, Coordinate p, bool isClosed) → void
Add an endpoint to the map, creating an entry for it if none exists
computeSimple(Geometry geom) bool
getNonSimpleLocation() Coordinate?
Gets a coordinate for the location where the geometry fails to be simple. (i.e. where it has a non-boundary self-intersection). {@link #isSimple} must be called before this method is called.
hasClosedEndpointIntersection(GeometryGraph graph) bool
Tests that no edge intersection is the endpoint of a closed line. This ensures that closed lines are not touched at their endpoint, which is an interior point according to the Mod-2 rule To check this we compute the degree of each endpoint. The degree of endpoints of closed lines must be exactly 2.
hasNonEndpointIntersection(GeometryGraph graph) bool
For all edges, check if there are any intersections which are NOT at an endpoint. The Geometry is not simple if there are intersections not at endpoints.
isSimple() bool
Tests whether the geometry is simple.
isSimpleGeometryCollection(Geometry geom) bool
Semantics for GeometryCollection is simple iff all components are simple.
isSimpleLine(LineString geom) bool
Reports whether a {@link LineString} is simple.
isSimpleLinearGeometry(Geometry geom) bool
isSimpleMultiLine(MultiLineString geom) bool
Reports whether a {@link MultiLineString} geometry is simple.
isSimpleMultiPoint(MultiPoint mp) bool
A MultiPoint is simple iff it has no repeated points @deprecated use isSimple()
isSimpleMultiPoint_(MultiPoint mp) bool
isSimplePolygonal(Geometry geom) bool
Computes simplicity for polygonal geometries. Polygonal geometries are simple if and only if all of their component rings are simple.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited