Table of Contents

Class CoordinateSequence

Namespace
NetTopologySuite.Geometries
Assembly
NetTopologySuite.dll
public abstract class CoordinateSequence
Inheritance
CoordinateSequence
Derived
Inherited Members
Extension Methods

Constructors

CoordinateSequence(int, int, int)

Initializes a new instance of the CoordinateSequence class.

protected CoordinateSequence(int count, int dimension, int measures)

Parameters

count int

The value for Count.

dimension int

The value for Dimension.

measures int

The value for Measures.

Exceptions

ArgumentOutOfRangeException

Thrown when any argument is negative.

ArgumentException

Thrown when dimension and measures specify fewer than two (2) spatial dimensions.

See Also

Properties

Count

Gets a value indicating the number of coordinates in this sequence.

public int Count { get; }

Property Value

int
See Also

Dimension

Returns the dimension (number of ordinates in each coordinate) for this sequence.

This total includes any measures, indicated by non-zero Measures.

public int Dimension { get; }

Property Value

int
See Also

First

Gets a value indicating the first Coordinate in this sequence.
For LineStrings e.g. this is the starting point.

public Coordinate First { get; }

Property Value

Coordinate

First Coordinate in sequence or null if empty.

See Also

HasM

Gets a value indicating if GetM(int) is supported.

public bool HasM { get; }

Property Value

bool
See Also

HasZ

Gets a value indicating if GetZ(int) is supported.

public bool HasZ { get; }

Property Value

bool
See Also

Last

Gets a value indicating the last Coordinate in this sequence.
For LineStrings e.g. this is the ending point.

public Coordinate Last { get; }

Property Value

Coordinate

Last Coordinate in sequence or null if empty.

See Also

MOrdinateIndex

Gets the index of the M ordinate (for use with GetOrdinate(int, int) or SetOrdinate(int, int, double)), or -1 if HasM is false.

public int MOrdinateIndex { get; }

Property Value

int

Remarks

It's just a cache for TryGetOrdinateIndex(Ordinate, out int) with M.

See Also

Measures

Gets the number of measures included in Dimension for each coordinate for this sequence.

public int Measures { get; }

Property Value

int

Remarks

For a measured coordinate sequence a non-zero value is returned.

  • For XY sequence measures is zero
  • For XYM sequence measure is one
  • For XYZ sequence measure is zero
  • For XYZM sequence measure is one
  • Values greater than one are supported
See Also

Ordinates

Gets the kind of ordinates this sequence supplies.

public Ordinates Ordinates { get; }

Property Value

Ordinates
See Also

Spatial

Gets the number of non-measure dimensions included in Dimension for each coordinate for this sequence.

Equivalent to Dimension - Measures.

public int Spatial { get; }

Property Value

int
See Also

ZOrdinateIndex

Gets the index of the Z ordinate (for use with GetOrdinate(int, int) or SetOrdinate(int, int, double)), or -1 if HasZ is false.

public int ZOrdinateIndex { get; }

Property Value

int

Remarks

It's just a cache for TryGetOrdinateIndex(Ordinate, out int) with Z.

See Also

Methods

Copy()

Returns a deep copy of this collection.

public abstract CoordinateSequence Copy()

Returns

CoordinateSequence

A copy of the coordinate sequence containing copies of all points

See Also

CreateCoordinate()

Creates a coordinate for use in this sequence.

public virtual Coordinate CreateCoordinate()

Returns

Coordinate

A coordinate for use with this sequence

Remarks

The coordinate is created supporting the same number of Dimension and Measures as this sequence and is suitable for use with GetCoordinate(int, Coordinate).

See Also

ExpandEnvelope(Envelope)

Expands the given Envelope to include the coordinates in the sequence. Allows implementing classes to optimize access to coordinate values.

public virtual Envelope ExpandEnvelope(Envelope env)

Parameters

env Envelope

The envelope to expand.

Returns

Envelope

A reference to the expanded envelope.

See Also

GetCoordinate(int)

Returns (possibly a copy of) the ith Coordinate in this collection. Whether or not the Coordinate returned is the actual underlying Coordinate or merely a copy depends on the implementation. Note that in the future the semantics of this method may change to guarantee that the Coordinate returned is always a copy. Callers are advised not to assume that they can modify a CoordinateSequence by modifying the Coordinate returned by this method.

public virtual Coordinate GetCoordinate(int i)

Parameters

i int

Returns

Coordinate
See Also

GetCoordinate(int, Coordinate)

Copies the i'th coordinate in the sequence to the supplied Coordinate. At least the first two dimensions must be copied.

public virtual void GetCoordinate(int index, Coordinate coord)

Parameters

index int

The index of the coordinate to copy.

coord Coordinate

A Coordinate to receive the value.

See Also

GetCoordinateCopy(int)

Returns a copy of the i'th coordinate in this sequence. This method optimizes the situation where the caller is going to make a copy anyway - if the implementation has already created a new Coordinate object, no further copy is needed.

public virtual Coordinate GetCoordinateCopy(int i)

Parameters

i int

The index of the coordinate to retrieve.

