Revision 2849 trunk/libraries/libCq CMS for java.old/src/org/cresques/io/GeoRasterFile.java
GeoRasterFile.java | ||
---|---|---|
74 | 74 |
private static TreeMap supportedExtensions = null; |
75 | 75 |
protected Component updatable = null; |
76 | 76 |
protected boolean doTransparency = false; |
77 |
/** |
|
78 |
* Variable que puede tener un valor si se le asigna el extent |
|
79 |
* de la vista. Esto es util para cargar imagenes sin georreferenciar |
|
80 |
* ya que podemos asignar el extent que queramos para ajustarnos a una |
|
81 |
* vista concreta |
|
82 |
*/ |
|
83 |
private Extent tempExtent = null; |
|
77 | 84 |
|
78 | 85 |
/** |
79 | 86 |
* Filtro para raster. |
... | ... | |
431 | 438 |
|
432 | 439 |
abstract public byte[] getWindow(int ulX, int ulY, int sizeX, int sizeY, int band); |
433 | 440 |
abstract public int getBlockSize(); |
441 |
|
|
442 |
/** |
|
443 |
* Obtiene el extent temporal. |
|
444 |
* @return Returns the tempExtent. |
|
445 |
*/ |
|
446 |
public Extent getTempExtent() { |
|
447 |
return tempExtent; |
|
448 |
} |
|
449 |
|
|
450 |
/** |
|
451 |
* Asigna un extent temporal que puede coincidir con el de la vista. Esto es |
|
452 |
* util para cargar imagenes sin georreferenciar ya que podemos asignar el extent |
|
453 |
* que queramos para ajustarnos a una vista concreta |
|
454 |
* @param tempExtent The tempExtent to set. |
|
455 |
*/ |
|
456 |
public void setTempExtent(Extent tempExtent) { |
|
457 |
this.tempExtent = tempExtent; |
|
458 |
} |
|
459 |
|
|
460 |
/** |
|
461 |
* Calcula un extent posible para la imagen a partir del extent de la vista |
|
462 |
* @param w Ancho de la imagen |
|
463 |
* @param h Alto de la imagen |
|
464 |
* @return Extent para la imagen |
|
465 |
*/ |
|
466 |
protected Extent calcTempExtent(double w, double h){ |
|
467 |
double ulX = 0D, ulY = 0D, lrX = 0D, lrY = 0D; |
|
468 |
if(w > h){ |
|
469 |
double widthView = tempExtent.maxX() - tempExtent.minX(); |
|
470 |
ulX = tempExtent.minX() + (widthView / 4); |
|
471 |
lrX = ulX + (widthView / 2); |
|
472 |
double newAlto = ((h * (widthView / 2)) / w); |
|
473 |
double centroY = tempExtent.minY()+((tempExtent.maxY() - tempExtent.minY())/2); |
|
474 |
ulY = centroY - (newAlto / 2); |
|
475 |
lrY = centroY + (newAlto / 2); |
|
476 |
}else{ |
|
477 |
double heightView = tempExtent.maxY() - tempExtent.minY(); |
|
478 |
ulY = tempExtent.minY() + (heightView / 4); |
|
479 |
lrY = ulY + (heightView / 2); |
|
480 |
double newAncho = ((w * (heightView / 2)) / h); |
|
481 |
double centroX = tempExtent.minX()+((tempExtent.maxX() - tempExtent.minX())/2); |
|
482 |
ulX = centroX - (newAncho / 2); |
|
483 |
lrX = centroX + (newAncho / 2); |
|
484 |
} |
|
485 |
return new Extent(ulX, ulY, lrX, lrY); |
|
486 |
} |
|
434 | 487 |
} |
Also available in: Unified diff