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