Class CoordinateSequence
Inheritance
Inherited Members
Namespace: NetTopologySuite.Geometries
Assembly: NetTopologySuite.dll
Syntax
[Serializable]
public abstract class CoordinateSequence
Constructors
| Improve this Doc View SourceCoordinateSequence(Int32, Int32, Int32)
Initializes a new instance of the CoordinateSequence class.
Declaration
protected CoordinateSequence(int count, int dimension, int measures)
Parameters
Type | Name | Description |
---|---|---|
Int32 | count | The value for Count. |
Int32 | dimension | The value for Dimension. |
Int32 | measures | The value for Measures. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown when any argument is negative. |
ArgumentException | Thrown when |
Properties
| Improve this Doc View SourceCount
Gets a value indicating the number of coordinates in this sequence.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Dimension
Returns the dimension (number of ordinates in each coordinate) for this sequence.
This total includes any measures, indicated by non-zero Measures.
Declaration
public int Dimension { get; }
Property Value
Type | Description |
---|---|
Int32 |
First
Gets a value indicating the first Coordinate
in this sequence.
For LineString
s e.g. this is the starting point.
Declaration
public Coordinate First { get; }
Property Value
Type | Description |
---|---|
Coordinate | First |
HasM
Gets a value indicating if GetM(Int32) is supported.
Declaration
public bool HasM { get; }
Property Value
Type | Description |
---|---|
Boolean |
HasZ
Gets a value indicating if GetZ(Int32) is supported.
Declaration
public bool HasZ { get; }
Property Value
Type | Description |
---|---|
Boolean |
Last
Gets a value indicating the last Coordinate
in this sequence.
For LineString
s e.g. this is the ending point.
Declaration
public Coordinate Last { get; }
Property Value
Type | Description |
---|---|
Coordinate | Last |
Measures
Gets the number of measures included in Dimension for each coordinate for this sequence.
Declaration
public int Measures { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
For a measured coordinate sequence a non-zero value is returned.
MOrdinateIndex
Gets the index of the M ordinate (for use with GetOrdinate(Int32, Int32) or SetOrdinate(Int32, Int32, Double)), or -1 if HasM is false.
Declaration
public int MOrdinateIndex { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
It's just a cache for TryGetOrdinateIndex(Ordinate, out Int32) with M.
Ordinates
Gets the kind of ordinates this sequence supplies.
Declaration
public Ordinates Ordinates { get; }
Property Value
Type | Description |
---|---|
Ordinates |
Spatial
Gets the number of non-measure dimensions included in Dimension for each coordinate for this sequence.
Equivalent to Dimension - Measures
.
Declaration
public int Spatial { get; }
Property Value
Type | Description |
---|---|
Int32 |
ZOrdinateIndex
Gets the index of the Z ordinate (for use with GetOrdinate(Int32, Int32) or SetOrdinate(Int32, Int32, Double)), or -1 if HasZ is false.
Declaration
public int ZOrdinateIndex { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
It's just a cache for TryGetOrdinateIndex(Ordinate, out Int32) with Z.
Methods
| Improve this Doc View SourceCopy()
Returns a deep copy of this collection.
Declaration
public abstract CoordinateSequence Copy()
Returns
Type | Description |
---|---|
CoordinateSequence | A copy of the coordinate sequence containing copies of all points |
CreateCoordinate()
Creates a coordinate for use in this sequence.
Declaration
public virtual Coordinate CreateCoordinate()
Returns
Type | Description |
---|---|
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(Int32, 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 virtual Envelope ExpandEnvelope(Envelope env)
Parameters
Type | Name | Description |
---|---|---|
Envelope | env | The envelope to expand. |
Returns
Type | Description |
---|---|
Envelope | A reference to the expanded envelope. |
GetCoordinate(Int32)
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.
Declaration
public virtual Coordinate GetCoordinate(int i)
Parameters
Type | Name | Description |
---|---|---|
Int32 | i |
Returns
Type | Description |
---|---|
Coordinate |
GetCoordinate(Int32, Coordinate)
Copies the i'th coordinate in the sequence to the supplied Coordinate. At least the first two dimensions must be copied.
Declaration
public virtual void GetCoordinate(int index, Coordinate coord)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the coordinate to copy. |
Coordinate | coord | A Coordinate to receive the value. |
GetCoordinateCopy(Int32)
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.
Declaration
public virtual Coordinate GetCoordinateCopy(int i)
Parameters
Type | Name | Description |
---|---|---|
Int32 | i | The index of the coordinate to retrieve. |
Returns
Type | Description |
---|---|
Coordinate | A copy of the i'th coordinate in the sequence |
GetM(Int32)
Returns ordinate M of the specified coordinate if available.
Declaration
public virtual double GetM(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Double | The value of the M ordinate in the index'th coordinate, or NullOrdinate if not defined. |
GetOrdinate(Int32, Ordinate)
Returns the ordinate of a coordinate in this sequence.
Declaration
public double GetOrdinate(int index, Ordinate ordinate)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The coordinate index in the sequence. |
Ordinate | ordinate | The ordinate value to get. |
Returns
Type | Description |
---|---|
Double | The ordinate value, or NullOrdinate if the sequence does not provide values for |
GetOrdinate(Int32, Int32)
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.
Declaration
public abstract double GetOrdinate(int index, int ordinateIndex)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The coordinate index in the sequence. |
Int32 | ordinateIndex | The ordinate index in the coordinate (in range [0, dimension-1]). |
Returns
Type | Description |
---|---|
Double | The ordinate value, or NullOrdinate if the sequence does not provide values for |
Remarks
If the sequence does not provide value for the required ordinate, the implementation must not throw an exception, it should return NullOrdinate.
GetX(Int32)
Returns ordinate X (0) of the specified coordinate.
Declaration
public virtual double GetX(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Double | The value of the X ordinate in the index'th coordinate. |
GetY(Int32)
Returns ordinate Y (1) of the specified coordinate.
Declaration
public virtual double GetY(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Double | The value of the Y ordinate in the index'th coordinate. |
GetZ(Int32)
Returns ordinate Z of the specified coordinate if available.
Declaration
public virtual double GetZ(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Returns
Type | Description |
---|---|
Double | The value of the Z ordinate in the index'th coordinate, or NullOrdinate if not defined. |
Reversed()
Returns a reversed copy of this CoordinateSequence.
Declaration
public virtual CoordinateSequence Reversed()
Returns
Type | Description |
---|---|
CoordinateSequence | A reversed copy of this CoordinateSequence. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when Copy() returned null. |
SetM(Int32, Double)
Sets ordinate M of the specified coordinate to the specified value if present.
Declaration
public virtual void SetM(int index, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the coordinate whose M value to set if present. |
Double | value | The value to set the coordinate's M value to if present. |
SetOrdinate(Int32, Ordinate, Double)
Sets the value for a given ordinate of a coordinate in this sequence.
Declaration
public void SetOrdinate(int index, Ordinate ordinate, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The coordinate index in the sequence. |
Ordinate | ordinate | The ordinate value to set. |
Double | value | The new ordinate value. |
SetOrdinate(Int32, Int32, Double)
Sets the value for a given ordinate of a coordinate in this sequence.
Declaration
public abstract void SetOrdinate(int index, int ordinateIndex, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The coordinate index in the sequence. |
Int32 | ordinateIndex | The ordinate index in the coordinate (in range [0, dimension-1]). |
Double | value | 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.
SetX(Int32, Double)
Sets ordinate X (0) of the specified coordinate to the specified value.
Declaration
public virtual void SetX(int index, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the coordinate whose X value to set. |
Double | value | The value to set the coordinate's X value to. |
SetY(Int32, Double)
Sets ordinate Y (1) of the specified coordinate to the specified value.
Declaration
public virtual void SetY(int index, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the coordinate whose Y value to set. |
Double | value | The value to set the coordinate's Y value to. |
SetZ(Int32, Double)
Sets ordinate Z of the specified coordinate to the specified value if present.
Declaration
public virtual void SetZ(int index, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the coordinate whose Z value to set if present. |
Double | value | The value to set the coordinate's Z value to if present. |
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.
Declaration
public virtual Coordinate[] ToCoordinateArray()
Returns
Type | Description |
---|---|
Coordinate[] |
TryGetOrdinateIndex(Ordinate, out Int32)
Retrieves the index at which this sequence stores a particular Ordinate's values, if that ordinate is present in Ordinates.
Declaration
public bool TryGetOrdinateIndex(Ordinate ordinate, out int ordinateIndex)
Parameters
Type | Name | Description |
---|---|---|
Ordinate | ordinate | The Ordinate value whose index to retrieve. |
Int32 | ordinateIndex | 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
Type | Description |
---|---|
Boolean | true if this sequence contains |