svn-gvsig-desktop / tags / v1_0_2_Build_899 / extensions / extGeoreferencing / src / com / iver / cit / gvsig / fmap / layers / FLyrGeoRaster.java @ 10517
History | View | Annotate | Download (18.8 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 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 com.iver.cit.gvsig.fmap.layers; |
20 |
|
21 |
import java.awt.Graphics2D; |
22 |
import java.awt.geom.Point2D; |
23 |
import java.awt.geom.Rectangle2D; |
24 |
import java.awt.image.BufferedImage; |
25 |
import java.io.BufferedReader; |
26 |
import java.io.File; |
27 |
import java.io.FileInputStream; |
28 |
import java.io.FileNotFoundException; |
29 |
import java.io.IOException; |
30 |
import java.io.InputStreamReader; |
31 |
import java.util.ArrayList; |
32 |
|
33 |
import javax.print.attribute.PrintRequestAttributeSet; |
34 |
|
35 |
import org.cresques.io.data.RasterMetaFileTags; |
36 |
import org.cresques.px.Extent; |
37 |
|
38 |
import com.iver.andami.PluginServices; |
39 |
import com.iver.cit.gvsig.fmap.DriverException; |
40 |
import com.iver.cit.gvsig.fmap.MapContext; |
41 |
import com.iver.cit.gvsig.fmap.ViewPort; |
42 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
43 |
import com.iver.utiles.XMLEntity; |
44 |
import com.iver.utiles.swing.threads.Cancellable; |
45 |
|
46 |
|
47 |
/**
|
48 |
* Clase de capa raster georeferenciada.
|
49 |
*
|
50 |
* @author Nacho Brodin (brodin_ign@gva.es)
|
51 |
*/
|
52 |
public class FLyrGeoRaster extends FLyrRaster{ |
53 |
|
54 |
//**********************Vars****************************************
|
55 |
private Extent assignExtent = null; |
56 |
private IStackZoom zoom = null; |
57 |
private FLyrPoints lyrPoints = null; |
58 |
private double widthPxImg, heightPxImg; |
59 |
private ViewPort viewPortWithoutTransformation = null; |
60 |
/**
|
61 |
* Dialogo de georreferenciaci?n asociado a la capa.
|
62 |
*/
|
63 |
private IGeoUi geoUI = null; |
64 |
private IPersistence persistence = null; |
65 |
//**********************End Vars************************************
|
66 |
|
67 |
//**********************Methods*************************************
|
68 |
|
69 |
/**
|
70 |
* Constructor
|
71 |
*/
|
72 |
public FLyrGeoRaster(){}
|
73 |
|
74 |
/**
|
75 |
* Contructor
|
76 |
*/
|
77 |
public FLyrGeoRaster(IPersistence persistence, IStackZoom zoom){
|
78 |
this.persistence = persistence;
|
79 |
this.zoom = zoom;
|
80 |
} |
81 |
|
82 |
/**
|
83 |
* Funci?n encargada de realizar la transformaci?n para las coordenadas
|
84 |
* del viewPort que se quiere dibujar. Para esta transformaci?n se tiene
|
85 |
* en cuenta que la imagen tiene un extent propio y uno asignado por el
|
86 |
* usuario por lo que habr? que transformar las coordenadas que solicita
|
87 |
* el usuario en coordenadas de la imagen.
|
88 |
* @param vp ViewPort solicitado por el usuario.
|
89 |
* @return ViewPort transformado a coordenadas de la imagen.
|
90 |
*/
|
91 |
public ViewPort toImageCoord(ViewPort vp) throws DriverException{ |
92 |
this.viewPortWithoutTransformation = vp;
|
93 |
|
94 |
if(this.assignExtent == null) |
95 |
return vp;
|
96 |
|
97 |
//Para la transformaci?n trasladamos virtualmente los extents, el real de la imagen
|
98 |
// y el asignado al centro del eje de coordenadas. Despu?s trasladamos el viewPort
|
99 |
//(vpTrasExtent) y con las proporciones de los 2 extents hallamos en ancho, alto y
|
100 |
//coordenada de inicio del viewport. Todo esto equivale a trasladar y escalar el
|
101 |
//viewPort para hallar el nuevo.
|
102 |
|
103 |
Rectangle2D userExtent = new Rectangle2D.Double(assignExtent.minX(), |
104 |
assignExtent.minY(), |
105 |
assignExtent.width(), |
106 |
assignExtent.height()); |
107 |
Rectangle2D imageExtent = super.getFullExtent(); |
108 |
Rectangle2D vpExtent = vp.getExtent();
|
109 |
|
110 |
//Traslaci?n del viewport estando el extent posicionado en el 0,0
|
111 |
Rectangle2D vpTrasExtent = new Rectangle2D.Double( vpExtent.getMinX() - userExtent.getMinX(), |
112 |
vpExtent.getMinY() - userExtent.getMinY(), |
113 |
vpExtent.getWidth(), |
114 |
vpExtent.getHeight()); |
115 |
double x = 0D, y = 0D, width = 0D, height = 0D; |
116 |
|
117 |
//Escalado de la anchura y altura. No hace falta traslaci?n
|
118 |
width = (vpExtent.getWidth() * imageExtent.getWidth())/assignExtent.width(); |
119 |
height = (vpExtent.getHeight() * imageExtent.getHeight())/assignExtent.height(); |
120 |
|
121 |
//Escalado del min del viewport para hallar el min del nuevo
|
122 |
x = (vpTrasExtent.getMinX() * imageExtent.getWidth())/assignExtent.width(); |
123 |
y = (vpTrasExtent.getMinY() * imageExtent.getHeight())/assignExtent.height(); |
124 |
|
125 |
//Traslaci?n
|
126 |
x += imageExtent.getMinX(); |
127 |
y += imageExtent.getMinY(); |
128 |
|
129 |
Rectangle2D newExtent = new Rectangle2D.Double(x, y, width, height); |
130 |
|
131 |
ViewPort viewPort = new ViewPort(vp.getProjection());
|
132 |
viewPort.setExtent(newExtent); |
133 |
viewPort.setImageSize(vp.getImageSize()); |
134 |
viewPort.refreshExtent(); |
135 |
|
136 |
return viewPort;
|
137 |
} |
138 |
|
139 |
/**
|
140 |
* Dibujado de la capa de raster georeferenciado aplicando la
|
141 |
* transformaci?n del viewPort.
|
142 |
*/
|
143 |
public void draw(BufferedImage image, Graphics2D g, ViewPort vp, |
144 |
Cancellable cancel,double scale) throws DriverException { |
145 |
super.draw(image, g, this.toImageCoord(vp), cancel, scale); |
146 |
} |
147 |
|
148 |
/**
|
149 |
* Impresi?n de la capa de raster georeferenciado aplicando la
|
150 |
* transformaci?n del viewPort.
|
151 |
*/
|
152 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
153 |
double scale, PrintRequestAttributeSet properties)throws DriverException { |
154 |
super.print(g, this.toImageCoord(viewPort), cancel, scale, properties); |
155 |
} |
156 |
|
157 |
/**
|
158 |
* Impresi?n de la capa de raster georeferenciado aplicando la
|
159 |
* transformaci?n del viewPort.
|
160 |
*/
|
161 |
public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel,double scale) |
162 |
throws DriverException {
|
163 |
_print(g, this.toImageCoord(viewPort), cancel, scale);
|
164 |
} |
165 |
|
166 |
/**
|
167 |
* Transforma un pixel de la imagen cuyas coordenadas son (0..maxWidth, 0..maxHeight)
|
168 |
* en coordenadas del mundo real a partir del extent asignado a la imagen.
|
169 |
* @param pixel Pixel de la imagen
|
170 |
* @return Coordenadas del mundo de ese pixel
|
171 |
*/
|
172 |
public Point2D img2World(Point2D pixel){ |
173 |
Point2D p = new Point2D.Double(); |
174 |
double wcWidth = 0.0, wcHeight = 0.0; |
175 |
double mapImgX = 0, mapImgY = 0; |
176 |
try{
|
177 |
wcWidth = getFullExtent().getWidth(); |
178 |
wcHeight = getFullExtent().getHeight(); |
179 |
|
180 |
//La esquina superior izquierda de la vista es minX,maxY y la de la imagen minX,minY
|
181 |
double pixelImgX = pixel.getX();
|
182 |
double pixelImgY = getImageHeight() - pixel.getY();
|
183 |
|
184 |
//Hallamos el pto en coordenadas reales con una regla de tres
|
185 |
mapImgX = (((pixelImgX * wcWidth) / widthPxImg)); |
186 |
mapImgY = (((pixelImgY * wcHeight) / heightPxImg)); |
187 |
|
188 |
//Trasladamos a su ubicaci?n real
|
189 |
mapImgX += this.getFullExtent().getMinX();
|
190 |
mapImgY += this.getFullExtent().getMinY();
|
191 |
|
192 |
|
193 |
}catch(DriverException ex){}
|
194 |
p.setLocation(mapImgX, mapImgY); |
195 |
return p;
|
196 |
} |
197 |
|
198 |
/**
|
199 |
* Transforma un pixel de la imagen cuyas coordenadas son (0..maxWidth, 0..maxHeight)
|
200 |
* en coordenadas del mundo real a partir del extent asignado a la imagen.
|
201 |
* @param x Coordenada X del pixel de la imagen
|
202 |
* @param y Coordenada Y del pixel de la imagen
|
203 |
* @return Coordenadas del mundo de ese pixel
|
204 |
*/
|
205 |
public Point2D img2World(double x, double y){ |
206 |
Point2D p = new Point2D.Double(); |
207 |
p.setLocation(x, y); |
208 |
return this.img2World(p); |
209 |
} |
210 |
|
211 |
/**
|
212 |
* Transforma una coordenada del mundo real a un pixel (0..maxWidth, 0..maxHeight)
|
213 |
* en coordenadas de la imagen a partir del extent asignado a esta.
|
214 |
* @param wcPoint coordenada del mundo
|
215 |
* @return Pixel de la imagen
|
216 |
*/
|
217 |
public Point2D world2Img(Point2D wcPoint){ |
218 |
//Si el punto cae fuera de la imagen salimos devolviendo null
|
219 |
|
220 |
if( wcPoint.getX() < this.getMinX() || |
221 |
wcPoint.getX() > this.getMaxX() ||
|
222 |
wcPoint.getY() < this.getMinY() ||
|
223 |
wcPoint.getY() > this.getMaxY())
|
224 |
return null; |
225 |
|
226 |
//Hallamos pixelImg q son las coordenadas en pixeles de la imagen que corresponden
|
227 |
//con el punto wcPoint
|
228 |
double wcWidth = 0.0, wcHeight = 0.0, ptoWCX = 0.0, ptoWCY = 0.0; |
229 |
double pixelImgX = 0, pixelImgY = 0; |
230 |
try{
|
231 |
wcWidth = getFullExtent().getWidth(); |
232 |
wcHeight = getFullExtent().getHeight(); |
233 |
//Traslaci?n al origen ya que la imagen empieza en 0,0
|
234 |
ptoWCX = wcPoint.getX() - getFullExtent().getMinX(); |
235 |
ptoWCY = wcPoint.getY() - getFullExtent().getMinY(); |
236 |
//Hallamos el pto en pixeles con una regla de tres
|
237 |
pixelImgX = ((ptoWCX * getImageWidth()) / wcWidth); |
238 |
pixelImgY = ((ptoWCY * getImageHeight()) / wcHeight); |
239 |
//La esquina superior izquierda de la vista es minX,maxY y la de la imagen minX,minY
|
240 |
pixelImgY = getImageHeight() - pixelImgY; |
241 |
}catch(DriverException ex){}
|
242 |
|
243 |
Point2D result = new Point2D.Double(); |
244 |
result.setLocation(pixelImgX, pixelImgY); |
245 |
return result;
|
246 |
} |
247 |
|
248 |
/**
|
249 |
* Transforma una coordenada del mundo real a un pixel (0..maxWidth, 0..maxHeight)
|
250 |
* en coordenadas de la imagen a partir del extent asignado a esta.
|
251 |
* @param x wcPoint coordenada X del mundo
|
252 |
* @param y wcPoint coordenada Y del mundo
|
253 |
* @return Pixel de la imagen
|
254 |
*/
|
255 |
public Point2D world2Img(double x, double y){ |
256 |
Point2D p = new Point2D.Double(); |
257 |
p.setLocation(x, y); |
258 |
return this.world2Img(p); |
259 |
} |
260 |
|
261 |
|
262 |
/**
|
263 |
* Recupera el extent asignado, si existe y llama al setXMLEntity de la capa de puntos
|
264 |
*/
|
265 |
public void setXMLEntity(XMLEntity xml)throws XMLException { |
266 |
super.setXMLEntity(xml);
|
267 |
|
268 |
if (xml.contains("raster.assignExtent.minX") && |
269 |
xml.contains("raster.assignExtent.minY") &&
|
270 |
xml.contains("raster.assignExtent.maxX") &&
|
271 |
xml.contains("raster.assignExtent.maxY")){
|
272 |
|
273 |
//Comprobamos si existe el fichero .rmf y si existe analizamos el contenido
|
274 |
//buscando el bloque que contiene georreferenciaci?n. Si tiene este bloque
|
275 |
//no utilizaremos el extent asignado que lleva el proyecto para que use la
|
276 |
//georreferenciaci?n de la imagen.
|
277 |
boolean georefRmf = false; |
278 |
String path = ((RasterFileAdapter)getSource()).getFile().getPath();
|
279 |
String rmfName = path.substring(0, path.lastIndexOf(".")) + ".rmf"; |
280 |
File rmfFile = new File(rmfName); |
281 |
try{
|
282 |
BufferedReader inGrf = new BufferedReader(new InputStreamReader(new FileInputStream(rmfFile))); |
283 |
String str = inGrf.readLine();
|
284 |
while( str != null && |
285 |
!str.startsWith("</"+RasterMetaFileTags.LAYER) &&
|
286 |
!str.startsWith("</"+RasterMetaFileTags.GEOPOINT))
|
287 |
str = inGrf.readLine(); |
288 |
if(str.startsWith("</"+RasterMetaFileTags.LAYER)) |
289 |
georefRmf = true;
|
290 |
}catch(FileNotFoundException ex){ |
291 |
//Si no encuentra el fichero no se modifica la variable georefRmf
|
292 |
}catch(IOException ex){ |
293 |
//Si da un error de I/O no se modifica la variable georefRmf
|
294 |
} |
295 |
|
296 |
if(!georefRmf){
|
297 |
this.assignExtent = new Extent(xml.getDoubleProperty("raster.assignExtent.minX"), |
298 |
xml.getDoubleProperty("raster.assignExtent.minY"),
|
299 |
xml.getDoubleProperty("raster.assignExtent.maxX"),
|
300 |
xml.getDoubleProperty("raster.assignExtent.maxY"));
|
301 |
} |
302 |
if (xml.contains("raster.assignExtent.imageWidth") && |
303 |
xml.contains("raster.assignExtent.imageHeight")){
|
304 |
this.widthPxImg = xml.getDoubleProperty("raster.assignExtent.imageWidth"); |
305 |
this.heightPxImg = xml.getDoubleProperty("raster.assignExtent.imageHeight"); |
306 |
} |
307 |
} |
308 |
} |
309 |
|
310 |
/**
|
311 |
* Cambia el nombre a la capa de puntos si esta empieza por * para que no se salve con ese
|
312 |
* nombre y llama a getXMLEntity del padre. Salva el extent asignado, si existe y llama a
|
313 |
* getXMLEntity de la capa de puntos para que se guarden los puntos de control en el proyecto.
|
314 |
* @throws XMLException
|
315 |
*/
|
316 |
public XMLEntity getXMLEntity() throws XMLException { |
317 |
boolean active = false; |
318 |
if(getName().startsWith("*")){ |
319 |
setName(getName().substring(1, getName().length()));
|
320 |
active = true;
|
321 |
} |
322 |
|
323 |
XMLEntity xml = super.getXMLEntity();
|
324 |
|
325 |
if(active)
|
326 |
setName("*"+getName());
|
327 |
|
328 |
if(this.assignExtent != null){ |
329 |
xml.putProperty("raster.assignExtent.minX", assignExtent.getMin().getX());
|
330 |
xml.putProperty("raster.assignExtent.minY", assignExtent.getMin().getY());
|
331 |
xml.putProperty("raster.assignExtent.maxX", assignExtent.getMax().getX());
|
332 |
xml.putProperty("raster.assignExtent.maxY", assignExtent.getMax().getY());
|
333 |
xml.putProperty("raster.assignExtent.imageWidth", this.getImageWidth()); |
334 |
xml.putProperty("raster.assignExtent.imageHeight", this.getImageHeight()); |
335 |
} |
336 |
|
337 |
try{
|
338 |
geoUI.savePoints(); |
339 |
}catch(Exception ex){ |
340 |
//La capa de puntos no est? cargada por lo que no podemos salvar
|
341 |
} |
342 |
return xml;
|
343 |
} |
344 |
|
345 |
/**
|
346 |
* A partir de nuevas coordenadas actualiza la vista, minimagen, capa de puntos el
|
347 |
* dialogo y la tabla.
|
348 |
*
|
349 |
*/
|
350 |
public void updateData(int nPunto, Point2D pixel, Point2D map, View view){ |
351 |
this.geoUI.updateData(nPunto, pixel, map, view);
|
352 |
} |
353 |
|
354 |
/**
|
355 |
* Borra de la lista de listeners el que se pasa como par?metro.
|
356 |
*
|
357 |
* @param o LayerListener a borrar.
|
358 |
*
|
359 |
* @return True si ha sido correcto el borrado del Listener.
|
360 |
*/
|
361 |
public boolean removeLayerListener(LayerListener o) { |
362 |
try{
|
363 |
//Hacemos invisible LyrPoints para que la capa gr?fica de Fmap no dibuje nada
|
364 |
this.getLyrPoints().setVisible(false); |
365 |
|
366 |
geoUI.close(); |
367 |
}catch(NullPointerException ex){ |
368 |
//Si geoUI es null no hace falta que cerremos la ventana
|
369 |
} |
370 |
return super.removeLayerListener(o); |
371 |
} |
372 |
//**********************End Methods**********************************
|
373 |
|
374 |
//**********************Setters & Getters****************************
|
375 |
/**
|
376 |
* @return Returns the viewPortWithoutTransform.
|
377 |
*/
|
378 |
public ViewPort getViewPortWithoutTransformation() {
|
379 |
return viewPortWithoutTransformation;
|
380 |
} |
381 |
|
382 |
/**
|
383 |
* Asigna la capa de puntos asociada a la capa Georraster
|
384 |
* @param lyr Capa de puntos
|
385 |
*/
|
386 |
public void setFLyrPoints(FLyrPoints lyr){ |
387 |
this.lyrPoints = lyr;
|
388 |
} |
389 |
|
390 |
/**
|
391 |
* Obtiene la capa de puntos asociada a la capa Georraster. Si no existe
|
392 |
* crear? una.
|
393 |
* @return Capa de puntos
|
394 |
*/
|
395 |
public FLyrPoints getFLyrPoints()throws ClassCastException{ |
396 |
//Si no existe una capa de puntos la creamos
|
397 |
if(lyrPoints == null){ |
398 |
View theView = (View) PluginServices.getMDIManager().getActiveWindow(); |
399 |
MapContext fmap = theView.getMapControl().getMapContext(); |
400 |
lyrPoints = new FLyrPoints(this, persistence); |
401 |
fmap.setGraphicsLayer(lyrPoints); |
402 |
} |
403 |
return lyrPoints;
|
404 |
} |
405 |
|
406 |
/**
|
407 |
* Asigna la dimensi?n de la imagen de disco en pixeles
|
408 |
* @param w Ancho
|
409 |
* @param h Alto
|
410 |
*/
|
411 |
public void setImageDimension(double w, double h){ |
412 |
this.widthPxImg = w;
|
413 |
this.heightPxImg = h;
|
414 |
} |
415 |
|
416 |
/**
|
417 |
* Obtiene el ancho de la imagen de disco en pixeles. Si no se tiene valor es
|
418 |
* porque se ha abierto un proyecto con una imagen con rmf asociado. En este
|
419 |
* caso se tendr? que leer el ancho de los atributos de la capa.
|
420 |
* @return
|
421 |
*/
|
422 |
public double getImageWidth(){ |
423 |
if(this.widthPxImg == 0){ |
424 |
ArrayList attr = getSource().getAttributes();
|
425 |
for (int i=0; i<attr.size(); i++) { |
426 |
Object [] a = (Object []) attr.get(i); |
427 |
if(((String)a[0]).equals("Width")) |
428 |
widthPxImg = ((Integer)a[1]).intValue(); |
429 |
} |
430 |
} |
431 |
return this.widthPxImg; |
432 |
} |
433 |
|
434 |
/**
|
435 |
* Obtiene el alto de la imagen de disco en pixeles. Si no se tiene valor es
|
436 |
* porque se ha abierto un proyecto con una imagen con rmf asociado. En este
|
437 |
* caso se tendr? que leer el ancho de los atributos de la capa.
|
438 |
* @return
|
439 |
*/
|
440 |
public double getImageHeight(){ |
441 |
if(this.heightPxImg == 0){ |
442 |
ArrayList attr = getSource().getAttributes();
|
443 |
for (int i=0; i<attr.size(); i++) { |
444 |
Object [] a = (Object []) attr.get(i); |
445 |
if(((String)a[0]).equals("Height")) |
446 |
heightPxImg = ((Integer)a[1]).intValue(); |
447 |
} |
448 |
} |
449 |
return this.heightPxImg; |
450 |
} |
451 |
/**
|
452 |
* @return Returns the geoDialog.
|
453 |
*/
|
454 |
public IGeoUi getGeoDialog() {
|
455 |
return geoUI;
|
456 |
} |
457 |
/**
|
458 |
* @param geoDialog The geoDialog to set.
|
459 |
*/
|
460 |
public void setGeoDialog(IGeoUi geoDialog) { |
461 |
this.geoUI = geoDialog;
|
462 |
} |
463 |
/**
|
464 |
* Obtiene el extent de la capa
|
465 |
* @return extent en Rectangle2D.
|
466 |
*/
|
467 |
public Rectangle2D getFullExtent()throws DriverException { |
468 |
if(assignExtent == null) |
469 |
return super.getFullExtent(); |
470 |
return assignExtent.toRectangle2D();
|
471 |
} |
472 |
|
473 |
/**
|
474 |
* Obtiene el extent de la capa
|
475 |
* @return extent de la capa
|
476 |
*/
|
477 |
public Extent getAssignExtent(){
|
478 |
try{
|
479 |
if(assignExtent == null) |
480 |
return new Extent( super.getFullExtent().getMinX(), |
481 |
super.getFullExtent().getMinY(),
|
482 |
super.getFullExtent().getMaxX(),
|
483 |
super.getFullExtent().getMaxY());
|
484 |
}catch(DriverException ex){}
|
485 |
return assignExtent;
|
486 |
} |
487 |
|
488 |
/**
|
489 |
* Obtiene la coordenada X m?xima
|
490 |
*/
|
491 |
public double getMaxX(){ |
492 |
if(assignExtent == null) |
493 |
return super.getMaxX(); |
494 |
return assignExtent.maxX();
|
495 |
} |
496 |
|
497 |
/**
|
498 |
* Obtiene la coordenada Y m?xima
|
499 |
*/
|
500 |
public double getMaxY(){ |
501 |
if(assignExtent == null) |
502 |
return super.getMaxY(); |
503 |
return assignExtent.maxY();
|
504 |
} |
505 |
|
506 |
/**
|
507 |
* Obtiene la coordenada X m?nima
|
508 |
*/
|
509 |
public double getMinX(){ |
510 |
if(assignExtent == null) |
511 |
return super.getMinX(); |
512 |
return assignExtent.minX();
|
513 |
} |
514 |
|
515 |
/**
|
516 |
* Obtiene la coordenada Y m?nima
|
517 |
*/
|
518 |
public double getMinY(){ |
519 |
if(assignExtent == null) |
520 |
return super.getMinY(); |
521 |
return assignExtent.minY();
|
522 |
} |
523 |
|
524 |
/**
|
525 |
* Obtiene el alto
|
526 |
*/
|
527 |
public double getHeight(){ |
528 |
if(assignExtent == null) |
529 |
return super.getHeight(); |
530 |
return assignExtent.height();
|
531 |
} |
532 |
|
533 |
/**
|
534 |
* Obtiene el ancho
|
535 |
*/
|
536 |
public double getWidth(){ |
537 |
if(assignExtent == null) |
538 |
return super.getWidth(); |
539 |
return assignExtent.width();
|
540 |
} |
541 |
|
542 |
/**
|
543 |
* @param assignExtent The assignExtent to set.
|
544 |
*/
|
545 |
public void setAssignExtent(Extent assignExtent) { |
546 |
if(assignExtent.getMax().distance(assignExtent.getMin()) > 0){ |
547 |
this.assignExtent = assignExtent;
|
548 |
setAssignZoomIntoStack(); |
549 |
} |
550 |
} |
551 |
|
552 |
/**
|
553 |
* Guarda el zoom asignado a la capa en la pila de zooms
|
554 |
*/
|
555 |
public void setAssignZoomIntoStack(){ |
556 |
zoom.setZoom(assignExtent); |
557 |
} |
558 |
|
559 |
/**
|
560 |
* Asigna el ?ltimo extent seleccionado si hay alguno
|
561 |
*/
|
562 |
public void setLastExtent(){ |
563 |
Extent e = null;
|
564 |
e = zoom.getLastZoom(); |
565 |
if(e != null) |
566 |
this.assignExtent = e;
|
567 |
} |
568 |
|
569 |
/**
|
570 |
* Asigna el siguiente extent de la pila si hay alguno
|
571 |
*/
|
572 |
public void setNextExtent(){ |
573 |
Extent e = null;
|
574 |
e = zoom.getNextZoom(); |
575 |
if(e != null) |
576 |
this.assignExtent = e;
|
577 |
} |
578 |
|
579 |
/**
|
580 |
* Obtiene la pila de extents aplicados
|
581 |
* @return pila de extents
|
582 |
*/
|
583 |
public IStackZoom getStackZoom(){
|
584 |
return zoom;
|
585 |
} |
586 |
|
587 |
/**
|
588 |
* Obtiene la capa de puntos
|
589 |
* @return FLyrPoints
|
590 |
*/
|
591 |
public FLyrPoints getLyrPoints() {
|
592 |
return lyrPoints;
|
593 |
} |
594 |
|
595 |
/**
|
596 |
* Obtiene el objeto que gestiona la persistencia
|
597 |
* @return interfaz IPersistence
|
598 |
*/
|
599 |
public IPersistence getPersistence() {
|
600 |
return persistence;
|
601 |
} |
602 |
|
603 |
/**
|
604 |
* Asigna el objeto que gestiona la persistencia
|
605 |
* @param persistence
|
606 |
*/
|
607 |
public void setPersistence(IPersistence persistence) { |
608 |
this.persistence = persistence;
|
609 |
if(this.lyrPoints != null) |
610 |
this.lyrPoints.setPersistence(persistence);
|
611 |
} |
612 |
|
613 |
/**
|
614 |
* Obtiene el objeto que gestiona la pila de zooms
|
615 |
* @return IStackZoom
|
616 |
*/
|
617 |
public IStackZoom getZoom() {
|
618 |
return zoom;
|
619 |
} |
620 |
|
621 |
/**
|
622 |
* Asigna el objeto que gestiona la pila de zooms
|
623 |
* @param IStackZoom
|
624 |
*/
|
625 |
public void setZoom(IStackZoom zoom) { |
626 |
if(this.zoom == null) |
627 |
this.zoom = zoom;
|
628 |
} |
629 |
//**********************End Setters & Getters************************
|
630 |
|
631 |
} |