Table of Contents

Class PolygonStore

Namespace
LansMap.Core.Vector

Filled-polygon collection: rings triangulated at add time into mercator triangles for the GPU fill layer.

public sealed class PolygonStore
Inheritance
object
PolygonStore

Fields

InitialTriangleCapacity

Starting triangle-list capacity for a new store.

public const int InitialTriangleCapacity = 256

Field Value

int

Properties

Dirty

True when triangles changed since the last ClearDirty().

public bool Dirty { get; }

Property Value

bool

PolygonCount

Number of polygons currently stored (removed ones excluded).

public int PolygonCount { get; }

Property Value

int

TriangleCount

Number of triangle slots, including collapsed removed ones until compact.

public int TriangleCount { get; }

Property Value

int

Triangles

Live triangle list the GPU fill layer uploads, including collapsed removed slots until compact.

public IReadOnlyList<PolygonStore.Triangle> Triangles { get; }

Property Value

IReadOnlyList<PolygonStore.Triangle>

Methods

AddPolygon(IReadOnlyList<LatLon>, uint)

Adds a filled ring, throwing if the ring is refused.

public int AddPolygon(IReadOnlyList<LatLon> ring, uint fillColorRgba)

Parameters

ring IReadOnlyList<LatLon>

Closed outline in degrees WGS84; at least three vertices.

fillColorRgba uint

Fill color as packed RGBA.

Returns

int

Polygon id of the stored ring.

Exceptions

ArgumentException

The ring was refused; see Describe(Rejection).

ClearDirty()

Clears Dirty after the GPU fill layer has uploaded.

public void ClearDirty()

Describe(Rejection)

Developer-facing text for a PolygonStore.Rejection. User-facing wording belongs to the UI.

public static string Describe(PolygonStore.Rejection refusal)

Parameters

refusal PolygonStore.Rejection

Why the ring was refused, or None.

Returns

string

One-line English for logs and the throwing overload.

RemovePolygon(int)

Collapses a polygon's triangles (color 0). Unknown ids are ignored. Compacts when more than half the slots are waste.

public void RemovePolygon(int id)

Parameters

id int

Polygon id from a successful add.

TryAddPolygon(IReadOnlyList<LatLon>, uint)

Tries to add a filled ring without throwing.

public PolygonStore.AddResult TryAddPolygon(IReadOnlyList<LatLon> ring, uint fillColorRgba)

Parameters

ring IReadOnlyList<LatLon>

Closed outline in degrees WGS84. Null or fewer than three vertices is TooFewPoints.

fillColorRgba uint

Fill color as packed RGBA.

Returns

PolygonStore.AddResult

An id on success; TooFewPoints or TriangulationFailed (self-intersection, no area, or ear clipping stopped) otherwise.