GetInUnits Method

[VB]

Public Overridable MustOverride Function GetInUnits(ByRef x As Double, ByRef y As Double) As Boolean

Public Overridable MustOverride Function GetInUnits(ByRef x As Double, ByRef y As Double, ByRef z As Double) As Boolean

[C#]

public abstract new System.Boolean GetInUnits(System.Double x, System.Double y)

public abstract new System.Boolean GetInUnits(System.Double x, System.Double y, System.Double z)

 

Description

The GetInUnits method gets the values of the CoordPoint's coordinates in the units used by the CoordPoint.  The values are returned in the form of the double arguments passed by reference.  It returns a boolean value indicating the success of the operation.  

There are two forms of this method, one for a two-dimensional CoordPoint that takes two arguments and one for a three-dimensional CoordPoint that takes three arguments.  

If this is a CartesianPoint, then the arguments x, y, and z correspond to the X, Y, and Z properties, respectively.

If this is a GeodeticPoint, then the arguments x, y, and z correspond to the Longitude, Latitude, and Height properties, respectively.

If this is a ProjectedPoint, then the arguments x, y, and z correspond to the East, North, and Height properties, respectively.

 

Example

[VB]

Private Sub GeoCalcNET_CoordPoint_GetInUnits(ByVal pt As GeoCalcNET.CoordPoint)

Dim x, y, z As Double

If pt.Dimensions = 2 Then

If Not pt.GetInUnits(x, y) Then

MessageBox.Show("unable to get coordinate values in units")

End If

Else

If Not pt.GetInUnits(x, y, z) Then

MessageBox.Show("unable to get coordinate values in units")

End If

End If

End Sub

 

[C#]

private void GeoCalcNET_CoordPoint_GetInUnits(GeoCalcNET.CoordPoint pt)

{

if(pt.Dimensions == 2)

{

double x = 0;

double y = 0;

if(! pt.GetInUnits(ref x, ref y))

{

MessageBox.Show("unable to get values from CoordPoint");

}

}

else if(pt.Dimensions == 3)

{

double x = 0;

double y = 0;

double z = 0;

if(! pt.GetInUnits(ref x, ref y, ref z))

{

MessageBox.Show("unable to get values from CoordPoint");

}

}

}