Table of Contents

Struct S57LongName

Namespace
EncDotNet.S57
Assembly
EncDotNet.S57.dll

Represents a feature object identifier, the "Long Name" (LNAM) that identifies a feature object and that feature-to-feature pointers use to refer to it (S-57 Part 3, 4.3 and 4.6).

public readonly record struct S57LongName : IEquatable<S57LongName>
Implements
Inherited Members

Remarks

A long name is the feature's producing agency (AGEN), feature identification number (FIDN) and feature identification subdivision (FIDS), from its FOID field. Unlike a record's S57RecordName (RCNM and RCID), it stays the same across editions and updates, which is why FFPT pointers use it as their foreign key.

In the binary implementation an FFPT pointer encodes the long name as a single 64-bit LNAM subfield: AGEN (b12), FIDN (b14) and FIDS (b12), each little-endian (S-57 Part 3, clauses 4.3, 7.2.2.1 and 7.6.6). Use FromLnam(ReadOnlySpan<byte>), ToLnam() and TryWriteLnam(Span<byte>) to convert between the two.

Constructors

S57LongName(ushort, uint, ushort)

Initializes a new instance of the S57LongName struct.

public S57LongName(ushort agencyCode, uint featureId, ushort featureSubdivision)

Parameters

agencyCode ushort

The producing agency (AGEN).

featureId uint

The feature identification number (FIDN).

featureSubdivision ushort

The feature identification subdivision (FIDS).

Fields

LnamLength

The length of a binary LNAM subfield, in bytes.

public const int LnamLength = 8

Field Value

int

Properties

AgencyCode

Gets the producing agency code (AGEN).

public ushort AgencyCode { get; init; }

Property Value

ushort

FeatureId

Gets the feature identification number (FIDN).

public uint FeatureId { get; init; }

Property Value

uint

FeatureSubdivision

Gets the feature identification subdivision (FIDS).

public ushort FeatureSubdivision { get; init; }

Property Value

ushort

Methods

FromLnam(ReadOnlySpan<byte>)

Decodes a long name from a binary LNAM subfield (S-57 Part 3, clause 4.3).

public static S57LongName FromLnam(ReadOnlySpan<byte> lnam)

Parameters

lnam ReadOnlySpan<byte>

The LnamLength bytes of the subfield: AGEN, FIDN and FIDS, each little-endian.

Returns

S57LongName

The long name.

Exceptions

ArgumentException

lnam isn't LnamLength bytes long.

ToLnam()

Encodes the long name as a binary LNAM subfield (S-57 Part 3, clause 4.3).

public byte[] ToLnam()

Returns

byte[]

A new array of LnamLength bytes: AGEN, FIDN and FIDS, each little-endian.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

TryWriteLnam(Span<byte>)

Tries to encode the long name as a binary LNAM subfield (S-57 Part 3, clause 4.3).

public bool TryWriteLnam(Span<byte> destination)

Parameters

destination Span<byte>

The span to write to. The first LnamLength bytes receive AGEN, FIDN and FIDS, each little-endian.

Returns

bool

true when the long name was written; false when destination is shorter than LnamLength bytes, in which case nothing is written.