Table of Contents

Class HeadlessVectorRenderer

Namespace
EncDotNet.S100.Renderers.Skia.Scene
Assembly
EncDotNet.S100.Renderers.Skia.dll

Source-agnostic entry point for headless vector rendering: lowers any S-100 Part 9 display list (point/line/solid-area/pattern-area/text) through the shared VectorSceneBuilder and rasterises it with SkiaDisplayListRenderer, auto-fitting the viewport to the resolved scene's EPSG:3857 extent unless an explicit viewport is supplied. Works for any vector product (S-101 ISO 8211, S-12x / S-201 / S-421 GML, …) because it depends only on the encoding-agnostic DrawingInstruction / IFeatureGeometryProvider contract — not on Mapsui.

public static class HeadlessVectorRenderer
Inheritance
HeadlessVectorRenderer
Inherited Members

Remarks

Tiled pattern area-fills are supported when an areaFillProvider is supplied (see Render(IReadOnlyList<DrawingInstruction>, IFeatureGeometryProvider, ColorPalette, Func<string, string?>?, Func<string, LineStyle?>?, double, double, int, int, RgbaColor, Func<string, AreaFill?>?, DrawingInstructionCategory, BasemapKind, Viewport?)); the renderer rasterises each referenced pattern tile via RasterizePatternTile(string, AreaFill, double) and tiles it across the polygon. Draw order follows the shared core's S-100 Part 9 ordering (solid areas → pattern areas → lines → points → text within a plane) — the same ordering each Mapsui layer applies — but a single headless bitmap does not reproduce the S-101 processor's two-layer area/non-area split (that split exists only to interleave S-102). Pattern area-fills are priority-clipped against higher-priority patterns and opaque solid fills: the shared VectorSceneBuilder applies PatternPriorityClipper when lowering the scene, so headless output matches the Mapsui pattern phase.

Methods

BuildScene(IReadOnlyList<DrawingInstruction>, IFeatureGeometryProvider, ColorPalette, Func<string, string?>?, Func<string, LineStyle?>?, double, double, Func<string, AreaFill?>?, DrawingInstructionCategory)

Lowers a Part 9 display list into a resolved VectorScene (EPSG:3857 world geometry with paint state) without rasterising it. This is the reusable lowering seam shared by the single-dataset Render(IReadOnlyList<DrawingInstruction>, IFeatureGeometryProvider, ColorPalette, Func<string, string?>?, Func<string, LineStyle?>?, double, double, int, int, RgbaColor, Func<string, AreaFill?>?, DrawingInstructionCategory, BasemapKind, Viewport?) path and the multi-layer headless compositor, which needs the scene to draw it against a shared viewport rather than an auto-fitted one.

public static VectorScene BuildScene(IReadOnlyList<DrawingInstruction> instructions, IFeatureGeometryProvider geometryProvider, ColorPalette palette, Func<string, string?>? symbolProvider, Func<string, LineStyle?>? lineStyleProvider, double symbolScale, double textScale, Func<string, AreaFill?>? areaFillProvider = null, DrawingInstructionCategory hiddenCategories = DrawingInstructionCategory.None)

Parameters

instructions IReadOnlyList<DrawingInstruction>

The Part 9 display list to lower.

geometryProvider IFeatureGeometryProvider

Resolves feature geometry referenced by the instructions.

palette ColorPalette

Active colour palette for token resolution.

symbolProvider Func<string, string>

Resolves a symbol name to raw SVG content (pre-processing), or null.

lineStyleProvider Func<string, LineStyle>

Resolves a line-style name to its catalogue definition, or null.

symbolScale double

Global symbol scale factor.

textScale double

Global text scale factor.

areaFillProvider Func<string, AreaFill>

Optional resolver for area-fill catalogue entries (tiled patterns).

hiddenCategories DrawingInstructionCategory

Drawing-instruction categories (areas, lines, points, text) to omit from the lowered scene. Defaults to None (lower everything). Used by the multi-layer compositor to apply a global suppression across layers.

Returns

VectorScene

The resolved vector scene.

FitViewport(VectorScene, int, int)

Builds a Viewport fitted to a resolved scene's EPSG:3857 extent, padded so the projected aspect ratio matches the requested pixel rectangle (the renderer scales X and Y independently, so matching the aspect avoids distortion). The geographic bounds are recovered from the projected extent via ToLonLat(double, double).

public static Viewport FitViewport(VectorScene scene, int widthPixels, int heightPixels)

Parameters

scene VectorScene
widthPixels int
heightPixels int

Returns

Viewport

Render(IReadOnlyList<DrawingInstruction>, IFeatureGeometryProvider, ColorPalette, Func<string, string?>?, Func<string, LineStyle?>?, double, double, int, int, RgbaColor, Func<string, AreaFill?>?, DrawingInstructionCategory, BasemapKind, Viewport?)

