Skip to content

Conversion

Namespace: ThinkGeo.Core

This static class provides a conversion method to go to and from different units.

public static class Conversion

Inheritance ObjectConversion

Remarks:

None

Methods

ConvertMeasureUnits(Double, DistanceUnit, DistanceUnit)

This method converts from one unit of measure to another.

public static double ConvertMeasureUnits(double amount, DistanceUnit fromUnit, DistanceUnit toUnit)

Parameters

amount Double
The total length size, represented in the unit specified in the fromUnit parameter.

fromUnit DistanceUnit
The unit of measure for the length in the Amount parameter.

toUnit DistanceUnit
The unit of measure for the result.

Returns

Double
The return length size, represented in the unit specified in the toUnit parameter.

Exceptions

ArgumentOutOfRangeException
If you pass in a fromUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a toUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

Remarks:

None

ConvertMeasureUnits(Double, AreaUnit, AreaUnit)

This method converts from one unit of measure to another.

public static double ConvertMeasureUnits(double amount, AreaUnit fromUnit, AreaUnit toUnit)

Parameters

amount Double
The total area size, represented in the unit specified in the fromUnit parameter.

fromUnit AreaUnit
The unit of measure for the area in the Amount parameter.

toUnit AreaUnit
The unit of measure for the result.

Returns

Double
The return area size, represented in the unit specified in the toUnit parameter.

Exceptions

ArgumentOutOfRangeException
If you pass in a fromUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

ArgumentOutOfRangeException
If you pass in a toUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

Remarks:

None

ConvertGeographyUnitToDistanceUnit(GeographyUnit)

This method returns a DistanceUnit that has been converted from a GeographyUnit.

public static DistanceUnit ConvertGeographyUnitToDistanceUnit(GeographyUnit unit)

Parameters

unit GeographyUnit
The GeographyUnit you want to convert.

Returns

DistanceUnit
This method returns a DistanceUnit that has been converted from a GeographyUnit.

Exceptions

ArgumentOutOfRangeException
If you pass in a GeographyUnit that is not defined in the enumeration, it will throw an ArgumentOutOfRangeException.

Remarks:

None

DegreesToRadians(Double)

internal static double DegreesToRadians(double degrees)

Parameters

degrees Double

Returns

Double

ConvertAngleUnits(Double, AngleUnit, AngleUnit)

public static double ConvertAngleUnits(double angle, AngleUnit fromUnit, AngleUnit toUnit)

Parameters

angle Double

fromUnit AngleUnit

toUnit AngleUnit

Returns

Double