SetInUnits Method

[VB]

Public Overridable MustOverride Function SetInUnits(ByVal x As Double, ByVal y As Double) As Boolean

Public Overridable MustOverride Function SetInUnits(ByVal x As Double, ByVal y As Double, ByVal z As Double) As Boolean

[C#]

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

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

 

Description

The SetInUnits method is used to set the coordinate values in the units used by the CoordPoint.  The desired values are passed to this method in the form of double valued arguments.  It returns a boolean value indicating the success of the operation.

There are two signatures for 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_SetInUnits(ByVal pt As GeoCalcNET.CoordPoint)

Dim x As Double = 2.1

Dim y As Double = 3.2

Dim z As Double = 4.3

If pt.Dimensions = 2 Then

If Not pt.SetInUnits(x, y) Then

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

End If

Else

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

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

End If

End If

End Sub

 

[C#]

private void GeoCalcNET_CoordPoint_SetInUnits(GeoCalcNET.CoordPoint pt)

{

if(pt.Dimensions == 2)

{

double x = 0;

double y = 0;

if(! pt.SetInUnits(x, y))

{

MessageBox.Show("unable to set values for CoordPoint");

}

}

else if(pt.Dimensions == 3)

{

double x = 0;

double y = 0;

double z = 0;

if(! pt.SetInUnits(x, y, z))

{

MessageBox.Show("unable to set values for CoordPoint");

}

}

}