Class FractionalGridCoordinates.Position

java.lang.Object
org.apache.sis.coverage.grid.FractionalGridCoordinates
org.apache.sis.coverage.grid.FractionalGridCoordinates.Position
All Implemented Interfaces:
Serializable, org.opengis.geometry.coordinate.Position, org.opengis.geometry.DirectPosition
Enclosing class:
FractionalGridCoordinates

static final class FractionalGridCoordinates.Position extends FractionalGridCoordinates implements org.opengis.geometry.DirectPosition
A grid coordinates viewed as a DirectPosition. This class is used only for coordinate transformation. We do not want to make this class public in order to avoid the abuse of DirectPosition as a storage of grid coordinates.

Note this this class does not comply with the contract documented in DirectPosition.equals(Object) and DirectPosition.hashCode() javadoc. This is another reason for not making this class public.

Since:
1.1
Version:
1.2
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
  • Constructor Details

    • Position

      Position(int dimension)
      Creates a new position of the given number of dimensions.
    • Position

      Position(FractionalGridCoordinates other)
      Creates a new position initialized to a copy of the given coordinates.
  • Method Details

    • getDirectPosition

      public org.opengis.geometry.DirectPosition getDirectPosition()
      Returns the direct position, which is this object itself.
      Specified by:
      getDirectPosition in interface org.opengis.geometry.coordinate.Position
    • getCoordinateReferenceSystem

      public org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
      Grid coordinates have no coordinate reference system.
      Specified by:
      getCoordinateReferenceSystem in interface org.opengis.geometry.DirectPosition
    • getCoordinate

      public double[] getCoordinate()
      Returns all coordinate values.
      Specified by:
      getCoordinate in interface org.opengis.geometry.DirectPosition
    • getOrdinate

      public double getOrdinate(int dimension)
      Returns the coordinate value at the given dimension.
      Specified by:
      getOrdinate in interface org.opengis.geometry.DirectPosition
    • setOrdinate

      public void setOrdinate(int dimension, double value)
      Sets the coordinate value at the given dimension.
      Specified by:
      setOrdinate in interface org.opengis.geometry.DirectPosition
    • toPosition

      public org.opengis.geometry.DirectPosition toPosition(org.opengis.referencing.operation.MathTransform gridToCRS) throws org.opengis.referencing.operation.TransformException
      Returns the grid coordinates converted to a geospatial position using the given transform.
      Overrides:
      toPosition in class FractionalGridCoordinates
      Parameters:
      gridToCRS - the transform to apply on grid coordinates.
      Returns:
      the grid coordinates converted using the given transform.
      Throws:
      org.opengis.referencing.operation.TransformException - if the grid coordinates cannot be converted by gridToCRS.
      See Also: