Table of Contents

Class LuaRuleExecutor

Namespace
EncDotNet.S100.Pipelines.Vector.Lua
Assembly
EncDotNet.S100.Core.dll

Product-agnostic executor for the S-100 Part 9A Lua portrayal stage. Drives the full pass — create context, load main.lua, run provider shims, initialise and override context parameters, call PortrayalMain, dedup and parse the emitted instructions, and apply post-parse transforms — entirely through injected seams, so a single implementation serves every Lua-portrayed product (S-101, S-131, S-57-as-S-101).

public sealed class LuaRuleExecutor : ILuaVectorRuleExecutor, IVectorRuleExecutor
Inheritance
LuaRuleExecutor
Implements
Inherited Members

Remarks

All product variation is supplied at construction:

Constructors

LuaRuleExecutor(ILuaEngine, ILuaRuleSource, ILuaDataProviderFactory, string, IReadOnlyList<LuaContextParameterBinding>, IFeatureAnchorProvider?, IReadOnlyList<IDrawingInstructionTransform>?, ISpatialReferenceResolver?)

Initialises a new generic Lua rule executor.

public LuaRuleExecutor(ILuaEngine luaEngine, ILuaRuleSource source, ILuaDataProviderFactory providerFactory, string productTag, IReadOnlyList<LuaContextParameterBinding> contextParameterBindings, IFeatureAnchorProvider? anchorProvider = null, IReadOnlyList<IDrawingInstructionTransform>? transforms = null, ISpatialReferenceResolver? spatialReferences = null)

Parameters

luaEngine ILuaEngine

The sandboxed Lua engine (S-100 Part 9A).

source ILuaRuleSource

Supplies Lua module source and declared context parameters.

providerFactory ILuaDataProviderFactory

Creates a render-scoped host-API data provider.

productTag string

Telemetry product tag (e.g. "S-101", "S-131"); S-57 reuses the S-101 Lua pipeline and therefore tags as "S-101".

contextParameterBindings IReadOnlyList<LuaContextParameterBinding>

Per-product mapping from MarinerSettings to declared context parameters, including any name aliases or inversions.

anchorProvider IFeatureAnchorProvider

Optional feature-anchor lookup for augmented line tessellation during parse; null for products without augmented geometry.

transforms IReadOnlyList<IDrawingInstructionTransform>

Optional ordered post-parse transforms (e.g. the S-101 SAFCON label merger); null or empty when none are required.

spatialReferences ISpatialReferenceResolver

Optional resolver for SpatialReference commands, so lines drawn on particular edges (such as the safety contour) follow those edges only; null for products whose rules emit none.

Methods

ExecuteAsync(MarinerSettings, CancellationToken)

Runs the rule stage and returns typed drawing instructions ready for the renderer.

public Task<IReadOnlyList<DrawingInstruction>> ExecuteAsync(MarinerSettings mariner, CancellationToken cancellationToken = default)

Parameters

mariner MarinerSettings

Mariner-configurable display preferences (S-100 Part 9 §4.2).

cancellationToken CancellationToken

Signals that the render has been cancelled. Script interpreters are generally not interruptible mid-evaluation, so implementations honour the token at coarse boundaries; the asynchronous shape exists to allow implementations to await catalogue asset loads (compiled XSLT, Lua source) before driving the synchronous engine.

Returns

Task<IReadOnlyList<DrawingInstruction>>

ExecuteRawAsync(MarinerSettings, CancellationToken)

Runs the Lua portrayal pass and returns the raw emitted drawing-instruction strings keyed by feature reference, without parsing or post-processing.

public Task<IReadOnlyList<EmittedInstruction>> ExecuteRawAsync(MarinerSettings mariner, CancellationToken cancellationToken = default)

Parameters

mariner MarinerSettings

Mariner-configurable display preferences (S-100 Part 9 §4.2).

cancellationToken CancellationToken

Honoured at coarse boundaries before Lua invocation.

Returns

Task<IReadOnlyList<EmittedInstruction>>

OpenSessionAsync(MarinerSettings, CancellationToken)

Opens a Lua portrayal session: one Lua state, set up with the catalogue's rules and mariner's context parameters, that portrays chosen features on demand (Portray(IReadOnlyCollection<string>)). Setting up the state is most of the cost of portraying a few features, so a caller that portrays features in batches, such as a route check leg by leg, keeps one session.

public Task<LuaPortrayalSession> OpenSessionAsync(MarinerSettings mariner, CancellationToken cancellationToken = default)

Parameters

mariner MarinerSettings

The mariner settings, for the context parameters.

cancellationToken CancellationToken

Cancels loading the rules.

Returns

Task<LuaPortrayalSession>

The session; the caller disposes it.