Class PolygonStore
Filled-polygon collection: rings triangulated at add time into mercator triangles for the GPU fill layer.
public sealed class PolygonStore
- Inheritance
-
objectPolygonStore
Fields
InitialTriangleCapacity
Starting triangle-list capacity for a new store.
public const int InitialTriangleCapacity = 256
Field Value
Properties
Dirty
True when triangles changed since the last ClearDirty().
public bool Dirty { get; }
Property Value
PolygonCount
Number of polygons currently stored (removed ones excluded).
public int PolygonCount { get; }
Property Value
TriangleCount
Number of triangle slots, including collapsed removed ones until compact.
public int TriangleCount { get; }
Property Value
Triangles
Live triangle list the GPU fill layer uploads, including collapsed removed slots until compact.
public IReadOnlyList<PolygonStore.Triangle> Triangles { get; }
Property Value
Methods
AddPolygon(IReadOnlyList<LatLon>, uint)
Adds a filled ring, throwing if the ring is refused.
public int AddPolygon(IReadOnlyList<LatLon> ring, uint fillColorRgba)
Parameters
ringIReadOnlyList<LatLon>Closed outline in degrees WGS84; at least three vertices.
fillColorRgbauintFill 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
refusalPolygonStore.RejectionWhy 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
idintPolygon 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
ringIReadOnlyList<LatLon>Closed outline in degrees WGS84. Null or fewer than three vertices is TooFewPoints.
fillColorRgbauintFill color as packed RGBA.
Returns
- PolygonStore.AddResult
An id on success; TooFewPoints or TriangulationFailed (self-intersection, no area, or ear clipping stopped) otherwise.