CartesianPoint Constructor

[VB]

Public Sub New()

Public Sub New(ByVal dimensions As Short)

Public Sub New(ByVal x As Double, ByVal y As Double)

Public Sub New(ByVal x As Double, ByVal y As Double, ByVal z As Double)

[C#]

public CartesianPoint()

public CartesianPoint(System.Int16 dimensions)

public CartesianPoint(System.Double x, System.Double y)

public CartesianPoint(System.Double x, System.Double y, System.Double z)

 

Description

The CartesianPoint constructor creates a new instance of the CartesianPoint class.  There are four signatures for this constructor that allow the user to specify various aspects of the point.

The default constructor creates a three-dimensional point located at the origin of the system (0, 0, 0).  The LinearUnits used on each of the coordinates is meters.

The second constructor takes a single argument that specifies the number of dimensions.  A CartesianPoint can have either two or three dimensions.  A GeoCalcException will be thrown if a value other than 2 or 3 is passed to this constructor.  The resulting CartesianPoint will be located at the origin of the system and the LinearUnits used on each of the coordinates will be meters.

The third constructor takes two double value arguments that specify the X and Y coordinate values.  The resulting CartesianPoint will have a Dimensions value of 2, and its location will be given by the coordinate values given as arguments.  The units of the arguments will be assumed to be meters, and the LinearUnits used on each of the coordinates will be meters.

The final constructor takes three double value arguments that specify the X, Y, and Z coordinate values.  The resulting CartesianPoint will have a Dimensions value of 3, and its location will be given by the coordinate values given as arguments.  The units of the arguments will be assumed to be meters, and the LinearUnits used on each of the coordinates will be meters.

 

Example

[VB]

Private Sub GeoCalcNET_CartesianPoint()

Dim x As Double = 3

Dim y As Double = 4

Dim z As Double = 5

 

Dim pt1 As New GeoCalcNET.CartesianPoint

pt1.SetInUnits(x, y, z)

 

Dim pt2 As New GeoCalcNET.CartesianPoint(2)

pt2.SetInUnits(x, y)

 

Dim pt3 As New GeoCalcNET.CartesianPoint(x, y)

 

Dim pt4 As New GeoCalcNET.CartesianPoint(x, y, z)

End Sub

 

[C#]

private void GeoCalcNET_CartesianPoint(GeoCalcNET.DataSourceComponent data)

{

GeoCalcNET.LinearUnit lu = data.GetLinearUnit("BMG", "PERCH");

GeoCalcNET.LinearValue x = new GeoCalcNET.LinearValue();

x.Units = lu;

x.InUnits = 23;

GeoCalcNET.LinearValue y = new GeoCalcNET.LinearValue();

y.Units = lu;

y.InUnits = 7754;

GeoCalcNET.LinearValue z = new GeoCalcNET.LinearValue();

z.Units = lu;

z.InUnits = 73;

 

GeoCalcNET.CartesianPoint pt1 = new GeoCalcNET.CartesianPoint();

pt1.X = x;

pt1.Y = y;

pt1.Z = z;

 

GeoCalcNET.CartesianPoint pt2 = new GeoCalcNET.CartesianPoint(2);

pt2.X = x;

pt2.Y = y;

 

GeoCalcNET.CartesianPoint pt3 = new GeoCalcNET.CartesianPoint(23, 7754);

pt3.X.Units = lu;

pt3.Y.Units = lu;

 

GeoCalcNET.CartesianPoint pt4 = new GeoCalcNET.CartesianPoint(23, 7754, 73);

pt4.X.Units = lu;

pt4.Y.Units = lu;

pt4.Z.Units = lu;

}