Class AbstractDirectPosition

    • Constructor Detail

      • AbstractDirectPosition

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

      • castOrCopy

        public static AbstractDirectPosition castOrCopy​(DirectPosition position)
        Returns the given position as an Abstract­Direct­Position instance. If the given position is already an instance of Abstract­Direct­Position, then it is returned unchanged. Otherwise the coordinate values and the CRS of the given position are copied in a new position.
        Parameters:
        position - the position to cast, or null.
        Returns:
        the values of the given position as an Abstract­Direct­Position instance.
        Since:
        1.0
      • getCoordinate

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

        public boolean normalize()
        Ensures that the position is contained in the coordinate system domain. For each dimension, this method compares the coordinate values against the limits of the coordinate system axis for that dimension. If some coordinates are out of range, then there is a choice depending on the axis range meaning:
        Returns:
        true if this position has been modified as a result of this method call, or false if no change has been done.
        See Also:
        General­Envelope​.normalize()
      • formatTo

        protected String formatTo​(Formatter formatter)
        Formats this position in the Well Known Text (WKT) format. The format is like below, where x₀, x₁, x₂, etc. are the coordinate values at index 0, 1, 2, etc.:
        POINT[x₀ x₁ x₂ …]
        If the coordinate reference system is geodetic or projected, then coordinate values are formatted with a precision equivalent to one centimetre on Earth (the actual number of fraction digits is adjusted for the axis unit of measurement and the planet size if different than Earth).
        Specified by:
        format­To in class Formattable­Object
        Parameters:
        formatter - the formatter where to format the inner content of this point.
        Returns:
        the WKT keyword, which is "Point" for this element.
        Since:
        1.0
        See Also:
        Formattable­Object​.to­WKT(), Formattable­Object​.to­String()
      • toString

        public String toString()
        Formats this position in the Well Known Text (WKT) format. The returned string is like below, where x₀, x₁, x₂, etc. are the coordinate values at index 0, 1, 2, etc.:
        POINT(x₀ x₁ x₂ …)
        This method formats the numbers as with Double​.to­String(double) (i.e. without fixed number of fraction digits). The string returned by this method can be parsed by the General­Direct­Position constructor.
        Overrides:
        to­String in class Formattable­Object
        Returns:
        this position as a POINT in Well Known Text (WKT) format.
      • hashCode

        public int hashCode()
        Returns a hash value for this coordinate tuple. This method returns a value compliant with the contract documented in the Direct­Position​.hash­Code() javadoc. Consequently, it should be possible to mix different Direct­Position implementations in the same hash map.
        Specified by:
        hash­Code in interface Direct­Position
        Overrides:
        hash­Code 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 equal coordinates and equal CRS. This method performs the comparison as documented in the Direct­Position​.equals(Object) javadoc. In particular, the given object is not required to be of the same implementation class. Consequently, it should be possible to mix different Direct­Position implementations in the same hash map.
        Specified by:
        equals in interface Direct­Position
        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare with this position.
        Returns:
        true if the given object is equal to this position.