Table of Contents

Class DepthFormatting

Namespace
EncDotNet.S100.Pipelines
Assembly
EncDotNet.S100.Core.dll

Locale-invariant conversion, formatting and parsing for depth values expressed in DepthUnit. Canonical storage is always metres; these helpers exist purely for user-facing presentation in the viewer (settings inputs, Pick panel, S-102 legend, status bar).

public static class DepthFormatting
Inheritance
DepthFormatting
Inherited Members

Remarks

Unit conversions are delegated to Depth/Length, which use the exact international foot (1 ft = 0.3048 m) and fathom (1 fathom = 6 ft = 1.8288 m). This type adds only the string formatting/parsing (including the combined fathoms-and-feet form) that the viewer needs.

Fields

FathomsPerMetre

Fathoms per metre.

public const double FathomsPerMetre = 0.5468066491688539

Field Value

double

FeetPerFathom

Feet per fathom.

public const double FeetPerFathom = 6

Field Value

double

FeetPerMetre

Feet per metre (international foot).

public const double FeetPerMetre = 3.280839895013123

Field Value

double

Methods

Format(double, DepthUnit, int?)

Formats metres in unit using invariant culture. FathomsFeet renders as "<fathoms>fm <feet>ft" (e.g. "5fm 2ft").

public static string Format(double metres, DepthUnit unit, int? decimals = null)

Parameters

metres double

Depth in metres.

unit DepthUnit

Display unit.

decimals int?

Number of decimal places. Defaults: 1 for metres/fathoms/feet, 0 for fathoms-and-feet (always rendered as whole feet remainder).

Returns

string

ToDisplay(double, DepthUnit)

Converts a depth value from canonical metres to the supplied display unit.

public static double ToDisplay(double metres, DepthUnit unit)

Parameters

metres double
unit DepthUnit

Returns

double

ToMetres(double, DepthUnit)

Converts a display value back to canonical metres.

public static double ToMetres(double display, DepthUnit unit)

Parameters

display double
unit DepthUnit

Returns

double

Remarks

For FathomsFeet the input is interpreted as a total in feet (the same convention as ToDisplay(double, DepthUnit)).

TryParse(string, DepthUnit, out double)

Parses text in unit back to metres using invariant culture. Returns true on success.

public static bool TryParse(string text, DepthUnit unit, out double metres)

Parameters

text string
unit DepthUnit
metres double

Returns

bool

Remarks

Accepted forms:

  • Bare number ("30", "30.5") — interpreted in unit.
  • Number with matching unit suffix ("30 m", "100ft", "5 fm").
  • For FathomsFeet: "5fm 2ft", "5 fm", "12 ft", or a bare number (treated as feet).

UnitAbbreviation(DepthUnit)

Returns the short abbreviation used for unit in formatted strings ("m", "ft", "fm", "fm/ft").

public static string UnitAbbreviation(DepthUnit unit)

Parameters

unit DepthUnit

Returns

string