Class Domain2DMapper

  • All Implemented Interfaces:
    Iterable<DomainMapper.DomainMapperEntry<int[]>>

    public class Domain2DMapper
    extends DomainMapper<int[]>
    This is an implementation of a DomainMapper which maps 2D indices from a source grid onto a pair of integers (as int[]) 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 method forGrid(HorizontalGrid, HorizontalGrid) which generates a Domain2DMapper from a source and a target grid, which uses cache of recent grids - creating a Domain2DMapper is not a particularly efficient operation and generally gets called very regularly for identical grids, particularly in a tiled WMS setting
    Author:
    Guy Griffiths
    • 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 (see Domain1DMapper 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 class DomainMapper<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