Statistics
| Revision:

gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.impl / deprecated / buffer / impl / rocache / IntBand.java @ 1939

History | View | Annotate | Download (1.75 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 int band loaded in memory.
12
 * 
13
 * @author Nacho Brodin (nachobrodin@gmail.com)
14
 */
15
public class IntBand extends ReadOnlyCacheBand {
16

    
17
        public IntBand(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_INT);
21
        }
22

    
23
         /*
24
     * (non-Javadoc)
25
     * @see org.gvsig.raster.buffer.IRasterBand#getIntBlock(int)
26
     */
27
        public int[][] getIntBlock(int block){
28
                if(block != loadedPage)
29
                        loadOrSwapPage(block);
30
                return page.getBand(0).getIntBlock(block);
31
        }
32
        
33
        /*
34
         * (non-Javadoc)
35
         * @see org.gvsig.raster.buffer.IRasterBand#getElemInt(int, int)
36
         */
37
        public int getElemInt(int line, int col) {
38
                int pag = line >> bitsPag;
39
                if(pag != loadedPage)
40
                        loadOrSwapPage(pag);
41
                return page.getElemInt(line & offset, col, 0);
42
        }
43
        
44
        /*
45
         * (non-Javadoc)
46
         * @see org.gvsig.raster.buffer.IRasterBand#getIntLine(int)
47
         */
48
        public int[] getIntLine(int line) throws OperationNotSupportedException {
49
                int pag = line >> bitsPag;
50
                if(pag != loadedPage)
51
                        loadOrSwapPage(pag);
52
                return page.getLineInt(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
                IntBand result = new IntBand(stripeList, 
62
                                ds,
63
                                offset,
64
                                bitsPag,
65
                                nBand,
66
                                getWidth(),
67
                                getHeight());
68
                return result;
69
        }
70
}