Table of Contents

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 PreparedGeometry

Inheritance

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

IGeometry2D

Methods

Contains(IGeometry2D)

Like SpatialNET.Relations.Contains(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).

public bool Contains(IGeometry2D other)

Parameters

other IGeometry2D

The other geometry.

Returns

bool

CoveredBy(IGeometry2D)

Like SpatialNET.Relations.CoveredBy(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).

public bool CoveredBy(IGeometry2D other)

Parameters

other IGeometry2D

The other geometry.

Returns

bool

Covers(IGeometry2D)

Like SpatialNET.Relations.Covers(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).

public bool Covers(IGeometry2D other)

Parameters

other IGeometry2D

The other geometry.

Returns

bool

Disjoint(IGeometry2D)

Like SpatialNET.Relations.Disjoint(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).

public bool Disjoint(IGeometry2D other)

Parameters

other IGeometry2D

The other geometry.

Returns

bool

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

other IGeometry2D

The other geometry.

Returns

double

Exceptions

ArgumentNullException

other is null.

NotSupportedException

other is not a known geometry kind.

Intersects(IGeometry2D)

Like SpatialNET.Relations.Intersects(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).

public bool Intersects(IGeometry2D other)

Parameters

other IGeometry2D

The other geometry.

Returns

bool

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

other IGeometry2D

The other geometry.

distance double

The distance; finite and not negative.

Returns

bool

Exceptions

ArgumentNullException

other is null.

ArgumentOutOfRangeException

distance is negative, NaN or infinite.

NotSupportedException

other is 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

point Coordinate

The point; its coordinates must be finite.

Returns

Location

Exceptions

ArgumentOutOfRangeException

The coordinates of point are 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

other IGeometry2D

The other geometry.

Returns

(Coordinate OnPrepared, Coordinate OnOther)?

The pair, or null if either geometry is empty.

Exceptions

ArgumentNullException

other is null.

NotSupportedException

other is not a known geometry kind.

Touches(IGeometry2D)

Like SpatialNET.Relations.Touches(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).

public bool Touches(IGeometry2D other)

Parameters

other IGeometry2D

The other geometry.

Returns

bool

Within(IGeometry2D)

Like SpatialNET.Relations.Within(SpatialNET.IGeometry2D,SpatialNET.IGeometry2D).

public bool Within(IGeometry2D other)

Parameters

other IGeometry2D

The other geometry.

Returns

bool