Table of Contents

Class PolylineStore

Namespace
LansMap.Core.Vector

Colored line collection drawn at constant screen-pixel width, stored as mercator segments for the GPU line layer.

public sealed class PolylineStore
Inheritance
object
PolylineStore

Fields

InitialSegmentCapacity

Starting segment-list capacity for a new store.

public const int InitialSegmentCapacity = 1024

Field Value

int

Properties

CompactionsRun

Times the store has compacted wasted slots; diagnostic.

public int CompactionsRun { get; }

Property Value

int

Dirty

True when segments changed since the last ClearDirty().

public bool Dirty { get; }

Property Value

bool

LineCount

Number of lines currently stored (removed ones excluded).

public int LineCount { get; }

Property Value

int

MaxAltitudeMercator

Tallest finite endpoint altitude this store has ever carried, in normalized mercator, for altitude-aware re-anchor.

public double MaxAltitudeMercator { get; }

Property Value

double

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

int

Segments

Live segment list the GPU line layer uploads.

public IReadOnlyList<PolylineStore.Segment> Segments { get; }

Property Value

IReadOnlyList<PolylineStore.Segment>

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

points IReadOnlyList<LatLon>

Vertices in degrees WGS84; at least two.

widthPx float

Stroke width in screen px.

colorRgba uint

Stroke 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

points IReadOnlyList<LatLon>

Vertices in degrees WGS84; at least two.

altitudesMeters IReadOnlyList<double>

Null for a ground line; otherwise one altitude in meters WGS84 per vertex, converted to mercator at that latitude.

widthPx float

Stroke width in screen px.

colorRgba uint

Stroke color as packed RGBA.

Returns

int

Line id of the stored polyline.

Exceptions

ArgumentException

Fewer than two points, or altitudesMeters is non-null and its count does not match points.

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

first MercatorPoint

First vertex in normalized mercator.

firstAltMerc float

First altitude in normalized mercator.

second MercatorPoint

Second vertex in normalized mercator; chain-unwrapped against first.

secondAltMerc float

Second altitude in normalized mercator.

maxPoints int

Maximum vertices the trail will hold; at least 2. Capacity is maxPoints minus 1 segments.

widthPx float

Stroke width in screen px.

colorRgba uint

Stroke color as packed RGBA.

Returns

int

Line id of the ring line.

Exceptions

ArgumentException

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

id int

Ring-line id from AddRingLine(MercatorPoint, float, MercatorPoint, float, int, float, uint).

point MercatorPoint

New vertex in normalized mercator; chain-unwrapped against the last sample, not against slot order.

altMerc float

New altitude in normalized mercator.

Exceptions

ArgumentException

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

id int

Line id from a successful add.