root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / fframes / FFrameView.java @ 1222
History | View | Annotate | Download (17.2 KB)
1 |
/*
|
---|---|
2 |
* Created on 20-feb-2004
|
3 |
*
|
4 |
*/
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package com.iver.cit.gvsig.gui.layout.fframes; |
46 |
|
47 |
import com.iver.andami.PluginServices; |
48 |
import com.iver.andami.messages.NotificationManager; |
49 |
|
50 |
import com.iver.cit.gvsig.ProjectExtension; |
51 |
import com.iver.cit.gvsig.fmap.ColorEvent; |
52 |
import com.iver.cit.gvsig.fmap.ExtentEvent; |
53 |
import com.iver.cit.gvsig.fmap.FMap; |
54 |
import com.iver.cit.gvsig.fmap.ViewPort; |
55 |
import com.iver.cit.gvsig.fmap.ViewPortListener; |
56 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
57 |
import com.iver.cit.gvsig.gui.layout.FLayoutUtilities; |
58 |
import com.iver.cit.gvsig.gui.layout.Layout; |
59 |
import com.iver.cit.gvsig.project.Project; |
60 |
import com.iver.cit.gvsig.project.ProjectView; |
61 |
|
62 |
import com.iver.utiles.XMLEntity; |
63 |
|
64 |
import org.apache.log4j.Logger; |
65 |
|
66 |
import java.awt.Dimension; |
67 |
import java.awt.Graphics2D; |
68 |
import java.awt.Rectangle; |
69 |
import java.awt.geom.AffineTransform; |
70 |
import java.awt.geom.Point2D; |
71 |
import java.awt.geom.Rectangle2D; |
72 |
import java.awt.image.BufferedImage; |
73 |
|
74 |
import java.util.ArrayList; |
75 |
|
76 |
|
77 |
/**
|
78 |
* FFrame para introducir una vista en el Layout.
|
79 |
*
|
80 |
* @author Vicente Caballero Navarro
|
81 |
*/
|
82 |
public class FFrameView extends FFrame implements ViewPortListener { |
83 |
private static Logger logger = Logger.getLogger(FFrameView.class.getName()); |
84 |
public static final int AUTOMATICO = 0; |
85 |
public static final int CONSTANTE = 1; |
86 |
public static final int MANUAL = 2; |
87 |
public static final int PRESENTACION = 0; |
88 |
public static final int BORRADOR = 1; |
89 |
private int m_Mode; |
90 |
private int m_typeScale = AUTOMATICO; |
91 |
private int m_extension = 0; |
92 |
private int m_quality = PRESENTACION; |
93 |
private int m_viewing = 0; |
94 |
private boolean m_bLinked = true; |
95 |
private ProjectView view = null; |
96 |
private FMap m_fmap = null; |
97 |
private double m_Scale = 0; |
98 |
private int m_mapUnits = 1; //Metros. |
99 |
private int num = 0; |
100 |
private BufferedImage m_image = null; |
101 |
private AffineTransform at = null; |
102 |
private Project project = null; |
103 |
|
104 |
/**
|
105 |
* Creates a new FFrameView object.
|
106 |
*/
|
107 |
public FFrameView() {
|
108 |
} |
109 |
|
110 |
/**
|
111 |
* Devuelve una descripci?n del FFrameView.
|
112 |
*
|
113 |
* @return Descripci?n.
|
114 |
*/
|
115 |
public String toString() { |
116 |
if (getView() == null) { |
117 |
return "FFrameView " + num + ": " + "Vacio"; |
118 |
} |
119 |
|
120 |
return "FFrameView " + num + ": " + getView().getName(); |
121 |
} |
122 |
|
123 |
/**
|
124 |
* Rellena la escala de la vista que contiene el fframe.
|
125 |
*
|
126 |
* @param d escala de la vista.
|
127 |
*/
|
128 |
public void setScale(double d) { |
129 |
m_Scale = d; |
130 |
} |
131 |
|
132 |
/**
|
133 |
* Inserta el nuevo extent a la FFrameView.
|
134 |
*
|
135 |
* @param r Rect?ngulo a ocupar por el FFrameView.
|
136 |
*/
|
137 |
public void setNewExtent(Rectangle2D r) { |
138 |
getFMap().getViewPort().setExtent(r); |
139 |
m_Scale = FLayoutUtilities.getScaleView(getFMap(), getBoundBox().height); |
140 |
} |
141 |
|
142 |
/**
|
143 |
* Devuelve el FMap de la vista o una clonaci?n de este si se utiliza una
|
144 |
* escala fija.
|
145 |
*
|
146 |
* @return FMap.
|
147 |
*/
|
148 |
public FMap getFMap() {
|
149 |
return m_fmap;
|
150 |
} |
151 |
|
152 |
/**
|
153 |
* Rellena la calidad que se quiere aplicar.
|
154 |
*
|
155 |
* @param q entero que representa la calidad a aplicar.
|
156 |
*/
|
157 |
public void setQuality(int q) { |
158 |
m_quality = q; |
159 |
} |
160 |
|
161 |
/**
|
162 |
* Devuelve un entero que representa la calidad que est? seleccionada.
|
163 |
*
|
164 |
* @return tipo de calidad selccionada.
|
165 |
*/
|
166 |
public int getQuality() { |
167 |
return m_quality;
|
168 |
} |
169 |
|
170 |
/**
|
171 |
* Devuelve un entero que representa la forma en que se actualiza la vista.
|
172 |
*
|
173 |
* @return forma que se actualiza la vista.
|
174 |
*/
|
175 |
public int getViewing() { |
176 |
return m_viewing;
|
177 |
} |
178 |
|
179 |
/**
|
180 |
* Rellena la forma de actualizar la vista.
|
181 |
*
|
182 |
* @param v entero que representa la forma de actualizar la vista.
|
183 |
*/
|
184 |
public void setViewing(int v) { |
185 |
m_viewing = v; |
186 |
} |
187 |
|
188 |
/**
|
189 |
* Inserta el ProjectView de donde obtener las propiedades de la vista a
|
190 |
* mostrar.
|
191 |
*
|
192 |
* @param v Modelo de la vista.
|
193 |
*/
|
194 |
public void setView(ProjectView v) { |
195 |
view = v; |
196 |
|
197 |
ViewPort vp = new ViewPort(v.getMapContext().getViewPort()
|
198 |
.getProjection()); |
199 |
|
200 |
if (m_bLinked) {
|
201 |
if (getTypeScale() == AUTOMATICO) {
|
202 |
m_fmap = v.getMapContext().createNewFMap(v.getMapContext() |
203 |
.getViewPort() |
204 |
.cloneViewPort()); |
205 |
v.getMapContext().getViewPort().addViewPortListener(this);
|
206 |
} else if (getTypeScale() == CONSTANTE) { |
207 |
vp.setExtent((Rectangle2D) v.getMapContext().getViewPort()
|
208 |
.getExtent().clone()); |
209 |
m_fmap = v.getMapContext().createNewFMap(vp); |
210 |
v.getMapContext().getViewPort().removeViewPortListener(this);
|
211 |
} else if (getTypeScale() == MANUAL) { |
212 |
vp.setExtent(getNewExtent(getScale())); |
213 |
m_fmap = v.getMapContext().createNewFMap(vp); |
214 |
v.getMapContext().getViewPort().removeViewPortListener(this);
|
215 |
} |
216 |
} else if (!m_bLinked) { |
217 |
try {
|
218 |
if (getTypeScale() == AUTOMATICO) {
|
219 |
m_fmap = v.getMapContext().cloneFMap(); //(v.getMapContext().getViewPort().cloneViewPort());
|
220 |
m_fmap.setViewPort(v.getMapContext().getViewPort() |
221 |
.cloneViewPort()); |
222 |
v.getMapContext().getViewPort().addViewPortListener(this);
|
223 |
} else if (getTypeScale() == CONSTANTE) { |
224 |
vp.setExtent((Rectangle2D) v.getMapContext().getViewPort()
|
225 |
.getExtent().clone()); |
226 |
m_fmap = v.getMapContext().cloneFMap(); |
227 |
m_fmap.setViewPort(vp); |
228 |
v.getMapContext().getViewPort().removeViewPortListener(this);
|
229 |
} else if (getTypeScale() == MANUAL) { |
230 |
vp.setExtent(getNewExtent(getScale())); |
231 |
m_fmap = v.getMapContext().cloneFMap(); |
232 |
m_fmap.setViewPort(vp); |
233 |
v.getMapContext().getViewPort().removeViewPortListener(this);
|
234 |
} |
235 |
} catch (XMLException e1) {
|
236 |
NotificationManager.addError("Cuando se a?ade una vista al Layout",
|
237 |
e1); |
238 |
} |
239 |
} |
240 |
|
241 |
/*
|
242 |
m_fmap = v.getMapContext();
|
243 |
|
244 |
v.getMapContext().getViewPort();
|
245 |
ViewPort vp = new ViewPort();
|
246 |
vp.setExtent(v.getMapContext().getViewPort().getExtent());
|
247 |
m_fmap = m_fmap.createNewFMap(vp);
|
248 |
view = v;
|
249 |
*/
|
250 |
} |
251 |
|
252 |
/**
|
253 |
* Devuelve el modelo de la vista.
|
254 |
*
|
255 |
* @return Modelo de la vista.
|
256 |
*/
|
257 |
public ProjectView getView() {
|
258 |
return view;
|
259 |
} |
260 |
|
261 |
/**
|
262 |
* Devuelve un Rect?ngulo que representa el extent de la vista que se
|
263 |
* requiere a partir de una escala.
|
264 |
*
|
265 |
* @param scale Escala a mostrar.
|
266 |
*
|
267 |
* @return Rect?ngulo.
|
268 |
*/
|
269 |
private Rectangle2D.Double getNewExtent(long scale) { |
270 |
double hview = getBoundBox().getHeight();
|
271 |
double wview = getBoundBox().getWidth();
|
272 |
double hextent = (scale * hview) / 100.0; |
273 |
double wextent = (scale * wview) / 100.0; |
274 |
double dif = hextent / m_fmap.getViewPort().getExtent().getHeight();
|
275 |
double newx = m_fmap.getViewPort().getExtent().getCenterX() -
|
276 |
((m_fmap.getViewPort().getExtent().getWidth() * dif) / 2.0);
|
277 |
double newy = m_fmap.getViewPort().getExtent().getCenterY() -
|
278 |
((m_fmap.getViewPort().getExtent().getHeight() * dif) / 2.0);
|
279 |
|
280 |
return new Rectangle2D.Double(newx, newy, wextent, hextent); |
281 |
} |
282 |
|
283 |
/**
|
284 |
* M?todo que dibuja sobre el graphics que se le pasa como par?metro, seg?n
|
285 |
* la transformada afin que se debe de aplicar y el rect?ngulo que se debe
|
286 |
* de dibujar.
|
287 |
*
|
288 |
* @param g Graphics2D
|
289 |
* @param at Transformada af?n.
|
290 |
* @param rv rect?ngulo sobre el que hacer un clip.
|
291 |
* @param imgBase Imagen para acelerar el dibujado.
|
292 |
*
|
293 |
* @throws com.iver.cit.gvsig.fmap.DriverException
|
294 |
*/
|
295 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
296 |
BufferedImage imgBase) throws com.iver.cit.gvsig.fmap.DriverException { |
297 |
Rectangle2D.Double r = getBoundingBox(at);
|
298 |
|
299 |
if (intersects(rv, r)) {
|
300 |
if (getFMap() == null) { |
301 |
drawEmpty(g); |
302 |
} else {
|
303 |
if (rv != null) { |
304 |
// Dibujamos en pantalla
|
305 |
Rectangle rclip = g.getClipBounds();
|
306 |
g.clipRect((int) r.getMinX(), (int) r.getMinY(), |
307 |
(int) r.getWidth(), (int) r.getHeight()); |
308 |
|
309 |
if (getQuality() == PRESENTACION) {
|
310 |
/* this.getFMap().setTransparent(true);
|
311 |
this.getFMap().drawView((Graphics2D) g,
|
312 |
new Rectangle((int) (r.x), (int) (r.y),
|
313 |
(int) (r.width), (int) (r.height)),
|
314 |
(Rectangle) rv, false, imgBase);
|
315 |
*/
|
316 |
if (rv.intersects(r)) {
|
317 |
this.getFMap().getViewPort().setOffset(new Point2D.Double( |
318 |
r.x, r.y)); |
319 |
this.getFMap().getViewPort().setImageSize(new Dimension( |
320 |
(int) r.width, (int) r.height)); |
321 |
|
322 |
try {
|
323 |
this.getFMap().draw(imgBase, g);
|
324 |
} catch (com.iver.cit.gvsig.fmap.DriverException e) {
|
325 |
// TODO Auto-generated catch block
|
326 |
e.printStackTrace(); |
327 |
} |
328 |
} |
329 |
|
330 |
if (rclip != null) { |
331 |
g.setClip(rclip.x, rclip.y, rclip.width, |
332 |
rclip.height); |
333 |
} |
334 |
} else {
|
335 |
drawDraft(g); |
336 |
} |
337 |
} else {
|
338 |
print(g, at); |
339 |
} |
340 |
} |
341 |
} |
342 |
} |
343 |
|
344 |
/**
|
345 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#print(java.awt.Graphics2D,
|
346 |
* java.awt.geom.AffineTransform)
|
347 |
*/
|
348 |
public void print(Graphics2D g, AffineTransform at) { |
349 |
Rectangle2D.Double r = getBoundingBox(at);
|
350 |
|
351 |
// Dibujamos en impresora
|
352 |
Rectangle rclip = g.getClipBounds();
|
353 |
g.clipRect((int) r.getMinX(), (int) r.getMinY(), (int) r.getWidth(), |
354 |
(int) r.getHeight());
|
355 |
this.getFMap().getViewPort().setOffset(new Point2D.Double(r.x, r.y)); |
356 |
this.getFMap().getViewPort().setImageSize(new Dimension((int) r.width, |
357 |
(int) r.height));
|
358 |
|
359 |
try {
|
360 |
this.getFMap().print(g);
|
361 |
} catch (com.iver.cit.gvsig.fmap.DriverException e) {
|
362 |
// TODO Auto-generated catch block
|
363 |
e.printStackTrace(); |
364 |
} |
365 |
|
366 |
g.setClip(rclip.x, rclip.y, rclip.width, rclip.height); |
367 |
} |
368 |
|
369 |
/**
|
370 |
* Rellena la unidad de medida en la que est? la vista.
|
371 |
*
|
372 |
* @param i entero que representa la unidad de medida de la vista.
|
373 |
*/
|
374 |
public void setMapUnits(int i) { |
375 |
m_mapUnits = i; |
376 |
} |
377 |
|
378 |
/**
|
379 |
* Obtiene la unidad de medida en la que est? la vista.
|
380 |
*
|
381 |
* @return Unidad de medida.
|
382 |
*/
|
383 |
public int getMapUnits() { |
384 |
return m_mapUnits;
|
385 |
} |
386 |
|
387 |
/**
|
388 |
* Devuelve la escala seg?n el tipo de escala que se haya seleccionado al
|
389 |
* a?adida la vista.
|
390 |
*
|
391 |
* @return escala.
|
392 |
*/
|
393 |
public long getScale() { |
394 |
/*if (m_bLinked){
|
395 |
return getScaleView1(METROS);
|
396 |
}
|
397 |
*/
|
398 |
if (getTypeScale() == AUTOMATICO) {
|
399 |
return FLayoutUtilities.getScaleView(getFMap(), getBoundBox().height);
|
400 |
} else if (getTypeScale() == CONSTANTE) { |
401 |
return (long) m_Scale; |
402 |
} else if (getTypeScale() == MANUAL) { |
403 |
return (long) m_Scale; |
404 |
} |
405 |
|
406 |
return (long) m_Scale; |
407 |
} |
408 |
|
409 |
/**
|
410 |
* Seleccionar si la vista esta relacionada o no con la original.
|
411 |
*
|
412 |
* @param b true si est? ligada y false si no lo est?.
|
413 |
*/
|
414 |
public void setLinked(boolean b) { |
415 |
m_bLinked = b; |
416 |
} |
417 |
|
418 |
/**
|
419 |
* Devuelve si est? ligada o no el FFrameView con la vista.
|
420 |
*
|
421 |
* @return True si la vista est? ligada.
|
422 |
*/
|
423 |
public boolean getLinked() { |
424 |
return m_bLinked;
|
425 |
} |
426 |
|
427 |
/**
|
428 |
* Devuelve la opci?n seleccionada:Rellenar marco de la vista o recorte a
|
429 |
* la vista.
|
430 |
*
|
431 |
* @return entero que representa la opci?n elegida.
|
432 |
*/
|
433 |
public int getExtension() { |
434 |
return m_extension;
|
435 |
} |
436 |
|
437 |
/**
|
438 |
* Devuelve el tipo de escala que est? seleccionada AUTOMATICO,CONSTANTE o
|
439 |
* MANUAL.
|
440 |
*
|
441 |
* @return entero que representa el tipo seleccionado.
|
442 |
*/
|
443 |
public int getTypeScale() { |
444 |
return m_typeScale;
|
445 |
} |
446 |
|
447 |
/**
|
448 |
* Rellenar si se quiere:Rellenar marco de la vista o recorte a la vista.
|
449 |
*
|
450 |
* @param i entero que representa la opci?n elegida.
|
451 |
*/
|
452 |
public void setExtension(int i) { |
453 |
m_extension = i; |
454 |
} |
455 |
|
456 |
/**
|
457 |
* Rellenar el tipo de escala que se desea.
|
458 |
*
|
459 |
* @param i entero que representa el tipo de escala.
|
460 |
*/
|
461 |
public void setTypeScale(int i) { |
462 |
m_typeScale = i; |
463 |
} |
464 |
|
465 |
/**
|
466 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getXMLEntity()
|
467 |
*/
|
468 |
public XMLEntity getXMLEntity() {
|
469 |
XMLEntity xml = new XMLEntity();
|
470 |
xml.putProperty("className",this.getClass().getName()); |
471 |
xml.putProperty("m_name", m_name);
|
472 |
xml.putProperty("x", getBoundBox().x);
|
473 |
xml.putProperty("y", getBoundBox().y);
|
474 |
xml.putProperty("w", getBoundBox().width);
|
475 |
xml.putProperty("h", getBoundBox().height);
|
476 |
xml.putProperty("m_Selected", m_Selected);
|
477 |
xml.putProperty("type", Layout.RECTANGLEVIEW);
|
478 |
xml.putProperty("m_Mode", m_Mode);
|
479 |
xml.putProperty("m_typeScale", m_typeScale);
|
480 |
xml.putProperty("m_extension", m_extension);
|
481 |
xml.putProperty("m_quality", m_quality);
|
482 |
xml.putProperty("m_viewing", m_viewing);
|
483 |
xml.putProperty("m_bLinked", m_bLinked);
|
484 |
xml.putProperty("m_mapUnits", m_mapUnits);
|
485 |
xml.putProperty("m_Scale", m_Scale);
|
486 |
|
487 |
xml.putProperty("extentX", getFMap().getViewPort().getExtent().getX());
|
488 |
xml.putProperty("extentY", getFMap().getViewPort().getExtent().getY());
|
489 |
xml.putProperty("extentW",
|
490 |
getFMap().getViewPort().getExtent().getWidth()); |
491 |
xml.putProperty("extentH",
|
492 |
getFMap().getViewPort().getExtent().getHeight()); |
493 |
xml.putProperty("tag", getTag());
|
494 |
|
495 |
ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
496 |
ArrayList views = pe.getProject().getViews();
|
497 |
|
498 |
boolean hasIndex = false; |
499 |
|
500 |
for (int i = 0; i < views.size(); i++) { |
501 |
if (view == ((ProjectView) views.get(i))) {
|
502 |
xml.putProperty("indice", i);
|
503 |
hasIndex = true;
|
504 |
} |
505 |
} |
506 |
|
507 |
if (!hasIndex) {
|
508 |
xml.putProperty("indice", -1); |
509 |
} |
510 |
|
511 |
xml.addChild(m_fmap.getXMLEntity()); |
512 |
|
513 |
return xml;
|
514 |
} |
515 |
|
516 |
/**
|
517 |
* Inserta la imagen para repintar el FFrameView.
|
518 |
*
|
519 |
* @param bi Imagen para repintar.
|
520 |
*/
|
521 |
public void setBufferedImage(BufferedImage bi) { |
522 |
m_image = bi; |
523 |
} |
524 |
|
525 |
/**
|
526 |
* Devuelve la imagen para repintar.
|
527 |
*
|
528 |
* @return Imagen para repintar.
|
529 |
*/
|
530 |
public BufferedImage getBufferedImage() { |
531 |
return m_image;
|
532 |
} |
533 |
|
534 |
/**
|
535 |
* Devuelve la MAtriz de transformaci?n utilizada por la FFrameView.
|
536 |
*
|
537 |
* @return MAtriz de transformaci?n.
|
538 |
*/
|
539 |
public AffineTransform getAt() { |
540 |
return at;
|
541 |
} |
542 |
|
543 |
/**
|
544 |
* Inserta la matriz de transformaci?n.
|
545 |
*
|
546 |
* @param transform Matriz de transformaci?n.
|
547 |
*/
|
548 |
public void setAt(AffineTransform transform) { |
549 |
at = transform; |
550 |
} |
551 |
|
552 |
/**
|
553 |
* Inserta el proyecto.
|
554 |
*
|
555 |
* @param p Proyecto.
|
556 |
*/
|
557 |
public void setProject(Project p) { |
558 |
project = p; |
559 |
} |
560 |
|
561 |
/**
|
562 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
|
563 |
* com.iver.cit.gvsig.project.Project)
|
564 |
*/
|
565 |
public void setXMLEntity(XMLEntity xml, Layout l) { |
566 |
if (xml.getIntProperty("m_Selected") != 0) { |
567 |
this.setSelected(true); |
568 |
} else {
|
569 |
this.setSelected(false); |
570 |
} |
571 |
|
572 |
this.setName(xml.getStringProperty("m_name")); |
573 |
this.setBoundBox(new Rectangle2D.Double(xml.getDoubleProperty("x"), |
574 |
xml.getDoubleProperty("y"), xml.getDoubleProperty("w"), |
575 |
xml.getDoubleProperty("h")));
|
576 |
|
577 |
this.m_Mode = xml.getIntProperty("m_Mode"); |
578 |
this.m_typeScale = xml.getIntProperty("m_typeScale"); |
579 |
this.m_extension = xml.getIntProperty("m_extension"); |
580 |
this.m_quality = xml.getIntProperty("m_quality"); |
581 |
this.m_viewing = xml.getIntProperty("m_viewing"); |
582 |
this.m_bLinked = xml.getBooleanProperty("m_bLinked"); |
583 |
this.m_mapUnits = xml.getIntProperty("m_mapUnits"); |
584 |
|
585 |
ProjectExtension pe = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
586 |
this.m_Scale = xml.getDoubleProperty("m_Scale"); |
587 |
|
588 |
int indice = xml.getIntProperty("indice"); |
589 |
|
590 |
if (indice != -1) { |
591 |
ProjectView view = (ProjectView) project.getViews().get(indice); |
592 |
this.m_fmap = view.getMapContext();
|
593 |
this.setView((ProjectView) view);
|
594 |
|
595 |
try {
|
596 |
//this.m_fmap = view.getMapContext();
|
597 |
|
598 |
/* this.getFMap().getViewPort().setExtent(new Rectangle2D.Double(
|
599 |
xml.getDoubleProperty("extentX"),
|
600 |
xml.getDoubleProperty("extentY"),
|
601 |
xml.getDoubleProperty("extentW"),
|
602 |
xml.getDoubleProperty("extentH")));
|
603 |
*/
|
604 |
if (m_bLinked) {
|
605 |
this.getFMap().getViewPort().setExtent(new Rectangle2D.Double( |
606 |
xml.getDoubleProperty("extentX"),
|
607 |
xml.getDoubleProperty("extentY"),
|
608 |
xml.getDoubleProperty("extentW"),
|
609 |
xml.getDoubleProperty("extentH")));
|
610 |
} else if (!m_bLinked) { |
611 |
this.m_fmap = FMap.createFromXML(xml.getChild(0)); |
612 |
} |
613 |
} catch (XMLException e) {
|
614 |
NotificationManager.addError("Pasando las propiedades del XMLEntity al objeto",
|
615 |
e); |
616 |
} |
617 |
} |
618 |
} |
619 |
|
620 |
/**
|
621 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getNameFFrame()
|
622 |
*/
|
623 |
public String getNameFFrame() { |
624 |
return PluginServices.getText(this, "Vista") + num; |
625 |
} |
626 |
|
627 |
/**
|
628 |
* @see com.iver.cit.gvsig.fmap.ExtentListener#extentChanged(com.iver.cit.gvsig.fmap.ExtentEvent)
|
629 |
*/
|
630 |
public void extentChanged(ExtentEvent e) { |
631 |
if (getTypeScale() == AUTOMATICO) {
|
632 |
m_fmap.getViewPort().setExtent(e.getNewExtent()); |
633 |
} |
634 |
} |
635 |
|
636 |
/**
|
637 |
* @see com.iver.cit.gvsig.fmap.ViewPortListener#backColorChanged(com.iver.cit.gvsig.fmap.ColorEvent)
|
638 |
*/
|
639 |
public void backColorChanged(ColorEvent e) { |
640 |
} |
641 |
} |