Class MapsuiDatasetRenderer
Converts a dataset processor's Mapsui-free portrayal output
(IVectorPortrayalSource / ICoveragePortrayalSource)
into a Mapsui-typed MapsuiDatasetResult. This is the Mapsui-aware
half of the portrayal-output seam: the processor (in the headless-facing
EncDotNet.S100.Datasets.Pipelines assembly) builds an immutable
snapshot of the dataset's portrayal, and this renderer rasterises it into
ILayers, owning every Mapsui type (NTS pattern clipping, feature
tagging, out-of-scale-band cap, coverage / arrow / glyph layer build).
public sealed class MapsuiDatasetRenderer
- Inheritance
-
MapsuiDatasetRenderer
- Inherited Members
Remarks
Issue #189 keystone: relocating the processor → ILayer conversion
here lets the Pipelines assembly (and the headless facade / CLI that
reference it) drop Mapsui as a dependency.
This is a PLAIN renderer (consumes IDatasetProcessor +
RenderContext). Issue #213 will later unify it under
IS100DatasetRenderer<IReadOnlyList<ILayer>>; the present
shape is structured so that adoption is purely additive.
Constructors
MapsuiDatasetRenderer(ICrsTransformFactory, IPatternClipCache?)
Creates a new renderer.
public MapsuiDatasetRenderer(ICrsTransformFactory crsTransformFactory, IPatternClipCache? patternClipCache = null)
Parameters
crsTransformFactoryICrsTransformFactoryCRS transform factory used by the coverage / arrow renderers to project the native grid CRS to EPSG:3857.
patternClipCacheIPatternClipCacheOptional process-wide pattern-fill priority-clip cache (e.g. a DiskPatternClipCache) shared across every S-101 render, so the cold first open of a previously-seen cell skips the multi-second NetTopologySuite clip. When null an in-memory single-slot cache is retained for the lifetime of this renderer.
Exceptions
- ArgumentNullException
Thrown when
crsTransformFactoryis null.
MapsuiDatasetRenderer(ICrsTransformFactory, IPatternClipCache?, S100MapsuiOptions)
Creates a new renderer with captured Mapsui rendering configuration.
public MapsuiDatasetRenderer(ICrsTransformFactory crsTransformFactory, IPatternClipCache? patternClipCache, S100MapsuiOptions options)
Parameters
crsTransformFactoryICrsTransformFactoryCRS transform factory used by the coverage / arrow renderers to project the native grid CRS to EPSG:3857.
patternClipCacheIPatternClipCacheOptional process-wide pattern-fill priority-clip cache. When null an in-memory single-slot cache is retained for the lifetime of this renderer.
optionsS100MapsuiOptionsCaptured rendering configuration.
Exceptions
- ArgumentNullException
Thrown when
crsTransformFactoryoroptionsis null.
Methods
ApplyCellScaleWindow(IEnumerable<ILayer>, int)
Applies the hole-safe per-cell zoom-out visibility window (issue #438
Phase 1) to a cell's built Mapsui layers: each layer stops drawing once
the viewport is zoomed out beyond minimumDisplayScale
(the coarsest denominator in the cell's intended band, S-100 Part 17 /
S-101 FC §3.1.1 DataCoverage.minimumDisplayScale).
public static void ApplyCellScaleWindow(IEnumerable<ILayer> layers, int minimumDisplayScale)
Parameters
layersIEnumerable<ILayer>The cell's built layers.
minimumDisplayScaleintThe coarsest display-scale denominator of the cell's band (must be positive; non-positive values are ignored).
Remarks
The denominator is converted to a Mapsui EPSG:3857 resolution at each
layer's own extent-centre latitude (undoing web-mercator 1/cos φ
distortion, matching ApplyOutOfScaleBandCap(IEnumerable<IFeature>, double)) and clamped
onto the layer's MaxVisible. The clamp only ever tightens, so an
existing (smaller) cap is preserved.
This is hole-safe: finer nested cells carry a smaller
minimumDisplayScale and therefore drop out first as
the viewport zooms out, leaving the coarser cell underneath visible.
Only the zoom-out edge is enforced — the zoom-in edge
(maximumDisplayScale → MinVisible) is deliberately not
applied here because a whole-cell zoom-in cutoff would blank areas a
finer cell does not fully cover; that suppression is deferred to the
coverage-clipping work (issue #438 Phase 2).
ApplyOutOfScaleBandCap(IEnumerable<IFeature>, double)
Clamps the maximum visible resolution (zoomed-out limit) of every style
on features to maxResolution,
suppressing point/line/text detail past the cell's intended scale band
(S-101 out-of-scale-band declutter, FC §3.1.1). Only ever tightens.
Exposed for diagnostics and tests.
public static void ApplyOutOfScaleBandCap(IEnumerable<IFeature> features, double maxResolution)
Parameters
featuresIEnumerable<IFeature>maxResolutiondouble
BuildCoverageLayer(CoverageSubLayerBase)
Builds the Mapsui layer for a coverage sub-layer that an S-98 rule replaced (for example R-101-104-B attaching a land-area mask to the S-104 surface, or R-111-WX-B blanking model current arrows inside S-111), or null for a sub-layer kind that is not rebuilt.
public ILayer? BuildCoverageLayer(CoverageSubLayerBase subLayer)
Parameters
subLayerCoverageSubLayerBaseThe replaced sub-layer.
Returns
- ILayer
The rebuilt layer, or null.
BuildGridCoverageLayer(GridCoverageSubLayer)
Builds the Mapsui raster layer for an S-104-style gridded coverage surface, applying the optional S-98 land-area mask (LandAreaMask) so the surface is clipped to water (issue #483). Exposed so the S-98 layer-stack projector can rebuild the raster after an inter-product rule attaches a mask that was not present when the layer was first rasterised.
public ILayer? BuildGridCoverageLayer(GridCoverageSubLayer grid)
Parameters
gridGridCoverageSubLayerThe gridded coverage sub-layer to rasterise.
Returns
- ILayer
The rasterised layer, or null if none was produced.
BuildIsolineLayer(IsolineCoverageSubLayer)
Builds the layer for labelled isolines (the S-104 surface): one feature covering the coverage extent, styled with an IsolineStyle that draws the lines in screen space each frame. Returns null when the sub-layer has no extent.
public static ILayer? BuildIsolineLayer(IsolineCoverageSubLayer sub)
Parameters
subIsolineCoverageSubLayerThe isoline sub-layer.
Returns
- ILayer
The layer, or null.
RenderAsync(IDatasetProcessor, RenderContext?, CancellationToken)
Renders the supplied processor's portrayal into Mapsui layers.
public Task<MapsuiDatasetResult> RenderAsync(IDatasetProcessor processor, RenderContext? context = null, CancellationToken cancellationToken = default)
Parameters
processorIDatasetProcessorThe dataset processor; must implement IVectorPortrayalSource or ICoveragePortrayalSource.
contextRenderContextOptional render context (palette, scales, ECDIS, time step).
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<MapsuiDatasetResult>
The Mapsui-typed render result.
Exceptions
- NotSupportedException
Thrown when the processor exposes neither portrayal-output capability.