root / trunk / libraries / libRaster / src / org / gvsig / raster / buffer / RasterBand.java @ 11074
History | View | Annotate | Download (2.46 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.raster.buffer; |
20 |
|
21 |
|
22 |
|
23 |
public abstract class RasterBand implements IBand{ |
24 |
public double noDataValue = -99999; |
25 |
protected int width; |
26 |
protected int height; |
27 |
protected int dataType; |
28 |
|
29 |
/**
|
30 |
* Constructor a llamar desde las clases hijas
|
31 |
* @param width
|
32 |
* @param height
|
33 |
*/
|
34 |
public RasterBand(int height, int width){ |
35 |
this.width = width;
|
36 |
this.height = height;
|
37 |
} |
38 |
|
39 |
/*
|
40 |
* (non-Javadoc)
|
41 |
* @see org.gvsig.fmap.dataaccess.buffer.IBand#getWidth()
|
42 |
*/
|
43 |
public int getWidth() { |
44 |
return width;
|
45 |
} |
46 |
|
47 |
/*
|
48 |
* (non-Javadoc)
|
49 |
* @see org.gvsig.fmap.dataaccess.buffer.IBand#getHeight()
|
50 |
*/
|
51 |
public int getHeight() { |
52 |
return height;
|
53 |
} |
54 |
|
55 |
/*
|
56 |
* (non-Javadoc)
|
57 |
* @see org.gvsig.fmap.dataaccess.buffer.IBand#getDataType()
|
58 |
*/
|
59 |
public int getDataType() { |
60 |
return dataType;
|
61 |
} |
62 |
|
63 |
|
64 |
public void setDataType(int dataType) { |
65 |
this.dataType = dataType;
|
66 |
} |
67 |
|
68 |
/**
|
69 |
* Obtiene el tama?o del tipo de dato en bytes
|
70 |
* @return Tipo de dato
|
71 |
*/
|
72 |
public int getDataSize() { |
73 |
if (dataType == TYPE_BYTE) {
|
74 |
return 1; |
75 |
} else if ((dataType == TYPE_SHORT) | (dataType == TYPE_USHORT)) { |
76 |
return 2; |
77 |
} else if (dataType == TYPE_INT) { |
78 |
return 4; |
79 |
}else if (dataType == TYPE_FLOAT) { |
80 |
return 8; |
81 |
}else if (dataType == TYPE_DOUBLE) { |
82 |
return 16; |
83 |
} |
84 |
|
85 |
return 0; |
86 |
} |
87 |
|
88 |
/**
|
89 |
* Obtiene el tama?o del buffer
|
90 |
* @return tama?o del buffer
|
91 |
*/
|
92 |
public int sizeof() { |
93 |
return getDataSize() * width * height;
|
94 |
} |
95 |
|
96 |
} |