gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / buffer / RasterBand.java @ 2623
History | View | Annotate | Download (2.27 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.raster.impl.buffer; |
23 |
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Band; |
25 |
|
26 |
|
27 |
|
28 |
public abstract class RasterBand implements Band { |
29 |
public double noDataValue = -99999; |
30 |
protected int width; |
31 |
protected int height; |
32 |
protected int dataType; |
33 |
|
34 |
/**
|
35 |
* Constructor a llamar desde las clases hijas
|
36 |
* @param width
|
37 |
* @param height
|
38 |
*/
|
39 |
public RasterBand(int height, int width){ |
40 |
this.width = width;
|
41 |
this.height = height;
|
42 |
} |
43 |
|
44 |
public int getWidth() { |
45 |
return width;
|
46 |
} |
47 |
|
48 |
public int getHeight() { |
49 |
return height;
|
50 |
} |
51 |
|
52 |
public int getDataType() { |
53 |
return dataType;
|
54 |
} |
55 |
|
56 |
|
57 |
public void setDataType(int dataType) { |
58 |
this.dataType = dataType;
|
59 |
} |
60 |
|
61 |
/**
|
62 |
* Obtiene el tama?o del tipo de dato en bytes
|
63 |
* @return Tipo de dato
|
64 |
*/
|
65 |
public int getDataSize() { |
66 |
if (dataType == TYPE_BYTE) {
|
67 |
return 1; |
68 |
} else if ((dataType == TYPE_SHORT) | (dataType == TYPE_USHORT)) { |
69 |
return 2; |
70 |
} else if (dataType == TYPE_INT) { |
71 |
return 4; |
72 |
}else if (dataType == TYPE_FLOAT) { |
73 |
return 8; |
74 |
}else if (dataType == TYPE_DOUBLE) { |
75 |
return 16; |
76 |
} |
77 |
|
78 |
return 0; |
79 |
} |
80 |
|
81 |
/**
|
82 |
* Obtiene el tama?o del buffer
|
83 |
* @return tama?o del buffer
|
84 |
*/
|
85 |
public int sizeof() { |
86 |
return getDataSize() * width * height;
|
87 |
} |
88 |
|
89 |
} |