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