Class CoordinateArraySequence
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.Inherited Members
Namespace: NetTopologySuite.Geometries.Implementation
Assembly: NetTopologySuite.dll
Syntax
[Serializable]
public class CoordinateArraySequence : CoordinateSequence
Constructors
| Edit this page View SourceCoordinateArraySequence(CoordinateSequence)
Creates a new sequence based on a deep copy of the given CoordinateSequence.
Declaration
public CoordinateArraySequence(CoordinateSequence coordSeq)
Parameters
Type | Name | Description |
---|---|---|
CoordinateSequence | coordSeq | The coordinate sequence that will be copied |
CoordinateArraySequence(Coordinate[])
Constructs a sequence based on the given array of Coordinates. The coordinate dimension defaults to 2
Declaration
public CoordinateArraySequence(Coordinate[] coordinates)
Parameters
Type | Name | Description |
---|---|---|
Coordinate[] | coordinates | 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.
Declaration
[Obsolete("Use an overload that accepts measures. This overload will be removed in a future release.")]
public CoordinateArraySequence(Coordinate[] coordinates, int dimension)
Parameters
Type | Name | Description |
---|---|---|
Coordinate[] | coordinates | The coordinate array that will be referenced. |
int | dimension | The 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[])).Declaration
public CoordinateArraySequence(Coordinate[] coordinates, int dimension, int measures)
Parameters
Type | Name | Description |
---|---|---|
Coordinate[] | coordinates | The coordinate array that will be referenced. |
int | dimension | The dimension of the coordinates |
int | measures | The number of measure ordinate values. |
CoordinateArraySequence(int)
Constructs a sequence of a given size, populated with new Coordinates.
Declaration
public CoordinateArraySequence(int size)
Parameters
Type | Name | Description |
---|---|---|
int | size | The size of the sequence to create. |
CoordinateArraySequence(int, int)
Constructs a sequence of a given size
, populated
with new Coordinates of the given dimension
.
Declaration
[Obsolete("Use an overload that accepts measures. This overload will be removed in a future release.")]
public CoordinateArraySequence(int size, int dimension)
Parameters
Type | Name | Description |
---|---|---|
int | size | The size of the sequence to create. |
int | dimension | the dimension of the coordinates |
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
Declaration
public CoordinateArraySequence(int size, int dimension, int measures)
Parameters
Type | Name | Description |
---|---|---|
int | size | The size of the sequence to create. |
int | dimension | the dimension of the coordinates |
int | measures | the number of measures of the coordinates |
Fields
| Edit this page View SourceCoordinates
Array of coordinates in sequence
Declaration
protected Coordinate[] Coordinates
Field Value
Type | Description |
---|---|
Coordinate[] |
Methods
| Edit this page View SourceCopy()
Creates a deep copy of the CoordinateArraySequence
.
Declaration
public override CoordinateSequence Copy()
Returns
Type | Description |
---|---|
CoordinateSequence | The deep copy. |
Overrides
| Edit this page View SourceEnforceArrayConsistency(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.
Declaration
[Obsolete("It is the clients responsibility to provide consistent arrays")]
protected Coordinate[] EnforceArrayConsistency(Coordinate[] array)
Parameters
Type | Name | Description |
---|---|---|
Coordinate[] | array | array containing consistent coordinate instances |
Returns
Type | Description |
---|---|
Coordinate[] |
ExpandEnvelope(Envelope)
Expands the given Envelope to include the coordinates in the sequence. Allows implementing classes to optimize access to coordinate values.
Declaration
public override Envelope ExpandEnvelope(Envelope env)
Parameters
Type | Name | Description |
---|---|---|
Envelope | env | The envelope to expand. |
Returns
Type | Description |
---|---|
Envelope | A reference to the expanded envelope. |
Overrides
| Edit this page View SourceGetClonedCoordinates()
Declaration
protected Coordinate[] GetClonedCoordinates()
Returns
Type | Description |
---|---|
Coordinate[] |
GetCoordinate(int)
Get the Coordinate with index i.
Declaration
public override Coordinate GetCoordinate(int i)
Parameters
Type | Name | Description |
---|---|---|
int | i | The index of the coordinate. |
Returns
Type | Description |
---|---|
Coordinate | The requested Coordinate instance. |
Overrides
| Edit this page View SourceGetCoordinate(int, Coordinate)
Copies the i'th coordinate in the sequence to the supplied Coordinate.
Declaration
public override void GetCoordinate(int index, Coordinate coord)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the coordinate to copy. |
Coordinate | coord | A Coordinate to receive the value. |
Overrides
| Edit this page View SourceGetCoordinateCopy(int)
Get a copy of the Coordinate with index i.
Declaration
public override Coordinate GetCoordinateCopy(int i)
Parameters
Type | Name | Description |
---|---|---|
int | i | The index of the coordinate. |
Returns
Type | Description |
---|---|
Coordinate | A copy of the requested Coordinate. |
Overrides
| Edit this page View SourceGetM(int)
Returns ordinate M of the specified coordinate if available.
Declaration
public override double GetM(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
double | The value of the M ordinate in the index'th coordinate, or Double.NaN if not defined. |
Overrides
| Edit this page View SourceGetOrdinate(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).
Declaration
public override double GetOrdinate(int index, int ordinateIndex)
Parameters
Type | Name | Description |
---|---|---|
int | index | The coordinate index in the sequence. |
int | ordinateIndex | The ordinate index in the coordinate (in range [0, dimension-1]). |
Returns
Type | Description |
---|---|
double |
Overrides
| Edit this page View SourceGetX(int)
Returns ordinate X (0) of the specified coordinate.
Declaration
public override double GetX(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
double | The value of the X ordinate in the index'th coordinate. |
Overrides
| Edit this page View SourceGetY(int)
Returns ordinate Y (1) of the specified coordinate.
Declaration
public override double GetY(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
double | The value of the Y ordinate in the index'th coordinate. |
Overrides
| Edit this page View SourceGetZ(int)
Returns ordinate Z of the specified coordinate if available.
Declaration
public override double GetZ(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
double | The value of the Z ordinate in the index'th coordinate, or Double.NaN if not defined. |
Overrides
| Edit this page View SourceReversed()
Returns a reversed copy of this CoordinateSequence.
Declaration
public override CoordinateSequence Reversed()
Returns
Type | Description |
---|---|
CoordinateSequence | A reversed copy of this CoordinateSequence. |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException |
SetOrdinate(int, int, double)
Sets the value for a given ordinate of a coordinate in this sequence.
Declaration
public override void SetOrdinate(int index, int ordinateIndex, double value)
Parameters
Type | Name | Description |
---|---|---|
int | index | The coordinate index in the sequence. |
int | ordinateIndex | The ordinate index in the coordinate (in range [0, dimension-1]). |
double | value | The new ordinate value. |
Overrides
| Edit this page View SourceToCoordinateArray()
This method exposes the internal Array of Coordinate Objects.
Declaration
public override Coordinate[] ToCoordinateArray()
Returns
Type | Description |
---|---|
Coordinate[] |
Overrides
| Edit this page View SourceToString()
Returns the string representation of the coordinate array.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |