Table of Contents

Class S131PortrayalCatalogue

Namespace
EncDotNet.S100.Datasets.S131
Assembly
EncDotNet.S100.Datasets.S131.dll

S-131 portrayal catalogue implementing IVectorPortrayalCatalogue. Loads Lua scripts, symbols, line styles, and colour palettes from a PortrayalCatalogueProvider backed by the bundled EncDotNet.S100.Specifications/content/S131/pc/ assets.

public sealed class S131PortrayalCatalogue : IVectorPortrayalCatalogue, IPortrayalCatalogue, IXsltRuleSource, ILuaRuleSource, IPortrayalAssetSource
Inheritance
S131PortrayalCatalogue
Implements
Inherited Members

Remarks

Modelled after S101PortrayalCatalogue rather than GmlPortrayalCatalogueBase because S-131 uses Lua portrayal (S-100 Part 9A) — the same engine as S-101 — not XSLT.

S-131 Edition 2.0.0 Portrayal Catalogue.

Constructors

S131PortrayalCatalogue(PortrayalCatalogueProvider, ILuaEngine?)

Initialises a new S131PortrayalCatalogue from the given portrayal catalogue provider.

public S131PortrayalCatalogue(PortrayalCatalogueProvider provider, ILuaEngine? luaEngine = null)

Parameters

provider PortrayalCatalogueProvider
luaEngine ILuaEngine

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 loads the catalogue's colour profile; never null.

CatalogueRef

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

public CatalogueRef? CatalogueRef { get; }

Property Value

CatalogueRef?

ContextParameters

The context parameters declared by the S-131 portrayal catalogue (S-100 Part 9A), projected onto the Core LuaContextParameter type for the generic Lua executor.

public IReadOnlyList<LuaContextParameter> ContextParameters { get; }

Property Value

IReadOnlyList<LuaContextParameter>

DisplayModes

Tracks the active S-100 Part 9 display-mode id for the catalogue. When the controller's active id changes the catalogue is responsible for resolving the corresponding viewing-group membership and pushing it into ViewingGroups via SetActiveModeMembership(IReadOnlySet<int>?).

public DisplayModeController DisplayModes { get; }

Property Value

DisplayModeController

DisplayPlanes

Controls which S-100 Part 9 §11.6 display planes are visible.

public DisplayPlaneController DisplayPlanes { get; }

Property Value

DisplayPlaneController

Edition

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

public string Edition { get; }

Property Value

string

Rules

All portrayal rules defined in the catalogue, ordered by ExecutionOrder.

public IReadOnlyList<PortrayalRule> Rules { get; }

Property Value

IReadOnlyList<PortrayalRule>

Spec

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

public SpecRef Spec { get; }

Property Value

SpecRef

ViewingGroups

Controls which viewing groups are currently visible.

public ViewingGroupController ViewingGroups { get; }

Property Value

ViewingGroupController

Methods

GetAreaFillAsync(string, CancellationToken)

Resolves an area fill by name from the catalogue resources.

public ValueTask<AreaFill> GetAreaFillAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string
cancellationToken CancellationToken

Returns

ValueTask<AreaFill>

GetCompiledRuleAsync(string, CancellationToken)

Returns the compiled XSLT transform for the named rule.

public ValueTask<XslCompiledTransform> GetCompiledRuleAsync(string ruleName, CancellationToken cancellationToken = default)

Parameters

ruleName string
cancellationToken CancellationToken

Returns

ValueTask<XslCompiledTransform>

GetLineStyleAsync(string, CancellationToken)

Resolves a line style by name from the catalogue resources.

public ValueTask<LineStyle> GetLineStyleAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string
cancellationToken CancellationToken

Returns

ValueTask<LineStyle>

GetLuaSourceAsync(string, CancellationToken)

Returns the raw Lua source for the given bare filename inside the portrayal catalogue's Rules/ directory (e.g. "main.lua", "S100Scripting.lua"), caching the decoded string so subsequent reads do not re-open the underlying IAssetSource.

public ValueTask<string?> GetLuaSourceAsync(string fileName, CancellationToken cancellationToken = default)

Parameters

fileName string
cancellationToken CancellationToken

Returns

ValueTask<string>

GetLuaSourceNamesAsync(CancellationToken)

Returns every Lua rule file declared in the portrayal catalogue manifest (filtered to .lua extension), e.g. main.lua, S100Scripting.lua.

public ValueTask<IReadOnlyList<string>> GetLuaSourceNamesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<IReadOnlyList<string>>

GetSymbolAsync(string, CancellationToken)

Resolves an SVG symbol by name from the catalogue resources.

public ValueTask<SvgSymbol> GetSymbolAsync(string symbolName, CancellationToken cancellationToken = default)

Parameters

symbolName string
cancellationToken CancellationToken

Returns

ValueTask<SvgSymbol>

SwitchPaletteAsync(PaletteType, CancellationToken)

Switches the active colour palette to type.

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

Asynchronous because catalogues that load palettes lazily from IAssetSource may need to fetch the colour profile XML on first access. Cached implementations complete synchronously through the ValueTask fast path. When the catalogue has no palette for type, implementations keep a usable palette active (the current one, or Day) rather than failing. Coverage catalogues also use this call to pre-load the assets their synchronous resolve methods need, so it must be awaited before those are called (see SwitchPaletteAsync(PaletteType, CancellationToken)).