Returns

Coordinate

A copy of the i'th coordinate in the sequence

See Also

GetM(int)

Returns ordinate M of the specified coordinate if available.

public virtual double GetM(int index)

Parameters

index int

Returns

double

The value of the M ordinate in the index'th coordinate, or NullOrdinate if not defined.

See Also

GetOrdinate(int, Ordinate)

Returns the ordinate of a coordinate in this sequence.

public double GetOrdinate(int index, Ordinate ordinate)

Parameters

index int

The coordinate index in the sequence.

ordinate Ordinate

The ordinate value to get.

Returns

double

The ordinate value, or NullOrdinate if the sequence does not provide values for ordinate"/>

See Also

GetOrdinate(int, int)

Returns the ordinate of a coordinate in this sequence. Ordinate indices 0 and 1 are assumed to be X and Y.

Ordinate indices greater than 1 have user-defined semantics (for instance, they may contain other dimensions or measure values as described by Dimension and Measures.
public abstract double GetOrdinate(int index, int ordinateIndex)

Parameters

index int

The coordinate index in the sequence.

ordinateIndex int

The ordinate index in the coordinate (in range [0, dimension-1]).

Returns

double

The ordinate value, or NullOrdinate if the sequence does not provide values for ordinateIndex"/>

Remarks

If the sequence does not provide value for the required ordinate, the implementation must not throw an exception, it should return NullOrdinate.

See Also

GetX(int)

Returns ordinate X (0) of the specified coordinate.

public virtual double GetX(int index)

Parameters

index int

Returns

double

The value of the X ordinate in the index'th coordinate.

See Also

GetY(int)

Returns ordinate Y (1) of the specified coordinate.

public virtual double GetY(int index)

Parameters

index int

Returns

double

The value of the Y ordinate in the index'th coordinate.

See Also

GetZ(int)

Returns ordinate Z of the specified coordinate if available.

public virtual double GetZ(int index)

Parameters

index int

Returns

double

The value of the Z ordinate in the index'th coordinate, or NullOrdinate if not defined.

See Also

Reversed()

Returns a reversed copy of this CoordinateSequence.

public virtual CoordinateSequence Reversed()

Returns

CoordinateSequence

A reversed copy of this CoordinateSequence.

Exceptions

InvalidOperationException

Thrown when Copy() returned null.

See Also

SetM(int, double)

Sets ordinate M of the specified coordinate to the specified value if present.

public virtual void SetM(int index, double value)

Parameters

index int

The index of the coordinate whose M value to set if present.

value double

The value to set the coordinate's M value to if present.

See Also

SetOrdinate(int, Ordinate, double)

Sets the value for a given ordinate of a coordinate in this sequence.

public void SetOrdinate(int index, Ordinate ordinate, double value)

Parameters

index int

The coordinate index in the sequence.

ordinate Ordinate

The ordinate value to set.

value double

The new ordinate value.

See Also

SetOrdinate(int, int, double)

Sets the value for a given ordinate of a coordinate in this sequence.

public abstract void SetOrdinate(int index, int ordinateIndex, double value)

Parameters

index int

The coordinate index in the sequence.

ordinateIndex int

The ordinate index in the coordinate (in range [0, dimension-1]).

value double

The new ordinate value.

Remarks

If the sequence can't store the ordinate value, the implementation must not throw an exception, it should simply ignore the call.

See Also

SetX(int, double)

Sets ordinate X (0) of the specified coordinate to the specified value.

public virtual void SetX(int index, double value)

Parameters

index int

The index of the coordinate whose X value to set.

value double

The value to set the coordinate's X value to.

See Also

SetY(int, double)

Sets ordinate Y (1) of the specified coordinate to the specified value.

public virtual void SetY(int index, double value)

Parameters

index int

The index of the coordinate whose Y value to set.

value double

The value to set the coordinate's Y value to.

See Also

SetZ(int, double)

Sets ordinate Z of the specified coordinate to the specified value if present.

public virtual void SetZ(int index, double value)

Parameters

index int

The index of the coordinate whose Z value to set if present.

value double

The value to set the coordinate's Z value to if present.

See Also

ToCoordinateArray()

Returns (possibly copies of) the Coordinates in this collection. Whether or not the Coordinates returned are the actual underlying Coordinates or merely copies depends on the implementation. Note that if this implementation does not store its data as an array of Coordinates, this method will incur a performance penalty because the array needs to be built from scratch.

public virtual Coordinate[] ToCoordinateArray()

Returns

Coordinate[]
See Also

TryGetOrdinateIndex(Ordinate, out int)

Retrieves the index at which this sequence stores a particular Ordinate's values, if that ordinate is present in Ordinates.

public bool TryGetOrdinateIndex(Ordinate ordinate, out int ordinateIndex)

Parameters

ordinate Ordinate

The Ordinate value whose index to retrieve.

ordinateIndex int

When this method returns, contains the index of the requested ordinate, if the ordinate is present in this sequence; otherwise, -1. This parameter is passed uninitialized.

Returns

bool

true if this sequence contains ordinate; otherwise, false.

See Also

See Also