Class WeatherCoverageStyle
How a weather layer is drawn from a WeatherCoverageSource: a colour fill (Fill), oriented symbols (Symbols) or labelled isolines (Isolines), with its S-98 display plane, its priority within the plane, its opacity and whether it is shown by default.
public abstract class WeatherCoverageStyle : ICoverageStyle
- Inheritance
-
WeatherCoverageStyle
- Implements
- Derived
- Inherited Members
Remarks
GRIB2 and NetCDF-CF have no portrayal catalogue, so the weather styles are SoundCharts' own, defined in code with the portrayal toolkit (WeatherPalette, Symbols, ContentScope). Being ICoverageStyles, they go through the ordinary coverage pipeline, and both renderers draw them with no weather-specific code (design note weather-sources.md §4).
| Style | Drawn as |
|---|---|
| WaveHeightStyle | A wave.hs fill. On by default. |
| WindBarbStyle | WMO wind barbs from wind.speed and wind.from_direction. On by default. |
| WindSpeedStyle | A wind.speed fill in Beaufort bands. Off by default. |
| WaveDirectionStyle | Arrows along wave.dir, sized by wave.hs. Off by default. |
| PressureIsobarStyle | Isobars every 4 hPa on pressure.msl, labelled. On by default. |
| SeaTemperatureStyle | A sea.temperature fill in 1 °C bands. On by default. |
| SeaTemperatureIsothermStyle | Isotherms every 2 °C on sea.temperature, labelled. Off by default. |
| CurrentArrowStyle | Arrows along current.to_direction in S-111's speed bands. On by default; hidden inside S-111 coverage. |
Layer order (design note §5): fills go on OnDemandSurface at priority FillPriority, under the S-104 surface; barbs and arrows go on DynamicArrows at priority SymbolPriority, over the S-111 arrows (priority 10); isobars go on OtherChartOverlays at priority IsolinePriority, under the observations (100). The sub-layers WeatherPortrayal builds carry these.
Land. Fills with ClipToWater set (wave height, sea surface temperature) are
clipped to water when an S-101 chart is loaded, by the S-98 rule that
clips the S-104 surface (S98DefaultRules.R_101_WX_B_ClipWeatherFillsToWater).
Wind isn't clipped: it blows over land too.
A style holds the active palette, so give each layer its own instance. It is not meant for concurrent mutation.
Fields
FillOpacity
The opacity of the colour fills: 0.5, so the chart under them stays readable.
public const double FillOpacity = 0.5
Field Value
FillPriority
The fills' priority within OnDemandSurface: 0, under the S-104 surface.
public const int FillPriority = 0
Field Value
IsolinePriority
The isolines' priority within OtherChartOverlays: 90, under the observations (100).
public const int IsolinePriority = 90
Field Value
StyleVersion
The version of the weather styles, folded into ContentScope. Bump it whenever the symbols, the palette or the bands change.
public const int StyleVersion = 4
Field Value
SymbolPriority
The barbs' and arrows' priority within DynamicArrows: 20, over the S-111 arrows (10).
public const int SymbolPriority = 20
Field Value
Properties
ActivePalette
Gets the active colour palette: Palette's colours for the palette last passed to SwitchPaletteAsync(PaletteType, CancellationToken) (Day until then).
public ColorPalette ActivePalette { get; }
Property Value
ActivePaletteType
The palette last passed to SwitchPaletteAsync(PaletteType, CancellationToken); Day until then.
public PaletteType ActivePaletteType { get; }
Property Value
ClipToWater
Whether the fill is clipped to water when an S-101 chart is loaded (ClipToWater): set for wave height, not for wind.
public bool ClipToWater { get; }
Property Value
ContentScope
The weather styles' part of the tile disk-cache content scope: the style name and StyleVersion plus the toolkit version (For(string, int)).
public static string ContentScope { get; }
Property Value
Contours
The contours of an isoline style, resolved against the active palette (PressureIsobarStyle); empty for a fill or symbols.
public virtual IReadOnlyList<ContourStyle> Contours { get; }
Property Value
IsVisibleByDefault
Whether the layer is drawn when nothing says otherwise: on for the wave height fill, wind barbs and isobars; off for the wind speed fill and wave arrows, which compete with the wave fill and the barbs (design note §10.1).
public bool IsVisibleByDefault { get; }
Property Value
Kind
Whether the style draws a colour fill or oriented symbols.
public WeatherLayerKind Kind { get; }
Property Value
LayerKey
The stable sub-layer key, e.g. "weather.wave.height".
public string LayerKey { get; }
Property Value
Name
The layer's display name, e.g. "Wave height".
public string Name { get; }
Property Value
Opacity
The portrayal opacity: FillOpacity for a fill, 1 for symbols and isolines. Renderers multiply it with any user opacity.
public double Opacity { get; }
Property Value
Plane
The S-98 display plane: OnDemandSurface for a fill, DynamicArrows for symbols and OtherChartOverlays for isolines.
public S98DisplayPlane Plane { get; }
Property Value
RotationFieldName
The field the symbols are rotated by, or null for a fill.
public string? RotationFieldName { get; }
Property Value
Symbols
The weather symbols (wind barbs, the calm circle and the wave arrow),
embedded from the project's Symbols folder. Colours are palette
classes resolved against Palette.
public static SymbolSet Symbols { get; }
Property Value
Remarks
The SVGs are generated by tools/GenerateWeatherSymbols and
checked in. They follow the S-100 SVG conventions: sizes in
millimetres (one user unit is one millimetre), the pivot point at the
origin and the centre of the view box (the arrow renderers centre a
symbol on its cell), and colours by palette class.
ValueFieldName
The coverage field the bands are keyed on, e.g. "wave.hs".
public string ValueFieldName { get; }
Property Value
WithinPlanePriority
The priority within Plane: FillPriority for a fill, SymbolPriority for symbols and IsolinePriority for isolines.
public int WithinPlanePriority { get; }
Property Value
Methods
AppliesTo(WeatherCoverageSource)
Whether source carries the fields this style reads
(ValueFieldName and, for symbols, RotationFieldName),
stored or derived.
public bool AppliesTo(WeatherCoverageSource source)
Parameters
sourceWeatherCoverageSourceThe coverage source.
Returns
CreateAll()
New instances of every weather style, in layer-stack order: the sea surface temperature, wave height and wind speed fills, the isotherms and pressure isobars, then the current arrows, wind barbs and wave arrows.
public static IReadOnlyList<WeatherCoverageStyle> CreateAll()
Returns
CreateFor(WeatherCoverageSource)
New instances of the styles that apply to source
(AppliesTo(WeatherCoverageSource)), in the order of CreateAll().
public static IReadOnlyList<WeatherCoverageStyle> CreateFor(WeatherCoverageSource source)
Parameters
sourceWeatherCoverageSourceThe coverage source.
Returns
FormatContourLabel(ContourStyle)
The label of one of Contours, e.g. "1012" for an
isobar. The default is the value in the invariant culture.
public virtual string FormatContourLabel(ContourStyle contour)
Parameters
contourContourStyleA contour of this style.
Returns
IsDrawnWith(EcdisDisplaySettings?)
Whether the layer is drawn under display: its
map-wide switch (LayerVisibility,
keyed by LayerKey; the viewer's Display controls Weather
section), or IsVisibleByDefault when the switch is unset
or there are no display settings (headless rendering).
public bool IsDrawnWith(EcdisDisplaySettings? display)
Parameters
displayEcdisDisplaySettingsThe display settings, or null.
Returns
ResolveColorScheme(MarinerSettings)
The colour bands of a fill, resolved against the active palette, or null for a symbol style.
public virtual CoverageColorScheme? ResolveColorScheme(MarinerSettings settings)
Parameters
settingsMarinerSettingsUnused: the weather bands don't depend on mariner settings.
Returns
ResolveSymbolScheme(MarinerSettings)
The symbol bands of a symbol style, or null for a fill.
public virtual CoverageSymbolScheme? ResolveSymbolScheme(MarinerSettings settings)
Parameters
settingsMarinerSettingsUnused: the weather bands don't depend on mariner settings.
Returns
SwitchPaletteAsync(PaletteType, CancellationToken)
Switches the active colour palette to type and
pre-loads the assets the synchronous resolve methods need.
public 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.