Class PreparedGeometry
- Namespace
- SpatialNET
- Assembly
- SpatialNET.Extensions.dll
A geometry prepared for repeated predicates (ADR 0013): a snapshot of the coordinates plus a segment index. Later changes to the host object have no effect. Results are identical to the unprepared predicates; fast paths exist for SpatialNET.PreparedGeometry.Intersects(SpatialNET.IGeometry2D)/SpatialNET.PreparedGeometry.Disjoint(SpatialNET.IGeometry2D), point-in-area and SpatialNET.PreparedGeometry.Contains(SpatialNET.IGeometry2D) of an area (vertices and segment contacts through the index); everything else, and a contact with the boundary that has no witness, goes through the exact SpatialNET.Relations.Relate(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public sealed class PreparedGeometryInheritance
Inherited Members
Remarks
Thread-safe after construction: the snapshot and the index are immutable, and every method uses only local state (ADR 0024).
Properties
Geometry
The snapshot of the prepared geometry.
public IGeometry2D Geometry { get; }Property Value
Methods
Contains(IGeometry2D)
Like SpatialNET.Relations.Contains(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public bool Contains(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
CoveredBy(IGeometry2D)
Like SpatialNET.Relations.CoveredBy(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public bool CoveredBy(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
Covers(IGeometry2D)
Like SpatialNET.Relations.Covers(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public bool Covers(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
Disjoint(IGeometry2D)
Like SpatialNET.Relations.Disjoint(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public bool Disjoint(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
Distance(IGeometry2D)
Like SpatialNET.Measures.Distance(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D): 0 if the geometries intersect, System.Double.NaN if either is empty (ADR 0024).
public double Distance(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
Exceptions
- ArgumentNullException
-
otherisnull. - NotSupportedException
-
otheris not a known geometry kind.
Intersects(IGeometry2D)
Like SpatialNET.Relations.Intersects(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public bool Intersects(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
IsWithinDistance(IGeometry2D, double)
Like SpatialNET.Measures.IsWithinDistance(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D,System.Double): whether the distance is at most
distance; false if either geometry is empty (ADR 0024).
public bool IsWithinDistance(IGeometry2D other, double distance)Parameters
otherIGeometry2D-
The other geometry.
distancedouble-
The distance; finite and not negative.
Returns
Exceptions
- ArgumentNullException
-
otherisnull. - ArgumentOutOfRangeException
-
distanceis negative,NaNor infinite. - NotSupportedException
-
otheris not a known geometry kind.
Locate(Coordinate)
Like SpatialNET.Locations.Locate(SpatialNET.IGeometry2D,SpatialNET.Coordinate), but for many points against the same geometry: a polygon uses the segment index (ADR 0022).
public Location Locate(Coordinate point)Parameters
pointCoordinate-
The point; its coordinates must be finite.
Returns
Exceptions
- ArgumentOutOfRangeException
-
The coordinates of
pointare not finite.
NearestPoints(IGeometry2D)
Like SpatialNET.Measures.NearestPoints(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D), with the point on the prepared geometry first. The distance of the pair is the same; among equally near pairs the pair may differ from the unprepared result (ADR 0024).
public (Coordinate OnPrepared, Coordinate OnOther)? NearestPoints(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
- (Coordinate OnPrepared, Coordinate OnOther)?
-
The pair, or
nullif either geometry is empty.
Exceptions
- ArgumentNullException
-
otherisnull. - NotSupportedException
-
otheris not a known geometry kind.
Touches(IGeometry2D)
Like SpatialNET.Relations.Touches(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public bool Touches(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.
Returns
Within(IGeometry2D)
Like SpatialNET.Relations.Within(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).
public bool Within(IGeometry2D other)Parameters
otherIGeometry2D-
The other geometry.