Statistics
| Revision:

gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.impl / src / main / java / org / gvsig / raster / cache / buffer / impl / rocache / DoubleBand.java @ 991

History | View | Annotate | Download (1.8 KB)

1
package org.gvsig.raster.cache.buffer.impl.rocache;
2

    
3
import java.util.ArrayList;
4

    
5
import org.gvsig.raster.cache.buffer.BufferDataSource;
6
import org.gvsig.raster.cache.buffer.PxTile;
7
import org.gvsig.raster.cache.buffer.exception.OperationNotSupportedException;
8
import org.gvsig.raster.cache.buffer.impl.RasterBuffer;
9

    
10
/**
11
 * This class represent a double band loaded in memory.
12
 * 
13
 * @author Nacho Brodin (nachobrodin@gmail.com)
14
 */
15
public class DoubleBand extends ReadOnlyCacheBand {
16

    
17
        public DoubleBand(ArrayList<PxTile> stripeList,
18
                        BufferDataSource dataSource, int offset, int bitsPag, int band,
19
                        int width, int height) {
20
                super(stripeList, dataSource, offset, bitsPag, band, width, height, RasterBuffer.TYPE_DOUBLE);
21
        }
22

    
23
         /*
24
     * (non-Javadoc)
25
     * @see org.gvsig.raster.buffer.IRasterBand#getDoubleBlock(int)
26
     */
27
        public double[][] getDoubleBlock(int block){
28
                if(block != loadedPage)
29
                        loadOrSwapPage(block);
30
                return page.getBand(0).getDoubleBlock(block);
31
        }
32
        
33
        /*
34
         * (non-Javadoc)
35
         * @see org.gvsig.raster.buffer.IRasterBand#getElemDouble(int, int)
36
         */
37
        public double getElemDouble(int line, int col) {
38
                int pag = line >> bitsPag;
39
                if(pag != loadedPage)
40
                        loadOrSwapPage(pag);
41
                return page.getElemDouble(line & offset, col, 0);
42
        }
43
        
44
        /*
45
         * (non-Javadoc)
46
         * @see org.gvsig.raster.buffer.IRasterBand#getDoubleLine(int)
47
         */
48
        public double[] getDoubleLine(int line) throws OperationNotSupportedException {
49
                int pag = line >> bitsPag;
50
                if(pag != loadedPage)
51
                        loadOrSwapPage(pag);
52
                return page.getLineDouble(line & offset)[0];
53
        }
54
        
55
        /*
56
         * (non-Javadoc)
57
         * @see java.lang.Object#clone()
58
         */
59
        public Object clone() {
60
                BufferDataSource ds = dataSource.clone();        
61
                DoubleBand result = new DoubleBand(stripeList, 
62
                                ds,
63
                                offset,
64
                                bitsPag,
65
                                nBand,
66
                                getWidth(),
67
                                getHeight());
68
                return result;
69
        }
70
}