Search Results for

    Show / Hide Table of Contents

    Class CoordinateArrays

    Useful utility functions for handling Coordinate arrays.

    Inheritance
    object
    CoordinateArrays
    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
    public static class CoordinateArrays

    Methods

    | Edit this page View Source

    AtLeastNCoordinatesOrNothing(int, Coordinate[])

    Returns either the given coordinate array if its length is greater than the given amount, or an empty coordinate array.

    Declaration
    public static Coordinate[] AtLeastNCoordinatesOrNothing(int n, Coordinate[] c)
    Parameters
    Type Name Description
    int n

    Length amount.

    Coordinate[] c

    Array of Coordinates.

    Returns
    Type Description
    Coordinate[]

    New Coordinate array.

    | Edit this page View Source

    Compare(Coordinate[], Coordinate[])

    Compares two Coordinate arrays in the forward direction of their coordinates, using lexicographic ordering.

    Declaration
    public static int Compare(Coordinate[] pts1, Coordinate[] pts2)
    Parameters
    Type Name Description
    Coordinate[] pts1
    Coordinate[] pts2
    Returns
    Type Description
    int
    | Edit this page View Source

    CopyDeep(Coordinate[])

    Creates a deep copy of the argument Coordinate array.

    Declaration
    public static Coordinate[] CopyDeep(Coordinate[] coordinates)
    Parameters
    Type Name Description
    Coordinate[] coordinates

    Array of Coordinates.

    Returns
    Type Description
    Coordinate[]

    Deep copy of the input.

    | Edit this page View Source

    CopyDeep(Coordinate[], int, Coordinate[], int, int)

    Creates a deep copy of a given section of a source Coordinate array into a destination Coordinate array. The destination array must be an appropriate size to receive the copied coordinates.

    Declaration
    public static void CopyDeep(Coordinate[] src, int srcStart, Coordinate[] dest, int destStart, int length)
    Parameters
    Type Name Description
    Coordinate[] src

    An array of Coordinates

    int srcStart

    The index to start copying from

    Coordinate[] dest

    The array to receive the deep-copied coordinates

    int destStart

    The destination index to start copying to

    int length

    The number of items to copy

    | Edit this page View Source

    Dimension(Coordinate[])

    Determine dimension based on subclass of Coordinate.

    Declaration
    public static int Dimension(Coordinate[] pts)
    Parameters
    Type Name Description
    Coordinate[] pts

    pts supplied coordinates

    Returns
    Type Description
    int

    number of ordinates recorded

    | Edit this page View Source

    EnforceConsistency(Coordinate[])

    Utility method ensuring array contents are of consistent dimension and measures.

    Array is modified in place if required, coordinates are replaced in the array as required to ensure all coordinates have the same dimension and measures. The final dimension and measures used are the maximum found when checking the array.
    Declaration
    public static void EnforceConsistency(Coordinate[] array)
    Parameters
    Type Name Description
    Coordinate[] array

    Modified in place to coordinates of consistent dimension and measures.

    | Edit this page View Source

    EnforceConsistency(Coordinate[], int, int)

    Utility method ensuring array contents are of the specified dimension and measures.

    Array is returned unmodified if consistent, or a copy of the array is made with each inconsistent coordinate duplicated into an instance of the correct dimension and measures.
    Declaration
    public static Coordinate[] EnforceConsistency(Coordinate[] array, int dimension, int measures)
    Parameters
    Type Name Description
    Coordinate[] array

    A coordinate array

    int dimension
    int measures
    Returns
    Type Description
    Coordinate[]

    Input array or copy created if required to enforce consistency.

    | Edit this page View Source

    Envelope(Coordinate[])

    Computes the Envelope(Coordinate[]) of the coordinates.

    Declaration
    public static Envelope Envelope(Coordinate[] coordinates)
    Parameters
    Type Name Description
    Coordinate[] coordinates

    the Coordinate array to scan.

    Returns
    Type Description
    Envelope

    the Envelope(Coordinate[]) of the coordinates.

    | Edit this page View Source

    Equals(Coordinate[], Coordinate[])

    Returns true if the two arrays are identical, both null, or pointwise equal (as compared using Coordinate.Equals).

    Declaration
    public static bool Equals(Coordinate[] coord1, Coordinate[] coord2)
    Parameters
    Type Name Description
    Coordinate[] coord1

    First array of Coordinates.

    Coordinate[] coord2

    Second array of Coordinates.

    Returns
    Type Description
    bool

    true if two Coordinates array are equals; false otherwise

    | Edit this page View Source

    Equals(Coordinate[], Coordinate[], IComparer<Coordinate[]>)

    Returns true if the two arrays are identical, both null, or pointwise equal, using a user-defined IComparer for Coordinates.

    Declaration
    public static bool Equals(Coordinate[] coord1, Coordinate[] coord2, IComparer<Coordinate[]> coordinateComparer)
    Parameters
    Type Name Description
    Coordinate[] coord1

    An array of Coordinates.

    Coordinate[] coord2

    Another array of Coordinates.

    IComparer<Coordinate[]> coordinateComparer

    A IComparer for Coordinates.

    Returns
    Type Description
    bool
    | Edit this page View Source

    Extract(Coordinate[], int, int)

    Extracts a subsequence of the input Coordinate array from indices start to end (inclusive). The input indices are clamped to the array size; If the end index is less than the start index, the extracted array will be empty.

    Declaration
    public static Coordinate[] Extract(Coordinate[] pts, int start, int end)
    Parameters
    Type Name Description
    Coordinate[] pts

    The input array.

    int start

    The index of the start of the subsequence to extract.

    int end

    The index of the end of the subsequence to extract.

    Returns
    Type Description
    Coordinate[]

    A subsequence of the input array.

    | Edit this page View Source

    HasRepeatedOrInvalidPoints(Coordinate[])

    Tests whether an array has any repeated or invalid coordinates.

    Declaration
    public static bool HasRepeatedOrInvalidPoints(Coordinate[] coord)
    Parameters
    Type Name Description
    Coordinate[] coord

    An array of coordinates

    Returns
    Type Description
    bool

    true if the array contains repeated or invalid coordinates

    | Edit this page View Source

    HasRepeatedPoints(Coordinate[])

    Returns whether Equals(object) returns true for any two consecutive coordinates in the given array.

    Declaration
    public static bool HasRepeatedPoints(Coordinate[] coord)
    Parameters
    Type Name Description
    Coordinate[] coord

    An array of Coordinates.

    Returns
    Type Description
    bool

    true if coord has repeated points; false otherwise.

    | Edit this page View Source

    IncreasingDirection(Coordinate[])

    Determines which orientation of the Coordinate array is (overall) increasing. In other words, determines which end of the array is "smaller" (using the standard ordering on Coordinate). Returns an integer indicating the increasing direction. If the sequence is a palindrome, it is defined to be oriented in a positive direction.

    Declaration
    public static int IncreasingDirection(Coordinate[] pts)
    Parameters
    Type Name Description
    Coordinate[] pts

    The array of Coordinates to test.

    Returns
    Type Description
    int

    1 if the array is smaller at the start or is a palindrome, -1 if smaller at the end.

    | Edit this page View Source

    IndexOf(Coordinate, Coordinate[])

    Returns the index of coordinate in coordinates. The first position is 0; the second is 1; etc.

    Declaration
    public static int IndexOf(Coordinate coordinate, Coordinate[] coordinates)
    Parameters
    Type Name Description
    Coordinate coordinate

    A Coordinate to search for.

    Coordinate[] coordinates

    A Coordinate array to search.

    Returns
    Type Description
    int

    The position of coordinate, or -1 if it is not found.

    | Edit this page View Source

    Intersection(Coordinate[], Envelope)

    Extracts the coordinates which intersect an Envelope(Coordinate[]).

    Declaration
    public static Coordinate[] Intersection(Coordinate[] coordinates, Envelope env)
    Parameters
    Type Name Description
    Coordinate[] coordinates

    The coordinates to scan

    Envelope env

    The envelope to intersect with

    Returns
    Type Description
    Coordinate[]

    An array of coordinates which intersect with the envelope

    | Edit this page View Source

    IsRing(Coordinate[])

    Tests whether an array of Coordinates forms a ring, by checking length and closure. Self-intersection is not checked.

    Declaration
    public static bool IsRing(Coordinate[] pts)
    Parameters
    Type Name Description
    Coordinate[] pts

    An array of Coordinates

    Returns
    Type Description
    bool

    true if the coordinate form a ring.

    | Edit this page View Source

    Measures(Coordinate[])

    Determine number of measures based on subclass of Coordinate.

    Declaration
    public static int Measures(Coordinate[] pts)
    Parameters
    Type Name Description
    Coordinate[] pts

    supplied coordinates

    Returns
    Type Description
    int

    number of measures recorded

    | Edit this page View Source

    MinCoordinate(Coordinate[])

    Returns the minimum coordinate, using the usual lexicographic comparison.

    Declaration
    public static Coordinate MinCoordinate(Coordinate[] coordinates)
    Parameters
    Type Name Description
    Coordinate[] coordinates

    Array to search.

    Returns
    Type Description
    Coordinate

    The minimum coordinate in the array, found using CompareTo.

    | Edit this page View Source

    PointNotInList(Coordinate[], Coordinate[])

    Finds a Coordinate in a list of Coordinates which is not contained in another list of Coordinates.

    Declaration
    public static Coordinate PointNotInList(Coordinate[] testPts, Coordinate[] pts)
    Parameters
    Type Name Description
    Coordinate[] testPts

    The Coordinates to test.

    Coordinate[] pts

    An array of Coordinates to test the input points against.

    Returns
    Type Description
    Coordinate

    A Coordinate from testPts which is not in pts, or null.

    | Edit this page View Source

    RemoveNull(Coordinate[])

    Collapses a coordinate array to remove all null elements.

    Declaration
    public static Coordinate[] RemoveNull(Coordinate[] coord)
    Parameters
    Type Name Description
    Coordinate[] coord

    The coordinate array to collapse

    Returns
    Type Description
    Coordinate[]

    An Array containing only non-null elements

    | Edit this page View Source

    RemoveRepeatedOrInvalidPoints(Coordinate[])

    If the coordinate array argument has repeated or invalid points, constructs a new array containing no repeated points. Otherwise, returns the argument.

    Declaration
    public static Coordinate[] RemoveRepeatedOrInvalidPoints(Coordinate[] coord)
    Parameters
    Type Name Description
    Coordinate[] coord

    An array of coordinates

    Returns
    Type Description
    Coordinate[]

    The array with repeated or invalid coordinates removed.

    | Edit this page View Source

    RemoveRepeatedPoints(Coordinate[])

    If the coordinate array argument has repeated points, constructs a new array containing no repeated points. Otherwise, returns the argument.

    Declaration
    public static Coordinate[] RemoveRepeatedPoints(Coordinate[] coord)
    Parameters
    Type Name Description
    Coordinate[] coord

    An array of Coordinates

    Returns
    Type Description
    Coordinate[]

    The array with repeated coordinates removed

    | Edit this page View Source

    Reverse(Coordinate[])

    Reverses the coordinates in an array in-place.

    Declaration
    public static void Reverse(Coordinate[] coord)
    Parameters
    Type Name Description
    Coordinate[] coord

    Array of Coordinates.

    | Edit this page View Source

    Scroll(Coordinate[], Coordinate)

    Shifts the positions of the coordinates until firstCoordinate is first.

    Declaration
    public static void Scroll(Coordinate[] coordinates, Coordinate firstCoordinate)
    Parameters
    Type Name Description
    Coordinate[] coordinates

    Array to rearrange.

    Coordinate firstCoordinate

    Coordinate to make first.

    | Edit this page View Source

    Scroll(Coordinate[], int)

    Shifts the positions of the coordinates until the coordinate at indexOfFirstCoordinate is first.

    Declaration
    public static void Scroll(Coordinate[] coordinates, int indexOfFirstCoordinate)
    Parameters
    Type Name Description
    Coordinate[] coordinates

    The array of coordinates to arrange

    int indexOfFirstCoordinate

    The index of the coordinate to make first

    | Edit this page View Source

    Scroll(Coordinate[], int, bool)

    Shifts the positions of the coordinates until the coordinate at indexOfFirstCoordinate is first.

    Declaration
    public static void Scroll(Coordinate[] coordinates, int indexOfFirstCoordinate, bool ensureRing)
    Parameters
    Type Name Description
    Coordinate[] coordinates

    The array of coordinates to arrange

    int indexOfFirstCoordinate

    The index of the coordinate to make first

    bool ensureRing

    A flag indicating if returned array should form a ring.

    Remarks

    If ensureRing is true, first and last coordinate of the returned array are equal.

    | Edit this page View Source

    ToCoordinateArray(IEnumerable<Coordinate>)

    Converts the given IEnumerable<T> of Coordinates into a Coordinate array.

    Declaration
    public static Coordinate[] ToCoordinateArray(IEnumerable<Coordinate> coordList)
    Parameters
    Type Name Description
    IEnumerable<Coordinate> coordList

    IEnumerable<T> of coordinates.

    Returns
    Type Description
    Coordinate[]
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX