Struct Depth
- Namespace
- EncDotNet.S100.Quantities
- Assembly
- EncDotNet.S100.Core.dll
A depth: a vertical Length measured from a vertical datum, stored canonically in metres.
public readonly record struct Depth : IComparable<Depth>, IEquatable<Depth>
- Implements
- Inherited Members
Remarks
Depth is a specialization of Length for the core hydrographic concept of a sounding. It carries the same unit-independent, value-semantics design as Length and adds depth-specific conveniences (fathom-and-feet decomposition via TotalFathoms/TotalFeet). Positive values are below the datum; negative values (drying heights) are permitted and their sign is preserved.
A Depth converts implicitly to its underlying Length so it can participate in generic distance arithmetic, while remaining a distinct type at API boundaries where the hydrographic meaning matters (safety contour, safety depth, contour value).
Properties
TotalFathoms
The depth expressed in fathoms.
public double TotalFathoms { get; }
Property Value
TotalFeet
The depth expressed in international feet.
public double TotalFeet { get; }
Property Value
TotalMetres
The depth expressed in metres (the canonical unit).
public double TotalMetres { get; }
Property Value
Zero
A zero depth (at the datum). Equal to default(Depth).
public static Depth Zero { get; }
Property Value
Methods
Abs()
Returns the absolute (non-negative) magnitude of this depth.
public Depth Abs()
Returns
AsLength()
The underlying vertical Length.
public Length AsLength()
Returns
CompareTo(Depth)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(Depth other)
Parameters
otherDepthAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
FromFathoms(double)
Creates a depth from a value in fathoms.
public static Depth FromFathoms(double fathoms)
Parameters
fathomsdouble
Returns
FromFeet(double)
Creates a depth from a value in international feet.
public static Depth FromFeet(double feet)
Parameters
feetdouble
Returns
FromLength(Length)
Creates a depth from an existing Length.
public static Depth FromLength(Length length)
Parameters
lengthLength
Returns
FromMetres(double)
Creates a depth from a value in metres.
public static Depth FromMetres(double metres)
Parameters
metresdouble
Returns
ToString()
Returns an invariant-culture string of the form "12.5 m" for
diagnostic purposes. User-facing presentation should go through a
dedicated formatter.
public override string ToString()
Returns
Operators
operator >(Depth, Depth)
Indicates whether one depth is deeper than another.
public static bool operator >(Depth a, Depth b)
Parameters
Returns
operator >=(Depth, Depth)
Indicates whether one depth is deeper than or equal to another.
public static bool operator >=(Depth a, Depth b)
Parameters
Returns
implicit operator Length(Depth)
Converts a depth to its underlying vertical Length.
public static implicit operator Length(Depth depth)
Parameters
depthDepth
Returns
operator <(Depth, Depth)
Indicates whether one depth is shallower than another.
public static bool operator <(Depth a, Depth b)
Parameters
Returns
operator <=(Depth, Depth)
Indicates whether one depth is shallower than or equal to another.
public static bool operator <=(Depth a, Depth b)