Class AmlDataSet
Represents a NATO Additional Military Layers (AML) cell: an S57Chart together with its AML product, its structured metadata and the object catalogue that gives its codes their meaning.
public sealed class AmlDataSet
- Inheritance
-
AmlDataSet
- Inherited Members
Remarks
An AML cell is an S-57 data set whose product specification (DSID PRSP) is one of
the AML codes 51-57, so S57DocumentReader and S57Chart read it as
they read any other cell. This type is a view over that chart: it doesn't copy its features or
spatial records.
Create it from a chart or a document, or load it with FromFile(string) or FromStream(Stream). Creating it from a data set that isn't an AML cell throws ArgumentException; use TryCreate(S57Chart, out AmlDataSet?) to test first.
Constructors
AmlDataSet(S57Chart)
Initializes a new instance of the AmlDataSet class over a chart.
public AmlDataSet(S57Chart chart)
Parameters
chartS57ChartThe chart of an AML cell.
Exceptions
- ArgumentNullException
chartis null.- ArgumentException
charthas no data set identification, or its product isn't Aml.
AmlDataSet(S57Document)
Initializes a new instance of the AmlDataSet class over the chart built from a document.
public AmlDataSet(S57Document document)
Parameters
documentS57DocumentThe document of an AML cell.
Remarks
The document is checked before the chart is built.
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
documenthas no data set identification, or its product isn't Aml.
Properties
AmlProduct
Gets the AML product the cell belongs to, from DSID PRSP.
public AmlProduct AmlProduct { get; }
Property Value
Catalogue
Gets the object catalogue for the cell's AML edition, chosen by For(S57ProductIdentity).
public S57ObjectCatalogue Catalogue { get; }
Property Value
Chart
Gets the chart this view is over.
public S57Chart Chart { get; }
Property Value
Identification
Gets the data set identification field (DSID).
public S57DataSetIdentification Identification { get; }
Property Value
Metadata
Gets the structured metadata from the DSID comment (COMT), or
null when the comment is empty or isn't a list of AML key=value pairs.
public AmlDataSetMetadata? Metadata { get; }
Property Value
Remarks
AML data is classified. Systems that show it should display the cell's protective marking (ProtectiveMarking) prominently wherever its data is shown.
Product
public S57ProductIdentity Product { get; }
Property Value
Methods
FromFile(string)
Loads an AML cell from a file.
public static AmlDataSet FromFile(string path)
Parameters
pathstringThe path to the cell.
Returns
- AmlDataSet
The AML cell.
Exceptions
- ArgumentException
The file isn't an AML cell.
FromFileAsync(string, CancellationToken)
Asynchronously loads an AML cell from a file.
public static Task<AmlDataSet> FromFileAsync(string path, CancellationToken cancellationToken = default)
Parameters
pathstringThe path to the cell.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<AmlDataSet>
A task whose result is the AML cell.
Exceptions
- ArgumentException
The file isn't an AML cell.
FromStream(Stream)
Loads an AML cell from a stream.
public static AmlDataSet FromStream(Stream stream)
Parameters
streamStreamThe stream holding the cell.
Returns
- AmlDataSet
The AML cell.
Exceptions
- ArgumentException
The stream doesn't hold an AML cell.
FromStreamAsync(Stream, CancellationToken)
Asynchronously loads an AML cell from a stream.
public static Task<AmlDataSet> FromStreamAsync(Stream stream, CancellationToken cancellationToken = default)
Parameters
streamStreamThe stream holding the cell.
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task<AmlDataSet>
A task whose result is the AML cell.
Exceptions
- ArgumentException
The stream doesn't hold an AML cell.
GetAttribute(S57AttributeValue)
Gets the catalogue definition of an attribute value's attribute.
public S57AttributeDefinition? GetAttribute(S57AttributeValue value)
Parameters
valueS57AttributeValueThe attribute value.
Returns
- S57AttributeDefinition
The attribute with the value's AttributeCode in Catalogue, or null when the catalogue has none.
GetAttributes(S57TypedFeature)
Gets a feature's attribute values (ATTF) with their catalogue definitions.
public IReadOnlyList<AmlAttributeValue> GetAttributes(S57TypedFeature feature)
Parameters
featureS57TypedFeatureThe feature.
Returns
- IReadOnlyList<AmlAttributeValue>
One entry for each of the feature's Attributes, in order.
Exceptions
- ArgumentNullException
featureis null.
GetNationalAttributes(S57TypedFeature)
Gets a feature's national attribute values (NATF) with their catalogue definitions.
public IReadOnlyList<AmlAttributeValue> GetNationalAttributes(S57TypedFeature feature)
Parameters
featureS57TypedFeatureThe feature.
Returns
- IReadOnlyList<AmlAttributeValue>
One entry for each of the feature's NationalAttributes, in order.
Exceptions
- ArgumentNullException
featureis null.
GetObjectClass(S57TypedFeature)
Gets the catalogue definition of a feature's object class.
public S57ObjectClassDefinition? GetObjectClass(S57TypedFeature feature)
Parameters
featureS57TypedFeatureThe feature.
Returns
- S57ObjectClassDefinition
The object class with the feature's ObjectCode in Catalogue, or null when the catalogue has none.
Exceptions
- ArgumentNullException
featureis null.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryCreate(S57Chart, out AmlDataSet?)
Tries to create a view over a chart.
public static bool TryCreate(S57Chart chart, out AmlDataSet? dataSet)
Parameters
chartS57ChartThe chart.
dataSetAmlDataSetWhen this method returns true, the view over
chart; otherwise, null.
Returns
Exceptions
- ArgumentNullException
chartis null.
TryCreate(S57Document, out AmlDataSet?)
Tries to create a view over the chart built from a document.
public static bool TryCreate(S57Document document, out AmlDataSet? dataSet)
Parameters
documentS57DocumentThe document.
dataSetAmlDataSetWhen this method returns true, the view over the chart built from
document; otherwise, null.
Returns
Exceptions
- ArgumentNullException
documentis null.