Revision 10988 branches/v10/libraries/libjni-gdal/src/es/gva/cit/jgdal/GdalRasterBand.java
GdalRasterBand.java | ||
---|---|---|
84 | 84 |
* Asigna el identificador de la banda |
85 | 85 |
*/ |
86 | 86 |
|
87 |
public GdalRasterBand(long cPtr){ |
|
88 |
|
|
87 |
public GdalRasterBand(long cPtr) { |
|
89 | 88 |
this.cPtr=cPtr; |
90 |
|
|
91 | 89 |
} |
92 | 90 |
|
93 | 91 |
|
... | ... | |
108 | 106 |
|
109 | 107 |
public GdalBuffer readRaster(int nXOff, int nYOff, int nXSize, int nYSize, |
110 | 108 |
int BufXSize, int BufYSize, |
111 |
int eBufType)throws GdalException{ |
|
112 |
|
|
113 |
if(cPtr <= 0) |
|
114 |
throw new GdalException("Error en GDALGetRasterBand(). La llamada GDALOpen no tuvo exito"); |
|
115 |
|
|
116 |
|
|
109 |
int eBufType)throws GdalException { |
|
117 | 110 |
GdalBuffer buffer = readRasterNat(cPtr, nXOff, nYOff, nXSize, nYSize, BufXSize, BufYSize, eBufType); |
118 | 111 |
|
119 | 112 |
if(buffer!=null) |
120 | 113 |
return buffer; |
121 | 114 |
else |
122 | 115 |
return null; |
123 |
|
|
124 | 116 |
} |
125 | 117 |
|
126 | 118 |
/** |
... | ... | |
138 | 130 |
*/ |
139 | 131 |
|
140 | 132 |
public void writeRaster(int nXOff, int nYOff, int nXSize, int nYSize, GdalBuffer buf, int eBufType)throws GdalException{ |
141 |
|
|
142 |
if(cPtr <= 0) |
|
143 |
throw new GdalException("Error en GDALGetRasterBand(). La llamada GDALOpen no tuvo exito"); |
|
144 |
|
|
145 | 133 |
GdalBuffer buffer=new GdalBuffer(); |
146 | 134 |
switch(eBufType){ |
147 | 135 |
case 0: |
... | ... | |
171 | 159 |
return; |
172 | 160 |
} |
173 | 161 |
|
174 |
writeRasterNat(cPtr, nXOff, nYOff, nXSize, nYSize, buffer, eBufType); |
|
175 |
|
|
162 |
writeRasterNat(cPtr, nXOff, nYOff, nXSize, nYSize, buffer, eBufType); |
|
176 | 163 |
} |
177 | 164 |
|
178 | 165 |
/** |
... | ... | |
181 | 168 |
*@throws GdalException |
182 | 169 |
*/ |
183 | 170 |
|
184 |
public int getRasterBandXSize()throws GdalException{ |
|
185 |
|
|
171 |
public int getRasterBandXSize()throws GdalException { |
|
186 | 172 |
String msg1="Error en getRasterBandXSize(). La llamada getRasterBand no tuvo exito"; |
187 | 173 |
String msg2="Tama?o de banda erroneo devuelto por GetRasterBandXSize"; |
188 | 174 |
|
... | ... | |
195 | 181 |
*@throws GdalException |
196 | 182 |
*/ |
197 | 183 |
|
198 |
public int getRasterBandYSize()throws GdalException{ |
|
199 |
|
|
184 |
public int getRasterBandYSize()throws GdalException { |
|
200 | 185 |
String msg1="Error en getRasterBandYSize(). La llamada getRasterBand no tuvo exito"; |
201 | 186 |
String msg2="Tama?o de banda erroneo devuelto por GetRasterBandYSize"; |
202 | 187 |
|
... | ... | |
210 | 195 |
* @throws GdalException |
211 | 196 |
*/ |
212 | 197 |
|
213 |
public int getOverviewCount()throws GdalException{ |
|
214 |
|
|
198 |
public int getOverviewCount()throws GdalException { |
|
215 | 199 |
String msg1="Error en getOverviewCount(). La llamada getRasterBand no tuvo exito"; |
216 | 200 |
String msg2="Error al obtener el n?mero de overviews"; |
217 | 201 |
|
... | ... | |
227 | 211 |
* @throws GdalException |
228 | 212 |
*/ |
229 | 213 |
|
230 |
public GdalRasterBand getOverview(int i)throws GdalException{ |
|
231 |
|
|
214 |
public GdalRasterBand getOverview(int i)throws GdalException { |
|
232 | 215 |
long cPtr_ov; |
233 |
|
|
234 |
if(cPtr <= 0) |
|
235 |
throw new GdalException("Error en getOverview(). La llamada GDALOpen no tuvo exito"); |
|
236 | 216 |
|
237 | 217 |
if(i<0 && i>=this.getOverviewCount()) |
238 | 218 |
throw new GdalException("El overview seleccionado no existe"); |
239 | 219 |
|
240 | 220 |
cPtr_ov = getOverviewNat(cPtr,i); |
241 | 221 |
|
242 |
if(cPtr_ov < 0) |
|
243 |
throw new GdalException("No ha podido obtenerse el overview seleccionado"); |
|
244 |
|
|
245 | 222 |
return new GdalRasterBand(cPtr_ov); |
246 | 223 |
} |
247 | 224 |
|
... | ... | |
252 | 229 |
* @throws GdalException |
253 | 230 |
*/ |
254 | 231 |
|
255 |
public int getBlockXSize()throws GdalException{ |
|
256 |
|
|
232 |
public int getBlockXSize()throws GdalException { |
|
257 | 233 |
String msg1="Error en getBlockXSize(). La llamada getRasterBand no tuvo exito"; |
258 | 234 |
String msg2="Tama?o de bloque erroneo devuelto por GetBlockXSize"; |
259 | 235 |
|
... | ... | |
267 | 243 |
* @throws GdalException |
268 | 244 |
*/ |
269 | 245 |
|
270 |
public int getBlockYSize()throws GdalException{ |
|
271 |
|
|
246 |
public int getBlockYSize()throws GdalException { |
|
272 | 247 |
String msg1="Error en getBlockXSize(). La llamada getRasterBand no tuvo exito"; |
273 | 248 |
String msg2="Tama?o de bloque erroneo devuelto por GetBlockYSize"; |
274 | 249 |
|
... | ... | |
281 | 256 |
* @throws GdalException |
282 | 257 |
*/ |
283 | 258 |
|
284 |
public int getRasterDataType()throws GdalException{ |
|
285 |
|
|
259 |
public int getRasterDataType()throws GdalException { |
|
286 | 260 |
String msg1="Error en getRasterDataType(). La llamada getRasterBand no tuvo exito"; |
287 | 261 |
String msg2="Tipo de dato devuelto por GetRasterDataType erroneo"; |
288 | 262 |
|
... | ... | |
292 | 266 |
/** |
293 | 267 |
* Obtiene la tabla de color asociada a la imagen |
294 | 268 |
*/ |
295 |
public GdalColorTable getRasterColorTable()throws GdalException{ |
|
296 |
if(cPtr <= 0) |
|
297 |
throw new GdalException("Error en getRasterColorTable(). La llamada GDALOpen no tuvo exito"); |
|
298 |
|
|
269 |
public GdalColorTable getRasterColorTable()throws GdalException { |
|
299 | 270 |
GdalColorTable gct = null; |
300 | 271 |
long l = getRasterColorTableNat(cPtr); |
301 |
if( l>0 )
|
|
272 |
if(l > 0)
|
|
302 | 273 |
gct = new GdalColorTable(l); |
303 | 274 |
else |
304 | 275 |
return null; |
... | ... | |
323 | 294 |
|
324 | 295 |
public GdalBuffer readRasterWithPalette(int nXOff, int nYOff, int nXSize, int nYSize, |
325 | 296 |
int BufXSize, int BufYSize, |
326 |
int eBufType)throws GdalException{ |
|
327 |
|
|
328 |
if(cPtr <= 0) |
|
329 |
throw new GdalException("Error en GDALGetRasterBand(). La llamada GDALOpen no tuvo exito"); |
|
330 |
|
|
331 |
|
|
297 |
int eBufType)throws GdalException { |
|
332 | 298 |
GdalBuffer buffer = readRasterWithPaletteNat(cPtr, nXOff, nYOff, nXSize, nYSize, BufXSize, BufYSize, eBufType); |
333 | 299 |
|
334 | 300 |
if(buffer!=null) |
335 | 301 |
return buffer; |
336 | 302 |
else |
337 | 303 |
return null; |
338 |
|
|
339 | 304 |
} |
340 | 305 |
|
341 | 306 |
/** |
342 | 307 |
*Devuelve el valor de NoData |
343 | 308 |
*/ |
344 | 309 |
|
345 |
public double getRasterNoDataValue()throws GdalException{ |
|
346 |
if(cPtr <= 0) |
|
347 |
throw new GdalException("Error en GDALGetRasterBand(). La llamada GDALOpen no tuvo exito"); |
|
310 |
public double getRasterNoDataValue()throws GdalException { |
|
348 | 311 |
return getRasterNoDataValueNat(cPtr); |
349 | 312 |
} |
350 | 313 |
|
... | ... | |
355 | 318 |
* @return Array de Strings que corresponden a los metadatos que ofrece la im?gen |
356 | 319 |
*/ |
357 | 320 |
|
358 |
public String[] getMetadata()throws GdalException{ |
|
359 |
if(cPtr <= 0) |
|
360 |
throw new GdalException("Error en GDALGetMetadata(). La llamada GDALOpen no tuvo exito"); |
|
321 |
public String[] getMetadata()throws GdalException { |
|
361 | 322 |
String[] res = getMetadataNat(cPtr,null); |
362 | 323 |
if(res == null) |
363 | 324 |
return new String[0]; |
364 | 325 |
else return res; |
365 |
|
|
366 | 326 |
} |
367 | 327 |
|
368 | 328 |
/** |
... | ... | |
371 | 331 |
* @throws GdalException |
372 | 332 |
*/ |
373 | 333 |
|
374 |
public int getRasterColorInterpretation()throws GdalException{ |
|
375 |
if(cPtr <= 0) |
|
376 |
throw new GdalException("Error en getColorInterpretationName(). La llamada Open no tuvo exito"); |
|
334 |
public int getRasterColorInterpretation()throws GdalException { |
|
377 | 335 |
int bandType = getRasterColorInterpretationNat(cPtr); |
378 | 336 |
return bandType; |
379 | 337 |
} |
Also available in: Unified diff