Interface IS100DynamicSourceRegistry
- Namespace
- EncDotNet.S100.Renderers.Mapsui.DynamicSources
- Assembly
- EncDotNet.S100.Renderers.Mapsui.dll
The read/write registry surface over the dynamic-source host: the set of
currently registered sources, a per-source visibility toggle, and geographic
hit-testing. Implemented by S100DynamicSourceHost and exposed
on a session via IS100MapSession.DynamicSources.
public interface IS100DynamicSourceRegistry
Remarks
The host's Register(IDynamicFeatureSource) method remains the only way to add or remove a source; this surface is the canonical read/write facade for view-models and pick services.
Visibility state is owned by the host. Toggling visibility flips the backing overlay layer's enabled bit — the source itself is left alone (it keeps publishing into the hidden layer), preserving the graphics-agnostic IDynamicFeatureSource contract.
Members are safe to call from the host's map thread. The host marshals its internal state mutations, so SourcesChanged fires on that thread when raised through the host's normal flow.
Properties
Sources
Currently registered sources in registration order. Stable across visibility toggles; updated on register / dispose.
IReadOnlyList<DynamicSourceRegistrationInfo> Sources { get; }
Property Value
Methods
GetVisible(string)
Returns the current visibility for the source identified by
sourceId. Defaults to true for
unregistered ids so seeding a not-yet-registered id is a no-op that still
round-trips its eventual default.
bool GetVisible(string sourceId)
Parameters
sourceIdstring
Returns
GetVisibleSourceInstances()
Snapshot of currently registered, currently visible source instances, in registration order. Hidden sources are excluded. Returns source instances (rather than the DynamicSourceRegistrationInfo projection) so a pick path can read CurrentFeatures directly.
IReadOnlyList<IDynamicFeatureSource> GetVisibleSourceInstances()
Returns
HitTest(MPoint, double)
Hit-tests every currently-visible source at a geographic click point and
returns the matches ordered by ascending distance (a click inside a
rendered vessel hull reports distance 0). Hidden sources are
excluded, so a click on a hidden target never appears in the result.
IReadOnlyList<DynamicSourceHit> HitTest(MPoint mapPoint, double resolution)
Parameters
mapPointMPointClick position in Spherical Mercator world units.
resolutiondoubleMap units per device pixel at the current zoom.
Returns
- IReadOnlyList<DynamicSourceHit>
Hits ordered by ascending distance from the click (possibly empty).
Register(IDynamicFeatureSource)
Registers a source as a managed overlay layer. The renderer is resolved from the source's RendererKey. The returned IDisposable unregisters the source and detaches its overlay layer when disposed.
IDisposable Register(IDynamicFeatureSource source)
Parameters
sourceIDynamicFeatureSourceThe source to host.
Returns
- IDisposable
A handle that unregisters the source when disposed.
Exceptions
- InvalidOperationException
A source with the same Id is already registered.
SetVisible(string, bool)
Sets the visibility for the source identified by
sourceId. May be called before the source registers
(seeding from persisted settings). Idempotent; fires
SourcesChanged only on a real transition.
void SetVisible(string sourceId, bool visible)
Parameters
Events
SourcesChanged
Raised when Sources changes (register / dispose) or when SetVisible(string, bool) transitions a source's visibility. Raised on the host's map thread through the host's marshal.
event Action? SourcesChanged