Class ProductRegistry
A mutable, product-agnostic map of canonical spec string
(e.g. "S-101", "GRIB2") to the ProductRegistration
that knows how to recognise, construct and describe that product.
DatasetPipelineFactory resolves against a registry instead of a
hard-coded switch, and hosts read product traits
(IsS100,
Portrayal, the default S-98 planes…) from
it rather than switching on spec names, so a host can enable a subset of
products — e.g. an S-101-only viewer — or add its own without changing.
Use AddAllS100Products(ProductRegistry) for the
batteries-included set.
public sealed class ProductRegistry : IProductPlaneTable
- Inheritance
-
ProductRegistry
- Implements
- Inherited Members
- Extension Methods
Remarks
Default is the process-wide registry the static conveniences (DetectProductSpec(string), a factory built without a registry, LoadedDatasetProjector, the viewer and the MCP tools) consult. A host that adds a product registers it there once at start-up.
The registry is safe to read and register on from several threads.
Constructors
ProductRegistry()
Creates an empty registry.
public ProductRegistry()
Properties
Default
The process-wide registry, pre-loaded with every built-in product (All). Hosts that don't take a registry of their own read this one, so a product registered here is detected, loaded and described everywhere.
public static ProductRegistry Default { get; }
Property Value
DisplayPlanes
The default-plane authority over this registry's DefaultPlanes: an unregistered product, or a layer kind the product gives no plane, lands on OtherChartOverlays.
public IDisplayPlaneAuthority DisplayPlanes { get; }
Property Value
RegisteredSpecs
The registered spec keys (canonical where recognized).
public IReadOnlyCollection<string> RegisteredSpecs { get; }
Property Value
Registrations
The registered product registrations, in registration order. Used by DatasetPipelineFactory to run each product's own content recognizers (MatchGml and its siblings) rather than a central per-product switch. A snapshot: registering while enumerating is safe.
public IReadOnlyCollection<ProductRegistration> Registrations { get; }
Property Value
Methods
IsRegistered(string)
Whether a product is registered for spec.
public bool IsRegistered(string spec)
Parameters
specstring
Returns
IsS100(string?)
Whether spec is an S-100 product
(IsS100). An unregistered or blank spec
counts as S-100 unless it is one of the non-S-100 format names
SpecName accepts (GRIB2, NetCDF, CAP).
public bool IsS100(string? spec)
Parameters
specstring
Returns
PortrayalOf(string?)
public PortrayalBasis PortrayalOf(string? spec)
Parameters
specstring
Returns
PortrayalSpecFor(SpecRef)
Returns the portrayal specification for product: the
registration's PortrayalSpec (edition
unspecified) when it names one — "S-101" for legacy S-57 —
otherwise product unchanged. Prefer
PortrayalSpec when a processor is at hand;
use this where a caller has only the product spec.
public SpecRef PortrayalSpecFor(SpecRef product)
Parameters
productSpecRefThe dataset's declared product specification.
Returns
PortrayalSpecName(string)
String overload of PortrayalSpecFor(SpecRef) for callers
that hold only the canonical product-spec code (e.g. the viewer's
DatasetEntry.ProductSpec): maps "S-57" to "S-101"
and returns every other code unchanged.
public string PortrayalSpecName(string productSpecName)
Parameters
productSpecNamestringThe canonical product-spec code.
Returns
Register(ProductRegistration)
Registers (or replaces, by normalized Spec)
a product. The spec is canonicalized on the way in (e.g. "S101" →
"S-101") so a registration made under a non-canonical identifier is
still resolvable by the canonical spec that DatasetPipelineFactory
detection produces.
public void Register(ProductRegistration registration)
Parameters
registrationProductRegistration
Resolve(string)
Resolves the registration for spec, throwing
NotSupportedException when none is registered.
public ProductRegistration Resolve(string spec)
Parameters
specstring
Returns
TryResolve(string, out ProductRegistration?)
Looks up the registration for spec.
public bool TryResolve(string spec, out ProductRegistration? registration)
Parameters
specstringregistrationProductRegistration
Returns
Unregister(string)
Removes the registration for spec, returning whether
one was registered.
public bool Unregister(string spec)
Parameters
specstring