Class DatumShiftGridFile.Float<C extends javax.measure.Quantity<C>,T extends javax.measure.Quantity<T>>
java.lang.Object
org.apache.sis.referencing.datum.DatumShiftGrid<C,T>
org.apache.sis.internal.referencing.provider.DatumShiftGridFile<C,T>
org.apache.sis.internal.referencing.provider.DatumShiftGridFile.Float<C,T>
- All Implemented Interfaces:
Serializable
- Enclosing class:
- DatumShiftGridFile<C extends javax.measure.Quantity<C>,
T extends javax.measure.Quantity<T>>
static final class DatumShiftGridFile.Float<C extends javax.measure.Quantity<C>,T extends javax.measure.Quantity<T>>
extends DatumShiftGridFile<C,T>
An implementation of
DatumShiftGridFile
which stores the offset values in float[]
arrays.
This class is in internal package (not public API) because it makes the following assumptions:
- Values x₀, y₀, Δx and Δy given to the constructor are in degrees and needs to be converted to radians.
- Single floating-point precision (
float)
is sufficient. - Values were defined in base 10, usually in ASCII files. This assumption has an impact on conversions
from
float
todouble
performed by thegetCellValue(int, int, int)
method.
- Since:
- 0.7
- Version:
- 0.7
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.internal.referencing.provider.DatumShiftGridFile
DatumShiftGridFile.Double<C extends javax.measure.Quantity<C>,
T extends javax.measure.Quantity<T>>, DatumShiftGridFile.Float<C extends javax.measure.Quantity<C>, T extends javax.measure.Quantity<T>> -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final float[][]
The translation values.private static final long
Serial number for inter-operability with different versions.Fields inherited from class org.apache.sis.internal.referencing.provider.DatumShiftGridFile
accuracy, CACHE, scanlineStride, subgrids
Fields inherited from class org.apache.sis.referencing.datum.DatumShiftGrid
INTERPOLATED_DIMENSIONS
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
Float
(int dim, javax.measure.Unit<C> coordinateUnit, javax.measure.Unit<T> translationUnit, boolean isCellValueRatio, double x0, double y0, double Δx, double Δy, int nx, int ny, org.opengis.parameter.ParameterDescriptorGroup descriptor, Path... files) Creates a new datum shift grid with the given grid geometry, filename and number of shift dimensions.private
Float
(DatumShiftGridFile<C, T> grid, float[][] offsets) Creates a new grid of the same geometry than the given grid but using a different data array. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getCellMean
(int dim) Returns the average translation parameters from source to target.final double
getCellValue
(int dim, int gridX, int gridY) Returns the cell value at the given dimension and grid index.protected final Object[]
getData()
Returns direct references (not cloned) to the data arrays.final int
Returns the number of shift dimensions.protected final DatumShiftGridFile<C,
T> Returns a new grid with the same geometry than this grid but different data arrays.Methods inherited from class org.apache.sis.internal.referencing.provider.DatumShiftGridFile
castTo, createGeodeticTransformation, equals, getCellPrecision, getParameterDescriptors, getParameterValues, hashCode, replaceOutsideGridCoordinates, setSubGrids, toString, useSharedData
Methods inherited from class org.apache.sis.referencing.datum.DatumShiftGrid
derivativeInCell, getCoordinateToGrid, getCoordinateUnit, getDomainOfValidity, getDomainOfValidity, getGridSize, getGridSize, getTranslationUnit, interpolateAt, interpolateInCell, isCellInGrid, isCellValueRatio
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for inter-operability with different versions.- See Also:
-
offsets
final float[][] offsetsThe translation values.offsets.length
is the number of dimensions, andoffsets[dim].length
shall be the same for alldim
value. Componentdim
of the translation vector at coordinategridX
,gridY
isoffsets[dim][gridX + gridY*scanlineStride]
.
-
-
Constructor Details
-
Float
Float(int dim, javax.measure.Unit<C> coordinateUnit, javax.measure.Unit<T> translationUnit, boolean isCellValueRatio, double x0, double y0, double Δx, double Δy, int nx, int ny, org.opengis.parameter.ParameterDescriptorGroup descriptor, Path... files) throws org.opengis.referencing.operation.NoninvertibleTransformException Creates a new datum shift grid with the given grid geometry, filename and number of shift dimensions. Alldouble
values given to this constructor will be converted from degrees to radians.- Parameters:
dim
- number of dimensions of translation vectors.- Throws:
org.opengis.referencing.operation.NoninvertibleTransformException
-
Float
Creates a new grid of the same geometry than the given grid but using a different data array.
-
-
Method Details
-
setData
Returns a new grid with the same geometry than this grid but different data arrays. This method is invoked byDatumShiftGridFile.useSharedData()
when it detects that a newly created grid uses the same data than an existing grid. Theother
object is the old grid, so we can share existing data. -
getData
Returns direct references (not cloned) to the data arrays. This method is for cache management,DatumShiftGridFile.equals(Object)
andDatumShiftGridFile.hashCode()
implementations only and should not be invoked in other context. -
getTranslationDimensions
public final int getTranslationDimensions()Returns the number of shift dimensions.- Specified by:
getTranslationDimensions
in classDatumShiftGrid<C extends javax.measure.Quantity<C>,
T extends javax.measure.Quantity<T>> - Returns:
- number of dimensions of translation vectors.
-
getCellValue
public final double getCellValue(int dim, int gridX, int gridY) Returns the cell value at the given dimension and grid index. This method casts thefloat
values todouble
by setting the extra decimal digits (not the binary digits) to 0. This is on the assumption that thefloat
values were parsed from an ASCII file, or any other medium that format numbers in base 10.- Specified by:
getCellValue
in classDatumShiftGrid<C extends javax.measure.Quantity<C>,
T extends javax.measure.Quantity<T>> - Parameters:
dim
- the dimension for which to get an average value.gridX
- the grid index along the x axis, from 0 inclusive tonx
exclusive.gridY
- the grid index along the y axis, from 0 inclusive tony
exclusive.- Returns:
- the offset at the given dimension in the grid cell at the given index.
-
getCellMean
public double getCellMean(int dim) Returns the average translation parameters from source to target. There is no need to use double-double arithmetic here since all data have only single precision.- Overrides:
getCellMean
in classDatumShiftGrid<C extends javax.measure.Quantity<C>,
T extends javax.measure.Quantity<T>> - Parameters:
dim
- the dimension for which to get an average value.- Returns:
- a value close to the average for the given dimension.
-