Class VectorSceneBuilder
Lowers a backend-agnostic S-100 Part 9 display list (a list of
DrawingInstructions plus an IFeatureGeometryProvider)
into a resolved VectorScene: instructions are sorted into
Part 9 draw order, colours/symbols/line-styles are resolved, sizes are
converted from millimetres to display pixels (1 px = 0.32 mm), and
geometry is projected to EPSG:3857. The result is consumed by both the
headless SkiaDisplayListRenderer and the Mapsui renderer so
the S-100 portrayal-correctness logic lives in exactly one place.
public sealed class VectorSceneBuilder
- Inheritance
-
VectorSceneBuilder
- Inherited Members
Remarks
Scope. Both solid-colour and tiled-symbol pattern area fills are lowered into the IR. Pattern fills are emitted as PatternAreaPaintOp only when a PatternResolver is supplied (the headless Skia path and the Mapsui TiledScene subsystem); the Mapsui feature path leaves the resolver unset and continues to drive its own pattern collection / insert phase, so its output is unchanged. When pattern ops are emitted they are priority-clipped via the shared PatternPriorityClipper — the same algorithm the Mapsui feature path uses — so all three paths clip identically. The (palette-independent) clip result can be memoized via PatternClipCache so re-builds that only change the palette skip the expensive overlay.
Fields
S100PixelSizeMm
Size, in millimetres, of one S-100 portrayal pixel on the nominal display surface (S-100 Part 9 §3.10.4 — 1 px = 0.32 mm). Used to convert spec-defined millimetre sizes to display pixels.
public const double S100PixelSizeMm = 0.32
Field Value
Properties
LineStyleProvider
Resolves a line-style name to its catalogue definition. Optional.
public Func<string, LineStyle?>? LineStyleProvider { get; init; }
Property Value
OutOfBandMinDisplayScale
Optional dataset-wide out-of-scale-band cap, expressed as an S-100
Part 9 §11.1 scale denominator (the cell's most-permissive
DataCoverage.minimumDisplayScale; S-101 FC §3.1.1). When set,
every op's effective ScaleMinimum is clamped to
this denominator, so features lacking their own SCAMIN — and those
whose SCAMIN is more permissive than the cell's — are hidden once the
display is zoomed out past the cell's compilation scale. This mirrors
the cap the Mapsui feature path applies via per-feature
MaxVisible (MapsuiDatasetRenderer.ApplyOutOfScaleBandCap),
keeping the VectorScene IR consumed by the TiledScene
render subsystem in agreement with the Mapsui subsystem.
public double? OutOfBandMinDisplayScale { get; init; }
Property Value
PatternClipCache
Optional memoizer for the pattern priority-clip result. When set, the builder routes the shared Clip(IReadOnlyList<PatternGroup>, IReadOnlyList<Polygon>) call through this delegate, so a re-build whose clip inputs are unchanged — most importantly a Day/Dusk/Night palette switch — reuses the previously computed (palette-independent) clip geometry instead of repeating the expensive NetTopologySuite overlay. The Mapsui renderer wires this to its pattern-clip cache for the default TiledScene render subsystem, matching the caching the Mapsui feature path already enjoys; the headless Skia path leaves it unset (a headless render clips once). Only consulted when a PatternResolver is also set (otherwise no pattern ops are emitted and there is nothing to clip).
public PatternClipMemoizer? PatternClipCache { get; init; }
Property Value
PatternResolver
Resolves an area-fill name to a pre-rasterised tiled pattern (PNG
bytes). When set, AreaInstructions with an
AreaFillReference are lowered to a
PatternAreaPaintOp; when unset (the Mapsui default),
pattern instructions are skipped so the Mapsui renderer's existing
pattern phase remains authoritative. Returning null
for a given name silently drops just that instruction.
public Func<string, byte[]?>? PatternResolver { get; init; }
Property Value
PreferLiveDrawing
The PreferLiveDrawing hint to stamp on the built scene.
public bool PreferLiveDrawing { get; init; }
Property Value
ResolveColor
Resolves an S-100 colour token to an RgbaColor. Required.
public required Func<string?, RgbaColor> ResolveColor { get; init; }
Property Value
SymbolResolver
Resolves a symbol name to a processed-SVG asset, or null when the symbol cannot be resolved (the op then carries a fallback dot). Optional.
public Func<string, SymbolAsset?>? SymbolResolver { get; init; }
Property Value
SymbolScale
Global scale factor applied to all point symbols (default 1.0).
public double SymbolScale { get; init; }
Property Value
TextScale
Global scale factor applied to all text labels (default 1.0).
public double TextScale { get; init; }
Property Value
Methods
Build(IReadOnlyList<DrawingInstruction>, IFeatureGeometryProvider)
Builds a resolved scene from the supplied display list and geometry.
public VectorScene Build(IReadOnlyList<DrawingInstruction> instructions, IFeatureGeometryProvider geometryProvider)
Parameters
instructionsIReadOnlyList<DrawingInstruction>geometryProviderIFeatureGeometryProvider
Returns
ResolveSymbolAsset(string?, ColorPalette?)
Convenience helper that produces a SymbolAsset from raw SVG content by recovering the pivot (TryParse(string)) and processing CSS classes (Process(string, ColorPalette?, double?)). Returns null when the content is null/empty or processing fails.
public static SymbolAsset? ResolveSymbolAsset(string? svgContent, ColorPalette? palette)
Parameters
svgContentstringpaletteColorPalette