Class PointEvents
- Namespace
- SpatialNET
- Assembly
- SpatialNET.Extensions.dll
Operations on the point events of a route (ADR 0040), as SpatialNET.LineEvents is for the line events: which point events lie in a range
(Between), which lie in which line event (Within), and which lie in none (Outside). They compute with the M values only: no
geometry, no factory, no database access. Draw point events with SpatialNET.LinearReferencing.LocateEvents``1(SpatialNET.IPolyline2D,System.Collections.Generic.IEnumerable{SpatialNET.PointEvent{``0}},SpatialNET.IGeometryFactory).
public static class PointEventsInheritance
Inherited Members
Remarks
The input may be in any order; results are sorted by M, and events with the same M keep the order of the input. The ranges of line events
are closed, so a point exactly on the boundary of two neighbouring line events lies in both (as with SpatialNET.LineEvents.At``1(System.Collections.Generic.IEnumerable{SpatialNET.LineEvent{``0}},System.Double)), and a
line event without length (From == To) is ignored, as in SpatialNET.LineEvents. The methods are static for the same reason as there.
Methods
Between<T>(IEnumerable<PointEvent<T>>, double, double)
The point events whose M lies between two values (closed range).
public static IReadOnlyList<PointEvent<T>> Between<T>(IEnumerable<PointEvent<T>> events, double from, double to)Parameters
eventsIEnumerable<PointEvent<T>>-
The point events.
fromdouble-
One end of the range.
todouble-
The other end; if it is lower than
fromthey are swapped.
Returns
- IReadOnlyList<PointEvent<T>>
-
The events inside the range, sorted by M.
Type Parameters
T-
The values.
Exceptions
- ArgumentNullException
-
eventsisnull. - ArgumentOutOfRangeException
-
An event has an M that is
NaNor infinite, orfromortois.
Outside<TPoint, TLine>(IEnumerable<PointEvent<TPoint>>, IEnumerable<LineEvent<TLine>>)
The point events that lie in no line event: a bridge without a speed limit, a report off the surveyed stretch.
public static IReadOnlyList<PointEvent<TPoint>> Outside<TPoint, TLine>(IEnumerable<PointEvent<TPoint>> points, IEnumerable<LineEvent<TLine>> lines)Parameters
pointsIEnumerable<PointEvent<TPoint>>-
The point events.
linesIEnumerable<LineEvent<TLine>>-
The line events.
Returns
- IReadOnlyList<PointEvent<TPoint>>
-
The point events outside, sorted by M.
Type Parameters
TPoint-
The values of the point events.
TLine-
The values of the line events; not used.
Exceptions
- ArgumentNullException
-
An argument is
null. - ArgumentOutOfRangeException
-
An event has an M,
FromorTothat isNaNor infinite.
Within<TPoint, TLine, TResult>(IEnumerable<PointEvent<TPoint>>, IEnumerable<LineEvent<TLine>>, Func<TPoint, TLine, TResult>)
For every point event the line events whose range contains its M: one result per pair, at the M of the point, with the value that
combine makes of the two values. A point event that lies in no line event gives nothing (see SpatialNET.PointEvents.Outside``2(System.Collections.Generic.IEnumerable{SpatialNET.PointEvent{``0}},System.Collections.Generic.IEnumerable{SpatialNET.LineEvent{``1}}));
one on the boundary of two neighbouring line events gives two results.
public static IReadOnlyList<PointEvent<TResult>> Within<TPoint, TLine, TResult>(IEnumerable<PointEvent<TPoint>> points, IEnumerable<LineEvent<TLine>> lines, Func<TPoint, TLine, TResult> combine)Parameters
pointsIEnumerable<PointEvent<TPoint>>-
The point events.
linesIEnumerable<LineEvent<TLine>>-
The line events.
combineFunc<TPoint, TLine, TResult>-
Makes the value of a result from the two values.
Returns
- IReadOnlyList<PointEvent<TResult>>
-
The results, sorted by M.
Type Parameters
TPoint-
The values of the point events.
TLine-
The values of the line events.
TResult-
The values of the result.
Remarks
Line events may overlap; every overlapping one gives a result.
Exceptions
- ArgumentNullException
-
An argument is
null. - ArgumentOutOfRangeException
-
An event has an M,
FromorTothat isNaNor infinite.