Class Position

  • Direct Known Subclasses:
    C2D, G2D, M, V

    public abstract class Position
    extends Object
    Represents a position in a coordinate system.

    A Position is represented by an array of coordinates. There must be at least two coordinates.

    The order of coordinates must follow the order: x, y, z, measure (easting, northing, altitude, measure) for coordinates in a projected coordinate reference system, or longitude, latitude, altitude, measure for coordinates in a geographic coordinate reference system).

    Usually the first coordinate value (X or Lon) increases along an EAST axis direction, and the second (Y or Lat) along an NORTH axis direction. In some projected coordinate systems, such as those used in South-Africa, the orientation is WEST for the first and SOUTH for the second coordinate value. To be sure of the interpretation of the first and second coordinate, you can inspect the CoordinateReferenceSystem used with the Position.

    Author:
    Karel Maesen, Geovise BVBA creation-date: 2/19/14
    • Field Detail

      • coords

        protected final double[] coords
    • Constructor Detail

      • Position

        protected Position​(double... coords)
        Constructs an instance with the specified coordinates
        Parameters:
        coords -
    • Method Detail

      • toArray

        public double[] toArray​(double[] dest)
        Copies the coordinates of this Position in the specified Array, in normal order.

        If the array is null or smaller than the coordinate dimension, then a new Array instance will be created.

        Parameters:
        dest - the recipient of the coordinates of this instance (if large enough)
        Returns:
        an array (possibly the same instance as specified by dest) holding the coordinates of this Position
      • getCoordinateDimension

        public abstract int getCoordinateDimension()
      • isEmpty

        public boolean isEmpty()
      • getCoordinate

        public double getCoordinate​(int idx)
        Returns the coordinate at the specified index

        Note that the index here refers to the coordinates ordered in a normalized order.

        Parameters:
        idx - the index of the coordinate (0-based)
        Returns:
        the coordinate value at the specified index.
      • getCoordinate

        @Deprecated
        public double getCoordinate​(CoordinateSystemAxis axis,
                                    CoordinateReferenceSystem<?> crs)
        Deprecated.
        Gets the coordinate value for the specified axis
        Parameters:
        axis - the CoordinateSystemAxis for which to get the coordinate
        Returns:
        the coordinate value for the specified axis
        Throws:
        IllegalArgumentException - if the specified axis is not present in the CoordinateReferenceSystem of this instance
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object