Class AbstractPosition

    • Constructor Detail

      • AbstractPosition

        protected AbstractPosition()
        Constructs a direct position.
    • Method Detail

      • getDirectPosition

        public Position getDirectPosition()
        Returns always this, the direct position for this position.
        Specified by:
        getDirectPosition in interface Position
        Returns:
        The direct position (may be this).
        Since:
        2.5
      • setPosition

        public void setPosition​(Position position)
        Sets this direct position to the given position. If the given position is null, then all ordinate values are set to NaN.
        Parameters:
        position - The new position.
        Since:
        2.5
      • getCoordinate

        public double[] getCoordinate()
        Returns a sequence of numbers that hold the coordinate of this position in its reference system.
        Specified by:
        getCoordinate in interface Position
        Returns:
        The coordinates.
      • checkCoordinateReferenceSystemDimension

        public static void checkCoordinateReferenceSystemDimension​(CoordinateReferenceSystem crs,
                                                                   int expected)
                                                            throws MismatchedDimensionException
        Convenience method for checking coordinate reference system validity.
        Parameters:
        crs - The coordinate reference system to check.
        expected - the dimension expected.
        Throws:
        MismatchedDimensionException - if the CRS dimension is not valid.
      • toString

        public String toString()
        Returns a string representation of this coordinate. The default implementation is okay for occasional formatting (for example for debugging purpose). But if there is a lot of positions to format, users will get more control by using their own instance of CoordinateFormat.
        Overrides:
        toString in class Object
      • hashCode

        public int hashCode()
        Returns a hash value for this coordinate.
        Specified by:
        hashCode in interface Position
        Overrides:
        hashCode in class Object
        Returns:
        A hash code value for this position.
      • equals

        public boolean equals​(Object object)
        Returns true if the specified object is also a direct position with equals coordinate and CRS.
        Specified by:
        equals in interface Position
        Overrides:
        equals in class Object
        Parameters:
        object - The object to compare with this position.
        Returns:
        true if the given object is equals to this position.