Package noaa.coastwatch.util
Class ResamplingMap
java.lang.Object
noaa.coastwatch.util.ResamplingMap
A
ResamplingMap
object holds coordinate mapping data
between two 2D coordinate systems: the source and destination.
Coordinates from the destination coordinate space can be queried to map
to their corresponding nearest neighbour in the source coordinate
space. This allows for a fast nearest neighbour resampling algorithms
to run using only the map. A map covers a specific rectangular
extent of the destination coordinate extents.- Since:
- 3.5.0
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorDescriptionResamplingMap
(int[] start, int[] length, int[] rowMap, int[] colMap) Creates a new 2D resampling map. -
Method Summary
Modifier and TypeMethodDescriptionboolean
map
(int[] destCoords, int[] sourceCoords) Maps the destination coordinates to their corresponding source coordinates.
-
Constructor Details
-
ResamplingMap
public ResamplingMap(int[] start, int[] length, int[] rowMap, int[] colMap) Creates a new 2D resampling map.- Parameters:
start
- the starting map coordinates in the destination space.length
- the map length along each dimension in the destination space.rowMap
- the source coordinate row mapping from destination coordinates. The source coordinate array can contain Integer.MIN_VALUE as a flag to indicate that no mapping exists for a given destination coordinate.colMap
- the source coordinate column mapping from destination coordinates. The source coordinate array can contain Integer.MIN_VALUE as a flag to indicate that no mapping exists for a given destination coordinate.
-
-
Method Details
-
map
public boolean map(int[] destCoords, int[] sourceCoords) Maps the destination coordinates to their corresponding source coordinates.- Parameters:
destCoords
- the destination coordinates to map as [row, col]. The coordinates must be within the destination space extents defined by the map.sourceCoords
- the source coordinates as [row, col] (modified).- Returns:
- true if the mapping exists from destination coordinates, or false if not. If false, the values in the sourceCoords array are undefined.
-