Statistics
| Revision:

gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster_dataaccess_refactoring / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / provider / fusion / PixelSquareStructure.java @ 2303

History | View | Annotate | Download (1.73 KB)

1
package org.gvsig.raster.impl.provider.fusion;
2

    
3
import org.gvsig.fmap.dal.coverage.RasterLocator;
4
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
5
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
6
import org.gvsig.fmap.dal.coverage.datastruct.NoData;
7

    
8
/** 
9
 * Structure which represents a bitmap
10
 * 
11
 * @author Nacho Brodin (nachobrodin@gmail.com)
12
 */
13
public class PixelSquareStructure {
14
        public double               pixelSize                 = 0;
15
        public int                  dataType                  = Buffer.TYPE_UNDEFINED;
16
        public int                  bandCount                 = 0;
17
        public int                  width                     = 0;
18
        public int                  height                    = 0;
19
        public Extent               bbox                      = null;
20
        public NoData               nodata                    = null;
21
        public Buffer               buffer                    = null;
22
        
23
        public PixelSquareStructure(
24
                        Buffer buf,
25
                        Extent bbox,
26
                        double pixelSize) {
27
                this.pixelSize = pixelSize;
28
                this.dataType = buf.getDataType();
29
                this.bandCount = buf.getBandCount();
30
                this.width = buf.getWidth();
31
                this.height = buf.getHeight();
32
                nodata = buf.getNoDataValue() != null ? 
33
                                buf.getNoDataValue() : 
34
                                RasterLocator.getManager().getDataStructFactory().createDefaultNoData(bandCount, dataType);
35
                this.bbox = bbox;
36
                this.buffer = buf;
37
        }
38
        
39
        public PixelSquareStructure(
40
                        double pixelSize,
41
                        int bandCount,
42
                        int datatype) {
43
                this.pixelSize = pixelSize;
44
                this.dataType = datatype;
45
                this.bandCount = bandCount;
46
                this.width = (int)Math.ceil(bbox.width() * pixelSize);
47
                this.height = (int)Math.ceil(bbox.height() * pixelSize);
48
                nodata = RasterLocator.getManager().getDataStructFactory().createDefaultNoData(bandCount, datatype);
49
        }
50
}
51