Table of Contents

Class CoordinateZ

Namespace
NetTopologySuite.Geometries
Assembly
NetTopologySuite.dll

A lightweight class used to store coordinates on the 2-dimensional Cartesian plane and an additional z-ordinate (Z) value.

This base data object is suitable for use with coordinate sequences with dimension = 3 and measures = 0.

public class CoordinateZ : Coordinate, IComparable, IComparable<Coordinate>
Inheritance
CoordinateZ
Implements
Derived
Inherited Members

Remarks

It is distinct from Point, which is a subclass of Geometry. Unlike objects of type Point (which contain additional information such as an envelope, a precision model, and spatial reference system information), a CoordinateZ only contains ordinate values and properties.

CoordinateZs are two-dimensional points, with an additional Z-ordinate. If an Z-ordinate value is not specified or not defined, constructed coordinates have a Z-ordinate of NaN (which is also the value of NullOrdinate).

Apart from the basic accessor functions, NTS supports only specific operations involving the Z-ordinate.

Implementations may optionally support Z-ordinate and M-measure values as appropriate for a CoordinateSequence. Use of Z and M setters or NetTopologySuite.Geometries.CoordinateZ.this[int] indexer are recommended.

Constructors

CoordinateZ()

Constructs a CoordinateZ at (0,0,NaN).

public CoordinateZ()

CoordinateZ(Coordinate)

Constructs a CoordinateZ having the same (x,y) values as c.

public CoordinateZ(Coordinate c)

Parameters

c Coordinate

Coordinate to copy.

CoordinateZ(double, double)

Constructs a CoordinateZ at (x,y,NaN).

public CoordinateZ(double x, double y)

Parameters

x double

X value.

y double

Y value.

CoordinateZ(double, double, double)

Constructs a CoordinateZ at (x,y,z).

public CoordinateZ(double x, double y, double z)

Parameters

x double

The X value

y double

The Y value

z double

The Z value

Properties

CoordinateValue

Gets/Sets CoordinateZs (x,y,z) values.

public override Coordinate CoordinateValue { get; set; }

Property Value

Coordinate

this[int]

Gets or sets the ordinate value for the given index.

public override double this[int ordinateIndex] { get; set; }

Parameters

ordinateIndex int

The ordinate index

Property Value

double

The ordinate value

Remarks

The base implementation supports 0 (X), 1 (Y) and 2 (Z) as values for the index.

Exceptions

ArgumentOutOfRangeException

Thrown if ordinateIndex is not in the valid range.

Z

Gets or sets the Z-ordinate value.

public override sealed double Z { get; set; }

Property Value

double

Methods

Create(double, double, double, double)

Create a Coordinate of the same type as this Coordinate, using the provided values for x, y and z.

public override Coordinate Create(double x = 0, double y = 0, double z = NaN, double m = NaN)

Parameters

x double

The x-ordinate value, if not provided, it is 0d.

y double

The y-ordinate value, if not provided, it is 0d.

z double

The z-ordinate value, if not provided, it is NullOrdinate.

m double

The m-ordinate value, if not provided, it is NullOrdinate.

Returns

Coordinate

A new CoordinateZ

Remarks

A provided value for m will be silently dropped.

Distance3D(CoordinateZ)

Computes the 3-dimensional Euclidean distance to another location.

public double Distance3D(CoordinateZ c)

Parameters

c CoordinateZ

A CoordinateZ with which to do the distance comparison.

Returns

double

the 3-dimensional Euclidean distance between the locations.

EqualInZ(CoordinateZ, double)

Tests if another CoordinateZ has the same value for Z, within a tolerance.

public bool EqualInZ(CoordinateZ c, double tolerance)

Parameters

c CoordinateZ

A CoordinateZ.

tolerance double

The tolerance value.

Returns

bool

true if the Z ordinates are within the given tolerance.

Equals3D(CoordinateZ)

Returns true if other has the same values for X, Y and Z.

public bool Equals3D(CoordinateZ other)

Parameters

other CoordinateZ

A CoordinateZ with which to do the 3D comparison.

Returns

bool

true if other is a CoordinateZ with the same values for X, Y and Z.

ToString()

Returns a string of the form (x, y, z) .

public override string ToString()

Returns

string

string of the form (x, y, z)