Revision 2288 org.gvsig.raster.ermapper/branches/org.gvsig.raster.ermapper_dataaccess_refactoring/org.gvsig.raster.ermapper.io/src/main/java/org/gvsig/raster/ermapper/io/ErmapperProvider.java
ErmapperProvider.java | ||
---|---|---|
114 | 114 |
RasterLocator.getManager().getProviderServices().addFormat(formatList[i], ErmapperProvider.class); |
115 | 115 |
} |
116 | 116 |
|
117 |
/* |
|
118 |
* (non-Javadoc) |
|
119 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getFormatList() |
|
120 |
*/ |
|
121 | 117 |
public String[] getFormatList() { |
122 | 118 |
return formatList; |
123 | 119 |
} |
... | ... | |
308 | 304 |
stpBuffer, |
309 | 305 |
query.getTaskStatus()); |
310 | 306 |
} |
311 |
|
|
312 | 307 |
|
313 |
/*public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf, TaskStatus status) |
|
314 |
throws ProcessInterruptedException, RasterDriverException { |
|
315 |
|
|
316 |
if(status != null && status.isCancelled()) |
|
317 |
return null; |
|
318 |
|
|
319 |
Point2D p1 = new Point2D.Double(ex.getULX(), ex.getULY()); |
|
320 |
Point2D p2 = new Point2D.Double(ex.getLRX(), ex.getLRY()); |
|
321 |
try { |
|
322 |
externalTransformation.inverseTransform(p1, p1); |
|
323 |
externalTransformation.inverseTransform(p2, p2); |
|
324 |
ownTransformation.transform(p1, p1); |
|
325 |
ownTransformation.transform(p2, p2); |
|
326 |
} catch (NoninvertibleTransformException e) { |
|
327 |
throw new RasterDriverException("Noninvertible transform"); |
|
328 |
} |
|
329 |
|
|
330 |
Extent selectedExtent = new ExtentImpl(p1.getX(), p1.getY(), p2.getX(), p2.getY()); |
|
331 |
|
|
332 |
setView(selectedExtent); |
|
333 |
int wPx = rasterBuf.getWidth(); |
|
334 |
int hPx = rasterBuf.getHeight(); |
|
335 |
int[] stpBuffer = new int[]{0, 0 , wPx, hPx}; |
|
336 |
|
|
337 |
loadBuffer(viewRequest, wPx, hPx, rasterBuf, bandList, stpBuffer, status); |
|
338 |
|
|
339 |
if(status != null && status.isCancelled()) |
|
340 |
return null; |
|
341 |
|
|
342 |
return rasterBuf; |
|
343 |
}*/ |
|
344 |
|
|
345 |
/*public Buffer getWindow(double ulx, double uly, double w, double h, |
|
346 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) throws ProcessInterruptedException, RasterDriverException { |
|
347 |
//El incremento o decremento de las X e Y depende de los signos de rotaci?n y escala en la matriz de transformaci?n. Por esto |
|
348 |
//tenemos que averiguar si lrx es x + w o x -w, asi como si lry es y + h o y - h |
|
349 |
|
|
350 |
if(status != null && status.isCancelled()) |
|
351 |
return null; |
|
352 |
|
|
353 |
Extent ext = getExtent(); |
|
354 |
Point2D pInit = rasterToWorld(new Point2D.Double(0, 0)); |
|
355 |
Point2D pEnd = rasterToWorld(new Point2D.Double(getWidth(), getHeight())); |
|
356 |
double wRaster = Math.abs(pEnd.getX() - pInit.getX()); |
|
357 |
double hRaster = Math.abs(pEnd.getY() - pInit.getY()); |
|
358 |
double lrx = (((ext.getULX() - wRaster) > ext.maxX()) || ((ext.getULX() - wRaster) < ext.minX())) ? (ulx + w) : (ulx - w); |
|
359 |
double lry = (((ext.getULY() - hRaster) > ext.maxY()) || ((ext.getULY() - hRaster) < ext.minY())) ? (uly + h) : (uly - h); |
|
360 |
|
|
361 |
Point2D p1 = new Point2D.Double(ulx, uly); |
|
362 |
Point2D p2 = new Point2D.Double(lrx, lry); |
|
363 |
try { |
|
364 |
externalTransformation.inverseTransform(p1, p1); |
|
365 |
externalTransformation.inverseTransform(p2, p2); |
|
366 |
p1.setLocation((int)p1.getX(), (int)p1.getY()); |
|
367 |
p2.setLocation((int)Math.ceil(p2.getX()), (int)Math.ceil(p2.getY())); |
|
368 |
p1.setLocation(Math.max(p1.getX(), 0), Math.max(p1.getY(), 0)); |
|
369 |
p2.setLocation(Math.max(p2.getX(), 0), Math.max(p2.getY(), 0)); |
|
370 |
p1.setLocation(Math.min(p1.getX(), getWidth()), Math.min(p1.getY(), getHeight())); |
|
371 |
p2.setLocation(Math.min(p2.getX(), getWidth()), Math.min(p2.getY(), getHeight())); |
|
372 |
ownTransformation.transform(p1, p1); |
|
373 |
ownTransformation.transform(p2, p2); |
|
374 |
} catch (NoninvertibleTransformException e) { |
|
375 |
throw new RasterDriverException("Noninvertible transform"); |
|
376 |
} |
|
377 |
|
|
378 |
Extent selectedExtent = new ExtentImpl(p1.getX(), p1.getY(), p2.getX(), p2.getY()); |
|
379 |
|
|
380 |
setView(selectedExtent); |
|
381 |
int wPx = rasterBuf.getWidth(); |
|
382 |
int hPx = rasterBuf.getHeight(); |
|
383 |
int[] stpBuffer = new int[]{0, 0 , wPx, hPx}; |
|
384 |
|
|
385 |
loadBuffer(viewRequest, wPx, hPx, rasterBuf, bandList, stpBuffer, status); |
|
386 |
|
|
387 |
if(status != null && status.isCancelled()) |
|
388 |
return null; |
|
389 |
|
|
390 |
return rasterBuf; |
|
391 |
}*/ |
|
392 |
|
|
393 |
/*public Buffer getWindow(Extent extent, int bufWidth, int bufHeight, |
|
394 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) throws ProcessInterruptedException, RasterDriverException { |
|
395 |
|
|
396 |
if(status != null && status.isCancelled()) |
|
397 |
return null; |
|
398 |
|
|
399 |
Point2D p1 = new Point2D.Double(extent.getULX(), extent.getULY()); |
|
400 |
Point2D p2 = new Point2D.Double(extent.getLRX(), extent.getLRY()); |
|
401 |
try { |
|
402 |
externalTransformation.inverseTransform(p1, p1); |
|
403 |
externalTransformation.inverseTransform(p2, p2); |
|
404 |
p1.setLocation((int)p1.getX(), (int)p1.getY()); |
|
405 |
p2.setLocation((int)Math.ceil(p2.getX()), (int)Math.ceil(p2.getY())); |
|
406 |
p1.setLocation(Math.max(p1.getX(), 0), Math.max(p1.getY(), 0)); |
|
407 |
p2.setLocation(Math.max(p2.getX(), 0), Math.max(p2.getY(), 0)); |
|
408 |
p1.setLocation(Math.min(p1.getX(), getWidth()), Math.min(p1.getY(), getHeight())); |
|
409 |
p2.setLocation(Math.min(p2.getX(), getWidth()), Math.min(p2.getY(), getHeight())); |
|
410 |
ownTransformation.transform(p1, p1); |
|
411 |
ownTransformation.transform(p2, p2); |
|
412 |
} catch (NoninvertibleTransformException e) { |
|
413 |
throw new RasterDriverException("Noninvertible transform"); |
|
414 |
} |
|
415 |
Extent selectedExtent = new ExtentImpl(p1, p2); |
|
416 |
setView(selectedExtent); |
|
417 |
int[] stpBuffer = new int[]{0, 0 , bufWidth, bufHeight}; |
|
418 |
|
|
419 |
//TODO: FUNCIONALIDAD: Implementar adjustToExtent = false |
|
420 |
|
|
421 |
loadBuffer(viewRequest, bufWidth, bufHeight, rasterBuf, bandList, stpBuffer, status); |
|
422 |
|
|
423 |
if(status != null && status.isCancelled()) |
|
424 |
return null; |
|
425 |
|
|
426 |
return rasterBuf; |
|
427 |
}*/ |
|
428 |
|
|
429 |
/*public Buffer getWindow(int x, int y, int w, int h, |
|
430 |
BandList bandList, Buffer rasterBuf, TaskStatus status) throws ProcessInterruptedException, RasterDriverException { |
|
431 |
|
|
432 |
if(status != null && status.isCancelled()) |
|
433 |
return null; |
|
434 |
|
|
435 |
Point2D init = this.rasterToWorld(new Point2D.Double(x, y)); |
|
436 |
Point2D end = this.rasterToWorld(new Point2D.Double(x + w, y + h)); |
|
437 |
Extent selectedExtent = new ExtentImpl(init.getX(), init.getY(), end.getX(), end.getY()); |
|
438 |
setView(selectedExtent); |
|
439 |
int[] stpBuffer = new int[]{0, 0 , rasterBuf.getWidth(), rasterBuf.getHeight()}; |
|
440 |
|
|
441 |
loadBuffer(viewRequest, rasterBuf.getWidth(), rasterBuf.getHeight(), rasterBuf, bandList, stpBuffer, status); |
|
442 |
|
|
443 |
if(status != null && status.isCancelled()) |
|
444 |
return null; |
|
445 |
|
|
446 |
return rasterBuf; |
|
447 |
}*/ |
|
448 |
|
|
449 | 308 |
/** |
450 | 309 |
* Carga el buffer con las bandas RGB del raster con los par?metros especificados de extensi?n |
451 | 310 |
* y tama?o de buffer. El problema de ecw es que solo podemos leer 3 bandas de una vez ya que solo disponemos |
Also available in: Unified diff