Class S100VectorSceneRenderer
The TiledScene ("B") render subsystem, Phase 1: a Mapsui
custom layer renderer that draws the chart base plane by rasterising
the backend-agnostic VectorScene IR directly — bypassing
Mapsui's feature / style / layer walk entirely — on a worker thread,
then compositing the result on the UI/render thread as a single translated
SKImage blit. See
docs/design/S100-Render-Subsystem-Design.md (§3, §4, Phase 1).
public static class S100VectorSceneRenderer
- Inheritance
-
S100VectorSceneRenderer
- Inherited Members
Remarks
Straight from the IR. This renderer consumes the fully-resolved
VectorScene (world coords in EPSG:3857, sizes in display px,
colours resolved, symbols pre-processed, patterns pre-rasterised) and draws
it with SkiaDisplayListRenderer, so the base plane never touches
Mapsui's feature/style model — unlike the retired Mapsui snapshot arm (issue
#600), which recorded what Mapsui would draw by riding GetFeatures /
SortFeatures and the per-feature style dispatch.
Off the synchronous loop (the Phase 1 goal). The expensive rasterisation never runs on the render thread. Each frame the renderer blits the best available image under a pure translation (north-up, constant resolution ⇒ the world→screen projection is an affine translation, identical to the snapshot path's math). When the current image no longer covers the viewport (zoom, or a pan past the recorded MarginPx margin) a fresh whole-viewport-plus-margin raster is scheduled on a worker; the stale image keeps blitting (translated) until the new one publishes, at which point the layer's per-session redraw sink marshals a single repaint that swaps it in. Jobs are coalesced latest-wins per layer so a fast gesture never queues a backlog.
Single surface (Phase 1 scope). One image per layer covering the viewport + margin — no tile pyramid, no prediction, no disk cache yet (those are Phases 2–4). A rotated viewport (course-up) breaks the translate-only blit and is out of v1 scope, so it falls back to drawing nothing for that frame (north-up is the only supported orientation).
Fidelity. The scene bound to the layer via BindScene(ILayer, VectorScene) is built by MapsuiDisplayListRenderer with the pattern resolver set, so area pattern fills are present in the IR (unlike the Mapsui arm, which lowers patterns through a separate post-IR phase). Scale-visibility (S-100 Part 9 §11.1, the per-op SCAMIN carried in the IR) is honoured against the live viewport's scale denominator, matching the A arm's scale-dependent show/hide.
Selection. A fresh vector layer is tagged with RendererName when SceneMode selects the single-surface arm (Single); the tagging is done by MapsuiDisplayListRenderer. EncDotNet.S100.Renderers.Mapsui.S100VectorSceneRenderer.Register() wires the renderer into Mapsui once at startup.
Fields
RendererName
The Mapsui.Layers.ILayer.CustomLayerRendererName value that routes a layer
through this renderer. Set on the vector layer by
MapsuiDisplayListRenderer when the TiledScene
subsystem is active.
public const string RendererName = "s100.vector.scene"
Field Value
Properties
MarginPx
Margin, in screen pixels, rasterised around the viewport on every edge so
a pan reveals already-rendered content out to the margin before a
re-raster is needed. Read once from S100_VECTOR_SCENE_MARGIN
(default 256).
public static double MarginPx { get; }
Property Value
Methods
BindScene(ILayer, VectorScene)
Binds the fully-resolved VectorScene that this renderer
rasterises for layer. Called by
MapsuiDisplayListRenderer when it produces a layer for the
active TiledScene subsystem. Binding a new scene invalidates any
cached image so the next frame re-rasterises.
public static void BindScene(ILayer layer, VectorScene scene)
Parameters
layerILayerThe Mapsui layer the scene belongs to.
sceneVectorSceneThe resolved scene IR (with pattern fills).
Render(SKCanvas, Viewport, ILayer, RenderService)
The render handler Mapsui invokes for layers tagged with RendererName. Blits the best available image under a translation and schedules an off-thread re-raster when the image no longer covers the viewport.
public static void Render(SKCanvas canvas, Viewport viewport, ILayer layer, RenderService renderService)
Parameters
canvasSKCanvasviewportViewportlayerILayerrenderServiceRenderService
TryBindFilteredScene(ILayer, ILayer, Func<PaintOp, bool>)
Binds to target a copy of the scene bound to
source that keeps only the ops keep
accepts — the single-surface counterpart of
TryBindFilteredScene(ILayer, ILayer, Func<PaintOp, bool>).
public static bool TryBindFilteredScene(ILayer source, ILayer target, Func<PaintOp, bool> keep)
Parameters
sourceILayerA layer a scene was bound to.
targetILayerThe layer to bind the filtered scene to.
keepFunc<PaintOp, bool>Returns true for each op to keep.