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