Class S131PortrayalCatalogue
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
providerPortrayalCatalogueProviderluaEngineILuaEngine
Properties
ActivePalette
The currently active colour palette.
public ColorPalette ActivePalette { get; }
Property Value
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
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
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
DisplayPlanes
Controls which S-100 Part 9 §11.6 display planes are visible.
public DisplayPlaneController DisplayPlanes { get; }
Property Value
Edition
The edition of the underlying portrayal catalogue (matches PortrayalCatalogue.Version).
public string Edition { get; }
Property Value
Rules
All portrayal rules defined in the catalogue, ordered by ExecutionOrder.
public IReadOnlyList<PortrayalRule> Rules { get; }
Property Value
Spec
The product specification (name + edition) this catalogue targets.
public SpecRef Spec { get; }
Property Value
ViewingGroups
Controls which viewing groups are currently visible.
public ViewingGroupController ViewingGroups { get; }
Property Value
Methods
GetAreaFillAsync(string, CancellationToken)
Resolves an area fill by name from the catalogue resources.
public ValueTask<AreaFill> GetAreaFillAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringcancellationTokenCancellationToken
Returns
GetCompiledRuleAsync(string, CancellationToken)
Returns the compiled XSLT transform for the named rule.
public ValueTask<XslCompiledTransform> GetCompiledRuleAsync(string ruleName, CancellationToken cancellationToken = default)
Parameters
ruleNamestringcancellationTokenCancellationToken
Returns
GetLineStyleAsync(string, CancellationToken)
Resolves a line style by name from the catalogue resources.
public ValueTask<LineStyle> GetLineStyleAsync(string name, CancellationToken cancellationToken = default)
Parameters
namestringcancellationTokenCancellationToken
Returns
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
fileNamestringcancellationTokenCancellationToken
Returns
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
cancellationTokenCancellationToken
Returns
GetSymbolAsync(string, CancellationToken)
Resolves an SVG symbol by name from the catalogue resources.
public ValueTask<SvgSymbol> GetSymbolAsync(string symbolName, CancellationToken cancellationToken = default)
Parameters
symbolNamestringcancellationTokenCancellationToken
Returns
SwitchPaletteAsync(PaletteType, CancellationToken)
Switches the active colour palette to type.
public ValueTask SwitchPaletteAsync(PaletteType type, CancellationToken cancellationToken = default)
Parameters
typePaletteTypeThe palette mood (Day, Dusk, or Night).
cancellationTokenCancellationTokenCancellation token.
Returns
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)).