Revision 6343
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.tilecache/org.gvsig.raster.tilecache.provider/src/main/java/org/gvsig/raster/tilecache/provider/TileCacheBandPageManager.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.IOException; |
4 | 4 |
import java.nio.Buffer; |
5 |
import java.nio.ByteBuffer; |
|
6 |
import java.nio.DoubleBuffer; |
|
7 |
import java.nio.FloatBuffer; |
|
8 |
import java.nio.IntBuffer; |
|
9 |
import java.nio.ShortBuffer; |
|
10 | 5 |
|
11 | 6 |
import org.gvsig.raster.lib.buffer.api.BandInfo; |
12 |
import org.gvsig.raster.lib.buffer.api.BandPageManager; |
|
13 | 7 |
import org.gvsig.raster.lib.buffer.api.BandTileManager; |
14 |
import org.gvsig.raster.lib.buffer.api.BufferLocator; |
|
15 |
import org.gvsig.raster.lib.buffer.api.BufferManager; |
|
16 | 8 |
|
17 | 9 |
/** |
18 | 10 |
* Band Page Managaer for a Memory Image |
... | ... | |
23 | 15 |
|
24 | 16 |
private TileStructImage tileStructImage; |
25 | 17 |
private int band; |
26 |
private int dataSize = -1; |
|
27 |
private int dataType = BufferManager.TYPE_UNDEFINED; |
|
28 |
private double pixelSize; |
|
29 | 18 |
private int zoomLevel; |
30 | 19 |
|
31 | 20 |
/** |
32 |
* @param image |
|
21 |
* @param tileStructImage |
|
22 |
* @param zoomLevel |
|
33 | 23 |
* @param band |
34 | 24 |
*/ |
35 |
public TileCacheBandPageManager(TileStructImage tileStructImage, double pixelSize, int band){
|
|
25 |
public TileCacheBandPageManager(TileStructImage tileStructImage, int zoomLevel, int band){
|
|
36 | 26 |
this.tileStructImage=tileStructImage; |
37 |
this.pixelSize=pixelSize; |
|
38 | 27 |
this.band=band; |
39 |
this.zoomLevel=tileStructImage.getZoomLvlForPixelSize(pixelSize);
|
|
28 |
this.zoomLevel=zoomLevel;
|
|
40 | 29 |
} |
41 | 30 |
|
42 | 31 |
@Override |
... | ... | |
46 | 35 |
|
47 | 36 |
@Override |
48 | 37 |
public void load(Buffer buffer, int row, int rows, int col, int cols, int dataType) throws IOException { |
49 |
// int xOffset = col; |
|
50 |
// int xSize = cols; |
|
51 |
// int yOffset = row; |
|
52 |
// int ySize = rows; |
|
53 | 38 |
buffer.rewind(); |
54 | 39 |
|
55 |
// int completeRasterRows=tileStructImage.getRows(this.zoomLevel); |
|
56 |
// int completeRasterColumns=tileStructImage.getColumns(this.zoomLevel); |
|
57 |
|
|
58 | 40 |
int tileRow=(int)row/getRowsPerTile(); |
59 | 41 |
int tileCol=(int)col/getColumnsPerTile(); |
60 | 42 |
|
61 | 43 |
tileStructImage.fetchTile(buffer, band, this.zoomLevel,tileRow,tileCol); |
62 | 44 |
|
63 |
// |
|
64 |
// buffer.rewind(); |
|
65 |
// |
|
66 |
// int offset=0; |
|
67 |
// for (int i=row; i<=rows; i++){ |
|
68 |
// int tileRow=(int)i/getRowsPerTile(); |
|
69 |
// int rowInTile=i-(tileRow*getRowsPerTile()); |
|
70 |
// int j =col; |
|
71 |
// while (j<cols){ |
|
72 |
// int tileCol=(int)j/getColumnsPerTile(); |
|
73 |
// int firstColInTile=j-(tileCol*getColumnsPerTile()); |
|
74 |
// int lastColInTile=getColumnsPerTile(); |
|
75 |
// if ( cols<(tileCol+1)*getColumnsPerTile() ){ |
|
76 |
// lastColInTile=cols-(tileRow*getRowsPerTile()); |
|
77 |
// } |
|
78 |
// Tile tile=tileStructImage.getTile(this.zoomLevel,tileRow,tileCol); |
|
79 |
// byte[] tileBuffer= tile.getBuffer(rowInTile,firstColInTile, lastColInTile); |
|
80 |
// int length=lastColInTile-firstColInTile; |
|
81 |
// ((ByteBuffer) buffer).put(tileBuffer, offset, length); |
|
82 |
// offset+=length; |
|
83 |
// |
|
84 |
// j=( tileCol*getColumnsPerTile() ) +1; |
|
85 |
// } |
|
86 |
// |
|
87 |
// } |
|
88 | 45 |
} |
89 | 46 |
|
90 | 47 |
@Override |
Also available in: Unified diff