Package uk.ac.rdg.resc.edal.dataset
Class Domain2DMapper
- java.lang.Object
-
- uk.ac.rdg.resc.edal.dataset.DomainMapper<int[]>
-
- uk.ac.rdg.resc.edal.dataset.Domain2DMapper
-
- All Implemented Interfaces:
Iterable<DomainMapper.DomainMapperEntry<int[]>>
public class Domain2DMapper extends DomainMapper<int[]>
This is an implementation of aDomainMapper
which maps 2D indices from a source grid onto a pair of integers (asint[]
) in the target domain. The first element of the returned array represents the x-component. The second element of the returned array represents the y-component. It also includes a static methodforGrid(HorizontalGrid, HorizontalGrid)
which generates aDomain2DMapper
from a source and a target grid, which uses cache of recent grids - creating aDomain2DMapper
is not a particularly efficient operation and generally gets called very regularly for identical grids, particularly in a tiled WMS setting- Author:
- Guy Griffiths
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Domain2DMapper.Domain2DMapperCacheKey
-
Nested classes/interfaces inherited from class uk.ac.rdg.resc.edal.dataset.DomainMapper
DomainMapper.DomainMapperEntry<P>, DomainMapper.Scanline<P>
-
-
Field Summary
-
Fields inherited from class uk.ac.rdg.resc.edal.dataset.DomainMapper
log
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int[]
convertIndexToCoordType(int index)
This performs the conversion from a single long index into whatever coordinate type is required.static Domain2DMapper
forGrid(HorizontalGrid sourceGrid, HorizontalGrid targetGrid)
Initialises aDomain2DMapper
from a source and a target grid.int
getTargetXSize()
Gets the x-size of the target gridint
getTargetYSize()
Gets the y-size of the target grid-
Methods inherited from class uk.ac.rdg.resc.edal.dataset.DomainMapper
equals, getBoundingBoxSize, getMaxIIndex, getMaxJIndex, getMinIIndex, getMinJIndex, getNumUniqueIJPairs, getTargetDomainSize, hashCode, isEmpty, iterator, put, scanlineIterator, sortIndices
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
convertIndexToCoordType
protected int[] convertIndexToCoordType(int index)
Description copied from class:DomainMapper
This performs the conversion from a single long index into whatever coordinate type is required. The simplest example would be to simply return the index for a 1D array (seeDomain1DMapper
for this). TODO This currently takes an int. Do we want to support target domains which are bigger than Integer.MAX_VALUE?- Specified by:
convertIndexToCoordType
in classDomainMapper<int[]>
- Parameters:
index
- The index to convert to a co-ordinate- Returns:
- The co-ordinate represented by the index
-
getTargetXSize
public int getTargetXSize()
Gets the x-size of the target grid
-
getTargetYSize
public int getTargetYSize()
Gets the y-size of the target grid
-
forGrid
public static Domain2DMapper forGrid(HorizontalGrid sourceGrid, HorizontalGrid targetGrid)
Initialises aDomain2DMapper
from a source and a target grid.- Parameters:
sourceGrid
- AHorizontalGrid
representing the domain of the source datatargetGrid
- AHorizontalGrid
representing the domain of the target- Returns:
- A
Domain2DMapper
performing the mapping
-
-