svn-gvsig-desktop / tags / v1_0_1_RELEASE / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / FLyrDefault.java @ 9531
History | View | Annotate | Download (18.6 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.fmap.layers; |
42 |
|
43 |
import java.awt.image.BufferedImage; |
44 |
import java.util.ArrayList; |
45 |
import java.util.Hashtable; |
46 |
import java.util.Iterator; |
47 |
import java.util.List; |
48 |
import java.util.Map; |
49 |
import java.util.Set; |
50 |
|
51 |
import javax.swing.ImageIcon; |
52 |
|
53 |
import org.apache.log4j.Logger; |
54 |
import org.cresques.cts.ICoordTrans; |
55 |
import org.cresques.cts.IProjection; |
56 |
|
57 |
import com.hardcode.driverManager.Driver; |
58 |
import com.hardcode.driverManager.DriverLoadException; |
59 |
import com.iver.cit.gvsig.fmap.DriverException; |
60 |
import com.iver.cit.gvsig.fmap.MapContext; |
61 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
62 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
63 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
64 |
import com.iver.cit.gvsig.fmap.operations.strategies.Strategy; |
65 |
import com.iver.utiles.XMLEntity; |
66 |
import com.iver.utiles.IPersistance; |
67 |
|
68 |
/**
|
69 |
* Implementaci?n de las caracter?sticas de alto nivel de las capas:
|
70 |
* visibilidad, activaci?n, nombre, ...
|
71 |
*/
|
72 |
public abstract class FLyrDefault implements FLayer { |
73 |
// private PropertyChangeSupport lnkPropertyChangeSupport;
|
74 |
private static Logger logger = Logger.getLogger(FLyrDefault.class); |
75 |
|
76 |
/** Path de la capa en el arbol de capas */
|
77 |
private FLayers parentLayer = null; |
78 |
|
79 |
private FLayers virtualLayers = null; |
80 |
|
81 |
private FLyrText layerText = null; |
82 |
|
83 |
private String name; |
84 |
|
85 |
private IProjection projection;
|
86 |
|
87 |
// private boolean visible = true;
|
88 |
//
|
89 |
// private boolean active;
|
90 |
|
91 |
private int transparency = 0; |
92 |
|
93 |
private ICoordTrans ct;
|
94 |
|
95 |
private double minScale = -1; // -1 indica que no se usa |
96 |
|
97 |
private double maxScale = -1; |
98 |
|
99 |
// private boolean isInTOC = true;
|
100 |
|
101 |
protected ArrayList layerListeners = new ArrayList(); |
102 |
|
103 |
private Strategy privateStrategy = null; |
104 |
|
105 |
// private boolean isediting;
|
106 |
|
107 |
private Hashtable properties = new Hashtable(); |
108 |
|
109 |
// private boolean bCacheDrawnLayers;
|
110 |
|
111 |
private BufferedImage cacheImageDrawnLayers = null; |
112 |
|
113 |
// private boolean bDirty;
|
114 |
|
115 |
// private boolean available = true;
|
116 |
|
117 |
//by default, all is active, visible and avalaible
|
118 |
private FLayerStatus status = new FLayerStatus(); |
119 |
|
120 |
public Object getProperty(Object key) { |
121 |
return properties.get(key);
|
122 |
} |
123 |
|
124 |
public void setProperty(Object key, Object val) { |
125 |
properties.put(key, val); |
126 |
} |
127 |
|
128 |
public Map getExtendedProperties() { |
129 |
return properties;
|
130 |
} |
131 |
/**
|
132 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setActive(boolean)
|
133 |
*/
|
134 |
public void setActive(boolean selected) { |
135 |
//active = selected;
|
136 |
status.active = selected; |
137 |
callActivationChanged(LayerEvent.createActivationChangedEvent(this,
|
138 |
"active"));
|
139 |
} |
140 |
|
141 |
/**
|
142 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#isActive()
|
143 |
*/
|
144 |
public boolean isActive() { |
145 |
// return active;
|
146 |
return status.active;
|
147 |
} |
148 |
|
149 |
/**
|
150 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setName(java.lang.String)
|
151 |
*/
|
152 |
public void setName(String name) { |
153 |
this.name = name;
|
154 |
callNameChanged(LayerEvent.createNameChangedEvent(this, "name")); |
155 |
} |
156 |
|
157 |
/**
|
158 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getName()
|
159 |
*/
|
160 |
public String getName() { |
161 |
return name;
|
162 |
} |
163 |
|
164 |
/*
|
165 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#load()
|
166 |
*/
|
167 |
public void load() throws DriverIOException { |
168 |
} |
169 |
|
170 |
/**
|
171 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setVisible(boolean)
|
172 |
*/
|
173 |
public void setVisible(boolean visibility) { |
174 |
// visible = visibility;
|
175 |
boolean changed = status.visible != visibility;
|
176 |
status.visible = visibility; |
177 |
setDirty(true);
|
178 |
if (changed){
|
179 |
if (this.getMapContext() != null){ |
180 |
this.getMapContext().clearAllCachingImageDrawnLayers();
|
181 |
} |
182 |
} |
183 |
callVisibilityChanged(LayerEvent.createVisibilityChangedEvent(this,
|
184 |
"visible"));
|
185 |
} |
186 |
|
187 |
/**
|
188 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#isVisible()
|
189 |
*/
|
190 |
public boolean isVisible() { |
191 |
// return visible && this.available;
|
192 |
return status.visible && status.available;
|
193 |
} |
194 |
|
195 |
/**
|
196 |
* Devuelve la capa padre de la actual.
|
197 |
*
|
198 |
* @return FLayers padre.
|
199 |
*/
|
200 |
public FLayers getParentLayer() {
|
201 |
return parentLayer;
|
202 |
} |
203 |
|
204 |
/**
|
205 |
* Inserta la capa padre.
|
206 |
*
|
207 |
* @param root
|
208 |
* capa padre.
|
209 |
*/
|
210 |
public void setParentLayer(FLayers root) { |
211 |
this.parentLayer = root;
|
212 |
} |
213 |
|
214 |
/**
|
215 |
* Inserta una proyecci?n.
|
216 |
*
|
217 |
* @param proj
|
218 |
* Proyecci?n.
|
219 |
*/
|
220 |
public void setProjection(IProjection proj) { |
221 |
projection = proj; |
222 |
// Comprobar que la proyecci?n es la misma que la de FMap
|
223 |
// Si no lo es, es una capa que est? reproyectada al vuelo
|
224 |
if ((proj != null) && (getMapContext() != null)) |
225 |
if (proj != getMapContext().getProjection()) {
|
226 |
ICoordTrans ct = proj.getCT(getMapContext().getProjection()); |
227 |
setCoordTrans(ct); |
228 |
logger.debug("Cambio proyecci?n: FMap con "
|
229 |
+ getMapContext().getProjection().getAbrev() + " y capa "
|
230 |
+ getName() + " con " + proj.getAbrev());
|
231 |
} |
232 |
} |
233 |
|
234 |
/**
|
235 |
* @see org.cresques.geo.Projected#getProjection()
|
236 |
*/
|
237 |
public IProjection getProjection() {
|
238 |
return projection;
|
239 |
} |
240 |
|
241 |
/**
|
242 |
* @see org.cresques.geo.Projected#reProject(org.cresques.cts.ICoordTrans)
|
243 |
*/
|
244 |
public void reProject(ICoordTrans arg0) { |
245 |
} |
246 |
|
247 |
/**
|
248 |
* Devuelve el nivel de transparencia de la capa.
|
249 |
*
|
250 |
* @return Entero que representa el nivel de transparencia.
|
251 |
*/
|
252 |
public int getTransparency() { |
253 |
return transparency;
|
254 |
} |
255 |
|
256 |
/**
|
257 |
* Inserta el nivel de transparencia de la capa.
|
258 |
*
|
259 |
* @param trans
|
260 |
* Nivel de transparencia.
|
261 |
*/
|
262 |
public void setTransparency(int trans) { |
263 |
transparency = trans; |
264 |
setDirty(true);
|
265 |
} |
266 |
|
267 |
/**
|
268 |
* Devuelve el XMLEntity a partir del objeto.
|
269 |
*
|
270 |
* @return XMLEntity.
|
271 |
* @throws XMLException
|
272 |
*/
|
273 |
public XMLEntity getXMLEntity() throws XMLException { |
274 |
XMLEntity xml = new XMLEntity();
|
275 |
xml.putProperty("className", this.getClass().getName()); |
276 |
|
277 |
if (this instanceof FLayers) { |
278 |
} |
279 |
|
280 |
// xml.putProperty("active", active);
|
281 |
xml.putProperty("active", status.active);
|
282 |
xml.putProperty("name", name);
|
283 |
xml.putProperty("minScale", minScale);
|
284 |
xml.putProperty("maxScale", maxScale);
|
285 |
|
286 |
// TODO xml.addChild(parentLayer.getXMLEntity());
|
287 |
// xml.putProperty("visible", visible);
|
288 |
xml.putProperty("visible", status.visible);
|
289 |
if (projection != null) { |
290 |
xml.putProperty("proj", projection.getAbrev());
|
291 |
} |
292 |
xml.putProperty("transparency", transparency);
|
293 |
// xml.putProperty("isInTOC", isInTOC);
|
294 |
xml.putProperty("isInTOC", status.inTOC);
|
295 |
|
296 |
// persist Properties hashTable
|
297 |
|
298 |
Set keyset = properties.keySet();
|
299 |
|
300 |
|
301 |
int numProperties = 0; |
302 |
Iterator keyitr = keyset.iterator();
|
303 |
while (keyitr.hasNext()) {
|
304 |
String propName = (String)keyitr.next(); |
305 |
Object obj = properties.get(propName);
|
306 |
if (obj instanceof IPersistance) |
307 |
{ |
308 |
IPersistance persistObj = (IPersistance)obj; |
309 |
XMLEntity xmlPropObj = persistObj.getXMLEntity(); |
310 |
// make sure the node contains the class name
|
311 |
if (!xmlPropObj.contains("className")) { |
312 |
try {
|
313 |
String propClassName = persistObj.getClassName();
|
314 |
System.out.println("PROP CLASS NAME "+propClassName); |
315 |
xmlPropObj.putProperty("className", propClassName);
|
316 |
} catch (Exception e) { |
317 |
e.printStackTrace(); |
318 |
} |
319 |
} |
320 |
xmlPropObj.putProperty("layerPropertyName", propName);
|
321 |
xml.addChild(xmlPropObj); |
322 |
numProperties++; |
323 |
} else if (obj instanceof String) { |
324 |
XMLEntity xmlPropObj = new XMLEntity();
|
325 |
xmlPropObj.putProperty("className", String.class.getName()); |
326 |
xmlPropObj.putProperty("value",(String)obj); |
327 |
xmlPropObj.putProperty("layerPropertyName", propName);
|
328 |
xml.addChild(xmlPropObj); |
329 |
numProperties++; |
330 |
} |
331 |
} |
332 |
xml.putProperty("numProperties", numProperties);
|
333 |
|
334 |
return xml;
|
335 |
} |
336 |
|
337 |
/*
|
338 |
* Inserta los valores de los atributos del XMLEntity al objeto.
|
339 |
*
|
340 |
* @param xml XMLEntity.
|
341 |
*
|
342 |
* @throws XMLException @throws DriverException @throws DriverIOException
|
343 |
*
|
344 |
* public void setXMLEntity03(XMLEntity xml) throws XMLException { active =
|
345 |
* xml.getBooleanProperty("active"); name = xml.getStringProperty("name");
|
346 |
* minScale=xml.getDoubleProperty("minScale");
|
347 |
* maxScale=xml.getDoubleProperty("maxScale"); visible =
|
348 |
* xml.getBooleanProperty("visible"); if (xml.contains("proj")) {
|
349 |
* setProjection(ProjectionPool.get(xml.getStringProperty("proj"))); } if
|
350 |
* (xml.contains("transparency")) transparency =
|
351 |
* xml.getIntProperty("transparency"); }
|
352 |
*/
|
353 |
|
354 |
/**
|
355 |
* Inserta los valores de los atributos del XMLEntity al objeto.
|
356 |
*
|
357 |
* @param xml
|
358 |
* XMLEntity.
|
359 |
*
|
360 |
* @throws XMLException
|
361 |
* @throws DriverException
|
362 |
* @throws DriverIOException
|
363 |
*/
|
364 |
public void setXMLEntity(XMLEntity xml) throws XMLException { |
365 |
// active = xml.getBooleanProperty("active");
|
366 |
status.active = xml.getBooleanProperty("active");
|
367 |
name = xml.getStringProperty("name");
|
368 |
minScale = xml.getDoubleProperty("minScale");
|
369 |
maxScale = xml.getDoubleProperty("maxScale");
|
370 |
// visible = xml.getBooleanProperty("visible");
|
371 |
status.visible = xml.getBooleanProperty("visible");
|
372 |
if (xml.contains("proj")) { |
373 |
setProjection(CRSFactory.getCRS(xml.getStringProperty("proj")));
|
374 |
} |
375 |
if (xml.contains("transparency")) |
376 |
transparency = xml.getIntProperty("transparency");
|
377 |
if (xml.contains("isInTOC")) |
378 |
// isInTOC = xml.getBooleanProperty("isInTOC");
|
379 |
status.inTOC = xml.getBooleanProperty("isInTOC");
|
380 |
|
381 |
// recreate Properties hashTable
|
382 |
|
383 |
if (xml.contains("numProperties")) { |
384 |
int numProps = xml.getIntProperty("numProperties"); |
385 |
Object obj= null; |
386 |
IPersistance objPersist; |
387 |
for (int iProp=0; iProp<numProps; iProp++) { |
388 |
XMLEntity xmlProp = xml.getChild(0);
|
389 |
try {
|
390 |
String className = xmlProp.getStringProperty("className"); |
391 |
if (className.equals(String.class.getName())) { |
392 |
obj = xmlProp.getStringProperty("value");
|
393 |
} else {
|
394 |
Class classProp = Class.forName(className); |
395 |
obj = classProp.newInstance(); |
396 |
objPersist = (IPersistance)obj; |
397 |
objPersist.setXMLEntity(xmlProp); |
398 |
} |
399 |
String propName = xmlProp.getStringProperty("layerPropertyName"); |
400 |
properties.put(propName, obj); |
401 |
} catch (Exception e) { |
402 |
continue;
|
403 |
} |
404 |
// remove Properties children to avoid breaking layers' XML reading logic
|
405 |
xml.removeChild(0);
|
406 |
} |
407 |
} |
408 |
} |
409 |
|
410 |
/**
|
411 |
* Inserta los valores de los atributos del XMLEntity al objeto.
|
412 |
*
|
413 |
* @param xml
|
414 |
* XMLEntity.
|
415 |
*
|
416 |
* @throws XMLException
|
417 |
* @throws DriverException
|
418 |
* @throws DriverIOException
|
419 |
*/
|
420 |
public void setXMLEntity03(XMLEntity xml) throws XMLException { |
421 |
// active = xml.getBooleanProperty("active");
|
422 |
status.active = xml.getBooleanProperty("active");
|
423 |
name = xml.getStringProperty("name");
|
424 |
minScale = xml.getDoubleProperty("minScale");
|
425 |
maxScale = xml.getDoubleProperty("maxScale");
|
426 |
// visible = xml.getBooleanProperty("visible");
|
427 |
status.visible = xml.getBooleanProperty("visible");
|
428 |
if (xml.contains("proj")) { |
429 |
setProjection(CRSFactory.getCRS(xml.getStringProperty("proj")));
|
430 |
} |
431 |
if (xml.contains("transparency")) |
432 |
transparency = xml.getIntProperty("transparency");
|
433 |
} |
434 |
|
435 |
/**
|
436 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getMapContext()
|
437 |
*/
|
438 |
public MapContext getMapContext() {
|
439 |
if (getParentLayer() != null) { |
440 |
return getParentLayer().getMapContext();
|
441 |
} else {
|
442 |
return null; |
443 |
} |
444 |
} |
445 |
|
446 |
/**
|
447 |
* A?ade a la lista de listener un nuevo LayerListener.
|
448 |
*
|
449 |
* @param o
|
450 |
* LayerListener.
|
451 |
*
|
452 |
* @return boolean.
|
453 |
*/
|
454 |
public boolean addLayerListener(LayerListener o) { |
455 |
if (layerListeners.contains(o))
|
456 |
return false; |
457 |
return layerListeners.add(o);
|
458 |
} |
459 |
public LayerListener[] getLayerListeners() { |
460 |
return (LayerListener[])layerListeners.toArray(new LayerListener[0]); |
461 |
} |
462 |
/**
|
463 |
* Borra de la lista de listeners el que se pasa como par?metro.
|
464 |
*
|
465 |
* @param o
|
466 |
* LayerListener a borrar.
|
467 |
*
|
468 |
* @return True si ha sido correcto el borrado del Listener.
|
469 |
*/
|
470 |
public boolean removeLayerListener(LayerListener o) { |
471 |
return layerListeners.remove(o);
|
472 |
} |
473 |
|
474 |
/**
|
475 |
* Llamada al metodo nameChanged de los Listeners dados de alta.
|
476 |
*
|
477 |
* @param e
|
478 |
* LayerEvent.
|
479 |
*/
|
480 |
private void callNameChanged(LayerEvent e) { |
481 |
for (Iterator iter = layerListeners.iterator(); iter.hasNext();) { |
482 |
LayerListener listener = (LayerListener) iter.next(); |
483 |
|
484 |
listener.nameChanged(e); |
485 |
} |
486 |
} |
487 |
|
488 |
/**
|
489 |
* Llamada al m?todo visibilityChanged de los Listeners.
|
490 |
*
|
491 |
* @param e
|
492 |
* LayerEvent.
|
493 |
*/
|
494 |
private void callVisibilityChanged(LayerEvent e) { |
495 |
for (Iterator iter = layerListeners.iterator(); iter.hasNext();) { |
496 |
LayerListener listener = (LayerListener) iter.next(); |
497 |
|
498 |
listener.visibilityChanged(e); |
499 |
} |
500 |
} |
501 |
|
502 |
/**
|
503 |
* Llamada al m?todo activationChanged de los Listener.
|
504 |
*
|
505 |
* @param e
|
506 |
* LayerEvent.
|
507 |
*/
|
508 |
private void callActivationChanged(LayerEvent e) { |
509 |
for (Iterator iter = layerListeners.iterator(); iter.hasNext();) { |
510 |
LayerListener listener = (LayerListener) iter.next(); |
511 |
|
512 |
listener.activationChanged(e); |
513 |
} |
514 |
} |
515 |
|
516 |
/**
|
517 |
* Devuelve las capas virtuales.
|
518 |
*
|
519 |
* @return FLayers.
|
520 |
*/
|
521 |
public FLayers getVirtualLayers() {
|
522 |
return virtualLayers;
|
523 |
} |
524 |
|
525 |
/**
|
526 |
* Inserta las capas virtuales.
|
527 |
*
|
528 |
* @param virtualLayers
|
529 |
* FLayers.
|
530 |
*/
|
531 |
public void setVirtualLayers(FLayers virtualLayers) { |
532 |
this.virtualLayers = virtualLayers;
|
533 |
} |
534 |
|
535 |
/**
|
536 |
* Devuelve la capa de texto.
|
537 |
*
|
538 |
* @return capa de texto.
|
539 |
*/
|
540 |
public FLyrText getLayerText() {
|
541 |
return layerText;
|
542 |
} |
543 |
|
544 |
/**
|
545 |
* Inserta la capa de texto.
|
546 |
*
|
547 |
* @param layerText
|
548 |
* Capa de texto.
|
549 |
*/
|
550 |
public void setLayerText(FLyrText layerText) { |
551 |
this.layerText = layerText;
|
552 |
} |
553 |
|
554 |
/**
|
555 |
* Inserta la Transformaci?n de coordenadas.
|
556 |
*
|
557 |
* @param ct
|
558 |
* Transformaci?n de coordenadas.
|
559 |
*/
|
560 |
public void setCoordTrans(ICoordTrans ct) { |
561 |
this.ct = ct;
|
562 |
} |
563 |
|
564 |
/**
|
565 |
* Devuelve las transformaci?n de coordenadas.
|
566 |
*
|
567 |
* @return ct.
|
568 |
*/
|
569 |
public ICoordTrans getCoordTrans() {
|
570 |
return ct;
|
571 |
} |
572 |
|
573 |
/**
|
574 |
* M?todo que es llamado por Flayers para notificar a la capa que va a ser
|
575 |
* a?adida. Esta previa notificaci?n es util para las capas que necesitan
|
576 |
* hacer algo antes de ser a?adida. Por ejemplo, el raster necesita volver a
|
577 |
* abrir el fichero que ha podido ser cerrado con anterioridad. Si no se
|
578 |
* redefine este m?todo no se har? nada ya que este es vacio.
|
579 |
*/
|
580 |
public void wakeUp() { |
581 |
} |
582 |
|
583 |
public double getMinScale() { |
584 |
return minScale;
|
585 |
} |
586 |
|
587 |
/*
|
588 |
* (non-Javadoc)
|
589 |
*
|
590 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getMaxScale()
|
591 |
*/
|
592 |
public double getMaxScale() { |
593 |
return maxScale;
|
594 |
} |
595 |
|
596 |
public void setMinScale(double minScale) { |
597 |
this.minScale = minScale;
|
598 |
} |
599 |
|
600 |
public void setMaxScale(double maxScale) { |
601 |
this.maxScale = maxScale;
|
602 |
} |
603 |
|
604 |
public boolean isWithinScale(double scale) { |
605 |
|
606 |
boolean bVisible = true; |
607 |
if (getMinScale() != -1) { |
608 |
if (scale < getMinScale())
|
609 |
bVisible = false;
|
610 |
} |
611 |
if (getMaxScale() != -1) { |
612 |
if (scale > getMaxScale())
|
613 |
bVisible = false;
|
614 |
} |
615 |
|
616 |
return bVisible;
|
617 |
} |
618 |
|
619 |
public Strategy getStrategy() {
|
620 |
return privateStrategy;
|
621 |
} |
622 |
|
623 |
public void setStrategy(Strategy s) { |
624 |
privateStrategy = s; |
625 |
} |
626 |
|
627 |
public void setEditing(boolean b) throws EditionException { |
628 |
// isediting = b;
|
629 |
status.editing = b; |
630 |
setDirty(true);
|
631 |
setCachingDrawnLayers(b); |
632 |
} |
633 |
|
634 |
protected void callEditionChanged(LayerEvent e) { |
635 |
for (Iterator iter = layerListeners.iterator(); iter.hasNext();) { |
636 |
LayerListener listener = (LayerListener) iter.next(); |
637 |
|
638 |
listener.editionChanged(e); |
639 |
} |
640 |
} |
641 |
|
642 |
public boolean isEditing() { |
643 |
// return isediting;
|
644 |
return status.editing;
|
645 |
} |
646 |
|
647 |
public ImageIcon getTocImageIcon() { |
648 |
return null; |
649 |
} |
650 |
|
651 |
public boolean isInTOC() { |
652 |
// return isInTOC;
|
653 |
return status.inTOC;
|
654 |
} |
655 |
|
656 |
/* (non-Javadoc)
|
657 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#isCachingDrawnLayers()
|
658 |
*/
|
659 |
public boolean isCachingDrawnLayers() { |
660 |
// return bCacheDrawnLayers;
|
661 |
return status.cacheDrawnLayers;
|
662 |
} |
663 |
|
664 |
/* (non-Javadoc)
|
665 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#setCachingDrawnLayers(boolean)
|
666 |
*/
|
667 |
public void setCachingDrawnLayers(boolean bCacheDrawnLayers) { |
668 |
// this.bCacheDrawnLayers = bCacheDrawnLayers;
|
669 |
status.cacheDrawnLayers = bCacheDrawnLayers; |
670 |
if (status.cacheDrawnLayers == false) |
671 |
this.cacheImageDrawnLayers = null; |
672 |
} |
673 |
|
674 |
public BufferedImage getCacheImageDrawnLayers() { |
675 |
return cacheImageDrawnLayers;
|
676 |
} |
677 |
|
678 |
public void setCacheImageDrawnLayers(BufferedImage cacheImageDrawnLayers) { |
679 |
this.cacheImageDrawnLayers = cacheImageDrawnLayers;
|
680 |
} |
681 |
|
682 |
public boolean isDirty() { |
683 |
return status.dirty;
|
684 |
} |
685 |
|
686 |
public void setDirty(boolean dirty) { |
687 |
status.dirty = dirty; |
688 |
} |
689 |
|
690 |
public boolean isAvailable() { |
691 |
return status.available;
|
692 |
} |
693 |
|
694 |
public void setAvailable(boolean available) { |
695 |
status.available = available; |
696 |
} |
697 |
|
698 |
public void reload() throws DriverIOException { |
699 |
this.setAvailable(true); |
700 |
} |
701 |
|
702 |
/**
|
703 |
* Returns the status of the layer
|
704 |
*/
|
705 |
public FLayerStatus getFLayerStatus(){
|
706 |
return status;
|
707 |
} |
708 |
/**
|
709 |
* Sets the status of the layer
|
710 |
* @param status
|
711 |
*/
|
712 |
public void setFLayerStatus(FLayerStatus status){ |
713 |
this.status = status;
|
714 |
} |
715 |
|
716 |
/*
|
717 |
* This stuff is to save error's info that causes
|
718 |
* unavailable status.
|
719 |
* */
|
720 |
|
721 |
public boolean isOk(){ |
722 |
return status.isOk();
|
723 |
} |
724 |
|
725 |
public int getNumErrors(){ |
726 |
return status.getNumErrors();
|
727 |
} |
728 |
|
729 |
public DriverException getError(int i){ |
730 |
return status.getError(i);
|
731 |
} |
732 |
|
733 |
public List getErrors(){ |
734 |
return status.getErrors();
|
735 |
} |
736 |
|
737 |
public void addError(DriverException error){ |
738 |
status.addLayerError(error); |
739 |
} |
740 |
|
741 |
public boolean visibleRequired() { |
742 |
return status.visible;
|
743 |
} |
744 |
|
745 |
public String getInfoString() { |
746 |
return null; |
747 |
} |
748 |
|
749 |
public boolean isWritable() { |
750 |
return status.writable;
|
751 |
} |
752 |
|
753 |
/* (non-Javadoc)
|
754 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#cloneLayer()
|
755 |
*/
|
756 |
public FLayer cloneLayer() throws Exception { |
757 |
return this; |
758 |
} |
759 |
|
760 |
|
761 |
|
762 |
} |