Interface ICoverageStyle
How a gridded coverage (S-102, S-104, S-111, weather grids) is drawn: its colour scheme, symbol scheme, contours and active palette. Consumed by CoveragePipeline, which resolves the schemes against the mariner settings and hands them, with the sampled grid, to the renderer.
public interface ICoverageStyle
Remarks
A style is not necessarily a portrayal catalogue. The S-102 and S-111 styles come from file-backed catalogues and also implement IPortrayalCatalogue; the S-104 style and the weather styles are defined in code and carry no specification or edition.
Call SwitchPaletteAsync(PaletteType, CancellationToken) before ResolveColorScheme(MarinerSettings) or ResolveSymbolScheme(MarinerSettings): it selects the palette the resolved colours come from, and implementations use it to pre-load the assets (palettes, rule scripts) the synchronous resolve methods read from memory; the S-102 and S-111 styles throw InvalidOperationException when resolving before that pre-warm. CoveragePipeline switches to Day itself when ActivePalette is still empty, so direct callers of the resolve methods are the ones that must honour this order.
A style instance is stateful (the active palette) and is not intended for concurrent mutation.
Properties
ActivePalette
The currently active colour palette.
ColorPalette ActivePalette { get; }
Property Value
Remarks
Implementations start at the empty Default until the first SwitchPaletteAsync(PaletteType, CancellationToken) call; never null.
Contours
Contour line styles to draw over the coverage, one per contour value. Empty when the style defines no contours (the case for every bundled style today).
IReadOnlyList<ContourStyle> Contours { get; }
Property Value
Methods
ResolveColorScheme(MarinerSettings)
Resolves a colour scheme for the value field this coverage carries,
or null when the style specifies no coverage colour fill (e.g.
S-111 Edition 2.0.0, whose portrayal catalogue defines arrow symbology
only — see content/S111/pc/Rules/select_arrow.xsl).
CoverageColorScheme? ResolveColorScheme(MarinerSettings settings)
Parameters
settingsMarinerSettingsMariner display preferences that select the bands (e.g. the S-102 safety, shallow and deep contours and the four-shade option).
Returns
- CoverageColorScheme
A scheme whose band colours are already resolved against ActivePalette, or
null.
Exceptions
- InvalidOperationException
The implementation requires pre-loaded assets and SwitchPaletteAsync(PaletteType, CancellationToken) has not been awaited yet.
ResolveSymbolScheme(MarinerSettings)
Returns a symbol scheme for oriented overlay symbols (e.g. current arrows),
or null if this style does not define one.
CoverageSymbolScheme? ResolveSymbolScheme(MarinerSettings settings)
Parameters
settingsMarinerSettingsMariner display preferences.
Returns
- CoverageSymbolScheme
The symbol scheme, or
null. The default implementation returnsnull.
Exceptions
- InvalidOperationException
The implementation requires pre-loaded assets and SwitchPaletteAsync(PaletteType, CancellationToken) has not been awaited yet.
SwitchPaletteAsync(PaletteType, CancellationToken)
Switches the active colour palette to type and
pre-loads the assets the synchronous resolve methods need.
ValueTask SwitchPaletteAsync(PaletteType type, CancellationToken cancellationToken = default)
Parameters
typePaletteTypeThe palette mood (Day, Dusk, or Night).
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
When the style has no palette for type,
implementations keep a usable palette active (the current one, or
Day) rather than failing.