Search Results for

    Show / Hide Table of Contents

    Class CoordinateSequence

    Inheritance
    object
    CoordinateSequence
    CoordinateArraySequence
    DotSpatialAffineCoordinateSequence
    PackedCoordinateSequence
    RawCoordinateSequence
    AxisPlaneCoordinateSequence
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.Geometries
    Assembly: NetTopologySuite.dll
    Syntax
    [Serializable]
    public abstract class CoordinateSequence

    Constructors

    | Edit this page View Source

    CoordinateSequence(int, int, int)

    Initializes a new instance of the CoordinateSequence class.

    Declaration
    protected CoordinateSequence(int count, int dimension, int measures)
    Parameters
    Type Name Description
    int count

    The value for Count.

    int dimension

    The value for Dimension.

    int measures

    The value for Measures.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when any argument is negative.

    ArgumentException

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

    Properties

    | Edit this page View Source

    Count

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

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    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
    int
    | Edit this page View Source

    First

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

    Declaration
    public Coordinate First { get; }
    Property Value
    Type Description
    Coordinate

    First Coordinate in sequence or null if empty.

    | Edit this page View Source

    HasM

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

    Declaration
    public bool HasM { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    HasZ

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

    Declaration
    public bool HasZ { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Last

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

    Declaration
    public Coordinate Last { get; }
    Property Value
    Type Description
    Coordinate

    Last Coordinate in sequence or null if empty.

    | Edit this page View Source

    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.

    Declaration
    public int MOrdinateIndex { get; }
    Property Value
    Type Description
    int
    Remarks

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

    | Edit this page View Source

    Measures

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

    Declaration
    public int Measures { get; }
    Property Value
    Type Description
    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
    | Edit this page View Source

    Ordinates

    Gets the kind of ordinates this sequence supplies.

    Declaration
    public Ordinates Ordinates { get; }
    Property Value
    Type Description
    Ordinates
    | Edit this page View Source

    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
    int
    | Edit this page View Source

    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.

    Declaration
    public int ZOrdinateIndex { get; }
    Property Value
    Type Description
    int
    Remarks

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

    Methods

    | Edit this page View Source

    Copy()

    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

    | Edit this page View Source

    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(int, Coordinate).

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    Declaration
    public virtual Coordinate GetCoordinate(int i)
    Parameters
    Type Name Description
    int i
    Returns
    Type Description
    Coordinate
    | Edit this page View Source

    GetCoordinate(int, 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
    int index

    The index of the coordinate to copy.

    Coordinate coord

    A Coordinate to receive the value.

    | Edit this page View Source

    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.

    Declaration
    public virtual Coordinate GetCoordinateCopy(int i)
    Parameters
    Type Name Description
    int i

    The index of the coordinate to retrieve.

    Returns
    Type Description
    Coordinate

    A copy of the i'th coordinate in the sequence

    | Edit this page View Source

    GetM(int)

    Returns ordinate M of the specified coordinate if available.

    Declaration
    public virtual 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 NullOrdinate if not defined.

    | Edit this page View Source

    GetOrdinate(int, Ordinate)

    Returns the ordinate of a coordinate in this sequence.

    Declaration
    public double GetOrdinate(int index, Ordinate ordinate)
    Parameters
    Type Name Description
    int 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 ordinate"/>

    | Edit this page View Source

    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.
    Declaration
    public abstract 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

    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.

    | Edit this page View Source

    GetX(int)

    Returns ordinate X (0) of the specified coordinate.

    Declaration
    public virtual 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.

    | Edit this page View Source

    GetY(int)

    Returns ordinate Y (1) of the specified coordinate.

    Declaration
    public virtual 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.

    | Edit this page View Source

    GetZ(int)

    Returns ordinate Z of the specified coordinate if available.

    Declaration
    public virtual 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 NullOrdinate if not defined.

    | Edit this page View Source

    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.

    | Edit this page View Source

    SetM(int, 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
    int 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.

    | Edit this page View Source

    SetOrdinate(int, 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
    int index

    The coordinate index in the sequence.

    Ordinate ordinate

    The ordinate value to set.

    double value

    The new ordinate value.

    | Edit this page View Source

    SetOrdinate(int, int, 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
    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.

    Remarks

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

    | Edit this page View Source

    SetX(int, 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
    int index

    The index of the coordinate whose X value to set.

    double value

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

    | Edit this page View Source

    SetY(int, 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
    int index

    The index of the coordinate whose Y value to set.

    double value

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

    | Edit this page View Source

    SetZ(int, 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
    int 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.

    | Edit this page View Source

    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[]
    | Edit this page View Source

    TryGetOrdinateIndex(Ordinate, out int)

    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.

    int 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
    bool

    true if this sequence contains ordinate; otherwise, false.

    Extension Methods

    CoordinateSequenceEx.GetHashCode(CoordinateSequence, int, Func<int, int>)

    See Also

    PackedCoordinateSequenceFactory
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX