Table of Contents

Class BorderCurveCache

Namespace
Map.Rendering
Assembly
MapAssembly.dll

Caches pre-computed smooth border polylines and their runtime styles Separates static geometry (expensive to compute) from dynamic appearance (cheap to update)

Pattern: Static Geometry + Dynamic Appearance

  • Smooth polylines (RDP + Chaikin) computed once at map load
  • Styles updated at runtime when ownership changes
public class BorderCurveCache
Inheritance
object
BorderCurveCache

Constructors

BorderCurveCache()

public BorderCurveCache()

Properties

BorderCount

public int BorderCount { get; }

Property Value

int

Methods

Clear()

Clear all cached data

public void Clear()

GetAllBorderStyles()

Get all border styles (for debugging/statistics)

public IEnumerable<((ushort, ushort) key, BorderStyle style)> GetAllBorderStyles()

Returns

IEnumerable<((ushort, ushort) key, BorderStyle style)>

GetAllBordersForRendering()

Get all borders for rendering Returns enumerable of (polyline, style) pairs

public IEnumerable<(List<Vector2> polyline, BorderStyle style)> GetAllBordersForRendering()

Returns

IEnumerable<(List<Vector2> polyline, BorderStyle style)>

GetPolyline(ushort, ushort)

Get smooth polyline for a specific border

public List<Vector2> GetPolyline(ushort provinceA, ushort provinceB)

Parameters

provinceA ushort
provinceB ushort

Returns

List<Vector2>

GetStyle(ushort, ushort)

Get style for a specific border

public BorderStyle GetStyle(ushort provinceA, ushort provinceB)

Parameters

provinceA ushort
provinceB ushort

Returns

BorderStyle

Initialize(Dictionary<(ushort, ushort), List<Vector2>>)

Initialize cache with pre-computed smooth polylines (Chaikin smoothed)

public void Initialize(Dictionary<(ushort, ushort), List<Vector2>> polylines)

Parameters

polylines Dictionary<(ushort, ushort), List<Vector2>>

UpdateProvinceBorderStyles(ushort, ushort, Func<ushort, ushort>, Func<ushort, Color>)

Update border styles for a province when its ownership changes Only updates style flags - geometry remains unchanged

public void UpdateProvinceBorderStyles(ushort provinceID, ushort newOwner, Func<ushort, ushort> getOwner, Func<ushort, Color> getCountryColor)

Parameters

provinceID ushort
newOwner ushort
getOwner Func<ushort, ushort>
getCountryColor Func<ushort, Color>