Struct S57LongName
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
agencyCodeushortThe producing agency (AGEN).
featureIduintThe feature identification number (FIDN).
featureSubdivisionushortThe feature identification subdivision (FIDS).
Fields
LnamLength
The length of a binary LNAM subfield, in bytes.
public const int LnamLength = 8
Field Value
Properties
AgencyCode
Gets the producing agency code (AGEN).
public ushort AgencyCode { get; init; }
Property Value
FeatureId
Gets the feature identification number (FIDN).
public uint FeatureId { get; init; }
Property Value
FeatureSubdivision
Gets the feature identification subdivision (FIDS).
public ushort FeatureSubdivision { get; init; }
Property Value
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
lnamReadOnlySpan<byte>The LnamLength bytes of the subfield: AGEN, FIDN and FIDS, each little-endian.
Returns
- S57LongName
The long name.
Exceptions
- ArgumentException
lnamisn'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
destinationSpan<byte>The span to write to. The first LnamLength bytes receive AGEN, FIDN and FIDS, each little-endian.
Returns
- bool
truewhen the long name was written;falsewhendestinationis shorter than LnamLength bytes, in which case nothing is written.