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