Revision 19201 trunk/libraries/libjni-gdal/src/main/java/es/gva/cit/jgdal/GdalRasterBand.java
GdalRasterBand.java | ||
---|---|---|
7 | 7 |
* Author: Nacho Brodin, brodin_ign@gva.es |
8 | 8 |
* |
9 | 9 |
**********************************************************************/ |
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
|
11 |
* |
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
13 |
* |
|
14 |
* This program is free software; you can redistribute it and/or |
|
15 |
* modify it under the terms of the GNU General Public License |
|
16 |
* as published by the Free Software Foundation; either version 2 |
|
17 |
* of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
* GNU General Public License for more details. |
|
23 |
* |
|
24 |
* You should have received a copy of the GNU General Public License |
|
25 |
* along with this program; if not, write to the Free Software |
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
27 |
* |
|
28 |
* For more information, contact: |
|
29 |
* |
|
30 |
* Generalitat Valenciana |
|
31 |
* Conselleria d'Infraestructures i Transport |
|
32 |
* Av. Blasco Ib??ez, 50
|
|
33 |
* 46010 VALENCIA |
|
34 |
* SPAIN |
|
35 |
* |
|
36 |
* +34 963862235 |
|
37 |
* gvsig@gva.es |
|
38 |
* www.gvsig.gva.es |
|
39 |
* |
|
40 |
* or |
|
41 |
* |
|
42 |
* IVER T.I. S.A |
|
43 |
* Salamanca 50 |
|
44 |
* 46005 Valencia |
|
45 |
* Spain |
|
46 |
* |
|
47 |
* +34 963163400 |
|
48 |
* dac@iver.es |
|
49 |
*/ |
|
10 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
|
11 |
*
|
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
|
13 |
*
|
|
14 |
* This program is free software; you can redistribute it and/or
|
|
15 |
* modify it under the terms of the GNU General Public License
|
|
16 |
* as published by the Free Software Foundation; either version 2
|
|
17 |
* of the License, or (at your option) any later version.
|
|
18 |
*
|
|
19 |
* This program is distributed in the hope that it will be useful,
|
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
22 |
* GNU General Public License for more details.
|
|
23 |
*
|
|
24 |
* You should have received a copy of the GNU General Public License
|
|
25 |
* along with this program; if not, write to the Free Software
|
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
|
27 |
*
|
|
28 |
* For more information, contact:
|
|
29 |
*
|
|
30 |
* Generalitat Valenciana
|
|
31 |
* Conselleria d'Infraestructures i Transport
|
|
32 |
* Av. Blasco Ib��ez, 50
|
|
33 |
* 46010 VALENCIA
|
|
34 |
* SPAIN
|
|
35 |
*
|
|
36 |
* +34 963862235
|
|
37 |
* gvsig@gva.es
|
|
38 |
* www.gvsig.gva.es
|
|
39 |
*
|
|
40 |
* or
|
|
41 |
*
|
|
42 |
* IVER T.I. S.A
|
|
43 |
* Salamanca 50
|
|
44 |
* 46005 Valencia
|
|
45 |
* Spain
|
|
46 |
*
|
|
47 |
* +34 963163400
|
|
48 |
* dac@iver.es
|
|
49 |
*/
|
|
50 | 50 |
|
51 | 51 |
package es.gva.cit.jgdal; |
52 | 52 |
|
53 | 53 |
/** |
54 |
* Representa a una banda simple de la im?gen o canal.
|
|
54 |
* Representa a una banda simple de la im�gen o canal.
|
|
55 | 55 |
* |
56 | 56 |
* @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es |
57 | 57 |
* @version 0.0 |
... | ... | |
59 | 59 |
*/ |
60 | 60 |
|
61 | 61 |
public class GdalRasterBand extends JNIBase{ |
62 |
|
|
63 | 62 |
|
63 |
|
|
64 | 64 |
private native long getOverviewNat(long cPtr,int i); |
65 | 65 |
private native long getRasterColorTableNat(long cPtr); |
66 | 66 |
private native GdalBuffer readRasterNat(long cPtr, |
67 |
int nXOff, int nYOff, int nXSize, int nYSize,
|
|
68 |
int BufXSize, int BufYSize,
|
|
69 |
int eBufType);
|
|
67 |
int nXOff, int nYOff, int nXSize, int nYSize, |
|
68 |
int BufXSize, int BufYSize, |
|
69 |
int eBufType); |
|
70 | 70 |
private native GdalBuffer readRasterWithPaletteNat(long cPtr, |
71 |
int nXOff, int nYOff, int nXSize, int nYSize,
|
|
72 |
int BufXSize, int BufYSize,
|
|
73 |
int eBufType);
|
|
71 |
int nXOff, int nYOff, int nXSize, int nYSize, |
|
72 |
int BufXSize, int BufYSize, |
|
73 |
int eBufType); |
|
74 | 74 |
private native void writeRasterNat( long cPtr, |
75 |
int nXOff, int nYOff, int nXSize, int nYSize,
|
|
76 |
GdalBuffer buffer,
|
|
77 |
int eBufType);
|
|
75 |
int nXOff, int nYOff, int nXSize, int nYSize, |
|
76 |
GdalBuffer buffer, |
|
77 |
int eBufType); |
|
78 | 78 |
private native double getRasterNoDataValueNat(long cPtr); |
79 | 79 |
private native String[] getMetadataNat(long cPtr,String pszDomain); |
80 | 80 |
private native int getRasterColorInterpretationNat(long cPtr); |
81 |
|
|
82 |
|
|
81 |
|
|
82 |
|
|
83 | 83 |
/** |
84 | 84 |
* Asigna el identificador de la banda |
85 | 85 |
*/ |
86 |
|
|
87 |
public GdalRasterBand(long cPtr) { |
|
88 |
this.cPtr=cPtr; |
|
89 |
} |
|
90 |
|
|
91 |
|
|
92 |
/** |
|
93 |
* Lee datos de la banda de la im?gen
|
|
94 |
* |
|
95 |
* @return Devuelve un vector de bytes con el trozo de raster le?do.
|
|
96 |
* @param nXOff El desplazamiento del pixel desde la esquina superior derecha |
|
97 |
* de la banda accedida. |
|
98 |
* @param nYOff El desplazamiento de l?nea desde la esquina superior derecha
|
|
99 |
* de la banda accedida. |
|
100 |
* @param nXSize Ancho de la regi?n en pixels de la banda que ser? accedida
|
|
101 |
* @param nYSize Altura de la regi?n en l?neas de la banda que ser? accedida
|
|
102 |
* @param BufXSize Ancho del buffer donde la regi?n de la im?gen ser? guardada
|
|
103 |
* @param BufYSize Altura del buffer donde la regi?n de la im?gen ser? guardada
|
|
104 |
* @param eBufType |
|
105 |
*/ |
|
106 |
|
|
86 |
|
|
87 |
public GdalRasterBand(long cPtr) {
|
|
88 |
this.cPtr=cPtr;
|
|
89 |
}
|
|
90 |
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Lee datos de la banda de la im�gen
|
|
94 |
*
|
|
95 |
* @return Devuelve un vector de bytes con el trozo de raster le�do.
|
|
96 |
* @param nXOff El desplazamiento del pixel desde la esquina superior derecha
|
|
97 |
* de la banda accedida.
|
|
98 |
* @param nYOff El desplazamiento de l�nea desde la esquina superior derecha
|
|
99 |
* de la banda accedida.
|
|
100 |
* @param nXSize Ancho de la regi�n en pixels de la banda que ser� accedida
|
|
101 |
* @param nYSize Altura de la regi�n en l�neas de la banda que ser� accedida
|
|
102 |
* @param BufXSize Ancho del buffer donde la regi�n de la im�gen ser� guardada
|
|
103 |
* @param BufYSize Altura del buffer donde la regi�n de la im�gen ser� guardada
|
|
104 |
* @param eBufType
|
|
105 |
*/
|
|
106 |
|
|
107 | 107 |
public GdalBuffer readRaster(int nXOff, int nYOff, int nXSize, int nYSize, |
108 |
int BufXSize, int BufYSize, |
|
109 |
int eBufType)throws GdalException { |
|
110 |
GdalBuffer buffer = readRasterNat(cPtr, nXOff, nYOff, nXSize, nYSize, BufXSize, BufYSize, eBufType); |
|
111 |
|
|
112 |
if(buffer!=null) |
|
113 |
return buffer; |
|
114 |
else |
|
115 |
return null; |
|
108 |
int BufXSize, int BufYSize, |
|
109 |
int eBufType)throws GdalException { |
|
110 |
System.err.println("Leyendo raster..."); |
|
111 |
GdalBuffer buffer = readRasterNat(cPtr, nXOff, nYOff, nXSize, nYSize, BufXSize, BufYSize, eBufType); |
|
112 |
System.err.println("Raster leido."); |
|
113 |
if(buffer!=null) |
|
114 |
return buffer; |
|
115 |
else |
|
116 |
return null; |
|
116 | 117 |
} |
117 |
|
|
118 |
|
|
118 | 119 |
/** |
119 |
* Escribe datos en la banda de la im?gen
|
|
120 |
* Escribe datos en la banda de la im�gen
|
|
120 | 121 |
* |
121 | 122 |
* @param nXOff El desplazamiento del pixel desde la esquina superior derecha |
122 | 123 |
* de la banda accedida. |
123 |
* @param nYOff El desplazamiento de l?nea desde la esquina superior derecha
|
|
124 |
* @param nYOff El desplazamiento de l�nea desde la esquina superior derecha
|
|
124 | 125 |
* de la banda accedida. |
125 |
* @param nXSize Ancho de la regi?n en pixels de la banda que ser? accedida
|
|
126 |
* @param nYSize Altura de la regi?n en l?neas de la banda que ser? accedida
|
|
127 |
* @param BufXSize Ancho del buffer donde la regi?n de la im?gen ser? guardada
|
|
128 |
* @param BufYSize Altura del buffer donde la regi?n de la im?gen ser? guardada
|
|
126 |
* @param nXSize Ancho de la regi�n en pixels de la banda que ser� accedida
|
|
127 |
* @param nYSize Altura de la regi�n en l�neas de la banda que ser� accedida
|
|
128 |
* @param BufXSize Ancho del buffer donde la regi�n de la im�gen ser� guardada
|
|
129 |
* @param BufYSize Altura del buffer donde la regi�n de la im�gen ser� guardada
|
|
129 | 130 |
* @param eBufType |
130 | 131 |
*/ |
131 |
|
|
132 |
|
|
132 | 133 |
public void writeRaster(int nXOff, int nYOff, int nXSize, int nYSize, GdalBuffer buf, int eBufType)throws GdalException{ |
133 |
GdalBuffer buffer=new GdalBuffer();
|
|
134 |
switch(eBufType){
|
|
135 |
case 0:
|
|
136 |
return;
|
|
137 |
case 1:
|
|
138 |
buffer.buffByte=buf.buffByte;
|
|
139 |
break;
|
|
140 |
case 2:
|
|
141 |
case 3:
|
|
142 |
case 8:
|
|
143 |
buffer.buffShort=buf.buffShort;
|
|
144 |
break;
|
|
145 |
case 4:
|
|
146 |
case 5:
|
|
147 |
case 9:
|
|
148 |
buffer.buffInt=buf.buffInt;
|
|
149 |
break;
|
|
150 |
case 6:
|
|
151 |
case 10:
|
|
152 |
buffer.buffFloat=buf.buffFloat;
|
|
153 |
break;
|
|
154 |
case 7:
|
|
155 |
case 11:
|
|
156 |
buffer.buffDouble=buf.buffDouble;
|
|
157 |
break;
|
|
158 |
case 12:
|
|
159 |
return;
|
|
160 |
}
|
|
161 |
|
|
162 |
writeRasterNat(cPtr, nXOff, nYOff, nXSize, nYSize, buffer, eBufType);
|
|
134 |
GdalBuffer buffer=new GdalBuffer();
|
|
135 |
switch(eBufType){
|
|
136 |
case 0:
|
|
137 |
return;
|
|
138 |
case 1:
|
|
139 |
buffer.buffByte=buf.buffByte;
|
|
140 |
break;
|
|
141 |
case 2:
|
|
142 |
case 3:
|
|
143 |
case 8:
|
|
144 |
buffer.buffShort=buf.buffShort;
|
|
145 |
break;
|
|
146 |
case 4:
|
|
147 |
case 5:
|
|
148 |
case 9:
|
|
149 |
buffer.buffInt=buf.buffInt;
|
|
150 |
break;
|
|
151 |
case 6:
|
|
152 |
case 10:
|
|
153 |
buffer.buffFloat=buf.buffFloat;
|
|
154 |
break;
|
|
155 |
case 7:
|
|
156 |
case 11:
|
|
157 |
buffer.buffDouble=buf.buffDouble;
|
|
158 |
break;
|
|
159 |
case 12:
|
|
160 |
return;
|
|
161 |
}
|
|
162 |
|
|
163 |
writeRasterNat(cPtr, nXOff, nYOff, nXSize, nYSize, buffer, eBufType);
|
|
163 | 164 |
} |
164 |
|
|
165 |
/** |
|
166 |
*Obtiene el tama?o en pixeles de la im?gen en el eje de las X
|
|
167 |
*@return Tama?o en pixeles del eje X
|
|
168 |
*@throws GdalException |
|
169 |
*/ |
|
170 |
|
|
171 |
public int getRasterBandXSize()throws GdalException { |
|
172 |
String msg1="Error en getRasterBandXSize(). La llamada getRasterBand no tuvo exito"; |
|
173 |
String msg2="Tama?o de banda erroneo devuelto por GetRasterBandXSize";
|
|
174 |
|
|
175 |
return baseSimpleFunctions(0,msg1,msg2); |
|
176 |
} |
|
177 |
|
|
178 |
/** |
|
179 |
*Obtiene el tama?o en pixeles de la im?gen en el eje de las Y
|
|
180 |
*@return Tama?o en pixeles del eje Y
|
|
181 |
*@throws GdalException |
|
182 |
*/ |
|
183 |
|
|
184 |
public int getRasterBandYSize()throws GdalException { |
|
185 |
String msg1="Error en getRasterBandYSize(). La llamada getRasterBand no tuvo exito"; |
|
186 |
String msg2="Tama?o de banda erroneo devuelto por GetRasterBandYSize";
|
|
187 |
|
|
188 |
return baseSimpleFunctions(1,msg1,msg2); |
|
189 |
} |
|
190 |
|
|
191 |
|
|
192 |
/** |
|
193 |
* Devuelve el n?mero de overviews que contiene la banda.
|
|
194 |
* @return N?mero de overviews
|
|
195 |
* @throws GdalException |
|
196 |
*/ |
|
197 |
|
|
198 |
public int getOverviewCount()throws GdalException { |
|
199 |
String msg1="Error en getOverviewCount(). La llamada getRasterBand no tuvo exito"; |
|
200 |
String msg2="Error al obtener el n?mero de overviews";
|
|
201 |
|
|
202 |
return baseSimpleFunctions(2,msg1,msg2); |
|
203 |
} |
|
204 |
|
|
205 |
|
|
206 |
/** |
|
207 |
* Obtiene el overview indicado por el ?ndice "i".
|
|
208 |
* |
|
209 |
* @param i indice del overview que se quiere recuperar. |
|
210 |
* @return GdalRasterBand Banda correspondiente al overview selecccionado |
|
211 |
* @throws GdalException |
|
212 |
*/ |
|
213 |
|
|
214 |
public GdalRasterBand getOverview(int i)throws GdalException { |
|
215 |
long cPtr_ov; |
|
216 |
|
|
217 |
if(i<0 && i>=this.getOverviewCount()) |
|
218 |
throw new GdalException("El overview seleccionado no existe"); |
|
219 |
|
|
220 |
cPtr_ov = getOverviewNat(cPtr,i); |
|
221 |
|
|
222 |
return new GdalRasterBand(cPtr_ov); |
|
223 |
} |
|
224 |
|
|
225 |
|
|
226 |
/** |
|
227 |
* Devuelve el tama?o en X del bloque para esa banda
|
|
228 |
* @return Tama?o en pixeles del bloque en el eje X
|
|
229 |
* @throws GdalException |
|
230 |
*/ |
|
231 |
|
|
232 |
public int getBlockXSize()throws GdalException { |
|
233 |
String msg1="Error en getBlockXSize(). La llamada getRasterBand no tuvo exito"; |
|
234 |
String msg2="Tama?o de bloque erroneo devuelto por GetBlockXSize";
|
|
235 |
|
|
236 |
return baseSimpleFunctions(3,msg1,msg2); |
|
237 |
} |
|
238 |
|
|
239 |
|
|
240 |
/** |
|
241 |
* Devuelve el tama?o en Y del bloque para esa banda
|
|
242 |
* @return Tama?o en pixeles del bloque en el eje Y
|
|
243 |
* @throws GdalException |
|
244 |
*/ |
|
245 |
|
|
246 |
public int getBlockYSize()throws GdalException { |
|
247 |
String msg1="Error en getBlockXSize(). La llamada getRasterBand no tuvo exito"; |
|
248 |
String msg2="Tama?o de bloque erroneo devuelto por GetBlockYSize";
|
|
249 |
|
|
250 |
return baseSimpleFunctions(4,msg1,msg2); |
|
251 |
} |
|
252 |
|
|
253 |
/** |
|
254 |
* Devuelve el tipo de datos de la banda |
|
255 |
* @return Tama?o en pixeles del bloque en el eje Y
|
|
256 |
* @throws GdalException |
|
257 |
*/ |
|
258 |
|
|
259 |
public int getRasterDataType()throws GdalException { |
|
260 |
String msg1="Error en getRasterDataType(). La llamada getRasterBand no tuvo exito"; |
|
261 |
String msg2="Tipo de dato devuelto por GetRasterDataType erroneo"; |
|
262 |
|
|
263 |
return baseSimpleFunctions(9,msg1,msg2); |
|
264 |
} |
|
265 |
|
|
266 |
/** |
|
267 |
* Obtiene la tabla de color asociada a la imagen |
|
268 |
*/ |
|
269 |
public GdalColorTable getRasterColorTable()throws GdalException { |
|
270 |
GdalColorTable gct = null; |
|
271 |
long l = getRasterColorTableNat(cPtr); |
|
272 |
if(l > 0) |
|
273 |
gct = new GdalColorTable(l); |
|
274 |
else |
|
275 |
return null; |
|
276 |
|
|
277 |
return gct; |
|
278 |
} |
|
279 |
|
|
280 |
/** |
|
281 |
* Lee datos de la banda de la im?gen con una paleta asociada
|
|
282 |
* |
|
283 |
* @return Devuelve un vector de bytes con el trozo de raster le?do.
|
|
284 |
* @param nXOff El desplazamiento del pixel desde la esquina superior derecha |
|
285 |
* de la banda accedida. |
|
286 |
* @param nYOff El desplazamiento de l?nea desde la esquina superior derecha
|
|
287 |
* de la banda accedida. |
|
288 |
* @param nXSize Ancho de la regi?n en pixels de la banda que ser? accedida
|
|
289 |
* @param nYSize Altura de la regi?n en l?neas de la banda que ser? accedida
|
|
290 |
* @param BufXSize Ancho del buffer donde la regi?n de la im?gen ser? guardada
|
|
291 |
* @param BufYSize Altura del buffer donde la regi?n de la im?gen ser? guardada
|
|
292 |
* @param eBufType |
|
293 |
*/ |
|
294 |
|
|
165 |
|
|
166 |
/**
|
|
167 |
*Obtiene el tama�o en pixeles de la im�gen en el eje de las X
|
|
168 |
*@return Tama�o en pixeles del eje X
|
|
169 |
*@throws GdalException
|
|
170 |
*/
|
|
171 |
|
|
172 |
public int getRasterBandXSize()throws GdalException {
|
|
173 |
String msg1="Error en getRasterBandXSize(). La llamada getRasterBand no tuvo exito";
|
|
174 |
String msg2="Tama�o de banda erroneo devuelto por GetRasterBandXSize";
|
|
175 |
|
|
176 |
return baseSimpleFunctions(0,msg1,msg2);
|
|
177 |
}
|
|
178 |
|
|
179 |
/**
|
|
180 |
*Obtiene el tama�o en pixeles de la im�gen en el eje de las Y
|
|
181 |
*@return Tama�o en pixeles del eje Y
|
|
182 |
*@throws GdalException
|
|
183 |
*/
|
|
184 |
|
|
185 |
public int getRasterBandYSize()throws GdalException {
|
|
186 |
String msg1="Error en getRasterBandYSize(). La llamada getRasterBand no tuvo exito";
|
|
187 |
String msg2="Tama�o de banda erroneo devuelto por GetRasterBandYSize";
|
|
188 |
|
|
189 |
return baseSimpleFunctions(1,msg1,msg2);
|
|
190 |
}
|
|
191 |
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Devuelve el n�mero de overviews que contiene la banda.
|
|
195 |
* @return N�mero de overviews
|
|
196 |
* @throws GdalException
|
|
197 |
*/
|
|
198 |
|
|
199 |
public int getOverviewCount()throws GdalException {
|
|
200 |
String msg1="Error en getOverviewCount(). La llamada getRasterBand no tuvo exito";
|
|
201 |
String msg2="Error al obtener el n�mero de overviews";
|
|
202 |
|
|
203 |
return baseSimpleFunctions(2,msg1,msg2);
|
|
204 |
}
|
|
205 |
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Obtiene el overview indicado por el �ndice "i".
|
|
209 |
*
|
|
210 |
* @param i indice del overview que se quiere recuperar.
|
|
211 |
* @return GdalRasterBand Banda correspondiente al overview selecccionado
|
|
212 |
* @throws GdalException
|
|
213 |
*/
|
|
214 |
|
|
215 |
public GdalRasterBand getOverview(int i)throws GdalException {
|
|
216 |
long cPtr_ov;
|
|
217 |
|
|
218 |
if(i<0 && i>=this.getOverviewCount())
|
|
219 |
throw new GdalException("El overview seleccionado no existe");
|
|
220 |
|
|
221 |
cPtr_ov = getOverviewNat(cPtr,i);
|
|
222 |
|
|
223 |
return new GdalRasterBand(cPtr_ov);
|
|
224 |
}
|
|
225 |
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Devuelve el tama�o en X del bloque para esa banda
|
|
229 |
* @return Tama�o en pixeles del bloque en el eje X
|
|
230 |
* @throws GdalException
|
|
231 |
*/
|
|
232 |
|
|
233 |
public int getBlockXSize()throws GdalException {
|
|
234 |
String msg1="Error en getBlockXSize(). La llamada getRasterBand no tuvo exito";
|
|
235 |
String msg2="Tama�o de bloque erroneo devuelto por GetBlockXSize";
|
|
236 |
|
|
237 |
return baseSimpleFunctions(3,msg1,msg2);
|
|
238 |
}
|
|
239 |
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Devuelve el tama�o en Y del bloque para esa banda
|
|
243 |
* @return Tama�o en pixeles del bloque en el eje Y
|
|
244 |
* @throws GdalException
|
|
245 |
*/
|
|
246 |
|
|
247 |
public int getBlockYSize()throws GdalException {
|
|
248 |
String msg1="Error en getBlockXSize(). La llamada getRasterBand no tuvo exito";
|
|
249 |
String msg2="Tama�o de bloque erroneo devuelto por GetBlockYSize";
|
|
250 |
|
|
251 |
return baseSimpleFunctions(4,msg1,msg2);
|
|
252 |
}
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Devuelve el tipo de datos de la banda
|
|
256 |
* @return Tama�o en pixeles del bloque en el eje Y
|
|
257 |
* @throws GdalException
|
|
258 |
*/
|
|
259 |
|
|
260 |
public int getRasterDataType()throws GdalException {
|
|
261 |
String msg1="Error en getRasterDataType(). La llamada getRasterBand no tuvo exito";
|
|
262 |
String msg2="Tipo de dato devuelto por GetRasterDataType erroneo";
|
|
263 |
|
|
264 |
return baseSimpleFunctions(9,msg1,msg2);
|
|
265 |
}
|
|
266 |
|
|
267 |
/**
|
|
268 |
* Obtiene la tabla de color asociada a la imagen
|
|
269 |
*/
|
|
270 |
public GdalColorTable getRasterColorTable()throws GdalException {
|
|
271 |
GdalColorTable gct = null;
|
|
272 |
long l = getRasterColorTableNat(cPtr);
|
|
273 |
if(l > 0)
|
|
274 |
gct = new GdalColorTable(l);
|
|
275 |
else
|
|
276 |
return null;
|
|
277 |
|
|
278 |
return gct;
|
|
279 |
}
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Lee datos de la banda de la im�gen con una paleta asociada
|
|
283 |
*
|
|
284 |
* @return Devuelve un vector de bytes con el trozo de raster le�do.
|
|
285 |
* @param nXOff El desplazamiento del pixel desde la esquina superior derecha
|
|
286 |
* de la banda accedida.
|
|
287 |
* @param nYOff El desplazamiento de l�nea desde la esquina superior derecha
|
|
288 |
* de la banda accedida.
|
|
289 |
* @param nXSize Ancho de la regi�n en pixels de la banda que ser� accedida
|
|
290 |
* @param nYSize Altura de la regi�n en l�neas de la banda que ser� accedida
|
|
291 |
* @param BufXSize Ancho del buffer donde la regi�n de la im�gen ser� guardada
|
|
292 |
* @param BufYSize Altura del buffer donde la regi�n de la im�gen ser� guardada
|
|
293 |
* @param eBufType
|
|
294 |
*/
|
|
295 |
|
|
295 | 296 |
public GdalBuffer readRasterWithPalette(int nXOff, int nYOff, int nXSize, int nYSize, |
296 |
int BufXSize, int BufYSize, |
|
297 |
int eBufType)throws GdalException { |
|
298 |
GdalBuffer buffer = readRasterWithPaletteNat(cPtr, nXOff, nYOff, nXSize, nYSize, BufXSize, BufYSize, eBufType); |
|
299 |
|
|
300 |
if(buffer!=null) |
|
301 |
return buffer; |
|
302 |
else |
|
303 |
return null; |
|
297 |
int BufXSize, int BufYSize, |
|
298 |
int eBufType)throws GdalException { |
|
299 |
|
|
300 |
GdalBuffer buffer = readRasterWithPaletteNat(cPtr, nXOff, nYOff, nXSize, nYSize, BufXSize, BufYSize, eBufType); |
|
301 |
|
|
302 |
|
|
303 |
if(buffer!=null) |
|
304 |
return buffer; |
|
305 |
else |
|
306 |
return null; |
|
304 | 307 |
} |
305 |
|
|
308 |
|
|
306 | 309 |
/** |
307 | 310 |
*Devuelve el valor de NoData |
308 | 311 |
*/ |
309 |
|
|
312 |
|
|
310 | 313 |
public double getRasterNoDataValue()throws GdalException { |
311 | 314 |
return getRasterNoDataValueNat(cPtr); |
312 | 315 |
} |
313 |
|
|
316 |
|
|
314 | 317 |
/** |
315 | 318 |
* Obtiene un array de Strings con los metadatos |
316 | 319 |
* |
317 | 320 |
* @throws GdalException |
318 |
* @return Array de Strings que corresponden a los metadatos que ofrece la im?gen
|
|
321 |
* @return Array de Strings que corresponden a los metadatos que ofrece la im�gen
|
|
319 | 322 |
*/ |
320 |
|
|
323 |
|
|
321 | 324 |
public String[] getMetadata()throws GdalException { |
322 | 325 |
String[] res = getMetadataNat(cPtr,null); |
323 | 326 |
if(res == null) |
324 | 327 |
return new String[0]; |
325 | 328 |
else return res; |
326 | 329 |
} |
327 |
|
|
330 |
|
|
328 | 331 |
/** |
329 |
* Obtiene identificador que representa el tipo de banda de color. |
|
330 |
* @return identificador del tipo de banda de color |
|
331 |
* @throws GdalException |
|
332 |
*/ |
|
333 |
|
|
332 |
* Obtiene identificador que representa el tipo de banda de color.
|
|
333 |
* @return identificador del tipo de banda de color
|
|
334 |
* @throws GdalException
|
|
335 |
*/
|
|
336 |
|
|
334 | 337 |
public int getRasterColorInterpretation()throws GdalException { |
335 |
int bandType = getRasterColorInterpretationNat(cPtr); |
|
336 |
return bandType; |
|
338 |
int bandType = getRasterColorInterpretationNat(cPtr);
|
|
339 |
return bandType;
|
|
337 | 340 |
} |
338 | 341 |
} |
Also available in: Unified diff