Class PolylineStore
Colored line collection drawn at constant screen-pixel width, stored as mercator segments for the GPU line layer.
public sealed class PolylineStore
- Inheritance
-
objectPolylineStore
Fields
InitialSegmentCapacity
Starting segment-list capacity for a new store.
public const int InitialSegmentCapacity = 1024
Field Value
Properties
CompactionsRun
Times the store has compacted wasted slots; diagnostic.
public int CompactionsRun { get; }
Property Value
Dirty
True when segments changed since the last ClearDirty().
public bool Dirty { get; }
Property Value
LineCount
Number of lines currently stored (removed ones excluded).
public int LineCount { get; }
Property Value
MaxAltitudeMercator
Tallest finite endpoint altitude this store has ever carried, in normalized mercator, for altitude-aware re-anchor.
public double MaxAltitudeMercator { get; }
Property Value
Remarks
A running maximum: it never decreases, even after the tallest line is removed. Non-finite values are ignored so one bad endpoint cannot poison the rest.
SegmentCount
Number of segment slots, including collapsed removed ones and unused ring-line slots.
public int SegmentCount { get; }
Property Value
Segments
Live segment list the GPU line layer uploads.
public IReadOnlyList<PolylineStore.Segment> Segments { get; }
Property Value
Methods
AddPolyline(IReadOnlyList<LatLon>, float, uint)
Adds a ground-level polyline (all altitudes zero).
public int AddPolyline(IReadOnlyList<LatLon> points, float widthPx, uint colorRgba)
Parameters
pointsIReadOnlyList<LatLon>Vertices in degrees WGS84; at least two.
widthPxfloatStroke width in screen px.
colorRgbauintStroke color as packed RGBA.
Returns
- int
Line id of the stored polyline.
Exceptions
- ArgumentException
Fewer than two points.
AddPolyline3D(IReadOnlyList<LatLon>, IReadOnlyList<double>, float, uint)
Adds a polyline with optional per-vertex altitude.
public int AddPolyline3D(IReadOnlyList<LatLon> points, IReadOnlyList<double> altitudesMeters, float widthPx, uint colorRgba)
Parameters
pointsIReadOnlyList<LatLon>Vertices in degrees WGS84; at least two.
altitudesMetersIReadOnlyList<double>Null for a ground line; otherwise one altitude in meters WGS84 per vertex, converted to mercator at that latitude.
widthPxfloatStroke width in screen px.
colorRgbauintStroke color as packed RGBA.
Returns
- int
Line id of the stored polyline.
Exceptions
- ArgumentException
Fewer than two points, or
altitudesMetersis non-null and its count does not matchpoints.
AddRingLine(MercatorPoint, float, MercatorPoint, float, int, float, uint)
Reserves a fixed-capacity trail line and writes its first segment, for in-place append without reallocating.
public int AddRingLine(MercatorPoint first, float firstAltMerc, MercatorPoint second, float secondAltMerc, int maxPoints, float widthPx, uint colorRgba)
Parameters
firstMercatorPointFirst vertex in normalized mercator.
firstAltMercfloatFirst altitude in normalized mercator.
secondMercatorPointSecond vertex in normalized mercator; chain-unwrapped against
first.secondAltMercfloatSecond altitude in normalized mercator.
maxPointsintMaximum vertices the trail will hold; at least 2. Capacity is maxPoints minus 1 segments.
widthPxfloatStroke width in screen px.
colorRgbauintStroke color as packed RGBA.
Returns
- int
Line id of the ring line.
Exceptions
- ArgumentException
maxPointsis less than 2.
AppendRingPoint(int, MercatorPoint, float)
Appends one vertex to a ring line, overwriting the oldest once the trail is full. Writes exactly one segment slot.
public void AppendRingPoint(int id, MercatorPoint point, float altMerc)
Parameters
idintRing-line id from AddRingLine(MercatorPoint, float, MercatorPoint, float, int, float, uint).
pointMercatorPointNew vertex in normalized mercator; chain-unwrapped against the last sample, not against slot order.
altMercfloatNew altitude in normalized mercator.
Exceptions
- ArgumentException
idis not a ring line.
ClearDirty()
Clears Dirty after the GPU line layer has uploaded.
public void ClearDirty()
RemovePolyline(int)
Collapses a line's segments (width 0). Unknown ids are ignored. Compacts when more than half the slots are waste. Works for both ordinary polylines and ring lines.
public void RemovePolyline(int id)
Parameters
idintLine id from a successful add.