Table of Contents

Class BorderCurveExtractor

Namespace
Map.Rendering
Assembly
MapAssembly.dll

Extracts smooth border curves from bitmap province boundaries Uses AdjacencySystem to process only known neighbor pairs (efficient) Pre-computes all curves at map load for zero-cost runtime updates

Architecture: Static Geometry + Dynamic Appearance Pattern

  • Geometry (curves) computed once and cached
  • Appearance (colors, thickness) updated at runtime via flags

REFACTORED: Now uses specialized helper classes for single responsibility

  • BorderPolylineSimplifier: RDP simplification, Chaikin smoothing, tessellation
  • BorderGeometryUtils: Geometric utilities (intersection, angles, distances)
  • BorderChainMerger: Chain merging with U-turn detection
  • JunctionDetector: Junction detection and endpoint snapping
  • MedianFilterProcessor: Median filtering and pixel chaining
public class BorderCurveExtractor
Inheritance
object
BorderCurveExtractor

Constructors

BorderCurveExtractor(MapTextureManager, AdjacencySystem, ProvinceSystem, ProvinceMapping)

public BorderCurveExtractor(MapTextureManager textures, AdjacencySystem adjacency, ProvinceSystem provinces, ProvinceMapping mapping)

Parameters

textures MapTextureManager
adjacency AdjacencySystem
provinces ProvinceSystem
mapping ProvinceMapping

Methods

ExtractAllBorders()

Extract and smooth all province borders using Chaikin algorithm Returns dictionary of border polylines: (provinceA, provinceB) -> smooth polyline points

public Dictionary<(ushort, ushort), List<Vector2>> ExtractAllBorders()

Returns

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