Class ProductRegistration
Registers one product with a ProductRegistry: the canonical
spec string it handles (e.g. "S-101", or a non-S-100 format name
such as "GRIB2"), the two ways to construct its processor (from a
file path, and from an IAssetSource), how
to recognise its files, and the product traits hosts need to treat it
correctly. The traits replace the switches on spec names that used to
be spread across the hosts (metadata reading, catalog projection, default
S-98 planes, portrayal labelling), so a new product is one registration plus
one processor and the hosts don't change.
public sealed record ProductRegistration : IEquatable<ProductRegistration>
- Inheritance
-
ProductRegistration
- Implements
- Inherited Members
Remarks
The registration lives where the product's types are visible (the built-in ones in S100Products), so the delegates (ReadMetadata, OpenData, the matchers) close over the product's own readers and the hosts only ever see the delegates.
Fields
AnyLayerKind
The DefaultPlanes key that applies to every layer kind without an entry of its own.
public const string AnyLayerKind = "*"
Field Value
Properties
CreateFromPath
Constructs the product's processor from a local file path.
public required DatasetProcessorFromPath CreateFromPath { get; init; }
Property Value
CreateFromSource
Constructs the product's processor from an asset source.
public required DatasetProcessorFromSource CreateFromSource { get; init; }
Property Value
DefaultPlanes
The default S-98 display plane for each layer kind the product emits, keyed by layer kind (case-insensitive), with AnyLayerKind for every other kind. Only the fallback for callers that ask the IDisplayPlaneAuthority without a sub-layer in hand: sub-layers carry their own plane. Empty (the default) puts the product on OtherChartOverlays.
public IReadOnlyDictionary<string, S98DisplayPlane> DefaultPlanes { get; init; }
Property Value
IsS100
Whether the product is an IHO S-100 product (or legacy S-57). Hosts label a product that isn't — a weather model grid, say — as "Not an S-100 product" and warn that it isn't for navigation (see PickReportNotice). Defaults to true.
public bool IsS100 { get; init; }
Property Value
MatchBytes
Optional recognizer from the file's leading bytes and extension, for a
format with a signature of its own (GRIB2's GRIB, NetCDF-3's
CDF\x01). DatasetPipelineFactory consults it for
every file no envelope matcher claimed, including files whose extension
says nothing (a NOMADS GRIB filter download), so a matcher must check the
signature rather than trust the extension.
public DatasetBytesMatcher? MatchBytes { get; init; }
Property Value
MatchFolder
Optional recognizer for a folder that is one dataset: given a folder's path, decides whether the product reads the folder as a whole (a weather model run published one GRIB2 file per forecast hour, #1075). A product whose processors take a folder path sets it; DatasetPipelineFactory offers every folder to it, and CreateFromPath and ReadMetadata then get the folder's path. null for every other product.
public Func<string, bool>? MatchFolder { get; init; }
Property Value
MatchGml
Optional recognizer for a GML-encoded product: given the parsed root of a
.gml document, decides whether the document belongs to this
product. This is what inverts the former central GML namespace
switch in DatasetPipelineFactory into data, so a new
GML product is recognized in the same place it is constructed. It is
null for non-GML products (S-101/S-57 ISO 8211,
S-102/S-104/S-111 HDF5), whose extension or header identifies them
instead. DatasetPipelineFactory reads the document root once
and returns the spec of the first registered product whose matcher claims
it.
public DatasetGmlMatcher? MatchGml { get; init; }
Property Value
MatchHdf5
Optional recognizer for an HDF5-encoded product: given the root group of
an HDF5 file (its productSpecification attribute, and any other
root attribute it wants to read), decides whether the file belongs to
this product. The HDF5 sibling of MatchIso8211 and
MatchGml: S-102, S-104 and S-111 each claim the files that
declare them, and an HDF5 file nobody claims is unknown.
public DatasetHdf5Matcher? MatchHdf5 { get; init; }
Property Value
MatchIso8211
Optional recognizer for an ISO 8211-encoded product: given the parsed
envelope of a .000 dataset, decides whether the file belongs to
this product. The .000 extension is shared by legacy S-57, S-101,
and S-401 (inland ENC), so the extension alone cannot route the file.
This inverts the former central S-57-vs-S-101 sniff in
DatasetPipelineFactory into data, so a new ISO 8211 product
is recognized in the same place it is constructed — the ISO 8211 sibling
of MatchGml. It is null for products whose
extension already identifies them. DatasetPipelineFactory
reads the envelope once and returns the spec of the first registered
product whose matcher claims it, so a host that omits S-57 never
misroutes a cell to a product it cannot build.
public DatasetIso8211Matcher? MatchIso8211 { get; init; }
Property Value
OpenData
Optional opener for the product's typed catalog payload, used by LoadedDatasetProjector to project a dataset's bytes into a LoadedDataset. null for a product with no catalog projection; a product whose payload isn't one of the built-in LoadedDatasetData variants returns a ProductDatasetData.
public DatasetDataOpener? OpenData { get; init; }
Property Value
PickReportNotice
The first line of a pick report for one of the product's features, when the product needs one; e.g. a weather model's "Weather model data, not for navigation.". null (the default) lets the host choose: the viewer shows its own localised "Weather model data, not for navigation." for a product that isn't IsS100, and nothing for an S-100 product.
public string? PickReportNotice { get; init; }
Property Value
Portrayal
What the product is drawn from: an S-100 portrayal catalogue (Catalogue, the default), or a portrayal this library defines in code because the specification defines none (Application(string), e.g. S-104 Ed 2.0.0). Hosts label an application portrayal wherever they describe the portrayal.
public PortrayalBasis Portrayal { get; init; }
Property Value
PortrayalSpec
The specification whose Feature Catalogue, Portrayal Catalogue and ECDIS
display conventions apply to the product, when it isn't the product's
own: "S-101" for legacy S-57, which is translated in memory and
drawn through the S-101 catalogue. null (the default)
means the product's own Spec.
public string? PortrayalSpec { get; init; }
Property Value
ReadMetadata
Optional cheap metadata reader: given a dataset path, returns its DatasetMetadata (declared spec, extent, CRS, time) without a full parse. The viewer's Library uses it to index loose datasets; a product without one can't be indexed without loading it. It may throw on an unreadable file; callers treat that as "not available".
public Func<string, DatasetMetadata>? ReadMetadata { get; init; }
Property Value
Spec
The canonical product-specification string (e.g. "S-101").
public required string Spec { get; init; }
Property Value
Methods
DefaultPlaneFor(string?)
Returns the default plane for layerKind from
DefaultPlanes: its own entry, else the
AnyLayerKind entry, else null.
public S98DisplayPlane? DefaultPlaneFor(string? layerKind)