svn-gvsig-desktop / branches / simbologia / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / FLayers.java @ 10450
History | View | Annotate | Download (39.8 KB)
1 | 1100 | fjp | /* 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 | 214 | fernando | package com.iver.cit.gvsig.fmap.layers; |
42 | |||
43 | 2608 | caballero | import java.awt.Graphics2D; |
44 | 4928 | ldiaz | import java.awt.Point; |
45 | 2608 | caballero | import java.awt.geom.Rectangle2D; |
46 | import java.awt.image.BufferedImage; |
||
47 | 5923 | fjp | import java.awt.image.WritableRaster; |
48 | 2608 | caballero | import java.io.File; |
49 | import java.util.ArrayList; |
||
50 | 2857 | jaume | import java.util.Collections; |
51 | 2608 | caballero | import java.util.Iterator; |
52 | 2981 | fjp | import java.util.List; |
53 | 5057 | ldiaz | import java.util.Vector; |
54 | 2608 | caballero | |
55 | 9010 | caballero | import javax.print.attribute.PrintRequestAttributeSet; |
56 | 5761 | jmvivo | import javax.swing.ImageIcon; |
57 | |||
58 | 3481 | caballero | import org.apache.log4j.Logger; |
59 | 2608 | caballero | import org.cresques.cts.ICoordTrans; |
60 | import org.cresques.cts.IProjection; |
||
61 | |||
62 | 1828 | fernando | import com.hardcode.driverManager.Driver; |
63 | import com.hardcode.driverManager.DriverLoadException; |
||
64 | 651 | fernando | import com.iver.cit.gvsig.fmap.DriverException; |
65 | 6878 | cesar | import com.iver.cit.gvsig.fmap.MapContext; |
66 | 5761 | jmvivo | import com.iver.cit.gvsig.fmap.MapControl; |
67 | 562 | fernando | import com.iver.cit.gvsig.fmap.ViewPort; |
68 | 6164 | luisw2 | import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
69 | 3462 | caballero | import com.iver.cit.gvsig.fmap.drivers.DefaultDBDriver; |
70 | 1453 | luisw | import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
71 | 2778 | fjp | import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
72 | 3301 | fjp | import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
73 | 1828 | fernando | import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
74 | 4928 | ldiaz | import com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint; |
75 | 562 | fernando | import com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection; |
76 | import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData; |
||
77 | 5200 | ldiaz | import com.iver.cit.gvsig.fmap.layers.layerOperations.XMLItem; |
78 | 562 | fernando | import com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor; |
79 | 926 | fernando | import com.iver.cit.gvsig.fmap.operations.strategies.VisitException; |
80 | 2659 | fjp | import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
81 | 3301 | fjp | import com.iver.utiles.IPersistance; |
82 | 562 | fernando | import com.iver.utiles.XMLEntity; |
83 | 6762 | jmvivo | import com.iver.utiles.extensionPoints.ExtensionPoint; |
84 | import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
||
85 | 5317 | fjp | import com.iver.utiles.swing.threads.Cancellable; |
86 | 541 | vcaballero | |
87 | 214 | fernando | /**
|
88 | * Representa un nodo interno en el ?rbol de capas
|
||
89 | */
|
||
90 | 4928 | ldiaz | public class FLayers extends FLyrDefault implements VectorialData, LayerCollection, InfoByPoint |
91 | { |
||
92 | 524 | vcaballero | //ArrayList de Listener registrados.
|
93 | 7562 | sbayarri | protected ArrayList layerCollectionListeners = new ArrayList(); |
94 | 3963 | caballero | |
95 | |||
96 | 7562 | sbayarri | protected List layers = Collections.synchronizedList(new ArrayList()); |
97 | protected MapContext fmap;
|
||
98 | protected static Logger logger = Logger.getLogger(FLayers.class.getName()); |
||
99 | 524 | vcaballero | /**
|
100 | * Crea un nuevo FLayers.
|
||
101 | 1005 | vcaballero | *
|
102 | * @param fmap
|
||
103 | * @param parent
|
||
104 | 524 | vcaballero | */
|
105 | 6878 | cesar | public FLayers(MapContext fmap, FLayers parent) {
|
106 | 694 | fernando | setParentLayer(parent); |
107 | this.fmap = fmap;
|
||
108 | 524 | vcaballero | } |
109 | 257 | vcaballero | |
110 | 524 | vcaballero | /**
|
111 | * A?ade un listener de los eventos de la colecci?n de capas
|
||
112 | *
|
||
113 | 1005 | vcaballero | * @param listener
|
114 | 524 | vcaballero | */
|
115 | public void addLayerCollectionListener(LayerCollectionListener listener) { |
||
116 | 5228 | caballero | if (!layerCollectionListeners.contains(listener))
|
117 | layerCollectionListeners.add(listener); |
||
118 | 524 | vcaballero | } |
119 | 1005 | vcaballero | |
120 | 3772 | fjp | |
121 | 1005 | vcaballero | /**
|
122 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllVisibles(boolean)
|
||
123 | */
|
||
124 | public void setAllVisibles(boolean visible) { |
||
125 | 708 | fernando | FLayer lyr; |
126 | 214 | fernando | |
127 | 524 | vcaballero | for (int i = 0; i < layers.size(); i++) { |
128 | lyr = ((FLayer) layers.get(i)); |
||
129 | 708 | fernando | lyr.setVisible(visible); |
130 | 1005 | vcaballero | |
131 | if (lyr instanceof LayerCollection) { |
||
132 | 708 | fernando | ((LayerCollection) lyr).setAllVisibles(visible); |
133 | } |
||
134 | 524 | vcaballero | } |
135 | } |
||
136 | 346 | fernando | |
137 | 524 | vcaballero | /**
|
138 | 1005 | vcaballero | * Elimina un listener de los eventos de la colecci?n de capas
|
139 | 524 | vcaballero | *
|
140 | 1005 | vcaballero | * @param listener
|
141 | 524 | vcaballero | */
|
142 | public void removeLayerCollectionListener(LayerCollectionListener listener) { |
||
143 | 3772 | fjp | layerCollectionListeners.remove(listener); |
144 | 524 | vcaballero | } |
145 | 214 | fernando | |
146 | 524 | vcaballero | /**
|
147 | 1005 | vcaballero | * A?ade una capa.
|
148 | 524 | vcaballero | *
|
149 | 1005 | vcaballero | * @param layer
|
150 | 524 | vcaballero | */
|
151 | 6556 | caballero | // private void doAddLayer(FLayer layer) {
|
152 | // layers.add(layer);
|
||
153 | // layer.setParentLayer(this);
|
||
154 | // }
|
||
155 | private void doAddLayer(int pos,FLayer layer) { |
||
156 | layers.add(pos,layer); |
||
157 | 694 | fernando | layer.setParentLayer(this);
|
158 | 524 | vcaballero | } |
159 | 6556 | caballero | public void addLayer(FLayer layer) { |
160 | addLayer(layers.size(),layer); |
||
161 | } |
||
162 | 524 | vcaballero | /**
|
163 | * A?ade una capa al final de la lista de subcapas
|
||
164 | *
|
||
165 | 1005 | vcaballero | * @param layer
|
166 | 524 | vcaballero | *
|
167 | * @throws CancelationException
|
||
168 | */
|
||
169 | 6556 | caballero | public void addLayer(int pos,FLayer layer) throws CancelationException { |
170 | 4376 | nacho | //Notificamos a la capa que va a ser a?adida
|
171 | 6762 | jmvivo | //FLyrDefault layerDef = (FLyrDefault)layer;
|
172 | 6537 | jmvivo | //if (!layerDef.isUnavailable()) {
|
173 | 6400 | jmvivo | if (layer instanceof FLyrDefault) |
174 | ((FLyrDefault)layer).wakeUp(); |
||
175 | 6480 | jaume | |
176 | 6400 | jmvivo | if (layer instanceof FLayers){ |
177 | FLayers layers=(FLayers)layer; |
||
178 | fmap.addAsCollectionListener(layers); |
||
179 | } |
||
180 | callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer)); |
||
181 | 6537 | jmvivo | //}
|
182 | 214 | fernando | |
183 | 6556 | caballero | doAddLayer(pos,layer); |
184 | 404 | fjp | |
185 | 6537 | jmvivo | //if (!layerDef.isUnavailable()) {
|
186 | 6400 | jmvivo | callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer)); |
187 | 6537 | jmvivo | //}
|
188 | 524 | vcaballero | } |
189 | 404 | fjp | |
190 | 524 | vcaballero | /**
|
191 | * Mueve una capa de la posici?n from a la posici?n to. (Se supone que
|
||
192 | * est?n dentro del mismo nivel). Para mover entre niveles, usar otro
|
||
193 | * m?todo (por hacer)
|
||
194 | *
|
||
195 | 1005 | vcaballero | * @param from origen.
|
196 | * @param to destino.
|
||
197 | 524 | vcaballero | *
|
198 | * @throws CancelationException
|
||
199 | */
|
||
200 | public void moveTo(int from, int to) throws CancelationException { |
||
201 | 2356 | vcaballero | int newfrom=layers.size()-from-1; |
202 | int newto=layers.size()-to-1; |
||
203 | 6466 | jmvivo | if ( newfrom < 0 || newfrom >=layers.size() || newto < 0 || newto >= layers.size()) return; |
204 | 2356 | vcaballero | FLayer aux = (FLayer) layers.get(newfrom); |
205 | callLayerMoving(LayerPositionEvent.createLayerMovingEvent(aux, newfrom, newto)); |
||
206 | layers.remove(newfrom); |
||
207 | layers.add(newto, aux); |
||
208 | callLayerMoved(LayerPositionEvent.createLayerMovedEvent(aux, newfrom, newto)); |
||
209 | 524 | vcaballero | } |
210 | 257 | vcaballero | |
211 | 524 | vcaballero | /**
|
212 | 1005 | vcaballero | * Borra una capa del ArrayList que contiene a las capas.
|
213 | 524 | vcaballero | *
|
214 | 1005 | vcaballero | * @param lyr FLayer.
|
215 | 524 | vcaballero | */
|
216 | private void doRemoveLayer(FLayer lyr) { |
||
217 | 2198 | vcaballero | layers.remove(lyr); |
218 | 524 | vcaballero | } |
219 | 214 | fernando | |
220 | 524 | vcaballero | /**
|
221 | 1005 | vcaballero | * Borra una capa de la colecci?n de capas.
|
222 | 524 | vcaballero | *
|
223 | 1005 | vcaballero | * @param lyr FLayer
|
224 | 524 | vcaballero | *
|
225 | 1005 | vcaballero | * @throws CancelationException
|
226 | 524 | vcaballero | */
|
227 | public void removeLayer(FLayer lyr) throws CancelationException { |
||
228 | 1081 | fernando | callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr)); |
229 | 524 | vcaballero | doRemoveLayer(lyr); |
230 | 1081 | fernando | callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr)); |
231 | 524 | vcaballero | } |
232 | 214 | fernando | |
233 | 524 | vcaballero | /**
|
234 | * Borra una FLayer del vector a partir del identificador.
|
||
235 | *
|
||
236 | * @param idLayer
|
||
237 | */
|
||
238 | public void removeLayer(int idLayer) { |
||
239 | 1081 | fernando | FLayer lyr = (FLayer) layers.get(idLayer); |
240 | callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr)); |
||
241 | 524 | vcaballero | layers.remove(idLayer); |
242 | 1081 | fernando | callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr)); |
243 | 524 | vcaballero | } |
244 | 257 | vcaballero | |
245 | 524 | vcaballero | /**
|
246 | * M?todo de conveniencia para borrar una capa con ese nombre
|
||
247 | *
|
||
248 | * @param layerName
|
||
249 | */
|
||
250 | public void removeLayer(String layerName) { |
||
251 | FLayer lyr; |
||
252 | 214 | fernando | |
253 | 524 | vcaballero | for (int i = 0; i < layers.size(); i++) { |
254 | lyr = ((FLayer) layers.get(i)); |
||
255 | 402 | fjp | |
256 | 524 | vcaballero | if (lyr.getName().compareToIgnoreCase(layerName) == 0) { |
257 | 1081 | fernando | removeLayer(i); |
258 | 214 | fernando | |
259 | 524 | vcaballero | break;
|
260 | } |
||
261 | } |
||
262 | } |
||
263 | 4945 | ldiaz | /**
|
264 | * M?todo de conveniencia para reemplazar una capa con ese nombre
|
||
265 | *
|
||
266 | * @param layerName
|
||
267 | */
|
||
268 | public void replaceLayer(String layerName, FLayer layer) |
||
269 | { |
||
270 | FLayer lyr; |
||
271 | 5021 | ldiaz | FLayer parent; |
272 | 4945 | ldiaz | for (int i = 0; i < layers.size(); i++) { |
273 | lyr = ((FLayer) layers.get(i)); |
||
274 | 214 | fernando | |
275 | 4945 | ldiaz | if (lyr.getName().compareToIgnoreCase(layerName) == 0) { |
276 | 5228 | caballero | parent = lyr.getParentLayer(); |
277 | 4945 | ldiaz | removeLayer(i); |
278 | 5021 | ldiaz | if (parent != null) |
279 | 4968 | ldiaz | //Notificamos a la capa que va a ser a?adida
|
280 | if (layer instanceof FLyrDefault) |
||
281 | ((FLyrDefault)layer).wakeUp(); |
||
282 | 5228 | caballero | |
283 | 4968 | ldiaz | if (layer instanceof FLayers){ |
284 | FLayers layers=(FLayers)layer; |
||
285 | fmap.addAsCollectionListener(layers); |
||
286 | } |
||
287 | callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer)); |
||
288 | |||
289 | 4945 | ldiaz | layers.add(i,layer); |
290 | 4968 | ldiaz | layer.setParentLayer(this);
|
291 | |||
292 | callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer)); |
||
293 | 4945 | ldiaz | break;
|
294 | } |
||
295 | } |
||
296 | } |
||
297 | |||
298 | 5228 | caballero | |
299 | 524 | vcaballero | /**
|
300 | * Obtiene el array de capas visibles que penden del arbol cuya ra?z es
|
||
301 | * este nodo
|
||
302 | *
|
||
303 | 1005 | vcaballero | * @return Vector de FLayer.
|
304 | 524 | vcaballero | */
|
305 | public FLayer[] getVisibles() { |
||
306 | ArrayList array = new ArrayList(); |
||
307 | 8173 | jmvivo | LayersIterator iter = new LayersIterator(this) { |
308 | public boolean evaluate(FLayer layer) { |
||
309 | return layer.isVisible();
|
||
310 | 524 | vcaballero | } |
311 | 9010 | caballero | |
312 | 8173 | jmvivo | }; |
313 | |||
314 | while (iter.hasNext()) {
|
||
315 | 9010 | caballero | array.add(iter.nextLayer()); |
316 | 524 | vcaballero | } |
317 | 404 | fjp | |
318 | 524 | vcaballero | return (FLayer[]) array.toArray(new FLayer[0]); |
319 | } |
||
320 | 404 | fjp | |
321 | 524 | vcaballero | /**
|
322 | 5228 | caballero | * Obtiene el hijo i-?simo (de abajo a arriba) directo de esta colecci?n.
|
323 | 524 | vcaballero | *
|
324 | 1005 | vcaballero | * @param index ?ndice.
|
325 | 524 | vcaballero | *
|
326 | 1005 | vcaballero | * @return capa seleccionada.
|
327 | 524 | vcaballero | */
|
328 | public FLayer getLayer(int index) { |
||
329 | return (FLayer) layers.get(index);
|
||
330 | } |
||
331 | 242 | vcaballero | |
332 | 524 | vcaballero | /**
|
333 | * M?todo de conveniencia para buscar una capa por su nombre Es conveniente
|
||
334 | * usar getLayer(int) siempre que se pueda, es m?s directo.
|
||
335 | *
|
||
336 | 1005 | vcaballero | * @param layerName nombre.
|
337 | 524 | vcaballero | *
|
338 | 1005 | vcaballero | * @return capa seleccionada.
|
339 | 524 | vcaballero | */
|
340 | public FLayer getLayer(String layerName) { |
||
341 | FLayer lyr; |
||
342 | 3038 | ldiaz | FLayer lyr2; |
343 | 3963 | caballero | ArrayList layerList;
|
344 | |||
345 | 524 | vcaballero | for (int i = 0; i < layers.size(); i++) { |
346 | lyr = ((FLayer) layers.get(i)); |
||
347 | 242 | vcaballero | |
348 | 4638 | ldiaz | if (lyr.getName().compareToIgnoreCase(layerName) == 0) { |
349 | return lyr;
|
||
350 | } |
||
351 | |||
352 | 3038 | ldiaz | layerList = new ArrayList(); |
353 | splitLayerGroup(lyr,layerList); |
||
354 | for(int j = 0; j<layerList.size(); j++ ) |
||
355 | { |
||
356 | lyr2 = ((FLayer)layerList.get(j)); |
||
357 | if (lyr2.getName().compareToIgnoreCase(layerName) == 0) { |
||
358 | return lyr2;
|
||
359 | } |
||
360 | 524 | vcaballero | } |
361 | } |
||
362 | 346 | fernando | |
363 | 524 | vcaballero | return null; |
364 | } |
||
365 | 3963 | caballero | |
366 | 3038 | ldiaz | // added by Laura
|
367 | // this is to to split up a layer group in order to get a layer by name
|
||
368 | // when there are layergroups.
|
||
369 | private void splitLayerGroup(FLayer layer, ArrayList result) |
||
370 | { |
||
371 | int i;
|
||
372 | FLayers layerGroup; |
||
373 | if (layer instanceof FLayers) |
||
374 | { |
||
375 | layerGroup = (FLayers)layer; |
||
376 | for (i=0; i < layerGroup.getLayersCount(); i++ ) |
||
377 | { |
||
378 | splitLayerGroup(layerGroup.getLayer(i),result); |
||
379 | } |
||
380 | } |
||
381 | else
|
||
382 | { |
||
383 | result.add(layer); |
||
384 | } |
||
385 | } |
||
386 | 346 | fernando | |
387 | 524 | vcaballero | /**
|
388 | * Obtiene el n?mero de capas que hay en su mismo nivel Es decir, no cuenta
|
||
389 | * las subcapas de un FLayers
|
||
390 | *
|
||
391 | 1005 | vcaballero | * @return n?mero de capas.
|
392 | 524 | vcaballero | */
|
393 | public int getLayersCount() { |
||
394 | return layers.size();
|
||
395 | } |
||
396 | 346 | fernando | |
397 | 524 | vcaballero | /**
|
398 | 1056 | vcaballero | * @see com.iver.cit.gvsig.fmap.layers.FLayer#draw(java.awt.image.BufferedImage,
|
399 | 524 | vcaballero | * java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort)
|
400 | */
|
||
401 | public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
||
402 | 2531 | caballero | Cancellable cancel,double scale) throws DriverException { |
403 | 2411 | caballero | //double scale = getFMap().getScaleView();
|
404 | 6611 | caballero | // Iterator iter = layers.iterator();
|
405 | // try
|
||
406 | // {
|
||
407 | 5923 | fjp | boolean bNeedRecalculateCache = false; |
408 | 6611 | caballero | // while (iter.hasNext())
|
409 | // {
|
||
410 | for (int i=0; i < layers.size(); i++) { |
||
411 | 3372 | fjp | if (cancel.isCanceled())
|
412 | break; // M?s que nada porque las capas raster no son interrumpibles por ahora. |
||
413 | 6611 | caballero | // FLayer lyr = (FLayer) iter.next();
|
414 | FLayer lyr = (FLayer) layers.get(i); |
||
415 | 3479 | caballero | /* if (lyr instanceof FLyrVect && ((FLyrVect)lyr).isBroken()){
|
416 | 3478 | caballero | continue;
|
417 | }
|
||
418 | 3479 | caballero | */
|
419 | 3772 | fjp | LayerDrawEvent beforeEvent = new LayerDrawEvent(lyr, g, viewPort, LayerDrawEvent.LAYER_BEFORE_DRAW);
|
420 | fmap.fireLayerDrawingEvent(beforeEvent); |
||
421 | 10450 | jaume | if ((lyr.isDirty()) || (lyr.isCachingDrawnLayers() == false)) |
422 | 6002 | fjp | bNeedRecalculateCache = true;
|
423 | |||
424 | 2981 | fjp | if (lyr.isVisible()) {
|
425 | 3963 | caballero | |
426 | 2981 | fjp | long t1 = System.currentTimeMillis(); |
427 | 5923 | fjp | System.err.println("Layer " + lyr.getName() + " dirty=" + lyr.isDirty()); |
428 | 3076 | fjp | // synchronized (this) {
|
429 | 3963 | caballero | //Sincronizaci?n del m?todo dibujar de cada Layer, esto es posible hacerlo de otra forma,
|
430 | 2981 | fjp | //pero de momento se queda as?, para solucionar el refresco de una misma vista que est? a?adida en el Layout.
|
431 | 3492 | jaume | try{
|
432 | 3685 | fjp | /* if (lyr instanceof IComposedDrawing)
|
433 | {
|
||
434 | // Acumulamos las peticiones hasta que sea
|
||
435 | // otro servidor o otro tipo de capa o la ?ltima
|
||
436 | // Si hay que dibujar:
|
||
437 | lyr.draw(image, g, viewPort, cancel,scale);
|
||
438 | // Si hay que acumlar:
|
||
439 | lyr.acumulateDrawing(antLayer);
|
||
440 | 3963 | caballero | |
441 | 3685 | fjp | }
|
442 | else */
|
||
443 | 3963 | caballero | |
444 | 6259 | fjp | if (lyr.isCachingDrawnLayers())
|
445 | 5923 | fjp | { |
446 | 7380 | jmvivo | if ((bNeedRecalculateCache) || (lyr.getCacheImageDrawnLayers()==null)) |
447 | { |
||
448 | //if (bNeedRecalculateCache)
|
||
449 | 5923 | fjp | // {
|
450 | // Copiamos la imagen actual
|
||
451 | BufferedImage buff = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); |
||
452 | 6480 | jaume | WritableRaster w = buff.getRaster();
|
453 | 5923 | fjp | image.copyData(w); |
454 | lyr.setCacheImageDrawnLayers(buff); |
||
455 | System.err.println("RECALCULO LA CACHE CON LO QUE HABIA ANTES DE " + lyr.getName()); |
||
456 | } |
||
457 | // }
|
||
458 | // else
|
||
459 | // {
|
||
460 | if (lyr.getCacheImageDrawnLayers() != null) |
||
461 | { |
||
462 | // Previo a esto hemos tenido que fijar
|
||
463 | 6480 | jaume | // la imagen que queremos usar, en el
|
464 | 5923 | fjp | // prepareDrawing de FMap.
|
465 | if (lyr.isDirty())
|
||
466 | { |
||
467 | g.drawImage(lyr.getCacheImageDrawnLayers(), 0, 0, null); |
||
468 | System.err.println("Pinto con acelerado lo que hab?a antes de " + lyr.getName()); |
||
469 | } |
||
470 | } |
||
471 | // }
|
||
472 | 6480 | jaume | } |
473 | 5923 | fjp | // Si la capa est? "sucia" o alguna de las de abajo est? sucia
|
474 | // hay que volver a dibujar.
|
||
475 | if (lyr.isDirty() || bNeedRecalculateCache)
|
||
476 | { |
||
477 | lyr.draw(image, g, viewPort, cancel,scale); |
||
478 | bNeedRecalculateCache = true;
|
||
479 | } |
||
480 | 3492 | jaume | } catch (DriverException e){
|
481 | 3941 | fjp | // fmap.callNewErrorEvent(new ErrorEvent(lyr.getName(), e));
|
482 | 5258 | jmvivo | fmap.addLayerError("La capa " + lyr.getName() + " es err?nea."); |
483 | 4181 | fjp | e.printStackTrace(); |
484 | 6537 | jmvivo | lyr.setAvailable(false);
|
485 | 4181 | fjp | // this.removeLayer(lyr);
|
486 | 6537 | jmvivo | } catch (Exception e) { |
487 | fmap.addLayerError("La capa " + lyr.getName() + " es err?nea."); |
||
488 | e.printStackTrace(); |
||
489 | lyr.setAvailable(false);
|
||
490 | 3492 | jaume | } |
491 | 3076 | fjp | // }
|
492 | 2981 | fjp | long t2 = System.currentTimeMillis(); |
493 | System.out.println("Layer " + lyr.getName() + " " |
||
494 | 3963 | caballero | + (t2-t1) + " milisecs.");
|
495 | 5923 | fjp | lyr.setDirty(false);
|
496 | 2981 | fjp | } |
497 | 3772 | fjp | LayerDrawEvent afterEvent = new LayerDrawEvent(lyr, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW);
|
498 | fmap.fireLayerDrawingEvent(afterEvent); |
||
499 | |||
500 | 2981 | fjp | } |
501 | if (getVirtualLayers() != null) { |
||
502 | getVirtualLayers().draw(image, g, viewPort, cancel,scale); |
||
503 | } |
||
504 | 6611 | caballero | // }
|
505 | // catch (ConcurrentModificationException e)
|
||
506 | // {
|
||
507 | // System.err.println(e.getMessage());
|
||
508 | // }
|
||
509 | 524 | vcaballero | } |
510 | |||
511 | /**
|
||
512 | 1005 | vcaballero | * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
|
513 | * com.iver.cit.gvsig.fmap.ViewPort,
|
||
514 | 5317 | fjp | * com.iver.utiles.swing.threads.Cancellable)
|
515 | 524 | vcaballero | */
|
516 | 9010 | caballero | public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintRequestAttributeSet properties) |
517 | 1005 | vcaballero | throws DriverException {
|
518 | 3963 | caballero | |
519 | 2510 | fjp | // TODO: A la hora de imprimir, isWithinScale falla, porque est?
|
520 | // calculando la escala en pantalla, no para el layout.
|
||
521 | // Revisar esto.
|
||
522 | 9481 | caballero | for (int i=0; i < layers.size(); i++) { |
523 | FLayer lyr = (FLayer) layers.get(i); |
||
524 | 9010 | caballero | lyr.print(g, viewPort, cancel, scale, properties); |
525 | 3963 | caballero | |
526 | 2531 | caballero | } |
527 | if (getVirtualLayers() != null) { |
||
528 | 9010 | caballero | getVirtualLayers().print( g, viewPort, cancel,scale, properties); |
529 | 3963 | caballero | } |
530 | 524 | vcaballero | } |
531 | |||
532 | /**
|
||
533 | * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
|
||
534 | */
|
||
535 | 651 | fernando | public Rectangle2D getFullExtent() throws DriverException { |
536 | 524 | vcaballero | Rectangle2D rAux = null; |
537 | 3478 | caballero | boolean first = true; |
538 | 524 | vcaballero | |
539 | 3963 | caballero | |
540 | 524 | vcaballero | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
541 | 533 | vcaballero | FLayer capa = (FLayer) iter.next(); |
542 | 3478 | caballero | try{
|
543 | if (first) {
|
||
544 | 524 | vcaballero | rAux = capa.getFullExtent(); |
545 | 3478 | caballero | first=false;
|
546 | 524 | vcaballero | } else {
|
547 | rAux.add(capa.getFullExtent()); |
||
548 | } |
||
549 | 3478 | caballero | }catch (Exception e) { |
550 | e.printStackTrace();//TODO hay que revisar para determinar el comportamiento que espera el usuario.
|
||
551 | } |
||
552 | 524 | vcaballero | } |
553 | |||
554 | return rAux;
|
||
555 | } |
||
556 | 1005 | vcaballero | |
557 | 524 | vcaballero | /**
|
558 | 1005 | vcaballero | * Llama al m?todo layerAdding de los listeners dados de alta.
|
559 | 524 | vcaballero | *
|
560 | 1005 | vcaballero | * @param event
|
561 | 524 | vcaballero | *
|
562 | * @throws CancelationException
|
||
563 | */
|
||
564 | 7585 | sbayarri | protected void callLayerAdding(LayerCollectionEvent event) |
565 | 524 | vcaballero | throws CancelationException {
|
566 | 3772 | fjp | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
567 | 2284 | jmorell | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
568 | 524 | vcaballero | ((LayerCollectionListener) iter.next()).layerAdding(event); |
569 | } |
||
570 | } |
||
571 | 257 | vcaballero | |
572 | 524 | vcaballero | /**
|
573 | 1005 | vcaballero | * Llama al m?todo layerRemoving de los listeners dados de alta.
|
574 | 524 | vcaballero | *
|
575 | 1005 | vcaballero | * @param event
|
576 | 524 | vcaballero | *
|
577 | * @throws CancelationException
|
||
578 | */
|
||
579 | 7585 | sbayarri | protected void callLayerRemoving(LayerCollectionEvent event) |
580 | 524 | vcaballero | throws CancelationException {
|
581 | 3772 | fjp | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
582 | 2284 | jmorell | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
583 | 524 | vcaballero | ((LayerCollectionListener) iter.next()).layerRemoving(event); |
584 | } |
||
585 | } |
||
586 | 257 | vcaballero | |
587 | 3963 | caballero | |
588 | 524 | vcaballero | /**
|
589 | 1005 | vcaballero | * Llama al m?todo layerMoving de los listeners dados de alta.
|
590 | 524 | vcaballero | *
|
591 | 1005 | vcaballero | * @param event
|
592 | 524 | vcaballero | *
|
593 | * @throws CancelationException
|
||
594 | */
|
||
595 | 7585 | sbayarri | protected void callLayerMoving(LayerPositionEvent event) |
596 | 524 | vcaballero | throws CancelationException {
|
597 | 3772 | fjp | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
598 | 2284 | jmorell | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
599 | 524 | vcaballero | ((LayerCollectionListener) iter.next()).layerMoving(event); |
600 | } |
||
601 | } |
||
602 | 353 | fernando | |
603 | 524 | vcaballero | /**
|
604 | 1005 | vcaballero | * Llama al m?todo layerAdded de los listeners dados de alta.
|
605 | 524 | vcaballero | *
|
606 | 1005 | vcaballero | * @param event
|
607 | 524 | vcaballero | */
|
608 | 7585 | sbayarri | protected void callLayerAdded(LayerCollectionEvent event) { |
609 | 3772 | fjp | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
610 | 2284 | jmorell | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
611 | 524 | vcaballero | ((LayerCollectionListener) iter.next()).layerAdded(event); |
612 | } |
||
613 | } |
||
614 | 353 | fernando | |
615 | 524 | vcaballero | /**
|
616 | 1005 | vcaballero | * Llama al m?todo layerRemoved de los listeners dados de alta.
|
617 | 524 | vcaballero | *
|
618 | 1005 | vcaballero | * @param event
|
619 | 524 | vcaballero | */
|
620 | 7585 | sbayarri | protected void callLayerRemoved(LayerCollectionEvent event) { |
621 | 3772 | fjp | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
622 | 2284 | jmorell | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
623 | 524 | vcaballero | ((LayerCollectionListener) iter.next()).layerRemoved(event); |
624 | } |
||
625 | } |
||
626 | 353 | fernando | |
627 | 435 | vcaballero | /**
|
628 | 1005 | vcaballero | * Llama al m?todo layerMoved de los listeners dados de alta.
|
629 | 524 | vcaballero | *
|
630 | 1005 | vcaballero | * @param event
|
631 | 524 | vcaballero | */
|
632 | 7585 | sbayarri | protected void callLayerMoved(LayerPositionEvent event) { |
633 | 3772 | fjp | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
634 | 2284 | jmorell | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
635 | 524 | vcaballero | ((LayerCollectionListener) iter.next()).layerMoved(event); |
636 | } |
||
637 | } |
||
638 | |||
639 | /**
|
||
640 | 1828 | fernando | * @throws XMLException
|
641 | 435 | vcaballero | * @see com.iver.cit.gvsig.fmap.layers.FLayer#getProperties()
|
642 | */
|
||
643 | 1828 | fernando | public XMLEntity getXMLEntity() throws XMLException { |
644 | 524 | vcaballero | XMLEntity xml = super.getXMLEntity();
|
645 | xml.putProperty("numLayers", layers.size());
|
||
646 | 1005 | vcaballero | |
647 | String[] s = new String[layers.size()]; |
||
648 | |||
649 | for (int i = 0; i < layers.size(); i++) { |
||
650 | s[i] = ((FLayer) layers.get(i)).getName(); |
||
651 | 558 | vcaballero | } |
652 | 1005 | vcaballero | |
653 | xml.putProperty("LayerNames", s);
|
||
654 | |||
655 | 524 | vcaballero | for (int i = 0; i < layers.size(); i++) { |
656 | xml.addChild(((FLayer) layers.get(i)).getXMLEntity()); |
||
657 | 435 | vcaballero | } |
658 | 524 | vcaballero | |
659 | 435 | vcaballero | return xml;
|
660 | } |
||
661 | 341 | fernando | |
662 | 435 | vcaballero | /**
|
663 | 1056 | vcaballero | * DOCUMENT ME!
|
664 | *
|
||
665 | * @param xml DOCUMENT ME!
|
||
666 | *
|
||
667 | * @throws XMLException
|
||
668 | *
|
||
669 | 435 | vcaballero | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setXMLEntity(com.iver.utiles.XMLEntity)
|
670 | */
|
||
671 | 3481 | caballero | public void setXMLEntity03(XMLEntity xml) throws XMLException{ |
672 | 2183 | fernando | super.setXMLEntity03(xml);
|
673 | int numLayers = xml.getIntProperty("numLayers"); |
||
674 | |||
675 | String[] s = xml.getStringArrayProperty("LayerNames"); |
||
676 | try {
|
||
677 | for (int i = 0; i < numLayers; i++) { |
||
678 | FLayer layer = null;
|
||
679 | 3963 | caballero | |
680 | 2183 | fernando | String className = xml.getChild(i).getStringProperty("className"); |
681 | 3963 | caballero | |
682 | 2183 | fernando | if (className.equals(FLyrVect.class.getName())) {
|
683 | if (xml.getChild(i).contains("file")) { |
||
684 | 3963 | caballero | |
685 | 2183 | fernando | layer = LayerFactory.createLayer(s[i], |
686 | (VectorialFileDriver)LayerFactory.getDM().getDriver(xml.getChild(i).getStringProperty("driverName")),
|
||
687 | new File(xml.getChild(i).getStringProperty("file")), |
||
688 | 6881 | cesar | this.getMapContext().getViewPort().getProjection());
|
689 | 3963 | caballero | |
690 | 2183 | fernando | } else if (true) { |
691 | //TODO falta por implementar
|
||
692 | } else if (true) { |
||
693 | //TODO falta por implementar
|
||
694 | } |
||
695 | 3963 | caballero | |
696 | 2183 | fernando | layer.setXMLEntity03(xml.getChild(i)); |
697 | // Comprobar que la proyecci?n es la misma que la de FMap
|
||
698 | 3963 | caballero | // Si no lo es, es una capa que est? reproyectada al vuelo
|
699 | 2183 | fernando | IProjection proj = layer.getProjection(); |
700 | if (proj != null) |
||
701 | if (proj != fmap.getProjection())
|
||
702 | { |
||
703 | 6164 | luisw2 | ICoordTrans ct = proj.getCT(fmap.getProjection()); |
704 | 2183 | fernando | layer.setCoordTrans(ct); |
705 | System.err.println("coordTrans = " + |
||
706 | proj.getAbrev() + " " +
|
||
707 | fmap.getProjection().getAbrev()); |
||
708 | } |
||
709 | 3963 | caballero | |
710 | 3174 | ldiaz | // } else if (className.equals(FLyrWMS.class.getName())) {
|
711 | // try {
|
||
712 | // layer = LayerFactory.createLayer(s[i],
|
||
713 | // StringUtilities.string2Rect(
|
||
714 | // xml.getChild(i).getStringProperty("fullExtent")),
|
||
715 | // new URL(xml.getChild(i).getStringProperty("host")),
|
||
716 | // xml.getChild(i).getStringProperty("format"),
|
||
717 | // xml.getChild(i).getStringProperty("layerQuery"),
|
||
718 | // xml.getChild(i).getStringProperty("infoLayerQuery"),
|
||
719 | // xml.getChild(i).getStringProperty("srs"));
|
||
720 | // } catch (MalformedURLException e) {
|
||
721 | // throw new XMLException(e);
|
||
722 | // }
|
||
723 | 2183 | fernando | } else if (className.equals((FLyrRaster.class.getName()))) { |
724 | //if (xml.getChild(i).contains("file")) {
|
||
725 | /*layer = LayerFactory.createLayer(s[i],
|
||
726 | xml.getChild(i).getStringProperty("driverName"),
|
||
727 | new File(xml.getChild(i).getStringProperty("file")),
|
||
728 | this.getFMap().getViewPort().getProjection());*/
|
||
729 | layer = new FLyrRaster();
|
||
730 | layer.setName(s[i]); |
||
731 | if (!xml.getChild(i).contains("proj")) |
||
732 | 6881 | cesar | ((FLyrRaster)layer).setProjection(this.getMapContext().getViewPort().getProjection());
|
733 | 2183 | fernando | layer.setXMLEntity03(xml.getChild(i)); |
734 | try {
|
||
735 | 3431 | caballero | layer.load(); |
736 | 3963 | caballero | |
737 | 2183 | fernando | } catch (DriverIOException e) {
|
738 | throw new XMLException(e); |
||
739 | } |
||
740 | 3963 | caballero | |
741 | 2234 | vcaballero | }else if (className.equals((FLayers.class.getName()))) { |
742 | 6881 | cesar | layer = new FLayers(getMapContext(),this); |
743 | 2234 | vcaballero | layer.setXMLEntity(xml.getChild(i)); |
744 | 2183 | fernando | } else {
|
745 | // Capas Nuevas (externas)
|
||
746 | try {
|
||
747 | Class clase = Class.forName(className); |
||
748 | layer = (FLayer) clase.newInstance(); |
||
749 | layer.setName(s[i]); |
||
750 | layer.setXMLEntity03(xml.getChild(i)); |
||
751 | try {
|
||
752 | 3431 | caballero | layer.load(); |
753 | 2183 | fernando | } catch (DriverIOException e) {
|
754 | throw new XMLException(e); |
||
755 | } |
||
756 | } catch (Exception e) { |
||
757 | //e.printStackTrace();
|
||
758 | throw new XMLException(e); |
||
759 | } |
||
760 | } |
||
761 | 3963 | caballero | |
762 | 2234 | vcaballero | this.addLayer(layer);
|
763 | 2183 | fernando | } |
764 | 7462 | azabala | } /*azabala-modificaciones en layerfactory-
|
765 | catch (DriverException e) {
|
||
766 | 2183 | fernando | throw new XMLException(e);
|
767 | 7462 | azabala | }*/
|
768 | catch (DriverLoadException e) {
|
||
769 | 2183 | fernando | throw new XMLException(e); |
770 | } |
||
771 | 3963 | caballero | |
772 | 2183 | fernando | } |
773 | |||
774 | /**
|
||
775 | * DOCUMENT ME!
|
||
776 | *
|
||
777 | * @param xml DOCUMENT ME!
|
||
778 | *
|
||
779 | * @throws XMLException
|
||
780 | *
|
||
781 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setXMLEntity(com.iver.utiles.XMLEntity)
|
||
782 | */
|
||
783 | 3481 | caballero | public void setXMLEntity(XMLEntity xml) throws XMLException{ |
784 | 442 | vcaballero | super.setXMLEntity(xml);
|
785 | 3481 | caballero | //LoadLayerException loadLayerException=new LoadLayerException();
|
786 | 894 | vcaballero | int numLayers = xml.getIntProperty("numLayers"); |
787 | 524 | vcaballero | |
788 | 1005 | vcaballero | String[] s = xml.getStringArrayProperty("LayerNames"); |
789 | 3304 | jmorell | // try {
|
790 | 3492 | jaume | fmap.clearErrors(); |
791 | 1060 | fjp | for (int i = 0; i < numLayers; i++) { |
792 | 6437 | jmvivo | this.addLayerFromXML(xml.getChild(i),s[i]);
|
793 | 3963 | caballero | |
794 | |||
795 | 894 | vcaballero | } |
796 | 3304 | jmorell | /* } catch (DriverException e) {
|
797 | 1060 | fjp | throw new XMLException(e);
|
798 | 3304 | jmorell | } */
|
799 | 3481 | caballero | /*if (loadLayerException.getExceptions().size()>0){
|
800 | throw loadLayerException;
|
||
801 | }*/
|
||
802 | 435 | vcaballero | } |
803 | 562 | fernando | |
804 | /**
|
||
805 | 1005 | vcaballero | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData#process(com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor,
|
806 | 2969 | fjp | * FBitSet)
|
807 | 562 | fernando | */
|
808 | 2969 | fjp | public void process(FeatureVisitor visitor, FBitSet subset) |
809 | 1005 | vcaballero | throws DriverException, VisitException {
|
810 | 562 | fernando | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
811 | FLayer layer = (FLayer) iter.next(); |
||
812 | 1005 | vcaballero | |
813 | 562 | fernando | if (layer instanceof VectorialData) { |
814 | ((VectorialData) layer).process(visitor, subset); |
||
815 | } |
||
816 | } |
||
817 | } |
||
818 | |||
819 | /**
|
||
820 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData#process(com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor)
|
||
821 | */
|
||
822 | 1005 | vcaballero | public void process(FeatureVisitor visitor) |
823 | throws DriverException, VisitException {
|
||
824 | 562 | fernando | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
825 | FLayer layer = (FLayer) iter.next(); |
||
826 | 1005 | vcaballero | |
827 | 9481 | caballero | if (layer instanceof FLayers){ |
828 | FLayers lyrs=(FLayers)layer; |
||
829 | for (int i=0;i<lyrs.getLayersCount();i++){ |
||
830 | FLayer lyr=lyrs.getLayer(i); |
||
831 | if (lyr.isActive()) {
|
||
832 | if (lyr instanceof VectorialData) { |
||
833 | ((VectorialData) lyr).process(visitor); |
||
834 | } |
||
835 | } |
||
836 | } |
||
837 | } |
||
838 | 1005 | vcaballero | if (layer.isActive()) {
|
839 | 661 | fjp | if (layer instanceof VectorialData) { |
840 | ((VectorialData) layer).process(visitor); |
||
841 | } |
||
842 | 1005 | vcaballero | } |
843 | 562 | fernando | } |
844 | } |
||
845 | 4200 | azabala | /**
|
846 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData#process(com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor, Rectangle2D)
|
||
847 | */
|
||
848 | public void process(FeatureVisitor visitor, Rectangle2D rect) throws DriverException, VisitException { |
||
849 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
850 | FLayer layer = (FLayer) iter.next(); |
||
851 | 694 | fernando | |
852 | 4200 | azabala | if (layer.isActive()) {
|
853 | if (layer instanceof VectorialData) { |
||
854 | ((VectorialData) layer).process(visitor, rect); |
||
855 | } |
||
856 | } |
||
857 | } |
||
858 | 5228 | caballero | |
859 | 4200 | azabala | } |
860 | |||
861 | 694 | fernando | /**
|
862 | 6881 | cesar | * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMapContext()
|
863 | 694 | fernando | */
|
864 | 6881 | cesar | public MapContext getMapContext() {
|
865 | 694 | fernando | return fmap;
|
866 | } |
||
867 | 885 | fjp | |
868 | /* (non-Javadoc)
|
||
869 | * @see com.iver.cit.gvsig.fmap.layers.FLayer#setCoordTrans(org.cresques.cts.ICoordTrans)
|
||
870 | */
|
||
871 | public void setCoordTrans(ICoordTrans ct) { |
||
872 | super.setCoordTrans(ct);
|
||
873 | 1005 | vcaballero | |
874 | 885 | fjp | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
875 | FLayer layer = (FLayer) iter.next(); |
||
876 | layer.setCoordTrans(ct); |
||
877 | 1005 | vcaballero | } |
878 | 885 | fjp | } |
879 | 1005 | vcaballero | |
880 | /**
|
||
881 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllActives(boolean)
|
||
882 | */
|
||
883 | public void setAllActives(boolean active) { |
||
884 | FLayer lyr; |
||
885 | |||
886 | for (int i = 0; i < layers.size(); i++) { |
||
887 | lyr = ((FLayer) layers.get(i)); |
||
888 | lyr.setActive(active); |
||
889 | |||
890 | if (lyr instanceof LayerCollection) { |
||
891 | ((LayerCollection) lyr).setAllActives(active); |
||
892 | } |
||
893 | } |
||
894 | } |
||
895 | |||
896 | /**
|
||
897 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getActives()
|
||
898 | */
|
||
899 | public FLayer[] getActives() { |
||
900 | ArrayList ret = new ArrayList(); |
||
901 | 8173 | jmvivo | LayersIterator it = new LayersIterator(this) { |
902 | |||
903 | 9010 | caballero | public boolean evaluate(FLayer layer) { |
904 | 8173 | jmvivo | return layer.isActive();
|
905 | } |
||
906 | 9010 | caballero | |
907 | 8173 | jmvivo | }; |
908 | 9010 | caballero | |
909 | 7986 | fjp | while (it.hasNext())
|
910 | { |
||
911 | 8173 | jmvivo | ret.add(it.next()); |
912 | 1005 | vcaballero | } |
913 | return (FLayer[]) ret.toArray(new FLayer[0]); |
||
914 | } |
||
915 | 1176 | fjp | |
916 | /* (non-Javadoc)
|
||
917 | * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMinScale()
|
||
918 | */
|
||
919 | public double getMinScale() { |
||
920 | return -1; // La visibilidad o no la controla cada capa |
||
921 | // dentro de una colecci?n
|
||
922 | } |
||
923 | |||
924 | /* (non-Javadoc)
|
||
925 | * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMaxScale()
|
||
926 | */
|
||
927 | public double getMaxScale() { |
||
928 | return -1; |
||
929 | } |
||
930 | public void setMinScale(double minScale) |
||
931 | { |
||
932 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
933 | FLayer lyr = (FLayer) iter.next(); |
||
934 | lyr.setMinScale(minScale); |
||
935 | } |
||
936 | } |
||
937 | public void setMaxScale(double maxScale) |
||
938 | { |
||
939 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
940 | FLayer lyr = (FLayer) iter.next(); |
||
941 | lyr.setMinScale(maxScale); |
||
942 | } |
||
943 | } |
||
944 | 2411 | caballero | public void setActive(boolean b){ |
945 | super.setActive(b);
|
||
946 | for (int i=0;i<layers.size();i++){ |
||
947 | ((FLayer)layers.get(i)).setActive(b); |
||
948 | } |
||
949 | } |
||
950 | 3963 | caballero | |
951 | 4147 | fjp | /* (non-Javadoc)
|
952 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
|
||
953 | */
|
||
954 | public boolean addLayerListener(LayerListener o) { |
||
955 | 5228 | caballero | for (int i = 0; i < layers.size(); i++) |
956 | 4147 | fjp | ((FLayer) layers.get(i)).addLayerListener(o); |
957 | return true; |
||
958 | } |
||
959 | |||
960 | 8597 | ldiaz | public XMLItem[] getInfo(Point p, double tolerance, Cancellable cancel) throws DriverException { |
961 | 4928 | ldiaz | int i;
|
962 | 5057 | ldiaz | Vector items = new Vector(); |
963 | FLayer layer; |
||
964 | XMLItem[] aux;
|
||
965 | 4928 | ldiaz | for (i = 0; i < this.layers.size(); i++){ |
966 | 5057 | ldiaz | layer = (FLayer)layers.get(i); |
967 | if (layer instanceof InfoByPoint){ |
||
968 | InfoByPoint queryable_layer = (InfoByPoint) layer; |
||
969 | 8558 | ldiaz | aux = queryable_layer.getInfo(p, tolerance, null);
|
970 | 8299 | ldiaz | if (!(queryable_layer instanceof FLayers)){ |
971 | 9010 | caballero | for(int j = 0; j < aux.length; j++){ |
972 | 8299 | ldiaz | items.add(aux[j]); |
973 | } |
||
974 | 4928 | ldiaz | } |
975 | 5228 | caballero | } |
976 | 5057 | ldiaz | } |
977 | return (XMLItem[])items.toArray(new XMLItem[0]); |
||
978 | 5228 | caballero | |
979 | 5057 | ldiaz | // for (i = 0; i < this.layers.size(); i++){
|
980 | // FLayer laCapa = (FLayer) layers.get(i);
|
||
981 | // if (laCapa instanceof FLyrVect){
|
||
982 | // }
|
||
983 | // else if (laCapa instanceof RasterOperations) {
|
||
984 | // try {
|
||
985 | // RasterOperations layer = (RasterOperations) laCapa;
|
||
986 | // sb.append(layer.getInfo(p, tolerance));
|
||
987 | // } catch (DriverException e) {
|
||
988 | 5228 | caballero | // e.printStackTrace();
|
989 | // }
|
||
990 | 5057 | ldiaz | // }
|
991 | // else if (laCapa instanceof InfoByPoint) {
|
||
992 | // try {
|
||
993 | // InfoByPoint layer = (InfoByPoint) laCapa;
|
||
994 | // sb.append(layer.getInfo(p, tolerance));
|
||
995 | // } catch (DriverException e) {
|
||
996 | 5228 | caballero | // e.printStackTrace();
|
997 | 5057 | ldiaz | // }
|
998 | // }
|
||
999 | 5228 | caballero | // }
|
1000 | 5057 | ldiaz | |
1001 | 4928 | ldiaz | } |
1002 | |||
1003 | 6480 | jaume | public ImageIcon getTocImageIcon() { |
1004 | 5761 | jmvivo | return new ImageIcon(MapControl.class.getResource("images/layerGroup.png")); |
1005 | } |
||
1006 | 6480 | jaume | |
1007 | 5923 | fjp | public boolean isDirty() { |
1008 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
1009 | FLayer lyr = (FLayer) iter.next(); |
||
1010 | if (lyr.isDirty())
|
||
1011 | return true; |
||
1012 | } |
||
1013 | return false; |
||
1014 | 6480 | jaume | } |
1015 | 4200 | azabala | |
1016 | 5923 | fjp | public void setDirty(boolean dirty) { |
1017 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
1018 | FLayer lyr = (FLayer) iter.next(); |
||
1019 | lyr.setDirty(dirty); |
||
1020 | } |
||
1021 | |||
1022 | } |
||
1023 | 6480 | jaume | |
1024 | 6437 | jmvivo | public boolean addLayerFromXMLEntity(XMLEntity xml, String name) { |
1025 | fmap.clearErrors(); |
||
1026 | this.addLayerFromXML(xml,name);
|
||
1027 | 5923 | fjp | |
1028 | 6480 | jaume | return (fmap.getLayersError().size() == 0); |
1029 | |||
1030 | 6437 | jmvivo | } |
1031 | 5923 | fjp | |
1032 | 6437 | jmvivo | private void addLayerFromXML(XMLEntity xml, String name) { |
1033 | 6480 | jaume | FLayer layer = null;
|
1034 | |||
1035 | 6437 | jmvivo | try {
|
1036 | if (name == null) name = xml.getName(); |
||
1037 | |||
1038 | |||
1039 | String className = xml.getStringProperty("className"); |
||
1040 | 9984 | jaume | Class clazz = Class.forName(className); |
1041 | Object o = clazz.newInstance();
|
||
1042 | if (o instanceof FLyrVect/*className.equals(FLyrVect.class.getName())*/) { |
||
1043 | 6437 | jmvivo | String type = xml.getStringProperty("type"); |
1044 | if ("vectorial".equals(type)){ |
||
1045 | //String recordsetName = xml.getChild(i).getStringProperty("recordset-name");
|
||
1046 | 9984 | jaume | IProjection proj = null;
|
1047 | if (xml.contains("proj")) { |
||
1048 | proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
|
||
1049 | } |
||
1050 | else
|
||
1051 | { |
||
1052 | proj = this.getMapContext().getViewPort().getProjection();
|
||
1053 | } |
||
1054 | 6437 | jmvivo | if (xml.contains("file")) { |
1055 | Driver d;
|
||
1056 | try {
|
||
1057 | d = LayerFactory.getDM().getDriver(xml.getStringProperty("driverName"));
|
||
1058 | } catch (DriverLoadException e1) {
|
||
1059 | throw new XMLException(e1); |
||
1060 | } |
||
1061 | layer = LayerFactory.createLayer(name, (VectorialFileDriver) d, |
||
1062 | 9984 | jaume | new File(xml.getStringProperty("file")), |
1063 | proj, className); |
||
1064 | 6437 | jmvivo | |
1065 | |||
1066 | } |
||
1067 | 9984 | jaume | if (xml.contains("db")) { |
1068 | 6437 | jmvivo | |
1069 | 9984 | jaume | String driverName = xml.getStringProperty("db"); |
1070 | VectorialDatabaseDriver driver; |
||
1071 | try {
|
||
1072 | driver = (VectorialDatabaseDriver) LayerFactory.getDM().getDriver(driverName); |
||
1073 | //Hay que separar la carga de los datos del XMLEntity del load.
|
||
1074 | driver.setXMLEntity(xml.getChild(2));
|
||
1075 | 6556 | caballero | |
1076 | 9984 | jaume | boolean loadOk = false; |
1077 | try {
|
||
1078 | ((DefaultDBDriver)driver).load(); |
||
1079 | if (((DefaultDBDriver)driver).getConnection() != null) { |
||
1080 | loadOk = true;
|
||
1081 | } |
||
1082 | 6556 | caballero | |
1083 | 9984 | jaume | } catch (DriverException e) {
|
1084 | e.printStackTrace(); |
||
1085 | loadOk = false;
|
||
1086 | 6556 | caballero | |
1087 | 9984 | jaume | } |
1088 | 6556 | caballero | |
1089 | 9984 | jaume | layer = LayerFactory.createDBLayer(driver, name, proj); |
1090 | if (!loadOk) {
|
||
1091 | layer.setAvailable(false);
|
||
1092 | } |
||
1093 | 6480 | jaume | |
1094 | 9984 | jaume | } catch (DriverLoadException e) {
|
1095 | e.printStackTrace(); |
||
1096 | throw new XMLException(e); |
||
1097 | } |
||
1098 | 6437 | jmvivo | |
1099 | 9984 | jaume | } |
1100 | // Clases con algun driver gen?rico creado por otro
|
||
1101 | // programador
|
||
1102 | if (xml.contains("other")) { |
||
1103 | 6437 | jmvivo | |
1104 | 9984 | jaume | String driverName = xml.getStringProperty("other"); |
1105 | VectorialDriver driver = null;
|
||
1106 | try {
|
||
1107 | driver = (VectorialDriver) LayerFactory.getDM().getDriver(driverName); |
||
1108 | } catch (DriverLoadException e) {
|
||
1109 | // Si no existe ese driver, no pasa nada.
|
||
1110 | // Puede que el desarrollador no quiera que
|
||
1111 | // aparezca en el cuadro de di?logo y ha metido
|
||
1112 | // el jar con sus clases en nuestro directorio lib.
|
||
1113 | // Intentamos cargar esa clase "a pelo".
|
||
1114 | if (xml.getChild(2).contains("className")) |
||
1115 | { |
||
1116 | String className2 = xml.getChild(2).getStringProperty("className"); |
||
1117 | try {
|
||
1118 | driver = (VectorialDriver) Class.forName(className2).newInstance();
|
||
1119 | } catch (Exception e1) { |
||
1120 | throw new XMLException(e1); |
||
1121 | } |
||
1122 | } |
||
1123 | } catch (NullPointerException npe) { |
||
1124 | // Si no existe ese driver, no pasa nada.
|
||
1125 | // Puede que el desarrollador no quiera que
|
||
1126 | // aparezca en el cuadro de di?logo y ha metido
|
||
1127 | // el jar con sus clases en nuestro directorio lib.
|
||
1128 | // Intentamos cargar esa clase "a pelo".
|
||
1129 | if (xml.getChild(2).contains("className")) |
||
1130 | { |
||
1131 | String className2 = xml.getChild(2).getStringProperty("className"); |
||
1132 | try {
|
||
1133 | driver = (VectorialDriver) Class.forName(className2).newInstance();
|
||
1134 | } catch (Exception e1) { |
||
1135 | throw new XMLException(e1); |
||
1136 | } |
||
1137 | } |
||
1138 | } |
||
1139 | if (driver instanceof IPersistance) |
||
1140 | { |
||
1141 | IPersistance persist = (IPersistance) driver; |
||
1142 | persist.setXMLEntity(xml.getChild(2));
|
||
1143 | } |
||
1144 | layer = LayerFactory.createLayer(name, driver, proj); |
||
1145 | } |
||
1146 | 6437 | jmvivo | |
1147 | |||
1148 | } else if ("raster".equals(type)) { |
||
1149 | 9984 | jaume | /* if (xml.getChild(i).contains("file")) {
|
1150 | Driver d = LayerFactory.getDM().getDriver(xml.getChild(i).getStringProperty("driverName"));
|
||
1151 | layer = LayerFactory.createLayer(s[i],
|
||
1152 | ,
|
||
1153 | new File(xml.getChild(i).getStringProperty("file")),
|
||
1154 | this.getFMap().getViewPort().getProjection());
|
||
1155 | 6437 | jmvivo | |
1156 | 9984 | jaume | }
|
1157 | */ }
|
||
1158 | 6437 | jmvivo | |
1159 | layer.setXMLEntity(xml); |
||
1160 | |||
1161 | 9984 | jaume | // } else if (className.equals(FLyrWMS.class.getName())) {
|
1162 | 6437 | jmvivo | // try {
|
1163 | 9984 | jaume | // layer = LayerFactory.createLayer(s[i],
|
1164 | // StringUtilities.string2Rect(
|
||
1165 | // xml.getChild(i).getStringProperty("fullExtent")),
|
||
1166 | // new URL(xml.getChild(i).getStringProperty("host")),
|
||
1167 | // xml.getChild(i).getStringProperty("format"),
|
||
1168 | // xml.getChild(i).getStringProperty("layerQuery"),
|
||
1169 | // xml.getChild(i).getStringProperty("infoLayerQuery"),
|
||
1170 | // xml.getChild(i).getStringProperty("srs"));
|
||
1171 | // layer.setXMLEntity(xml.getChild(i));
|
||
1172 | 6437 | jmvivo | // } catch (MalformedURLException e) {
|
1173 | 9984 | jaume | // throw new XMLException(e);
|
1174 | 6437 | jmvivo | // }
|
1175 | } else if (className.equals((FLyrRaster.class.getName()))) { |
||
1176 | //if (xml.getChild(i).contains("file")) {
|
||
1177 | /*layer = LayerFactory.createLayer(s[i],
|
||
1178 | 9984 | jaume | xml.getChild(i).getStringProperty("driverName"),
|
1179 | new File(xml.getChild(i).getStringProperty("file")),
|
||
1180 | this.getFMap().getViewPort().getProjection());*/
|
||
1181 | 6437 | jmvivo | layer = new FLyrRaster();
|
1182 | layer.setName(name); |
||
1183 | if (!xml.contains("proj")) |
||
1184 | 6881 | cesar | ((FLyrRaster)layer).setProjection(this.getMapContext().getViewPort().getProjection());
|
1185 | 6437 | jmvivo | layer.setXMLEntity(xml); |
1186 | try {
|
||
1187 | layer.load(); |
||
1188 | } catch (DriverIOException e) {
|
||
1189 | throw new XMLException(e); |
||
1190 | } |
||
1191 | |||
1192 | }else if (className.equals((FLayers.class.getName()))) { |
||
1193 | 6881 | cesar | layer = new FLayers(getMapContext(),this); |
1194 | 6437 | jmvivo | layer.setXMLEntity(xml); |
1195 | } else {
|
||
1196 | // Capas Nuevas (externas)
|
||
1197 | 9984 | jaume | Class clase = Class.forName(className); |
1198 | layer = (FLayer) clase.newInstance(); |
||
1199 | layer.setName(name); |
||
1200 | layer.setXMLEntity(xml); |
||
1201 | try {
|
||
1202 | layer.load(); |
||
1203 | }catch (DriverIOException e) {
|
||
1204 | throw new XMLException(e); |
||
1205 | } |
||
1206 | 6437 | jmvivo | |
1207 | } |
||
1208 | |||
1209 | this.addLayer(layer);
|
||
1210 | 6480 | jaume | logger.debug("layer: "+ layer.getName() +" loaded"); |
1211 | 6437 | jmvivo | // Comprobar que la proyecci?n es la misma que la de FMap
|
1212 | 9984 | jaume | // Si no lo es, es una capa que est? reproyectada al vuelo
|
1213 | IProjection proj = layer.getProjection(); |
||
1214 | if ((proj != null)) |
||
1215 | if (proj != getMapContext().getProjection())
|
||
1216 | { |
||
1217 | ICoordTrans ct = proj.getCT(getMapContext().getProjection()); |
||
1218 | // TODO: REVISAR CON LUIS
|
||
1219 | // Se lo fijamos a todas, luego cada una que se reproyecte
|
||
1220 | // si puede, o que no haga nada
|
||
1221 | layer.setCoordTrans(ct); |
||
1222 | // NOTA: DESPU?S DE ESTO DEBER?AMOS CREAR LAS ETIQUETAS
|
||
1223 | // SI ES NECESARIO.
|
||
1224 | // TODO: REVISAR A FONDO ESTO, PORQUE LAS ETIQUETAS SE CREAN
|
||
1225 | // 2 VECES SI HAY REPROYECC?N
|
||
1226 | if (layer instanceof FLyrVect) |
||
1227 | { |
||
1228 | FLyrVect lyrVect = (FLyrVect)layer; |
||
1229 | VectorialLegend legend = (VectorialLegend) lyrVect.getLegend(); |
||
1230 | if (legend.getLabelField() != null) { |
||
1231 | lyrVect.createLabelLayer(lyrVect.getRecordset()); |
||
1232 | } |
||
1233 | 6437 | jmvivo | |
1234 | 9984 | jaume | } |
1235 | } |
||
1236 | }catch (Exception e) { |
||
1237 | fmap.addLayerError(xml.getStringProperty("name"));
|
||
1238 | //loadLayerException.addException(e);
|
||
1239 | 6437 | jmvivo | /*if (layer!=null){
|
1240 | 9984 | jaume | layer.setActive(false);
|
1241 | layer.setVisible(false);
|
||
1242 | this.addLayer(layer);
|
||
1243 | }*/
|
||
1244 | 6437 | jmvivo | //throw new XMLException(e);
|
1245 | 9984 | jaume | System.err.println("No se ha podido cargar la capa : "+xml.getStringProperty("name")); |
1246 | logger.debug("No se ha podido cargar la capa : "+xml.getStringProperty("name") + ". Raz?n:"); |
||
1247 | // logger.debug(e.fillInStackTrace());
|
||
1248 | e.printStackTrace(); |
||
1249 | } |
||
1250 | 6437 | jmvivo | } |
1251 | 7562 | sbayarri | |
1252 | 6762 | jmvivo | private void addLayerFromXMLNew(XMLEntity xml, String name) { |
1253 | FLayer layer = null;
|
||
1254 | 6437 | jmvivo | |
1255 | 7562 | sbayarri | |
1256 | 6762 | jmvivo | try {
|
1257 | String className = xml.getStringProperty("className"); |
||
1258 | |||
1259 | if (className.equals((FLayers.class.getName()))){
|
||
1260 | 7562 | sbayarri | layer = new FLayers(getMapContext(),this); |
1261 | 6762 | jmvivo | } else {
|
1262 | // Por compatibilidad
|
||
1263 | if (className.equals(FLyrVect.class.getName())) {
|
||
1264 | if (xml.contains("file")) { |
||
1265 | 7562 | sbayarri | layer = new FLayerFileVectorial();
|
1266 | 6762 | jmvivo | } else if (xml.contains("db")) { |
1267 | try {
|
||
1268 | 7562 | sbayarri | layer = (FLayer)((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create("com.iver.cit.gvsig.fmap.layers.FLayerJDBCVectorial"); |
1269 | 6762 | jmvivo | } catch (Exception e) { |
1270 | throw new XMLException(new Exception("No se tiene registrada la capa de tipo JDBC")); |
||
1271 | 7562 | sbayarri | } |
1272 | //className = FLayerJDBCVectorial.class.getName();
|
||
1273 | 6762 | jmvivo | } else if (xml.contains("other")){ |
1274 | 7562 | sbayarri | layer = new FLayerGenericVectorial();
|
1275 | 6762 | jmvivo | } else {
|
1276 | throw new XMLException(new Exception("Capa vectorial de tipo no reconocido")); |
||
1277 | } |
||
1278 | 7562 | sbayarri | // Fin por compatibilidad
|
1279 | 6762 | jmvivo | } else {
|
1280 | try {
|
||
1281 | layer = (FLayer)(((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create(className));
|
||
1282 | } catch (Exception e) { |
||
1283 | 7562 | sbayarri | //puende que no este registrada como punto de extension
|
1284 | 6762 | jmvivo | Class clase = Class.forName(className); |
1285 | layer = (FLayer) clase.newInstance(); |
||
1286 | // FIXME: Hacemos algo aqui o dejamos que suba el error?
|
||
1287 | } |
||
1288 | } |
||
1289 | 7562 | sbayarri | |
1290 | } |
||
1291 | 6762 | jmvivo | layer.setXMLEntity(xml); |
1292 | if (name != null) layer.setName(name); |
||
1293 | try {
|
||
1294 | layer.load(); |
||
1295 | }catch (DriverIOException e) {
|
||
1296 | throw new XMLException(e); |
||
1297 | } |
||
1298 | |||
1299 | this.addLayer(layer);
|
||
1300 | logger.debug("layer: "+ layer.getName() +" loaded"); |
||
1301 | // Comprobar que la proyecci?n es la misma que la de FMap
|
||
1302 | // Si no lo es, es una capa que est? reproyectada al vuelo
|
||
1303 | IProjection proj = layer.getProjection(); |
||
1304 | if ((proj != null)) |
||
1305 | 6881 | cesar | if (proj != getMapContext().getProjection())
|
1306 | 6762 | jmvivo | { |
1307 | 6881 | cesar | ICoordTrans ct = proj.getCT(getMapContext().getProjection()); |
1308 | 6762 | jmvivo | // TODO: REVISAR CON LUIS
|
1309 | // Se lo fijamos a todas, luego cada una que se reproyecte
|
||
1310 | // si puede, o que no haga nada
|
||
1311 | layer.setCoordTrans(ct); |
||
1312 | // NOTA: DESPU?S DE ESTO DEBER?AMOS CREAR LAS ETIQUETAS
|
||
1313 | // SI ES NECESARIO.
|
||
1314 | // TODO: REVISAR A FONDO ESTO, PORQUE LAS ETIQUETAS SE CREAN
|
||
1315 | // 2 VECES SI HAY REPROYECC?N
|
||
1316 | if (layer instanceof FLyrVect) |
||
1317 | { |
||
1318 | FLyrVect lyrVect = (FLyrVect)layer; |
||
1319 | VectorialLegend legend = (VectorialLegend) lyrVect.getLegend(); |
||
1320 | if (legend.getLabelField() != null) { |
||
1321 | lyrVect.createLabelLayer(lyrVect.getRecordset()); |
||
1322 | } |
||
1323 | |||
1324 | } |
||
1325 | } |
||
1326 | }catch (Exception e) { |
||
1327 | fmap.addLayerError(xml.getStringProperty("name"));
|
||
1328 | //loadLayerException.addException(e);
|
||
1329 | /*if (layer!=null){
|
||
1330 | layer.setActive(false);
|
||
1331 | layer.setVisible(false);
|
||
1332 | this.addLayer(layer);
|
||
1333 | }*/
|
||
1334 | //throw new XMLException(e);
|
||
1335 | System.err.println("No se ha podido cargar la capa : "+xml.getStringProperty("name")); |
||
1336 | logger.debug("No se ha podido cargar la capa : "+xml.getStringProperty("name") + ". Raz?n:"); |
||
1337 | // logger.debug(e.fillInStackTrace());
|
||
1338 | e.printStackTrace(); |
||
1339 | } |
||
1340 | } |
||
1341 | |||
1342 | 214 | fernando | } |