gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.impl / deprecated / buffer / impl / rocache / ShortBand.java @ 1939
History | View | Annotate | Download (1.77 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.Buffer; |
7 |
import org.gvsig.raster.cache.buffer.PxTile; |
8 |
import org.gvsig.raster.cache.buffer.exception.OperationNotSupportedException; |
9 |
|
10 |
/**
|
11 |
* This class represent a short band loaded in memory.
|
12 |
*
|
13 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
14 |
*/
|
15 |
public class ShortBand extends ReadOnlyCacheBand { |
16 |
|
17 |
public ShortBand(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, Buffer.TYPE_SHORT); |
21 |
} |
22 |
|
23 |
/*
|
24 |
* (non-Javadoc)
|
25 |
* @see org.gvsig.raster.buffer.IRasterBand#getShortBlock(int)
|
26 |
*/
|
27 |
public short[][] getShortBlock(int block){ |
28 |
if(block != loadedPage)
|
29 |
loadOrSwapPage(block); |
30 |
return page.getBand(0).getShortBlock(block); |
31 |
} |
32 |
|
33 |
/*
|
34 |
* (non-Javadoc)
|
35 |
* @see org.gvsig.raster.buffer.IRasterBand#getElemShort(int, int)
|
36 |
*/
|
37 |
public short getElemShort(int line, int col) { |
38 |
int pag = line >> bitsPag;
|
39 |
if(pag != loadedPage)
|
40 |
loadOrSwapPage(pag); |
41 |
return page.getElemShort(line & offset, col, 0); |
42 |
} |
43 |
|
44 |
/*
|
45 |
* (non-Javadoc)
|
46 |
* @see org.gvsig.raster.buffer.IRasterBand#getShortLine(int)
|
47 |
*/
|
48 |
public short[] getShortLine(int line) throws OperationNotSupportedException { |
49 |
int pag = line >> bitsPag;
|
50 |
if(pag != loadedPage)
|
51 |
loadOrSwapPage(pag); |
52 |
return page.getLineShort(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 |
ShortBand result = new ShortBand(stripeList,
|
62 |
ds, |
63 |
offset, |
64 |
bitsPag, |
65 |
nBand, |
66 |
getWidth(), |
67 |
getHeight()); |
68 |
return result;
|
69 |
} |
70 |
} |