Table of Contents

Class S102PortrayalCatalogue

Namespace
EncDotNet.S100.Datasets.S102
Assembly
EncDotNet.S100.Datasets.S102.dll

S-102 portrayal catalogue that executes the bundled BathymetryCoverage.lua rule (S-102 Edition 3.0.0, Annex B) via an ILuaEngine and resolves the emitted colour tokens against the bundled Day / Dusk / Night palettes (ColorProfiles/colorProfile.xml, S-100 Part 9 §11).

public class S102PortrayalCatalogue : ICoverageStyle, IPortrayalCatalogue
Inheritance
S102PortrayalCatalogue
Implements
Inherited Members

Remarks

The bundled Lua rule emits one CoverageColor:<TOKEN>;LookupEntry:<label>,<min>,<max>,<interval> instruction per depth band. The bands depend on the four S-102 context parameters supplied via MarinerSettings: FourShades, SafetyContour, ShallowContour, DeepContour. Invariants (ShallowContour ≤ SafetyContour ≤ DeepContour) are clamped rather than throwing — the viewer surface area is a settings panel and bad inputs must not crash the render pipeline.

Cells whose depth equals FillValue resolve to the palette's NODTA token via NoDataColor.

Constructors

S102PortrayalCatalogue(ILuaEngine, PortrayalCatalogueProvider)

Creates a catalogue backed by Lua script execution.

public S102PortrayalCatalogue(ILuaEngine luaEngine, PortrayalCatalogueProvider provider)

Parameters

luaEngine ILuaEngine

The Lua engine used to run portrayal scripts.

provider PortrayalCatalogueProvider

The portrayal catalogue provider that supplies script assets.

Fields

CoverageLimitColorToken

The coverage-limit border's colour token.

public const string CoverageLimitColorToken = "CHGRD"

Field Value

string

SafetyContourColorToken

The S-101 safety contour colour token (DEPARE03).

public const string SafetyContourColorToken = "DEPSC"

Field Value

string

Properties

ActivePalette

The currently active colour palette.

public ColorPalette ActivePalette { get; }

Property Value

ColorPalette

Remarks

Implementations start at the empty Default until the first SwitchPaletteAsync(PaletteType, CancellationToken) call; never null.

CatalogueRef

The identity of the underlying portrayal catalogue XML, when available.

public CatalogueRef? CatalogueRef { get; }

Property Value

CatalogueRef?

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).

public IReadOnlyList<ContourStyle> Contours { get; }

Property Value

IReadOnlyList<ContourStyle>

Remarks

Always empty: the S-102 catalogue defines depth-band fills only.

CoverageLimitStyle

The border drawn along the limit of the S-102 data, where the grid's values give way to no-data and the S-101 depth areas and contours take over (S-98 Part A §A-6.9.1): a dashed 0.32 mm line in CHGRD, as S-101 draws an area boundary of lower importance. Value is unused.

public ContourStyle CoverageLimitStyle { get; }

Property Value

ContourStyle

Edition

The edition of the underlying portrayal catalogue (matches PortrayalCatalogue.Version).

public string Edition { get; }

Property Value

string

Remarks

Always 3.0.0, the edition of the bundled S-102 portrayal catalogue.

RenderNoDataFill

Controls whether NODATA cells (depth equal to FillValue) are painted with the active palette's NODTA token.

When true (the default), ResolveColorScheme(MarinerSettings) surfaces the resolved NODTA colour via NoDataColor so the renderer fills fill cells with an opaque grey — the correct behaviour for a standalone S-102 portrayal (S-102 Edition 3.0.0 Annex B).

When false, NoDataColor is left null so the renderer leaves NODATA cells transparent. This is the correct behaviour when S-102 is overlaid on another layer (e.g. an S-101 ENC in the layered viewer): the un-surveyed remainder of the rectangular coverage extent must not obscure the underlying chart.

public bool RenderNoDataFill { get; init; }

Property Value

bool

Spec

The product specification (name + edition) this catalogue targets.

public SpecRef Spec { get; }

Property Value

SpecRef

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).

public CoverageColorScheme ResolveColorScheme(MarinerSettings settings)

Parameters

settings MarinerSettings

Mariner 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.

Remarks

Runs the bundled Lua rule with the S-102 context parameters taken from settings and converts the emitted depth bands into a colour scheme using the active palette. Never returns null.

Exceptions

InvalidOperationException

The implementation requires pre-loaded assets and SwitchPaletteAsync(PaletteType, CancellationToken) has not been awaited yet.

ArgumentNullException

settings is null.

InvalidOperationException

SwitchPaletteAsync(PaletteType, CancellationToken) has not been called yet, so the Lua rule is not loaded.

SafetyContourStyle(MarinerSettings)

The S-102 safety contour: the depth isoline at the mariner's safety contour, traced from the grid (S-164 UserSelectedSafetyContour; S-98 Part A §A-6.9.1 NOTE allows OEM safety contour functions). It is drawn as S-101 draws its safety contour (DEPARE03: solid, 0.64 mm, DEPSC), unlabelled, in the active palette.

public ContourStyle SafetyContourStyle(MarinerSettings settings)

Parameters

settings MarinerSettings

The mariner settings.

Returns

ContourStyle

The contour style, in metres.

Remarks

The value is the safety contour the depth bands use, so the line runs along the boundary between the safe and unsafe shades. It is not adjusted for water level.

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

type PaletteType

The palette mood (Day, Dusk, or Night).

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

Remarks

When the style has no palette for type, implementations keep a usable palette active (the current one, or Day) rather than failing.