Class Position1D

    • Field Detail

      • ordinate

        public double ordinate
        The ordinate value.
    • Constructor Detail

      • Position1D

        public Position1D()
        Constructs a position initialized to (0) with a null coordinate reference system.
      • Position1D

        public Position1D​(CoordinateReferenceSystem crs)
        Constructs a position with the specified coordinate reference system.
        Parameters:
        crs - The coordinate reference system.
      • Position1D

        public Position1D​(double ordinate)
        Constructs a 1D position from the specified ordinate.
        Parameters:
        ordinate - The ordinate value.
      • Position1D

        public Position1D​(Position point)
        Constructs a position initialized to the same values than the specified point.
        Parameters:
        point - The position to copy.
    • Method Detail

      • setCoordinateReferenceSystem

        public void setCoordinateReferenceSystem​(CoordinateReferenceSystem crs)
        Set the coordinate reference system in which the coordinate is given.
        Parameters:
        crs - The new coordinate reference system, or null.
      • getDimension

        public final int getDimension()
        The length of coordinate sequence (the number of entries). This is always 1 for DirectPosition1D objects.
        Specified by:
        getDimension in interface Position
        Returns:
        The dimensionality of this position.
      • 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
        Overrides:
        getCoordinate in class AbstractPosition
        Returns:
        The coordinates.
      • getOrdinate

        public final double getOrdinate​(int dimension)
                                 throws IndexOutOfBoundsException
        Returns the ordinate at the specified dimension.
        Specified by:
        getOrdinate in interface Position
        Parameters:
        dimension - The dimension, which must be 0.
        Returns:
        The ordinate.
        Throws:
        IndexOutOfBoundsException - if the specified dimension is out of bounds.
      • setOrdinate

        public final void setOrdinate​(int dimension,
                                      double value)
                               throws IndexOutOfBoundsException
        Sets the ordinate value along the specified dimension.
        Specified by:
        setOrdinate in interface Position
        Parameters:
        dimension - The dimension, which must be 0.
        value - the ordinate value.
        Throws:
        IndexOutOfBoundsException - if the specified dimension is out of bounds.
      • hashCode

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

        public boolean equals​(Object o)
        Description copied from class: AbstractPosition
        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 AbstractPosition
        Parameters:
        o - The object to compare with this position.
        Returns:
        true if the given object is equals to this position.
      • clone

        public Position1D clone()
        Returns a copy of this position.
        Specified by:
        clone in interface Cloneable
        Overrides:
        clone in class Object
        Returns:
        A copy of this object.
        See Also:
        Object.clone()