Table of Contents

Struct DegreesMinutesSeconds

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This structure represents a degrees, minutes and seconds value.

public struct DegreesMinutesSeconds
Inherited Members

Remarks

This structure is used in many places to represent decimal degree numbers as degrees, minutes and seconds.

Constructors

DegreesMinutesSeconds(int, int, double)

This constructor allows you to create an instance of the class by specifying the degree, minute and second values.

public DegreesMinutesSeconds(int degrees, int minutes, double seconds)

Parameters

degrees int

This parameter represents the degree portion of the structure.

minutes int

This parameter represents the minute portion of the structure.

seconds double

This parameter represents the second portion of the structure.

Remarks

None

Properties

Degrees

This property returns the degrees portion of the structure.

public int Degrees { get; set; }

Property Value

int

Remarks

None

Minutes

This property returns the minutes portion of the structure.

public int Minutes { get; set; }

Property Value

int

Remarks

None

Seconds

This property returns the seconds portion of the structure.

public double Seconds { get; set; }

Property Value

double

Remarks

None

Methods

Add(DegreesMinutesSeconds)

Add two DegreesMinutsSeconds together and return back a summary of the two.

public DegreesMinutesSeconds Add(DegreesMinutesSeconds targetDegreesMinutesSeconds)

Parameters

targetDegreesMinutesSeconds DegreesMinutesSeconds

The target DegreesMinutesSeconds to be added together.

Returns

DegreesMinutesSeconds

The summary of the two DegreesMinutesSeconds.

Examples

DegreesMinutesSeconds dms1 = new DegreesMinutesSeconds(15, 21, 19.1);
DegreesMinutesSeconds dms2 = new DegreesMinutesSeconds(12, 43, 12);

DegreesMinutesSeconds dms3 = dms1.Add(dms2);
// The return value should be:28d 4' 31.1''
Dim dms1 As New DegreesMinutesSeconds(15, 21, 19.1)
Dim dms2 As New DegreesMinutesSeconds(12, 43, 12)

Dim dms3 As DegreesMinutesSeconds = dms1.Add(dms2)
' The return value should be:28d 4' 31.1''

Equals(object)

Compares current DegreesMinutesSeconds with a passing object.

public override bool Equals(object obj)

Parameters

obj object

The passing object which will be used to compare with current DegreesMinutesSeconds.

Returns

bool

True if the passing object satisfies the following two conditions:

1) The object is of DegreesMinutesSeconds type.

2) The Degrees, Minutes and Seconds of both DegreesMinutesSeconds should be the same.

If both conditions are not met, will return false.

GetFormattedString(int)

This method returns a formatted representation of the degrees, minutes and seconds value that has been rounded to the specified decimals.

public string GetFormattedString(int decimals)

Parameters

decimals int

The target decimals that the degrees, minutes, seconds value will be rounded to.

Returns

string

This method returns a formatted representation of the degrees, minutes and seconds value.

Remarks

The value will be formatted in the standard string format. For example, 75º 21' 2.1235" (when the decimals parameter is set to 4).

GetFormattedString(DegreesMinutesSecondsFormatType)

public string GetFormattedString(DegreesMinutesSecondsFormatType formatType)

Parameters

formatType DegreesMinutesSecondsFormatType

Returns

string

GetFormattedString(DegreesMinutesSecondsFormatType, int)

public string GetFormattedString(DegreesMinutesSecondsFormatType formatType, int decimals)

Parameters

formatType DegreesMinutesSecondsFormatType
decimals int

Returns

string

GetHashCode()

Serves as hash function for the particular type.

public override int GetHashCode()

Returns

int

The hash code for this particular type.

ToString()

This method returns a formatted representation of the degrees, minutes and seconds value.

public override string ToString()

Returns

string

This method returns a formatted representation of the degrees, minutes and seconds value.

Remarks

The value will be formatted in the standard string format: 75º 21' 28"

Operators

operator +(DegreesMinutesSeconds, DegreesMinutesSeconds)

Operation + overloads for DegreesMinutesSeconds.Sum of two DegreesMinutesSeconds.

public static DegreesMinutesSeconds operator +(DegreesMinutesSeconds degreesMinutesSeconds1, DegreesMinutesSeconds degreesMinutesSeconds2)

Parameters

degreesMinutesSeconds1 DegreesMinutesSeconds

The first target DegreesMinutesSeconds.

degreesMinutesSeconds2 DegreesMinutesSeconds

The second target DegreesMinutesSeconds.

Returns

DegreesMinutesSeconds

The summary of the two DegreesMinutesSeconds.

Examples

DegreesMinutesSeconds dms1 = new DegreesMinutesSeconds(15, 21, 19.1);
DegreesMinutesSeconds dms2 = new DegreesMinutesSeconds(12, 43, 12);

DegreesMinutesSeconds dms3 = dms1 + dms2;
// The return value should be:28d 4' 31.1''
Dim dms1 As New DegreesMinutesSeconds(15, 21, 19.1)
Dim dms2 As New DegreesMinutesSeconds(12, 43, 12)

Dim dms3 As DegreesMinutesSeconds = dms1 + dms2
' The return value should be:28d 4' 31.1''

operator ==(DegreesMinutesSeconds, DegreesMinutesSeconds)

Operation == overloads for DegreesMinutesSeconds.Sum of two DegreesMinutesSeconds.

public static bool operator ==(DegreesMinutesSeconds degreesMinutesSeconds1, DegreesMinutesSeconds degreesMinutesSeconds2)

Parameters

degreesMinutesSeconds1 DegreesMinutesSeconds

The first target DegreesMinutesSeconds.

degreesMinutesSeconds2 DegreesMinutesSeconds

The second target DegreesMinutesSeconds.

Returns

bool

True if the two degreesMinutesSeconds are equal in their responding Degrees, Minutes, Seconds. Otherwise returns false.

operator !=(DegreesMinutesSeconds, DegreesMinutesSeconds)

Operation != overloads for DegreesMinutesSeconds.Sum of two DegreesMinutesSeconds.

public static bool operator !=(DegreesMinutesSeconds degreesMinutesSeconds1, DegreesMinutesSeconds degreesMinutesSeconds2)

Parameters

degreesMinutesSeconds1 DegreesMinutesSeconds

The first target DegreesMinutesSeconds.

degreesMinutesSeconds2 DegreesMinutesSeconds

The second target DegreesMinutesSeconds.

Returns

bool

True if any of the two degreesMinutesSeconds are not equal in their responding Degrees, Minutes, Seconds. Otherwise returns false.