Class CoordinateArraySequence
- Namespace
- NetTopologySuite.Geometries.Implementation
- Assembly
- NetTopologySuite.dll
A CoordinateSequence backed by an array of Coordinates. This is the implementation that Geometrys use by default.
Coordinates returned by ToCoordinateArray(), GetCoordinate(int) and GetCoordinate(int, Coordinate) are live -- modifications to them are actually changing the CoordinateSequence's underlying data. A dimension may be specified for the coordinates in the sequence, which may be 2 or 3. The actual coordinates will always have 3 ordinates, but the dimension is useful as metadata in some situations.public class CoordinateArraySequence : CoordinateSequence
- Inheritance
-
CoordinateArraySequence
- Inherited Members
- Extension Methods
Constructors
CoordinateArraySequence(CoordinateSequence)
Creates a new sequence based on a deep copy of the given CoordinateSequence.
public CoordinateArraySequence(CoordinateSequence coordSeq)
Parameters
coordSeq
CoordinateSequenceThe coordinate sequence that will be copied
CoordinateArraySequence(Coordinate[])
Constructs a sequence based on the given array of Coordinates. The coordinate dimension defaults to 2
public CoordinateArraySequence(Coordinate[] coordinates)
Parameters
coordinates
Coordinate[]The coordinate array that will be referenced.
Remarks
The array is not copied.
CoordinateArraySequence(Coordinate[], int)
Constructs a sequence based on the given array of Coordinates.
[Obsolete("Use an overload that accepts measures. This overload will be removed in a future release.")]
public CoordinateArraySequence(Coordinate[] coordinates, int dimension)
Parameters
coordinates
Coordinate[]The coordinate array that will be referenced.
dimension
intThe dimension of the coordinates
Remarks
The Array is not copied
CoordinateArraySequence(Coordinate[], int, int)
Constructs a sequence based on the given array of Coordinates.
The Array is not copied It is your responsibility to ensure the array contains Coordinates of the indicated dimension and measures (See EnforceConsistency(Coordinate[])).public CoordinateArraySequence(Coordinate[] coordinates, int dimension, int measures)
Parameters
coordinates
Coordinate[]The coordinate array that will be referenced.
dimension
intThe dimension of the coordinates
measures
intThe number of measure ordinate values.
CoordinateArraySequence(int)
Constructs a sequence of a given size, populated with new Coordinates.
public CoordinateArraySequence(int size)
Parameters
size
intThe size of the sequence to create.
CoordinateArraySequence(int, int)
Constructs a sequence of a given size
, populated
with new Coordinates of the given dimension
.
[Obsolete("Use an overload that accepts measures. This overload will be removed in a future release.")]
public CoordinateArraySequence(int size, int dimension)
Parameters
CoordinateArraySequence(int, int, int)
Constructs a sequence of a given size
, populated
with new Coordinates of the given dimension
with the given number of measures
public CoordinateArraySequence(int size, int dimension, int measures)
Parameters
size
intThe size of the sequence to create.
dimension
intthe dimension of the coordinates
measures
intthe number of measures of the coordinates
Fields
Coordinates
Array of coordinates in sequence
protected Coordinate[] Coordinates
Field Value
Methods
Copy()
Creates a deep copy of the CoordinateArraySequence
.
public override CoordinateSequence Copy()
Returns
- CoordinateSequence
The deep copy.
EnforceArrayConsistency(Coordinate[])
Ensure array contents of the same type, making use of CreateCoordinate() as needed.
A new array will be created if needed to return a consistent result.
[Obsolete("It is the clients responsibility to provide consistent arrays")]
protected Coordinate[] EnforceArrayConsistency(Coordinate[] array)
Parameters
array
Coordinate[]array containing consistent coordinate instances
Returns
ExpandEnvelope(Envelope)
Expands the given Envelope to include the coordinates in the sequence. Allows implementing classes to optimize access to coordinate values.
public override Envelope ExpandEnvelope(Envelope env)
Parameters
env
EnvelopeThe envelope to expand.
Returns
- Envelope
A reference to the expanded envelope.
GetClonedCoordinates()
protected Coordinate[] GetClonedCoordinates()
Returns
GetCoordinate(int)
Get the Coordinate with index i.
public override Coordinate GetCoordinate(int i)
Parameters
i
intThe index of the coordinate.
Returns
- Coordinate
The requested Coordinate instance.
GetCoordinate(int, Coordinate)
Copies the i'th coordinate in the sequence to the supplied Coordinate.
public override void GetCoordinate(int index, Coordinate coord)
Parameters
index
intThe index of the coordinate to copy.
coord
CoordinateA Coordinate to receive the value.
GetCoordinateCopy(int)
Get a copy of the Coordinate with index i.
public override Coordinate GetCoordinateCopy(int i)
Parameters
i
intThe index of the coordinate.
Returns
- Coordinate
A copy of the requested Coordinate.
GetM(int)
Returns ordinate M of the specified coordinate if available.
public override double GetM(int index)
Parameters
index
int
Returns
- double
The value of the M ordinate in the index'th coordinate, or Double.NaN if not defined.
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).
public override double GetOrdinate(int index, int ordinateIndex)
Parameters
index
intThe coordinate index in the sequence.
ordinateIndex
intThe ordinate index in the coordinate (in range [0, dimension-1]).
Returns
GetX(int)
Returns ordinate X (0) of the specified coordinate.
public override double GetX(int index)
Parameters
index
int
Returns
- double
The value of the X ordinate in the index'th coordinate.
GetY(int)
Returns ordinate Y (1) of the specified coordinate.
public override double GetY(int index)
Parameters
index
int
Returns
- double
The value of the Y ordinate in the index'th coordinate.
GetZ(int)
Returns ordinate Z of the specified coordinate if available.
public override double GetZ(int index)
Parameters
index
int
Returns
- double
The value of the Z ordinate in the index'th coordinate, or Double.NaN if not defined.
Reversed()
public override CoordinateSequence Reversed()
Returns
SetOrdinate(int, int, double)
Sets the value for a given ordinate of a coordinate in this sequence.
public override void SetOrdinate(int index, int ordinateIndex, double value)
Parameters
index
intThe coordinate index in the sequence.
ordinateIndex
intThe ordinate index in the coordinate (in range [0, dimension-1]).
value
doubleThe new ordinate value.
ToCoordinateArray()
This method exposes the internal Array of Coordinate Objects.
public override Coordinate[] ToCoordinateArray()
Returns
ToString()
Returns the string representation of the coordinate array.
public override string ToString()