Class S101PortrayalCatalogue
S-101 portrayal catalogue implementing IVectorPortrayalCatalogue. Loads and compiles XSLT rules, caches Lua scripts, and resolves symbols, line styles, and area fills from a PortrayalCatalogueProvider.
public sealed class S101PortrayalCatalogue : IVectorPortrayalCatalogue, IPortrayalCatalogue, IXsltRuleSource, ILuaRuleSource, IPortrayalAssetSource
- Inheritance
-
S101PortrayalCatalogue
- Implements
- Inherited Members
Constructors
S101PortrayalCatalogue(PortrayalCatalogueProvider, ILuaEngine?)
Creates an S-101 portrayal catalogue backed by the given provider. Decoded assets (compiled XSLT, symbols, line styles, area fills, palettes, Lua sources) are cached on the provider's AssetCache.
public S101PortrayalCatalogue(PortrayalCatalogueProvider provider, ILuaEngine? luaEngine = null)
Parameters
providerPortrayalCatalogueProviderThe portrayal catalogue provider that supplies rule files and assets.
luaEngineILuaEngineThe Lua engine used to run Lua portrayal rules, or
nullwhen only XSLT rules will be executed.
Exceptions
- ArgumentNullException
providerisnull.
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-101 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
Remarks
Built lazily from the catalogue's rule files, in declaration order. A rule's type (XSLT or Lua) is taken from its file extension, and its target feature type is inferred from the rule name with any trailing digits removed; top-level and template rules apply to every feature.
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
Remarks
Returns null (and caches null) if
the file cannot be fetched, so the MoonSharp module loader's
"missing module → return null" contract is preserved without retrying
failed lookups on every require() call.
This caches only the immutable string source. The
compiled Lua Script instance is intentionally constructed
per execution to preserve sandbox isolation (S-100 Part 9A).
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)).