Struct LinearDistance
Allows the use of different types of linear measurement units
Implements
Namespace: FpAssistantCore.General
Assembly: FpAssistantCoreScl.dll
Syntax
public struct LinearDistance
Remarks
This covers both distances along the surface of the earth as well as altitude or vertical distances
Constructors
View SourceLinearDistance(Double, LinearDistanceUnits)
Constructor to initialise with a specific value and unit type
Declaration
public LinearDistance(double value, LinearDistanceUnits valueUnit)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | |
LinearDistanceUnits | valueUnit |
Remarks
[JsonConstructor] : Parameter names must match property names so that [JsonConstructor] attribute on this constructor can be called
See Also
View SourceLinearDistance(Double, AltitudeUnits)
Constructor to initialise with a specific value and altitude unit type
Declaration
public LinearDistance(double linearDistanceValue, AltitudeUnits altitudeUnit)
Parameters
Type | Name | Description |
---|---|---|
System.Double | linearDistanceValue | Numerical value of the distance |
AltitudeUnits | altitudeUnit | Unit type of the distance from an AltitudeUnit enum |
See Also
View SourceLinearDistance(Double, CoordinateSystemUnits)
Constructor to initialise with a specific value and coordinate system unit type
Declaration
public LinearDistance(double linearDistanceValue, CoordinateSystemUnits coordinateSystemUnits)
Parameters
Type | Name | Description |
---|---|---|
System.Double | linearDistanceValue | Numerical value of the distance |
CoordinateSystemUnits | coordinateSystemUnits | Unit type of the distance from an CoordinateSystemUnits enum |
See Also
View SourceLinearDistance(String)
Constructor to initialise with a specific value and unit type as a string
Declaration
public LinearDistance(string linearDistanceValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | linearDistanceValue | String value of the distance |
Remarks
Postfix text for string can be: km k kilometres kilometre kilometres kilometre
m metres metre meter metre mt
f feet ft
nm n naut nautical
Examples
LinearDistance ld = new LinearDistance("100m");
Properties
View SourceIsSi
Determine if declaration is an SI or Non-SI unit type
Declaration
public readonly bool IsSi { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True is a SI unit, otherwise False |
Remarks
SI Units: Kilometres and Metres
Non-SI Units: Nautical Miles and Feet
Examples
LinearDistance ld1KM = new LinearDistance(1.00, LinearDistanceUnits.KM);
if ( ld1KM.IsSi == true ) { }
View Source
Value
Contains the numerical value of the distance
Declaration
public double Value { get; set; }
Property Value
Type | Description |
---|---|
System.Double | Numerical value of the distance |
ValueUnit
The type of measurement unit of the distance value
Declaration
public readonly LinearDistanceUnits ValueUnit { get; }
Property Value
Type | Description |
---|---|
LinearDistanceUnits | Enum value of the assigned unit |
Remarks
Changing of the unit is not permitted
Methods
View SourceAdd(LinearDistance, LinearDistance)
ADD of two LinearDistance objects
Declaration
public static LinearDistance Add(LinearDistance left, LinearDistance right)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | left | |
LinearDistance | right |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
AsAltitude()
Converts the current object to Altitude object
Declaration
public Altitude AsAltitude()
Returns
Type | Description |
---|---|
Altitude | Altitude object |
Remarks
Will convert KM to Metres and NM to Feet as these units are not allowed in Altitude object
ConvertTo(LinearDistanceUnits)
Converts the current object to another type of unit
Declaration
public LinearDistance ConvertTo(LinearDistanceUnits linearDistanceUnit_ConvertTo)
Parameters
Type | Name | Description |
---|---|---|
LinearDistanceUnits | linearDistanceUnit_ConvertTo | The unit to convert the current distance to |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object with request measurement unit |
ConvertTo(CriteriaUnits)
Converts the current object to another type of unit
Declaration
public LinearDistance ConvertTo(CriteriaUnits criteriaUnit)
Parameters
Type | Name | Description |
---|---|---|
CriteriaUnits | criteriaUnit | Type of unit required |
Returns
Type | Description |
---|---|
LinearDistance | Distance converted to unit |
Remarks
Will convert between feet and metres | NM and KM only based on the SI or Non-SI unit value
See Also
View SourceConvertTo(CoordinateSystemUnits)
Converts the current object to another type of unit
Declaration
public LinearDistance ConvertTo(CoordinateSystemUnits CoordinateSystemUnitConvertTo)
Parameters
Type | Name | Description |
---|---|---|
CoordinateSystemUnits | CoordinateSystemUnitConvertTo |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object with request measurement unit |
See Also
View SourceDivide(LinearDistance, LinearDistance)
Operator division of two LinearDistance objects
Declaration
public static LinearDistance Divide(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand of the addition |
LinearDistance | linearDistance2 | Second operand of the addition |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
Equals(LinearDistance)
Declaration
public bool Equals(LinearDistance other)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
FeetToMetres(Double)
Convert Feet to Metres
Declaration
public static double FeetToMetres(double feet)
Parameters
Type | Name | Description |
---|---|---|
System.Double | feet | Feet value |
Returns
Type | Description |
---|---|
System.Double | Metres value |
FeetToNM(Double)
Convert Feet to NM
Declaration
public static double FeetToNM(double feet)
Parameters
Type | Name | Description |
---|---|---|
System.Double | feet | Feet value |
Returns
Type | Description |
---|---|
System.Double | NM value |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
MetresToFeet(Double)
Convert Metres to Feet
Declaration
public static double MetresToFeet(double metres)
Parameters
Type | Name | Description |
---|---|---|
System.Double | metres | Metres value |
Returns
Type | Description |
---|---|
System.Double | Feet value |
MetresToNM(Double)
Convert Metres to NM
Declaration
public static double MetresToNM(double metres)
Parameters
Type | Name | Description |
---|---|---|
System.Double | metres | Metres value |
Returns
Type | Description |
---|---|
System.Double | NM value |
Multiply(LinearDistance, LinearDistance)
Multiply of two LinearDistance objects
Declaration
public static LinearDistance Multiply(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand of the multiplication |
LinearDistance | linearDistance2 | Second operand of the multiplication |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of multiplication |
NMToFeet(Double)
Convert NM to Feet
Declaration
public static double NMToFeet(double nm)
Parameters
Type | Name | Description |
---|---|---|
System.Double | nm | NM value |
Returns
Type | Description |
---|---|
System.Double | NM value |
NMToMetres(Double)
Convert NM to Metres
Declaration
public static double NMToMetres(double nm)
Parameters
Type | Name | Description |
---|---|---|
System.Double | nm | NM value |
Returns
Type | Description |
---|---|
System.Double | NM value |
PrecisionFeet(Int32)
Set precision for Feet in .ToString()
Declaration
public void PrecisionFeet(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value |
PrecisionKilometres(Int32)
Set precision for Kilometres used in .ToString()
Declaration
public void PrecisionKilometres(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value |
PrecisionMetres(Int32)
Set precision for Metres in .ToString()
Declaration
public void PrecisionMetres(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value |
PrecisionNauticalMiles(Int32)
Set precision for Nautical Miles used in .ToString()
Declaration
public void PrecisionNauticalMiles(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value |
Subtract(LinearDistance, LinearDistance)
Subtract of two LinearDistance objects
Declaration
public static LinearDistance Subtract(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand |
LinearDistance | linearDistance2 | Second operand |
Returns
Type | Description |
---|---|
LinearDistance | Value of subtraction in units of first operand |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
ToString(LinearDistanceFormat)
Declaration
public string ToString(LinearDistanceFormat linearDistanceFormat)
Parameters
Type | Name | Description |
---|---|---|
LinearDistanceFormat | linearDistanceFormat |
Returns
Type | Description |
---|---|
System.String |
ToString(IFormatProvider, LinearDistanceFormat)
Declaration
public string ToString(IFormatProvider provider, LinearDistanceFormat linearDistanceFormat)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | provider | |
LinearDistanceFormat | linearDistanceFormat |
Returns
Type | Description |
---|---|
System.String |
ZeroMetres()
0 Metres
Declaration
public static LinearDistance ZeroMetres()
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance instance set to 0 Metres |
Operators
View SourceAddition(LinearDistance, LinearDistance)
Operator addition of two LinearDistance objects
Declaration
public static LinearDistance operator +(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand of the addition |
LinearDistance | linearDistance2 | Second operand of the addition |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
Addition(LinearDistance, Double)
Operator addition of a LinearDistance and an double data types
Declaration
public static LinearDistance operator +(LinearDistance linearDistance, double distance)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance | First operand of the addition |
System.Double | distance | Value of distance, second operand |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
Addition(LinearDistance, Int32)
Operator addition of a LinearDistance and an int data types
Declaration
public static LinearDistance operator +(LinearDistance linearDistance, int distance)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance | First operand of the addition |
System.Int32 | distance | Value of distance, second operand |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
Division(LinearDistance, LinearDistance)
Operator division of two LinearDistance objects
Declaration
public static LinearDistance operator /(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand of the addition |
LinearDistance | linearDistance2 | Second operand of the addition |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
Division(LinearDistance, Double)
Operator division of a LinearDistance object and double
Declaration
public static LinearDistance operator /(LinearDistance linearDistance, double distance)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance | |
System.Double | distance | Second operand of the addition |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
Division(LinearDistance, Int32)
Operator division of a LinearDistance object and int
Declaration
public static LinearDistance operator /(LinearDistance linearDistance, int distance)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance | |
System.Int32 | distance | Second operand of the addition |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of addition |
Equality(LinearDistance, LinearDistance)
Declaration
public static bool operator ==(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | |
LinearDistance | linearDistance2 |
Returns
Type | Description |
---|---|
System.Boolean |
Explicit(Altitude to LinearDistance)
Operator explicit cast from Altitude type
Declaration
public static explicit operator LinearDistance(Altitude altitude)
Parameters
Type | Name | Description |
---|---|---|
Altitude | altitude |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object with same values of altitude object |
Examples
Altitude altitudeFeet = new Altitude(123, AltitudeUnits.Feet);
LinearDistance linearDistanceFeet = (LinearDistance)altitudeFeet;
View Source
GreaterThan(LinearDistance, LinearDistance)
Operator > of two LinearDistance objects
Declaration
public static bool operator>(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand |
LinearDistance | linearDistance2 | Second operand |
Returns
Type | Description |
---|---|
System.Boolean | True if linearDistance1 greater than linearDistance2 |
Inequality(LinearDistance, LinearDistance)
Declaration
public static bool operator !=(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | |
LinearDistance | linearDistance2 |
Returns
Type | Description |
---|---|
System.Boolean |
LessThan(LinearDistance, LinearDistance)
Declaration
public static bool operator <(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | |
LinearDistance | linearDistance2 |
Returns
Type | Description |
---|---|
System.Boolean |
Multiply(LinearDistance, LinearDistance)
Operator multiplication of two LinearDistance objects
Declaration
public static LinearDistance operator *(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand of the multiplication |
LinearDistance | linearDistance2 | Second operand of the multiplication |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of multiplication |
Multiply(LinearDistance, Double)
Operator multiplication of a LinearDistance object and double
Declaration
public static LinearDistance operator *(LinearDistance linearDistance, double distance)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance | |
System.Double | distance | Second operand of the multiplication |
Returns
Type | Description |
---|---|
LinearDistance | LinearDistance object of multiplication |
Subtraction(LinearDistance, LinearDistance)
Operator Subtraction of two LinearDistance objects
Declaration
public static LinearDistance operator -(LinearDistance linearDistance1, LinearDistance linearDistance2)
Parameters
Type | Name | Description |
---|---|---|
LinearDistance | linearDistance1 | First operand |
LinearDistance | linearDistance2 | Second operand |
Returns
Type | Description |
---|---|
LinearDistance | Value of Subtraction in units of first operand |