Renders a display list to a standalone bitmap. By default the viewport is auto-fitted to the scene extent and scale-visibility culling is disabled (the fitted scale is not a meaningful compilation scale), so all resolved ops are drawn; pass an explicit viewport to frame an exact window and enable scale-visibility culling.

public static SKBitmap Render(IReadOnlyList<DrawingInstruction> instructions, IFeatureGeometryProvider geometryProvider, ColorPalette palette, Func<string, string?>? symbolProvider, Func<string, LineStyle?>? lineStyleProvider, double symbolScale, double textScale, int widthPixels, int heightPixels, RgbaColor background, Func<string, AreaFill?>? areaFillProvider = null, DrawingInstructionCategory hiddenCategories = DrawingInstructionCategory.None, BasemapKind basemap = BasemapKind.None, Viewport? viewport = null)

Parameters

instructions IReadOnlyList<DrawingInstruction>

The Part 9 display list to render.

geometryProvider IFeatureGeometryProvider

Resolves feature geometry referenced by the instructions.

palette ColorPalette

Active colour palette for token resolution.

symbolProvider Func<string, string>

Resolves a symbol name to raw SVG content (pre-processing), or null.

lineStyleProvider Func<string, LineStyle>

Resolves a line-style name to its catalogue definition, or null.

symbolScale double

Global symbol scale factor.

textScale double

Global text scale factor.

widthPixels int

Output bitmap width.

heightPixels int

Output bitmap height.

background RgbaColor

Background fill colour.

areaFillProvider Func<string, AreaFill>

Optional resolver for area-fill catalogue entries by name. When supplied together with symbolProvider, area instructions with an AreaFillReference are rasterised into tiled pattern fills via RasterizePatternTile(string, AreaFill, double). When omitted, pattern areas are skipped (matching legacy behaviour).

hiddenCategories DrawingInstructionCategory

Bitmask of instruction categories to suppress from the output (S-100 Part 9 instruction types — areas, lines, points, text). Defaults to None (render everything). Hiding categories filters the display list before lowering, so the remaining instructions keep their priorities, viewing-group state, and extent. The auto-fitted viewport is computed from the filtered scene, matching what the user actually sees.

basemap BasemapKind

Optional basemap drawn beneath the dataset (issue #411). When Offline, the bundled Natural Earth land layer (GetLandScene(Viewport)) is painted first, against the same auto-fitted viewport, so it registers exactly with the chart. Defaults to None (no basemap; output unchanged).

viewport Viewport

Optional explicit display window. When null (the default) the viewport is auto-fitted to the scene extent (padded 10%, aspect-matched) and scale-visibility culling is disabled. When supplied, that exact window is rendered and S-100 Part 9 scale-visibility culling is enabled — because an explicit viewport carries a meaningful ScaleDenominator — bringing this path into alignment with the composite/GUI render paths.

Returns

SKBitmap

A newly allocated bitmap owned by the caller.

RenderBlank(int, int, RgbaColor)

Produces a blank bitmap of the requested size filled with background. Used when a pre-render gate (e.g. an S-411 time-window suppression) means the dataset contributes no portrayal for the current context.

public static SKBitmap RenderBlank(int widthPixels, int heightPixels, RgbaColor background)

Parameters

widthPixels int

Output bitmap width.

heightPixels int

Output bitmap height.

background RgbaColor

Background fill colour.

Returns

SKBitmap

A newly allocated bitmap owned by the caller.

TryGetSeamAwareWorldBounds(VectorScene, out double, out double, out double, out double)

Computes a seam-aware EPSG:3857 bounding box for the scene: when the geometry straddles the ±180° antimeridian the returned window is shifted into a contiguous longitude frame (its maxX may exceed +½ Circumference), so the fitted viewport frames the data on its true extent instead of collapsing to a near-global span (issue #413). Delegates the detection to SeamAwareBoundsAccumulator. Returns false when the scene has no geometry to bound.

public static bool TryGetSeamAwareWorldBounds(VectorScene scene, out double minX, out double minY, out double maxX, out double maxY)

Parameters

scene VectorScene
minX double
minY double
maxX double
maxY double

Returns

bool

TryGetWorldBounds(VectorScene, out double, out double, out double, out double)

Computes the EPSG:3857 bounding box spanning every resolved paint op's world geometry. Returns false when the scene has no geometry to bound. Exposed so the multi-layer compositor can union each vector layer's projected extent into a shared viewport.

public static bool TryGetWorldBounds(VectorScene scene, out double minX, out double minY, out double maxX, out double maxY)

Parameters

scene VectorScene
minX double
minY double
maxX double
maxY double

Returns

bool

Remarks

This is the naive min/max — it does not account for the ±180° antimeridian seam. Use TryGetSeamAwareWorldBounds(VectorScene, out double, out double, out double, out double) (or feed the scene to a SeamAwareBoundsAccumulator) when fitting an auto-viewport so datasets crossing the dateline are framed correctly.