Class BorderCurveCache
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
-
objectBorderCurveCache
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
provinceAushortprovinceBushort
Returns
- List<Vector2>
GetStyle(ushort, ushort)
Get style for a specific border
public BorderStyle GetStyle(ushort provinceA, ushort provinceB)
Parameters
provinceAushortprovinceBushort
Returns
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
polylinesDictionary<(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
provinceIDushortnewOwnerushortgetOwnerFunc<ushort, ushort>getCountryColorFunc<ushort, Color>