Table of Contents

Class AmlDataSet

Namespace
EncDotNet.S57.Aml
Assembly
EncDotNet.S57.dll

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

chart S57Chart

The chart of an AML cell.

Exceptions

ArgumentNullException

chart is null.

ArgumentException

chart has 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

document S57Document

The document of an AML cell.

Remarks

The document is checked before the chart is built.

Exceptions

ArgumentNullException

document is null.

ArgumentException

document has 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

AmlProduct

Catalogue

Gets the object catalogue for the cell's AML edition, chosen by For(S57ProductIdentity).

public S57ObjectCatalogue Catalogue { get; }

Property Value

S57ObjectCatalogue

Chart

Gets the chart this view is over.

public S57Chart Chart { get; }

Property Value

S57Chart

Identification

Gets the data set identification field (DSID).

public S57DataSetIdentification Identification { get; }

Property Value

S57DataSetIdentification

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

AmlDataSetMetadata

Remarks

AML data is classified. Systems that show it should display the cell's protective marking (ProtectiveMarking) prominently wherever its data is shown.

Product

Gets the product identity of the cell. Its Kind is always Aml.

public S57ProductIdentity Product { get; }

Property Value

S57ProductIdentity

Methods

FromFile(string)

Loads an AML cell from a file.

public static AmlDataSet FromFile(string path)

Parameters

path string

The 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

path string

The path to the cell.

cancellationToken CancellationToken

A 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

stream Stream

The 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

stream Stream

The stream holding the cell.

cancellationToken CancellationToken

A 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

value S57AttributeValue

The 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

feature S57TypedFeature

The feature.

Returns

IReadOnlyList<AmlAttributeValue>

One entry for each of the feature's Attributes, in order.

Exceptions

ArgumentNullException

feature is null.

GetNationalAttributes(S57TypedFeature)

Gets a feature's national attribute values (NATF) with their catalogue definitions.

public IReadOnlyList<AmlAttributeValue> GetNationalAttributes(S57TypedFeature feature)

Parameters

feature S57TypedFeature

The feature.

Returns

IReadOnlyList<AmlAttributeValue>

One entry for each of the feature's NationalAttributes, in order.

Exceptions

ArgumentNullException

feature is null.

GetObjectClass(S57TypedFeature)

Gets the catalogue definition of a feature's object class.

public S57ObjectClassDefinition? GetObjectClass(S57TypedFeature feature)

Parameters

feature S57TypedFeature

The feature.

Returns

S57ObjectClassDefinition

The object class with the feature's ObjectCode in Catalogue, or null when the catalogue has none.

Exceptions

ArgumentNullException

feature is 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

chart S57Chart

The chart.

dataSet AmlDataSet

When this method returns true, the view over chart; otherwise, null.

Returns

bool

true if chart is an AML cell; otherwise, false.

Exceptions

ArgumentNullException

chart is 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

document S57Document

The document.

dataSet AmlDataSet

When this method returns true, the view over the chart built from document; otherwise, null.

Returns

bool

true if document is an AML cell; otherwise, false. The chart is built only when it is.

Exceptions

ArgumentNullException

document is null.