Statistics
| Revision:

gvsig-raster / org.gvsig.mosaic / trunk / org.gvsig.mosaic / org.gvsig.mosaic.provider / src / main / java / org / gvsig / mosaic / MosaicPageManager.java @ 9009

History | View | Annotate | Download (2.68 KB)

1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package org.gvsig.mosaic;
7

    
8
import java.io.IOException;
9
import java.nio.Buffer;
10
import org.gvsig.fmap.geom.primitive.Envelope;
11
import org.gvsig.mosaic.lib.api.MosaicFile;
12
import org.gvsig.raster.lib.buffer.api.Band;
13
import org.gvsig.raster.lib.buffer.api.BandInfo;
14
import org.gvsig.raster.lib.buffer.api.BandTileManager;
15
import org.gvsig.raster.lib.buffer.api.TileStruct;
16

    
17
/**
18
 *
19
 * @author osc
20
 */
21
public class MosaicPageManager implements BandTileManager {
22
    private final MosaicFile mosaic;
23
//    private final int rows;
24
//    private final int cols;
25
    private final int rowsPerTile;
26
    private final int columnsPerTile;
27
    private final int numBand;
28

    
29
    /**
30
     *
31
     * @param numBand
32
     * @param bandType
33
     * @param rows
34
     * @param cols
35
     */
36
    public MosaicPageManager(MosaicFile mosaic, int numBand, int bandType, int rowsPerTile, int columnsPerTile) {
37
        this.mosaic = mosaic;
38
        this.numBand = numBand;
39
        this.rowsPerTile = rowsPerTile;
40
        this.columnsPerTile = columnsPerTile;
41
    }
42

    
43
    /**
44
     *
45
     * @param row
46
     * @param col
47
     * @param dataType
48
     */
49
    @Override
50
    public Band load(int row, int col, int dataType) {
51
//        Envelope envelope = this.mosaic.getEnvelope(
52
//                col*columnsPerTile,
53
//                row*rowsPerTile,
54
//                columnsPerTile,
55
//                rowsPerTile
56
//        );
57
        Envelope envelope = this.mosaic.getEnvelope(
58
                col,
59
                row,
60
                columnsPerTile,
61
                rowsPerTile
62
        );
63
        Band band = this.mosaic.getBufferBand(envelope,this.numBand);
64
        
65
        return band;
66
        }
67
    
68
    @Override
69
    public void save(Buffer buffer, int row, int rows, int col, int cols, int dataType) throws IOException {
70
       // 
71
    }
72

    
73
    @Override
74
    public BandInfo getBandInfo() {
75
        return this.mosaic.getBandsInfo().get(this.numBand);
76
    }
77

    
78
    @Override
79
    public int getRowsPerTile() {
80
        return this.rowsPerTile;
81
    }
82

    
83
    @Override
84
    public int getColumnsPerTile() {
85
       return this.columnsPerTile;
86
    }
87

    
88
    @Override
89
    public TileStruct getTileStruct() {
90
        return null;
91
    }
92

    
93
    @Override
94
    public boolean isSupportedSave() {
95
        return false;
96
    }
97

    
98
    @Override
99
    public void dispose() {
100
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
101
    }
102

    
103
    private Envelope calculateEnvelopeForTile(int row, int col) {
104
        return null;
105
    }
106
}