Class Characteristics
- Namespace
- SpatialNET
- Assembly
- SpatialNET.Extensions.dll
Yes/no questions about the form of a geometry (ADR 0025): IsSimple, IsClosed, IsRing and EqualsExact.
public static class CharacteristicsInheritance
Inherited Members
Methods
EqualsExact(IGeometry2D, IGeometry2D, double)
Whether two geometries are of the same kind and have the same structure and the same coordinates, vertex by vertex and
as given (no normalization: the order of points, paths and rings, the start of a ring and its direction all count; a
ring counts as closed whether or not its closing point is stored). Only X and Y are compared, within
tolerance (a vertex pair is equal if its distance is at most the tolerance);
Z and M are ignored. For the topological equality use SpatialNET.Relations.EqualsTopo(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public static bool EqualsExact(this IGeometry2D a, IGeometry2D b, double tolerance = 0)Parameters
aIGeometry2D-
The first geometry.
bIGeometry2D-
The second geometry.
tolerancedouble-
The tolerance in the unit of the coordinates; finite and not negative. The default 0 means exact equality.
Returns
Exceptions
- ArgumentNullException
-
aorbisnull. - ArgumentOutOfRangeException
-
toleranceis negative,NaNor infinite. - NotSupportedException
-
A geometry is not a known geometry kind.
IsClosed(IPolyline2D)
Whether every non-empty path of the polyline is closed (its first and last point have the same X and Y). A polyline without a non-empty path is not closed.
public static bool IsClosed(this IPolyline2D line)Parameters
lineIPolyline2D-
The polyline.
Returns
Exceptions
- ArgumentNullException
-
lineisnull.
IsRing(IPolyline2D)
Whether the polyline is a ring: exactly one non-empty path, closed, with at least four points, and simple (it does not touch itself except at the closing point).
public static bool IsRing(this IPolyline2D line)Parameters
lineIPolyline2D-
The polyline.
Returns
Exceptions
- ArgumentNullException
-
lineisnull.
IsSimple(IGeometry2D)
Whether a geometry is simple in the sense of the OGC (ADR 0025). A point and a polygon are always simple (whether a polygon is a valid area is SpatialNET.Validation.IsValid(SpatialNET.IGeometry2D)); a multipoint is simple if no point occurs twice; a polyline is simple if it does not intersect itself except at end points: two segments of different paths may meet only in a shared vertex that is an end point of both paths, and both paths must be open there (the closing point of a closed path is an interior point, so no other path may touch it). Any number of open paths may end in one point. Consecutive segments of one path and the two ends of a closed path are no violation, a path that doubles back on itself is.
public static bool IsSimple(this IGeometry2D geometry)Parameters
geometryIGeometry2D-
The geometry.
Returns
Exceptions
- ArgumentNullException
-
geometryisnull. - NotSupportedException
-
geometryis not a known geometry kind.