root / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / layers / FLayers.java @ 38605
History | View | Annotate | Download (46.6 KB)
1 | 21200 | vcaballero | /* 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 org.gvsig.fmap.mapcontext.layers; |
||
42 | |||
43 | import java.awt.Graphics2D; |
||
44 | import java.awt.Point; |
||
45 | import java.awt.image.BufferedImage; |
||
46 | import java.util.ArrayList; |
||
47 | import java.util.Collections; |
||
48 | import java.util.Iterator; |
||
49 | import java.util.List; |
||
50 | 25920 | jmvivo | import java.util.Set; |
51 | import java.util.TreeSet; |
||
52 | 21200 | vcaballero | |
53 | import org.cresques.cts.ICoordTrans; |
||
54 | 23183 | vcaballero | import org.cresques.cts.IProjection; |
55 | 33429 | cordinyana | import org.slf4j.Logger; |
56 | import org.slf4j.LoggerFactory; |
||
57 | |||
58 | 29272 | jldominguez | import org.gvsig.compat.print.PrintAttributes; |
59 | 25038 | jmvivo | import org.gvsig.fmap.dal.exception.DataException; |
60 | 24504 | jmvivo | import org.gvsig.fmap.dal.exception.ReadException; |
61 | 21426 | vcaballero | import org.gvsig.fmap.geom.primitive.Envelope; |
62 | 21200 | vcaballero | import org.gvsig.fmap.mapcontext.MapContext; |
63 | 34895 | fdiaz | import org.gvsig.fmap.mapcontext.MapContextRuntimeException; |
64 | 21200 | vcaballero | import org.gvsig.fmap.mapcontext.Messages; |
65 | import org.gvsig.fmap.mapcontext.ViewPort; |
||
66 | import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
||
67 | import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer; |
||
68 | import org.gvsig.fmap.mapcontext.layers.operations.InfoByPoint; |
||
69 | import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection; |
||
70 | 34895 | fdiaz | import org.gvsig.fmap.mapcontext.layers.operations.LayerNotFoundInCollectionException; |
71 | 22252 | jmvivo | import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitable; |
72 | 23183 | vcaballero | import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor; |
73 | 30011 | cordinyana | import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable; |
74 | 32880 | jjdelcerro | import org.gvsig.metadata.exceptions.MetadataException; |
75 | 30173 | jldominguez | import org.gvsig.tools.ToolsLocator; |
76 | 31284 | cordinyana | import org.gvsig.tools.dispose.Disposable; |
77 | 33429 | cordinyana | import org.gvsig.tools.dynobject.DynObjectSet; |
78 | 32880 | jjdelcerro | import org.gvsig.tools.dynobject.DynStruct; |
79 | 33429 | cordinyana | import org.gvsig.tools.dynobject.impl.MultiDynObjectSet; |
80 | 23303 | jmvivo | import org.gvsig.tools.exception.BaseException; |
81 | 32880 | jjdelcerro | import org.gvsig.tools.persistence.PersistenceManager; |
82 | 30173 | jldominguez | import org.gvsig.tools.persistence.PersistentState; |
83 | 32880 | jjdelcerro | import org.gvsig.tools.persistence.exception.PersistenceException; |
84 | 25058 | jmvivo | import org.gvsig.tools.task.Cancellable; |
85 | 23066 | jmvivo | import org.gvsig.tools.visitor.NotSupportedOperationException; |
86 | import org.gvsig.tools.visitor.Visitor; |
||
87 | 21200 | vcaballero | |
88 | |||
89 | /**
|
||
90 | * <p>Represents a generic collection of layers, that can be represented as a node in a tree of nodes of layers.</p>
|
||
91 | *
|
||
92 | * <p>Adapts the basic functionality implemented for a layer in the abstract class <code>FLyrDefault</code>, to
|
||
93 | * a collection of layers, implementing, as well, specific methods for this kind of object, defined in the
|
||
94 | * interfaces <code>VectorialData</code>, <code>LayerCollection</code>, and <code>InfoByPoint</code>.</p>
|
||
95 | *
|
||
96 | * @see FLyrDefault
|
||
97 | */
|
||
98 | 22252 | jmvivo | public class FLayers extends FLyrDefault implements LayerCollection, |
99 | 26225 | jmvivo | InfoByPoint { |
100 | 34895 | fdiaz | |
101 | |||
102 | 21200 | vcaballero | /**
|
103 | * List with all listeners registered for this kind of node.
|
||
104 | *
|
||
105 | * @see #addLayerCollectionListener(LayerCollectionListener)
|
||
106 | * @see #removeLayerCollectionListener(LayerCollectionListener)
|
||
107 | * @see #callLayerAdded(LayerCollectionEvent)
|
||
108 | * @see #callLayerAdding(LayerCollectionEvent)
|
||
109 | * @see #callLayerMoved(LayerPositionEvent)
|
||
110 | * @see #callLayerMoving(LayerPositionEvent)
|
||
111 | * @see #callLayerRemoved(LayerCollectionEvent)
|
||
112 | * @see #callLayerRemoving(LayerCollectionEvent)
|
||
113 | */
|
||
114 | 30173 | jldominguez | protected ArrayList layerCollectionListeners = null; |
115 | 21200 | vcaballero | |
116 | /**
|
||
117 | * A synchronized list with the layers.
|
||
118 | *
|
||
119 | * @see #setAllVisibles(boolean)
|
||
120 | * @see #addLayer(FLayer)
|
||
121 | * @see #addLayer(int, FLayer)
|
||
122 | * @see #moveTo(int, int)
|
||
123 | * @see #removeLayer(FLayer)
|
||
124 | * @see #removeLayer(int)
|
||
125 | * @see #removeLayer(String)
|
||
126 | * @see #replaceLayer(String, FLayer)
|
||
127 | * @see #getVisibles()
|
||
128 | * @see #getLayer(int)
|
||
129 | * @see #getLayer(String)
|
||
130 | * @see #getLayersCount()
|
||
131 | 21426 | vcaballero | * @see #getFullEnvelope()
|
132 | 21200 | vcaballero | */
|
133 | 30173 | jldominguez | protected List layers = null; |
134 | 21200 | vcaballero | |
135 | /**
|
||
136 | * The model of the layer.
|
||
137 | *
|
||
138 | * @see #getMapContext()
|
||
139 | */
|
||
140 | protected MapContext fmap;
|
||
141 | |||
142 | /**
|
||
143 | * Useful for debug the problems during the implementation.
|
||
144 | */
|
||
145 | 30173 | jldominguez | private static Logger logger = LoggerFactory.getLogger(FLayers.class); |
146 | 21200 | vcaballero | |
147 | 30173 | jldominguez | public FLayers() {
|
148 | super();
|
||
149 | layerCollectionListeners = new ArrayList(); |
||
150 | layers = Collections.synchronizedList(new ArrayList()); |
||
151 | |||
152 | logger = LoggerFactory.getLogger(FLayers.class); |
||
153 | } |
||
154 | 21200 | vcaballero | /*
|
155 | * (non-Javadoc)
|
||
156 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
|
||
157 | */
|
||
158 | public void addLayerCollectionListener(LayerCollectionListener listener) { |
||
159 | 22252 | jmvivo | if (!layerCollectionListeners.contains(listener)) {
|
160 | 21200 | vcaballero | layerCollectionListeners.add(listener); |
161 | 22252 | jmvivo | } |
162 | 21200 | vcaballero | } |
163 | |||
164 | /*
|
||
165 | * (non-Javadoc)
|
||
166 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllVisibles(boolean)
|
||
167 | */
|
||
168 | public void setAllVisibles(boolean visible) { |
||
169 | FLayer lyr; |
||
170 | |||
171 | for (int i = 0; i < layers.size(); i++) { |
||
172 | lyr = ((FLayer) layers.get(i)); |
||
173 | lyr.setVisible(visible); |
||
174 | |||
175 | if (lyr instanceof LayerCollection) { |
||
176 | ((LayerCollection) lyr).setAllVisibles(visible); |
||
177 | } |
||
178 | } |
||
179 | } |
||
180 | |||
181 | /*
|
||
182 | * (non-Javadoc)
|
||
183 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
|
||
184 | */
|
||
185 | public void removeLayerCollectionListener(LayerCollectionListener listener) { |
||
186 | layerCollectionListeners.remove(listener); |
||
187 | } |
||
188 | |||
189 | /**
|
||
190 | * Adds a layer on an specified position in this node.
|
||
191 | *
|
||
192 | * @param pos position in the inner list where the layer will be added
|
||
193 | * @param layer a layer
|
||
194 | */
|
||
195 | private void doAddLayer(int pos,FLayer layer) { |
||
196 | layers.add(pos,layer); |
||
197 | 34908 | fdiaz | ToolsLocator.getDisposableManager().bind(layer); |
198 | 21200 | vcaballero | layer.setParentLayer(this);
|
199 | 26319 | jmvivo | IProjection layerProj = layer.getProjection(); |
200 | if(layerProj != null && fmap != null) { |
||
201 | IProjection mapContextProj = fmap.getProjection(); |
||
202 | // TODO REVISAR ESTO !!!!
|
||
203 | // Esta condici?n puede que no fuese exacta para todos los casos
|
||
204 | if (!layerProj.getAbrev().equals(mapContextProj.getAbrev())) {
|
||
205 | ICoordTrans ct = layerProj.getCT(mapContextProj); |
||
206 | layer.setCoordTrans(ct); |
||
207 | } else {
|
||
208 | layer.setCoordTrans(null);
|
||
209 | } |
||
210 | 26225 | jmvivo | } |
211 | this.updateDrawVersion();
|
||
212 | 21200 | vcaballero | } |
213 | |||
214 | /*
|
||
215 | * (non-Javadoc)
|
||
216 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
|
||
217 | */
|
||
218 | public void addLayer(FLayer layer) { |
||
219 | addLayer(layers.size(),layer); |
||
220 | } |
||
221 | |||
222 | /**
|
||
223 | * Adds a layer in an specified position in this node.
|
||
224 | *
|
||
225 | * @param layer a layer
|
||
226 | */
|
||
227 | public void addLayer(int pos,FLayer layer) { |
||
228 | try {
|
||
229 | //Notificamos a la capa que va a ser a?adida
|
||
230 | 22252 | jmvivo | if (layer instanceof FLyrDefault) { |
231 | 21200 | vcaballero | ((FLyrDefault)layer).wakeUp(); |
232 | 22252 | jmvivo | } |
233 | 21200 | vcaballero | |
234 | if (layer instanceof FLayers){ |
||
235 | FLayers layers=(FLayers)layer; |
||
236 | fmap.addAsCollectionListener(layers); |
||
237 | } |
||
238 | callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer)); |
||
239 | |||
240 | doAddLayer(pos,layer); |
||
241 | |||
242 | callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer)); |
||
243 | } catch (CancelationException e) {
|
||
244 | 25543 | vcaballero | logger.warn(e.getMessage()); |
245 | 21200 | vcaballero | } catch (LoadLayerException e) {
|
246 | layer.setAvailable(false);
|
||
247 | layer.addError(e); |
||
248 | } |
||
249 | } |
||
250 | |||
251 | /*
|
||
252 | * (non-Javadoc)
|
||
253 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#moveTo(int, int)
|
||
254 | */
|
||
255 | public void moveTo(int from, int to) throws CancelationException { |
||
256 | int newfrom=layers.size()-from-1; |
||
257 | int newto=layers.size()-to-1; |
||
258 | 22252 | jmvivo | if ( newfrom < 0 || newfrom >=layers.size() || newto < 0 || newto >= layers.size()) { |
259 | return;
|
||
260 | } |
||
261 | 21200 | vcaballero | FLayer aux = (FLayer) layers.get(newfrom); |
262 | callLayerMoving(LayerPositionEvent.createLayerMovingEvent(aux, newfrom, newto)); |
||
263 | layers.remove(newfrom); |
||
264 | layers.add(newto, aux); |
||
265 | 26225 | jmvivo | this.updateDrawVersion();
|
266 | 21200 | vcaballero | callLayerMoved(LayerPositionEvent.createLayerMovedEvent(aux, newfrom, newto)); |
267 | } |
||
268 | |||
269 | /**
|
||
270 | * Removes an inner layer.
|
||
271 | *
|
||
272 | * @param lyr a layer
|
||
273 | */
|
||
274 | private void doRemoveLayer(FLayer lyr) { |
||
275 | layers.remove(lyr); |
||
276 | 31284 | cordinyana | lyr.dispose(); |
277 | 26225 | jmvivo | this.updateDrawVersion();
|
278 | 21200 | vcaballero | } |
279 | |||
280 | /*
|
||
281 | * (non-Javadoc)
|
||
282 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
|
||
283 | */
|
||
284 | public void removeLayer(FLayer lyr) throws CancelationException { |
||
285 | callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr)); |
||
286 | doRemoveLayer(lyr); |
||
287 | callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr)); |
||
288 | } |
||
289 | |||
290 | /*
|
||
291 | * (non-Javadoc)
|
||
292 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(int)
|
||
293 | */
|
||
294 | public void removeLayer(int idLayer) { |
||
295 | FLayer lyr = (FLayer) layers.get(idLayer); |
||
296 | callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr)); |
||
297 | 34908 | fdiaz | this.doRemoveLayer(lyr);
|
298 | // layers.remove(idLayer);
|
||
299 | // this.updateDrawVersion();
|
||
300 | 21200 | vcaballero | callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr)); |
301 | } |
||
302 | |||
303 | /*
|
||
304 | * (non-Javadoc)
|
||
305 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(java.lang.String)
|
||
306 | */
|
||
307 | public void removeLayer(String layerName) { |
||
308 | FLayer lyr; |
||
309 | |||
310 | for (int i = 0; i < layers.size(); i++) { |
||
311 | lyr = ((FLayer) layers.get(i)); |
||
312 | |||
313 | if (lyr.getName().compareToIgnoreCase(layerName) == 0) { |
||
314 | removeLayer(i); |
||
315 | |||
316 | break;
|
||
317 | } |
||
318 | } |
||
319 | } |
||
320 | |||
321 | /**
|
||
322 | * Replace a layer identified by its name, by another.
|
||
323 | *
|
||
324 | * @param layerName the name of the layer to be replaced
|
||
325 | * @param layer the new layer
|
||
326 | 36468 | jpiera | * @deprecated use {@link FLayers#replaceLayer(FLayer, FLayer)}
|
327 | 21200 | vcaballero | */
|
328 | public void replaceLayer(String layerName, FLayer layer) throws LoadLayerException |
||
329 | { |
||
330 | 36468 | jpiera | replaceLayer(getLayer(layerName), layer); |
331 | 21200 | vcaballero | } |
332 | 36468 | jpiera | |
333 | /**
|
||
334 | * Replace a layer by another layer. It search recursively by all the
|
||
335 | * ILayerCollection nodes
|
||
336 | *
|
||
337 | * @param layer
|
||
338 | * the layer to be replaced
|
||
339 | * @param newLayer
|
||
340 | * the new layer
|
||
341 | */
|
||
342 | public void replaceLayer(FLayer layer, FLayer newLayer) throws LoadLayerException |
||
343 | { |
||
344 | replaceLayer(this, layer, newLayer);
|
||
345 | } |
||
346 | |||
347 | /**
|
||
348 | * Replace a layer by other layer. It search recursively by all the
|
||
349 | * ILayerCollection nodes
|
||
350 | * @param parentLayer
|
||
351 | * the parent layer
|
||
352 | * @param layer
|
||
353 | * the layer to be replaced
|
||
354 | * @param newLayer
|
||
355 | * the new layer
|
||
356 | * @throws LoadLayerException
|
||
357 | */
|
||
358 | private void replaceLayer(FLayers parentLayer, FLayer layer, FLayer newLayer) throws LoadLayerException |
||
359 | { |
||
360 | FLayer lyr; |
||
361 | for (int i = 0; i < parentLayer.getLayersCount(); i++) { |
||
362 | lyr = ((FLayer) parentLayer.getLayer(i)); |
||
363 | if (lyr.equals(layer)) {
|
||
364 | parentLayer.removeLayer(i); |
||
365 | parentLayer.addLayer(i, newLayer); |
||
366 | break;
|
||
367 | } |
||
368 | if (lyr instanceof LayerCollection){ |
||
369 | replaceLayer((FLayers)lyr, layer, newLayer); |
||
370 | } |
||
371 | } |
||
372 | } |
||
373 | 21200 | vcaballero | |
374 | /*
|
||
375 | * (non-Javadoc)
|
||
376 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getVisibles()
|
||
377 | */
|
||
378 | public FLayer[] getVisibles() { |
||
379 | ArrayList array = new ArrayList(); |
||
380 | LayersIterator iter = new LayersIterator(this) { |
||
381 | public boolean evaluate(FLayer layer) { |
||
382 | return layer.isVisible();
|
||
383 | } |
||
384 | |||
385 | }; |
||
386 | |||
387 | while (iter.hasNext()) {
|
||
388 | array.add(iter.nextLayer()); |
||
389 | } |
||
390 | |||
391 | return (FLayer[]) array.toArray(new FLayer[0]); |
||
392 | } |
||
393 | |||
394 | /*
|
||
395 | * (non-Javadoc)
|
||
396 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(int)
|
||
397 | */
|
||
398 | public FLayer getLayer(int index) { |
||
399 | return (FLayer) layers.get(index);
|
||
400 | } |
||
401 | |||
402 | /*
|
||
403 | * (non-Javadoc)
|
||
404 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(java.lang.String)
|
||
405 | */
|
||
406 | public FLayer getLayer(String layerName) { |
||
407 | FLayer lyr; |
||
408 | FLayer lyr2; |
||
409 | ArrayList layerList;
|
||
410 | |||
411 | for (int i = 0; i < layers.size(); i++) { |
||
412 | lyr = ((FLayer) layers.get(i)); |
||
413 | |||
414 | if (lyr.getName().compareToIgnoreCase(layerName) == 0) { |
||
415 | return lyr;
|
||
416 | } |
||
417 | |||
418 | layerList = new ArrayList(); |
||
419 | splitLayerGroup(lyr,layerList); |
||
420 | for(int j = 0; j<layerList.size(); j++ ) |
||
421 | { |
||
422 | lyr2 = ((FLayer)layerList.get(j)); |
||
423 | if (lyr2.getName().compareToIgnoreCase(layerName) == 0) { |
||
424 | return lyr2;
|
||
425 | } |
||
426 | } |
||
427 | } |
||
428 | |||
429 | return null; |
||
430 | } |
||
431 | |||
432 | /**
|
||
433 | * <p> Splits up a layer group in order to get a layer by name when there are layer groups</p>
|
||
434 | *
|
||
435 | * <p>In <code>result</code> always will be at least one layer.</p>
|
||
436 | *
|
||
437 | * @param layer the layer we are looking for
|
||
438 | * @param result an array list that will have the results of the search
|
||
439 | */
|
||
440 | private void splitLayerGroup(FLayer layer, ArrayList result) |
||
441 | { |
||
442 | int i;
|
||
443 | FLayers layerGroup; |
||
444 | if (layer instanceof FLayers) |
||
445 | { |
||
446 | layerGroup = (FLayers)layer; |
||
447 | for (i=0; i < layerGroup.getLayersCount(); i++ ) |
||
448 | { |
||
449 | splitLayerGroup(layerGroup.getLayer(i),result); |
||
450 | } |
||
451 | } |
||
452 | else
|
||
453 | { |
||
454 | result.add(layer); |
||
455 | } |
||
456 | } |
||
457 | |||
458 | /*
|
||
459 | * (non-Javadoc)
|
||
460 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayersCount()
|
||
461 | */
|
||
462 | public int getLayersCount() { |
||
463 | return layers.size();
|
||
464 | } |
||
465 | |||
466 | /*
|
||
467 | * (non-Javadoc)
|
||
468 | * @see com.iver.cit.gvsig.fmap.layers.FLayer#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.utiles.swing.threads.Cancellable, double)
|
||
469 | */
|
||
470 | public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
||
471 | 26225 | jmvivo | Cancellable cancel, double scale) throws ReadException { |
472 | // FIXME Arreglar este error
|
||
473 | throw new RuntimeException("Esto no deberia de llamarse"); |
||
474 | 21200 | vcaballero | } |
475 | |||
476 | /*
|
||
477 | * (non-Javadoc)
|
||
478 | 26319 | jmvivo | *
|
479 | 26225 | jmvivo | * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
|
480 | * com.iver.cit.gvsig.fmap.ViewPort,
|
||
481 | * com.iver.utiles.swing.threads.Cancellable, double,
|
||
482 | 29272 | jldominguez | * javax.print.attribute.PrintAttributes)
|
483 | 21200 | vcaballero | */
|
484 | 26225 | jmvivo | public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
485 | 29272 | jldominguez | double scale, PrintAttributes properties)
|
486 | 21200 | vcaballero | throws ReadException {
|
487 | 26225 | jmvivo | throw new RuntimeException("No deberia pasar por aqui"); |
488 | 21200 | vcaballero | } |
489 | |||
490 | 26225 | jmvivo | public void print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
491 | 29272 | jldominguez | double scale, PrintAttributes properties)
|
492 | 26225 | jmvivo | throws ReadException {
|
493 | this.print_old(g, viewPort, cancel, scale, properties, null); |
||
494 | } |
||
495 | |||
496 | 21200 | vcaballero | /**
|
497 | * <p>Checks all layers (each one as a sub-node of this node <i>collection of layers</i>) of this collection and draws their requested properties. If a node is
|
||
498 | * a group of layers (<code>ComposedLayer</code>), executes it's drawn.</p>
|
||
499 | *
|
||
500 | * <p>All nodes which could group with the composed layer <code>group</code>, will be drawn together. And once the <code>
|
||
501 | * group</code> is drawn, will be set to <code>null</code> if hasn't a parent layer.</p>
|
||
502 | *
|
||
503 | * <p>The particular implementation depends on the kind of each layer and composed layer. And this process can be cancelled at any
|
||
504 | * time by the shared object <code>cancel</code>.</p>
|
||
505 | *
|
||
506 | * <p>According the print quality, labels will be printed in different resolution:
|
||
507 | * <ul>
|
||
508 | * <li><b>PrintQuality.DRAFT</b>: 72 dpi (dots per inch).</li>
|
||
509 | * <li><b>PrintQuality.NORMAL</b>: 300 dpi (dots per inch).</li>
|
||
510 | * <li><b>PrintQuality.HIGH</b>: 600 dpi (dots per inch).</li>
|
||
511 | * </ul>
|
||
512 | * </p>
|
||
513 | *
|
||
514 | * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
|
||
515 | * @param viewPort the information for drawing the layers
|
||
516 | * @param cancel shared object that determines if this layer can continue being drawn
|
||
517 | * @param scale the scale of the view. Must be between {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}.
|
||
518 | * @param properties properties that will be print
|
||
519 | * @param group a composed layer pending to paint; if this parameter is <code>null</code>, the composed layer
|
||
520 | *
|
||
521 | * @return <code>null</code> if the layers in <code>group</code> had been drawn or were <code>null</code>; otherwise, the <code>group</code>
|
||
522 | *
|
||
523 | 29272 | jldominguez | * @see FLayer#print(Graphics2D, ViewPort, Cancellable, double, PrintAttributes)
|
524 | 21200 | vcaballero | *
|
525 | * @throws ReadDriverException if fails the driver reading the data.
|
||
526 | */
|
||
527 | 29272 | jldominguez | public ComposedLayer print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties, ComposedLayer group) |
528 | 26225 | jmvivo | throws ReadException {
|
529 | double dpi = 72; |
||
530 | 21200 | vcaballero | |
531 | 29272 | jldominguez | int resolution = properties.getPrintQuality();
|
532 | if (resolution == PrintAttributes.PRINT_QUALITY_NORMAL) {
|
||
533 | 21200 | vcaballero | dpi = 300;
|
534 | 29272 | jldominguez | } else if (resolution == PrintAttributes.PRINT_QUALITY_HIGH){ |
535 | 21200 | vcaballero | dpi = 600;
|
536 | 29272 | jldominguez | } else if (resolution == PrintAttributes.PRINT_QUALITY_DRAFT){ |
537 | 21200 | vcaballero | dpi = 72;
|
538 | } |
||
539 | |||
540 | // TODO: A la hora de imprimir, isWithinScale falla, porque est?
|
||
541 | // calculando la escala en pantalla, no para el layout.
|
||
542 | // Revisar esto.
|
||
543 | |||
544 | // TODO: We have to check when we have to call the drawLabels method when exists a ComposedLayer group.
|
||
545 | for (int i=0; i < layers.size(); i++) { |
||
546 | FLayer lyr = (FLayer) layers.get(i); |
||
547 | 22252 | jmvivo | if (!lyr.isVisible() || !lyr.isWithinScale(scale)) {
|
548 | continue;
|
||
549 | } |
||
550 | 21200 | vcaballero | |
551 | try{
|
||
552 | |||
553 | ///// CHEMA ComposedLayer
|
||
554 | // Checks for draw group (ComposedLayer)
|
||
555 | if (group != null) { |
||
556 | if (lyr instanceof FLayers){ |
||
557 | 26225 | jmvivo | group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group); |
558 | 21200 | vcaballero | } else {
|
559 | // If layer can be added to the group, does it
|
||
560 | if (lyr instanceof ILabelable |
||
561 | && ((ILabelable) lyr).isLabeled() |
||
562 | && ((ILabelable) lyr).getLabelingStrategy() != null
|
||
563 | && ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) { |
||
564 | group.add(lyr); |
||
565 | } else {
|
||
566 | // draw the 'pending to draw' layer group
|
||
567 | group.print(g,viewPort,cancel,scale,properties); |
||
568 | |||
569 | // gets a new group instance
|
||
570 | if (lyr instanceof ILabelable |
||
571 | && ((ILabelable) lyr).isLabeled() |
||
572 | && ((ILabelable) lyr).getLabelingStrategy() != null
|
||
573 | && ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) { |
||
574 | group = lyr.newComposedLayer(); |
||
575 | } else {
|
||
576 | group = null;
|
||
577 | } |
||
578 | // if layer hasn't group, draws it inmediately
|
||
579 | if (group == null) { |
||
580 | if (lyr instanceof FLayers){ |
||
581 | 26225 | jmvivo | group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group); |
582 | 21200 | vcaballero | } else {
|
583 | lyr.print(g, viewPort, cancel,scale,properties); |
||
584 | if (lyr instanceof ILabelable |
||
585 | && ((ILabelable) lyr).isLabeled() |
||
586 | && ((ILabelable) lyr).getLabelingStrategy() != null
|
||
587 | && ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) { |
||
588 | ILabelable lLayer = (ILabelable) lyr; |
||
589 | lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
|
||
590 | } |
||
591 | } |
||
592 | } else {
|
||
593 | // add the layer to the group
|
||
594 | group.setMapContext(fmap); |
||
595 | group.add(lyr); |
||
596 | |||
597 | } |
||
598 | |||
599 | } |
||
600 | } |
||
601 | } else {
|
||
602 | // gets a new group instance
|
||
603 | group = lyr.newComposedLayer(); |
||
604 | // if layer hasn't group, draws it inmediately
|
||
605 | if (group == null) { |
||
606 | if (lyr instanceof FLayers){ |
||
607 | 26225 | jmvivo | group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group); |
608 | 21200 | vcaballero | } else {
|
609 | lyr.print(g, viewPort, cancel,scale,properties); |
||
610 | if (lyr instanceof ILabelable && ((ILabelable) lyr).isLabeled()) { |
||
611 | ILabelable lLayer = (ILabelable) lyr; |
||
612 | |||
613 | lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
|
||
614 | } |
||
615 | } |
||
616 | } else {
|
||
617 | // add the layer to the group
|
||
618 | group.setMapContext(fmap); |
||
619 | group.add(lyr); |
||
620 | |||
621 | } |
||
622 | } |
||
623 | ///// CHEMA ComposedLayer
|
||
624 | |||
625 | } catch (Exception e){ |
||
626 | String mesg = Messages.getString("error_printing_layer")+" "+ lyr.getName() + ": " + e.getMessage(); |
||
627 | fmap.addLayerError(mesg); |
||
628 | logger.error(mesg, e); |
||
629 | } |
||
630 | |||
631 | } |
||
632 | |||
633 | ///// CHEMA ComposedLayer
|
||
634 | if (group != null && this.getParentLayer() == null) { |
||
635 | //si tenemos un grupo pendiente de pintar, pintamos
|
||
636 | group.print(g, viewPort, cancel,scale,properties); |
||
637 | group = null;
|
||
638 | |||
639 | } |
||
640 | ///// CHEMA ComposedLayer
|
||
641 | |||
642 | 26225 | jmvivo | // if (getVirtualLayers() != null) {
|
643 | // getVirtualLayers().print( g, viewPort, cancel, scale, properties);
|
||
644 | // }
|
||
645 | 21200 | vcaballero | |
646 | ///// CHEMA ComposedLayer
|
||
647 | return group;
|
||
648 | ///// CHEMA ComposedLayer
|
||
649 | } |
||
650 | |||
651 | /*
|
||
652 | * (non-Javadoc)
|
||
653 | * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
|
||
654 | */
|
||
655 | 21426 | vcaballero | public Envelope getFullEnvelope() {
|
656 | Envelope rAux = null;
|
||
657 | 21200 | vcaballero | boolean first = true; |
658 | |||
659 | |||
660 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
661 | FLayer capa = (FLayer) iter.next(); |
||
662 | try{
|
||
663 | if (first) {
|
||
664 | 21426 | vcaballero | rAux = capa.getFullEnvelope(); |
665 | 21200 | vcaballero | first=false;
|
666 | } else {
|
||
667 | 21426 | vcaballero | rAux.add(capa.getFullEnvelope()); |
668 | 21200 | vcaballero | } |
669 | }catch (Exception e) { |
||
670 | e.printStackTrace();//TODO hay que revisar para determinar el comportamiento que espera el usuario.
|
||
671 | } |
||
672 | } |
||
673 | |||
674 | return rAux;
|
||
675 | } |
||
676 | |||
677 | /**
|
||
678 | * Notifies all listeners associated to this collection of layers,
|
||
679 | * that another layer is going to be added or replaced in the internal
|
||
680 | * list of layers.
|
||
681 | *
|
||
682 | * @param e a layer collection event with the new layer
|
||
683 | */
|
||
684 | protected void callLayerAdding(LayerCollectionEvent event) |
||
685 | throws CancelationException {
|
||
686 | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
||
687 | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
||
688 | ((LayerCollectionListener) iter.next()).layerAdding(event); |
||
689 | } |
||
690 | } |
||
691 | |||
692 | /**
|
||
693 | * Notifies all listeners associated to this collection of layers,
|
||
694 | * that a layer is going to be removed from the internal list of layers.
|
||
695 | *
|
||
696 | * @param event a layer collection event with the layer being removed
|
||
697 | *
|
||
698 | * @throws CancelationException any exception produced during the cancellation of the driver.
|
||
699 | */
|
||
700 | protected void callLayerRemoving(LayerCollectionEvent event) |
||
701 | throws CancelationException {
|
||
702 | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
||
703 | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
||
704 | ((LayerCollectionListener) iter.next()).layerRemoving(event); |
||
705 | } |
||
706 | } |
||
707 | |||
708 | /**
|
||
709 | * Notifies all listeners associated to this collection of layers,
|
||
710 | * that a layer is going to be moved in the internal list of layers.
|
||
711 | *
|
||
712 | * @param event a layer collection event with the layer being moved, and the initial and final positions
|
||
713 | *
|
||
714 | * @throws CancelationException any exception produced during the cancellation of the driver.
|
||
715 | */
|
||
716 | protected void callLayerMoving(LayerPositionEvent event) |
||
717 | throws CancelationException {
|
||
718 | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
||
719 | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
||
720 | ((LayerCollectionListener) iter.next()).layerMoving(event); |
||
721 | } |
||
722 | } |
||
723 | |||
724 | /**
|
||
725 | * Notifies all listeners associated to this collection of layers,
|
||
726 | * that another layer has been added or replaced in the internal
|
||
727 | * list of layers.
|
||
728 | *
|
||
729 | * @param e a layer collection event with the new layer
|
||
730 | */
|
||
731 | protected void callLayerAdded(LayerCollectionEvent event) { |
||
732 | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
||
733 | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
||
734 | ((LayerCollectionListener) iter.next()).layerAdded(event); |
||
735 | } |
||
736 | } |
||
737 | |||
738 | /**
|
||
739 | * Notifies all listeners associated to this collection of layers,
|
||
740 | * that another layer has been removed from the internal list of layers.
|
||
741 | *
|
||
742 | * @param e a layer collection event with the layer removed
|
||
743 | */
|
||
744 | protected void callLayerRemoved(LayerCollectionEvent event) { |
||
745 | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
||
746 | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
||
747 | ((LayerCollectionListener) iter.next()).layerRemoved(event); |
||
748 | } |
||
749 | } |
||
750 | |||
751 | /**
|
||
752 | * Notifies all listeners associated to this collection of layers,
|
||
753 | * that another layer has been moved in the internal list of layers.
|
||
754 | *
|
||
755 | * @param e a layer collection event with the layer moved, and the initial and final positions
|
||
756 | */
|
||
757 | protected void callLayerMoved(LayerPositionEvent event) { |
||
758 | ArrayList aux = (ArrayList) layerCollectionListeners.clone(); |
||
759 | for (Iterator iter = aux.iterator(); iter.hasNext();) { |
||
760 | ((LayerCollectionListener) iter.next()).layerMoved(event); |
||
761 | } |
||
762 | } |
||
763 | |||
764 | 30173 | jldominguez | public void saveToState(PersistentState state) throws PersistenceException { |
765 | |||
766 | super.saveToState(state);
|
||
767 | 31154 | jldominguez | |
768 | state.set("mapContext", fmap);
|
||
769 | state.set("layers", layers);
|
||
770 | 21200 | vcaballero | } |
771 | |||
772 | 30173 | jldominguez | public void loadFromState(PersistentState state) throws PersistenceException { |
773 | 23183 | vcaballero | |
774 | 30173 | jldominguez | super.loadFromState(state);
|
775 | |||
776 | 33281 | jjdelcerro | setMapContext((MapContext) state.get("mapContext"));
|
777 | 30173 | jldominguez | Iterator iter = state.getIterator("layers"); |
778 | 23303 | jmvivo | while (iter.hasNext()) {
|
779 | 33281 | jjdelcerro | FLayer item = (FLayer) iter.next(); |
780 | 30173 | jldominguez | layers.add(item); |
781 | 23183 | vcaballero | } |
782 | } |
||
783 | 30173 | jldominguez | |
784 | 21200 | vcaballero | /*
|
785 | * (non-Javadoc)
|
||
786 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMapContext()
|
||
787 | */
|
||
788 | public MapContext getMapContext() {
|
||
789 | return fmap;
|
||
790 | } |
||
791 | /*
|
||
792 | * (non-Javadoc)
|
||
793 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setCoordTrans(org.cresques.cts.ICoordTrans)
|
||
794 | */
|
||
795 | public void setCoordTrans(ICoordTrans ct) { |
||
796 | super.setCoordTrans(ct);
|
||
797 | |||
798 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
799 | FLayer layer = (FLayer) iter.next(); |
||
800 | layer.setCoordTrans(ct); |
||
801 | } |
||
802 | } |
||
803 | /*
|
||
804 | * (non-Javadoc)
|
||
805 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllActives(boolean)
|
||
806 | */
|
||
807 | public void setAllActives(boolean active) { |
||
808 | FLayer lyr; |
||
809 | |||
810 | for (int i = 0; i < layers.size(); i++) { |
||
811 | lyr = ((FLayer) layers.get(i)); |
||
812 | lyr.setActive(active); |
||
813 | |||
814 | if (lyr instanceof LayerCollection) { |
||
815 | ((LayerCollection) lyr).setAllActives(active); |
||
816 | } |
||
817 | } |
||
818 | } |
||
819 | |||
820 | /*
|
||
821 | * (non-Javadoc)
|
||
822 | * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getActives()
|
||
823 | */
|
||
824 | public FLayer[] getActives() { |
||
825 | ArrayList ret = new ArrayList(); |
||
826 | LayersIterator it = new LayersIterator(this) { |
||
827 | |||
828 | public boolean evaluate(FLayer layer) { |
||
829 | return layer.isActive();
|
||
830 | } |
||
831 | |||
832 | }; |
||
833 | |||
834 | while (it.hasNext())
|
||
835 | { |
||
836 | ret.add(it.next()); |
||
837 | } |
||
838 | return (FLayer[]) ret.toArray(new FLayer[0]); |
||
839 | } |
||
840 | |||
841 | /*
|
||
842 | * (non-Javadoc)
|
||
843 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMinScale()
|
||
844 | */
|
||
845 | public double getMinScale() { |
||
846 | return -1; // La visibilidad o no la controla cada capa |
||
847 | // dentro de una colecci?n
|
||
848 | } |
||
849 | /*
|
||
850 | * (non-Javadoc)
|
||
851 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMaxScale()
|
||
852 | */
|
||
853 | public double getMaxScale() { |
||
854 | return -1; |
||
855 | } |
||
856 | /*
|
||
857 | * (non-Javadoc)
|
||
858 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMinScale(double)
|
||
859 | */
|
||
860 | public void setMinScale(double minScale) |
||
861 | { |
||
862 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
863 | FLayer lyr = (FLayer) iter.next(); |
||
864 | lyr.setMinScale(minScale); |
||
865 | } |
||
866 | } |
||
867 | /*
|
||
868 | * (non-Javadoc)
|
||
869 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMaxScale(double)
|
||
870 | */
|
||
871 | public void setMaxScale(double maxScale) |
||
872 | { |
||
873 | for (Iterator iter = layers.iterator(); iter.hasNext();) { |
||
874 | FLayer lyr = (FLayer) iter.next(); |
||
875 | lyr.setMinScale(maxScale); |
||
876 | } |
||
877 | } |
||
878 | /*
|
||
879 | * (non-Javadoc)
|
||
880 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setActive(boolean)
|
||
881 | */
|
||
882 | public void setActive(boolean b){ |
||
883 | super.setActive(b);
|
||
884 | for (int i=0;i<layers.size();i++){ |
||
885 | ((FLayer)layers.get(i)).setActive(b); |
||
886 | } |
||
887 | } |
||
888 | /* (non-Javadoc)
|
||
889 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
|
||
890 | */
|
||
891 | public boolean addLayerListener(LayerListener o) { |
||
892 | 22252 | jmvivo | for (int i = 0; i < layers.size(); i++) { |
893 | 21200 | vcaballero | ((FLayer) layers.get(i)).addLayerListener(o); |
894 | 22252 | jmvivo | } |
895 | 21200 | vcaballero | return true; |
896 | } |
||
897 | 33429 | cordinyana | |
898 | public DynObjectSet getInfo(Point p, double tolerance, |
||
899 | 30187 | jcarrasco | Cancellable cancel) throws LoadLayerException, DataException {
|
900 | 35487 | fdiaz | return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance); |
901 | 33657 | cordinyana | } |
902 | |||
903 | public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel, |
||
904 | boolean fast) throws LoadLayerException, DataException { |
||
905 | 35487 | fdiaz | return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance); |
906 | } |
||
907 | |||
908 | public DynObjectSet getInfo(org.gvsig.fmap.geom.primitive.Point p,
|
||
909 | double tolerance) throws LoadLayerException, DataException { |
||
910 | 33657 | cordinyana | int i;
|
911 | FLayer layer; |
||
912 | 33429 | cordinyana | List res = new ArrayList(); |
913 | 33657 | cordinyana | for (i = 0; i < this.layers.size(); i++) { |
914 | layer = (FLayer) layers.get(i); |
||
915 | if (layer instanceof InfoByPoint) { |
||
916 | InfoByPoint queryable_layer = (InfoByPoint) layer; |
||
917 | 35487 | fdiaz | res.add(queryable_layer.getInfo(p, tolerance)); |
918 | 33657 | cordinyana | } |
919 | } |
||
920 | 33429 | cordinyana | DynObjectSet[] innerSets =
|
921 | (DynObjectSet[]) res.toArray(new DynObjectSet[res.size()]); |
||
922 | return new MultiDynObjectSet(innerSets); |
||
923 | 33657 | cordinyana | } |
924 | 35487 | fdiaz | |
925 | 21200 | vcaballero | /*
|
926 | * (non-Javadoc)
|
||
927 | * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getTocImageIcon()
|
||
928 | */
|
||
929 | 29570 | csanchez | public String getTocImageIcon() { |
930 | return "toc-layer-group"; |
||
931 | 21200 | vcaballero | } |
932 | |||
933 | /**
|
||
934 | * <p>Adds the layer with the information in an XML entity and the specified name, to this collection of layers. And
|
||
935 | * returns <code>true</code> if there hasn't been errors.</p>
|
||
936 | *
|
||
937 | * @see CopyOfFLayers#addLayerFromXML(XMLEntity, String)
|
||
938 | *
|
||
939 | * @param xml tree-node structure with information about layers
|
||
940 | * @param name name of the layer to add
|
||
941 | * @return <code>true</code> if there were no errors adding the layer, <code>false</code> otherwise
|
||
942 | *
|
||
943 | * @throws LoadLayerException if fails loading this layer.
|
||
944 | */
|
||
945 | 26225 | jmvivo | // public boolean addLayerFromXMLEntity(XMLEntity xml, String name) throws LoadLayerException {
|
946 | // fmap.clearErrors();
|
||
947 | // this.addLayerFromXML(xml,name);
|
||
948 | //
|
||
949 | // return (fmap.getLayersError().size() == 0);
|
||
950 | //
|
||
951 | // }
|
||
952 | 21200 | vcaballero | |
953 | 30173 | jldominguez | // /**
|
954 | // * <p>Adds the layer with the information in an XML entity and the specified name, to this collection of layers.</p>
|
||
955 | // *
|
||
956 | // * <p>This method really executes the addition, considering the kind of layer (<code>FLyrVect</code>,
|
||
957 | // * <code>FLyrAnnotation</code>, <code>FLyrRaster</code>, a collection of layers (<code>FLayers</code>),
|
||
958 | // * or another kind of layer (<code>FLayer</code>)), and the driver in the layer.</p>
|
||
959 | // *
|
||
960 | // * @param xml tree-node structure with information about layers
|
||
961 | // * @param name name of the layer to add
|
||
962 | // *
|
||
963 | // * @throws LoadLayerException if fails loading this layer.
|
||
964 | // */
|
||
965 | // private void addLayerFromXML(XMLEntity xml, String name) throws LoadLayerException {
|
||
966 | // FLayer layer = null;
|
||
967 | //
|
||
968 | // try {
|
||
969 | // if (name == null) {
|
||
970 | // name = xml.getName();
|
||
971 | // }
|
||
972 | //
|
||
973 | //
|
||
974 | // String className = xml.getStringProperty("className");
|
||
975 | // Class clase = Class.forName(className);
|
||
976 | // layer = (FLayer) clase.newInstance();
|
||
977 | // if (FLayers.class.isAssignableFrom(clase)) {
|
||
978 | // ((FLayers)layer).setMapContext(getMapContext());
|
||
979 | // ((FLayers)layer).setParentLayer(this);
|
||
980 | // // layer = new FLayers(getMapContext(),this);
|
||
981 | // layer.setXMLEntity(xml);
|
||
982 | // } else {
|
||
983 | // // Capas Nuevas (externas)
|
||
984 | // layer.setName(name);
|
||
985 | // layer.setXMLEntity(xml);
|
||
986 | // layer.load();
|
||
987 | // }
|
||
988 | //
|
||
989 | // // //TODO VCN FLyrAnnotation es un parche para no tener que duplicar todo el c?digo de aq? y de los diferentes m?todos de LayerFactory,
|
||
990 | // // //ya que los drivers de una FLyrAnnotation no sabemos cual es puede ser cualquier Driver Vectorial.
|
||
991 | // // if (className.equals(FLyrVect.class.getName())){// || className.equals(FLyrAnnotation.class.getName())) {
|
||
992 | // // String type = xml.getStringProperty("type");
|
||
993 | // // if ("vectorial".equals(type)){
|
||
994 | // // //String recordsetName = xml.getChild(i).getStringProperty("recordset-name");
|
||
995 | // // IProjection proj = null;
|
||
996 | // // if (xml.contains("proj")) {
|
||
997 | // // proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
|
||
998 | // // }
|
||
999 | // // else
|
||
1000 | // // {
|
||
1001 | // // proj = this.getMapContext().getViewPort().getProjection();
|
||
1002 | // // }
|
||
1003 | // // if (xml.contains("file")) {
|
||
1004 | // // Driver d;
|
||
1005 | // // try {
|
||
1006 | // // d = LayerFactory.getDM().getDriver(xml.getStringProperty("driverName"));
|
||
1007 | // // } catch (DriverLoadException e1) {
|
||
1008 | // // throw new DriverLayerException(name,e1);
|
||
1009 | // // }
|
||
1010 | // // layer = LayerFactory.createLayer(name, (VectorialFileDriver) d,
|
||
1011 | // // new File(xml.getStringProperty("file")),
|
||
1012 | // // proj);
|
||
1013 | // //
|
||
1014 | // //
|
||
1015 | // // }
|
||
1016 | // // if (xml.contains("db")) {
|
||
1017 | // //
|
||
1018 | // // String driverName = xml.getStringProperty("db");
|
||
1019 | // // IVectorialDatabaseDriver driver;
|
||
1020 | // // try {
|
||
1021 | // // driver = (IVectorialDatabaseDriver) LayerFactory.getDM().getDriver(driverName);
|
||
1022 | // // //Hay que separar la carga de los datos del XMLEntity del load.
|
||
1023 | // // driver.setXMLEntity(xml.getChild(2));
|
||
1024 | // //
|
||
1025 | // // boolean loadOk = false;
|
||
1026 | // // ((DefaultJDBCDriver)driver).load();
|
||
1027 | // // if (((DefaultJDBCDriver)driver).getConnection() != null) {
|
||
1028 | // // loadOk = true;
|
||
1029 | // // }
|
||
1030 | // // layer = LayerFactory.createDBLayer(driver, name, proj);
|
||
1031 | // // if (!loadOk) {
|
||
1032 | // // layer.setAvailable(false);
|
||
1033 | // // }
|
||
1034 | // //
|
||
1035 | // // } catch (DriverLoadException e) {
|
||
1036 | // // throw new DriverLayerException(name,e);
|
||
1037 | // // } catch (XMLException e) {
|
||
1038 | // // throw new DriverLayerException(name,e);
|
||
1039 | // // } catch (ReadException e) {
|
||
1040 | // // throw new DriverLayerException(name,e);
|
||
1041 | // // }
|
||
1042 | // //
|
||
1043 | // // }
|
||
1044 | // // // Clases con algun driver gen?rico creado por otro
|
||
1045 | // // // programador
|
||
1046 | // // if (xml.contains("other")) {
|
||
1047 | // //
|
||
1048 | // // String driverName = xml.getStringProperty("other");
|
||
1049 | // // VectorialDriver driver = null;
|
||
1050 | // // try {
|
||
1051 | // // driver = (VectorialDriver) LayerFactory.getDM().getDriver(driverName);
|
||
1052 | // // } catch (DriverLoadException e) {
|
||
1053 | // // // Si no existe ese driver, no pasa nada.
|
||
1054 | // // // Puede que el desarrollador no quiera que
|
||
1055 | // // // aparezca en el cuadro de di?logo y ha metido
|
||
1056 | // // // el jar con sus clases en nuestro directorio lib.
|
||
1057 | // // // Intentamos cargar esa clase "a pelo".
|
||
1058 | // // if (xml.getChild(2).contains("className"))
|
||
1059 | // // {
|
||
1060 | // // String className2 = xml.getChild(2).getStringProperty("className");
|
||
1061 | // // try {
|
||
1062 | // // driver = (VectorialDriver) Class.forName(className2).newInstance();
|
||
1063 | // // } catch (Exception e1) {
|
||
1064 | // // throw new DriverLayerException(name,e);
|
||
1065 | // // }
|
||
1066 | // // }
|
||
1067 | // // } catch (NullPointerException npe) {
|
||
1068 | // // // Si no existe ese driver, no pasa nada.
|
||
1069 | // // // Puede que el desarrollador no quiera que
|
||
1070 | // // // aparezca en el cuadro de di?logo y ha metido
|
||
1071 | // // // el jar con sus clases en nuestro directorio lib.
|
||
1072 | // // // Intentamos cargar esa clase "a pelo".
|
||
1073 | // // if (xml.getChild(2).contains("className"))
|
||
1074 | // // {
|
||
1075 | // // String className2 = xml.getChild(2).getStringProperty("className");
|
||
1076 | // // try {
|
||
1077 | // // driver = (VectorialDriver) Class.forName(className2).newInstance();
|
||
1078 | // // } catch (Exception e1) {
|
||
1079 | // // throw new DriverLayerException(name,e1);
|
||
1080 | // // }
|
||
1081 | // // }
|
||
1082 | // // }
|
||
1083 | // // if (driver instanceof IPersistence)
|
||
1084 | // // {
|
||
1085 | // // IPersistence persist = (IPersistence) driver;
|
||
1086 | // // persist.setXMLEntity(xml.getChild(2));
|
||
1087 | // // }
|
||
1088 | // // layer = LayerFactory.createLayer(name, driver, proj);
|
||
1089 | // // }
|
||
1090 | // //
|
||
1091 | // // }
|
||
1092 | // //
|
||
1093 | // // //TODO VCN FLyrAnnotation es un parche para no tener que duplicar todo el c?digo de aq? y de los diferentes m?todos de LayerFactory,
|
||
1094 | // // //ya que los drivers de una FLyrAnnotation no sabemos cual es puede ser cualquier Driver Vectorial.
|
||
1095 | // // if (className.equals(FLyrAnnotation.class.getName())){
|
||
1096 | // // layer=FLyrAnnotation.createLayerFromVect((FLyrVect)layer);
|
||
1097 | // // }
|
||
1098 | // //
|
||
1099 | // //
|
||
1100 | // // layer.setXMLEntity(xml);
|
||
1101 | // //
|
||
1102 | // // } else {
|
||
1103 | // // Class clase = LayerFactory.getLayerClassForLayerClassName(className);
|
||
1104 | // // layer = (FLayer) clase.newInstance();
|
||
1105 | // // if (clase.isAssignableFrom(FLayers.class)) {
|
||
1106 | // // ((FLayers)layer).setMapContext(getMapContext());
|
||
1107 | // // ((FLayers)layer).setParentLayer(this);
|
||
1108 | // //// layer = new FLayers(getMapContext(),this);
|
||
1109 | // // layer.setXMLEntity(xml);
|
||
1110 | // // } else {
|
||
1111 | // // // Capas Nuevas (externas)
|
||
1112 | // // layer.setName(name);
|
||
1113 | // // layer.setXMLEntity(xml);
|
||
1114 | // // layer.load();
|
||
1115 | // // }
|
||
1116 | // // }
|
||
1117 | // this.addLayer(layer);
|
||
1118 | // logger.debug("layer: "+ layer.getName() +" loaded");
|
||
1119 | // // Comprobar que la proyecci?n es la misma que la de FMap
|
||
1120 | // // Si no lo es, es una capa que est? reproyectada al vuelo
|
||
1121 | // IProjection proj = layer.getProjection();
|
||
1122 | // if ((proj != null)) {
|
||
1123 | // if (!proj.getFullCode().equals(getMapContext().getProjection().getFullCode()))
|
||
1124 | // {
|
||
1125 | // ICoordTrans ct = proj.getCT(getMapContext().getProjection());
|
||
1126 | // // TODO: REVISAR CON LUIS
|
||
1127 | // // Se lo fijamos a todas, luego cada una que se reproyecte
|
||
1128 | // // si puede, o que no haga nada
|
||
1129 | //
|
||
1130 | // layer.setCoordTrans(ct);
|
||
1131 | // }
|
||
1132 | // }
|
||
1133 | // } catch (XMLException e) {
|
||
1134 | // fmap.addLayerError(xml.getStringProperty("name"));
|
||
1135 | // throw new LoadLayerException(name,e);
|
||
1136 | // } catch (ClassNotFoundException e) {
|
||
1137 | // fmap.addLayerError(xml.getStringProperty("name"));
|
||
1138 | // throw new LoadLayerException(name,e);
|
||
1139 | // } catch (InstantiationException e) {
|
||
1140 | // fmap.addLayerError(xml.getStringProperty("name"));
|
||
1141 | // throw new LoadLayerException(name,e);
|
||
1142 | // } catch (IllegalAccessException e) {
|
||
1143 | // fmap.addLayerError(xml.getStringProperty("name"));
|
||
1144 | // throw new LoadLayerException(name,e);
|
||
1145 | // } catch (LoadLayerException e){
|
||
1146 | // fmap.addLayerError(xml.getStringProperty("name"));
|
||
1147 | // throw e;
|
||
1148 | // }
|
||
1149 | // }
|
||
1150 | 23183 | vcaballero | |
1151 | 21200 | vcaballero | /**
|
1152 | * <p>Sets the <code>MapContext</code> that contains this layer node.</p>
|
||
1153 | *
|
||
1154 | * @param mapContext the <code>MapContext</code> that contains this layer node
|
||
1155 | */
|
||
1156 | public void setMapContext(MapContext mapContext) { |
||
1157 | this.fmap = mapContext;
|
||
1158 | } |
||
1159 | |||
1160 | 30173 | jldominguez | // /**
|
1161 | // * <p>Creates a new layer of the same class as the property <i>className</i> of the XML, after, adds the XML entity to that layer
|
||
1162 | // * and loads the layer. Then, adds the layer to this collection of layers, and if there is a projection defined,
|
||
1163 | // * inserts the transformation coordinates to the layer.</p>
|
||
1164 | // *
|
||
1165 | // * <p>If the new layer is an instance of <code>FLyrVect</code>, and has a label field, creates a label layer on the layer.</p>
|
||
1166 | // *
|
||
1167 | // * @param xml tree-node structure with information about layers
|
||
1168 | // * @param name name of the layer to add
|
||
1169 | // */
|
||
1170 | // private void addLayerFromXMLNew(XMLEntity xml, String name) {
|
||
1171 | // // FLayer layer = null;
|
||
1172 | // //
|
||
1173 | // //
|
||
1174 | // // try {
|
||
1175 | // // String className = xml.getStringProperty("className");
|
||
1176 | // // Class clazz = Class.forName(className);
|
||
1177 | // // if (clazz.isAssignableFrom(FLayers.class)) {
|
||
1178 | // // layer = (FLayer) clazz.newInstance();
|
||
1179 | // // ((FLayers)layer).setMapContext(getMapContext());
|
||
1180 | // // ((FLayers)layer).setParentLayer(this);
|
||
1181 | // // // if (className.equals((FLayers.class.getName()))){
|
||
1182 | // // // layer = new FLayers(getMapContext(),this);
|
||
1183 | // // } else {
|
||
1184 | // // // Por compatibilidad
|
||
1185 | // // if (className.equals(FLyrVect.class.getName())) {
|
||
1186 | // // if (xml.contains("file")) {
|
||
1187 | // // layer = new FLayerFileVectorial();
|
||
1188 | // // } else if (xml.contains("db")) {
|
||
1189 | // // try {
|
||
1190 | // // layer = (FLayer)((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create("com.iver.cit.gvsig.fmap.layers.FLayerJDBCVectorial");
|
||
1191 | // // } catch (Exception e) {
|
||
1192 | // // throw new XMLException(new Exception("No se tiene registrada la capa de tipo JDBC"));
|
||
1193 | // // }
|
||
1194 | // // //className = FLayerJDBCVectorial.class.getName();
|
||
1195 | // // } else if (xml.contains("other")){
|
||
1196 | // // layer = new FLayerGenericVectorial();
|
||
1197 | // // } else {
|
||
1198 | // // throw new XMLException(new Exception("Capa vectorial de tipo no reconocido"));
|
||
1199 | // // }
|
||
1200 | // // // Fin por compatibilidad
|
||
1201 | // // } else {
|
||
1202 | // // try {
|
||
1203 | // // layer = (FLayer)(((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create(className));
|
||
1204 | // // } catch (Exception e) {
|
||
1205 | // // //puende que no este registrada como punto de extension
|
||
1206 | // // Class clase = Class.forName(className);
|
||
1207 | // // layer = (FLayer) clase.newInstance();
|
||
1208 | // // // FIXME: Hacemos algo aqui o dejamos que suba el error?
|
||
1209 | // // }
|
||
1210 | // // }
|
||
1211 | // //
|
||
1212 | // // }
|
||
1213 | // // layer.setXMLEntity(xml);
|
||
1214 | // // if (name != null) layer.setName(name);
|
||
1215 | // // layer.load();
|
||
1216 | // //
|
||
1217 | // // this.addLayer(layer);
|
||
1218 | // // logger.debug("layer: "+ layer.getName() +" loaded");
|
||
1219 | // // // Comprobar que la proyecci?n es la misma que la de FMap
|
||
1220 | // // // Si no lo es, es una capa que est? reproyectada al vuelo
|
||
1221 | // // IProjection proj = layer.getProjection();
|
||
1222 | // // if ((proj != null))
|
||
1223 | // // if (proj != getMapContext().getProjection())
|
||
1224 | // // {
|
||
1225 | // // ICoordTrans ct = proj.getCT(getMapContext().getProjection());
|
||
1226 | // // // TODO: REVISAR CON LUIS
|
||
1227 | // // // Se lo fijamos a todas, luego cada una que se reproyecte
|
||
1228 | // // // si puede, o que no haga nada
|
||
1229 | // // layer.setCoordTrans(ct);
|
||
1230 | // //
|
||
1231 | // // }
|
||
1232 | // // }catch (Exception e) {
|
||
1233 | // // fmap.addLayerError(xml.getStringProperty("name"));
|
||
1234 | // // logger.debug(Messages.getString("could_not_load_layer")+": "+xml.getStringProperty("name") + ".\n"
|
||
1235 | // // +Messages.getString("reason")+":", e);
|
||
1236 | // // }
|
||
1237 | // }
|
||
1238 | 22252 | jmvivo | |
1239 | public void accept(Visitor visitor) throws BaseException { |
||
1240 | throw new NotSupportedOperationException(visitor, this); |
||
1241 | } |
||
1242 | |||
1243 | public void accept(LayersVisitor visitor) throws BaseException { |
||
1244 | for (int i = 0; i < this.getLayersCount(); i++) { |
||
1245 | FLayer layer = this.getLayer(i);
|
||
1246 | if (layer instanceof LayersVisitable) { |
||
1247 | ((LayersVisitable) layer).accept(visitor); |
||
1248 | } else {
|
||
1249 | visitor.visit(layer); |
||
1250 | } |
||
1251 | } |
||
1252 | } |
||
1253 | |||
1254 | 25920 | jmvivo | /*
|
1255 | * (non-Javadoc)
|
||
1256 | 26319 | jmvivo | *
|
1257 | 25920 | jmvivo | * @see org.gvsig.metadata.Metadata#getMetadataID()
|
1258 | */
|
||
1259 | 32880 | jjdelcerro | public Object getMetadataID() throws MetadataException { |
1260 | 29276 | jldominguez | StringBuffer strb = new StringBuffer(); |
1261 | 25920 | jmvivo | strb.append("Layers(");
|
1262 | strb.append(this.getName());
|
||
1263 | strb.append("):{");
|
||
1264 | Iterator iter = this.layers.iterator(); |
||
1265 | while (iter.hasNext()) {
|
||
1266 | strb.append(((FLayer) iter.next()).getMetadataID()); |
||
1267 | strb.append(",");
|
||
1268 | } |
||
1269 | strb.append("}");
|
||
1270 | return strb.toString();
|
||
1271 | |||
1272 | 25795 | jmvivo | } |
1273 | 22252 | jmvivo | |
1274 | 25920 | jmvivo | /*
|
1275 | * (non-Javadoc)
|
||
1276 | 26319 | jmvivo | *
|
1277 | 25920 | jmvivo | * @see org.gvsig.metadata.Metadata#getMetadataChildren()
|
1278 | */
|
||
1279 | public Set getMetadataChildren() { |
||
1280 | Set ret = new TreeSet(); |
||
1281 | Iterator iter = this.layers.iterator(); |
||
1282 | while (iter.hasNext()) {
|
||
1283 | ret.add(iter.next()); |
||
1284 | } |
||
1285 | return ret;
|
||
1286 | } |
||
1287 | 25795 | jmvivo | |
1288 | 25920 | jmvivo | /*
|
1289 | * (non-Javadoc)
|
||
1290 | 26319 | jmvivo | *
|
1291 | 25920 | jmvivo | * @see org.gvsig.metadata.Metadata#getMetadataName()
|
1292 | */
|
||
1293 | 32880 | jjdelcerro | public String getMetadataName() throws MetadataException { |
1294 | 29276 | jldominguez | StringBuffer strb = new StringBuffer(); |
1295 | 25920 | jmvivo | strb.append("Layer Group '");
|
1296 | strb.append(this.getName());
|
||
1297 | strb.append("': {");
|
||
1298 | Iterator iter = this.layers.iterator(); |
||
1299 | while (iter.hasNext()) {
|
||
1300 | strb.append(((FLayer) iter.next()).getMetadataName()); |
||
1301 | strb.append(",");
|
||
1302 | } |
||
1303 | strb.append("}");
|
||
1304 | return strb.toString();
|
||
1305 | } |
||
1306 | |||
1307 | |||
1308 | 26225 | jmvivo | public void beginDraw(Graphics2D g, ViewPort viewPort) { |
1309 | LayerDrawEvent beforeEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_BEFORE_DRAW); |
||
1310 | fmap.fireLayerDrawingEvent(beforeEvent); |
||
1311 | } |
||
1312 | |||
1313 | public void endDraw(Graphics2D g, ViewPort viewPort) { |
||
1314 | LayerDrawEvent afterEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW); |
||
1315 | fmap.fireLayerDrawingEvent(afterEvent); |
||
1316 | } |
||
1317 | |||
1318 | 30173 | jldominguez | public static void registerPersistent() { |
1319 | |||
1320 | 32880 | jjdelcerro | PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
1321 | if( manager.getDefinition(FLyrDefault.class) == null ) { |
||
1322 | FLyrDefault.registerPersistent(); |
||
1323 | } |
||
1324 | DynStruct definition = manager.addDefinition( |
||
1325 | FLayers.class, |
||
1326 | "FLayers",
|
||
1327 | "FLayers Persistence definition",
|
||
1328 | null,
|
||
1329 | null
|
||
1330 | ); |
||
1331 | definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, "FLyrDefault");
|
||
1332 | 30173 | jldominguez | |
1333 | 33281 | jjdelcerro | definition.addDynFieldObject("mapContext").setClassOfValue(MapContext.class).setMandatory(true); |
1334 | definition.addDynFieldList("layers").setClassOfItems(FLayer.class).setMandatory(true); |
||
1335 | 30173 | jldominguez | } |
1336 | |||
1337 | 31284 | cordinyana | protected void doDispose() throws BaseException { |
1338 | if (layers != null) { |
||
1339 | for (int i = 0; i < layers.size(); i++) { |
||
1340 | dispose((Disposable) layers.get(i)); |
||
1341 | } |
||
1342 | } |
||
1343 | } |
||
1344 | 34895 | fdiaz | |
1345 | public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException{ |
||
1346 | 33657 | cordinyana | |
1347 | 34895 | fdiaz | callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(layer)); |
1348 | group.addLayer(layer, where, adjoiningLayer); |
||
1349 | 34908 | fdiaz | removeLayer(layer); |
1350 | 34895 | fdiaz | this.updateDrawVersion();
|
1351 | callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(layer)); |
||
1352 | |||
1353 | } |
||
1354 | |||
1355 | public void move(FLayer layer, LayerCollection group){ |
||
1356 | try {
|
||
1357 | move(layer, group, END, null);
|
||
1358 | } catch (LayerNotFoundInCollectionException e){
|
||
1359 | throw new MapContextRuntimeException(e); |
||
1360 | } |
||
1361 | } |
||
1362 | |||
1363 | public void addLayer(FLayer layer, int where, FLayer adjoiningLayer) |
||
1364 | throws LayerNotFoundInCollectionException {
|
||
1365 | |||
1366 | switch (where) {
|
||
1367 | case BEGIN:
|
||
1368 | addLayer(0,layer);
|
||
1369 | break;
|
||
1370 | case BEFORE:
|
||
1371 | if (adjoiningLayer!=null){ |
||
1372 | if (this.layers.contains(adjoiningLayer)){ |
||
1373 | for(int i=0; i<this.getLayersCount(); i++){ |
||
1374 | if(adjoiningLayer==this.getLayer(i)){ |
||
1375 | addLayer(i, layer); |
||
1376 | break;
|
||
1377 | } |
||
1378 | } |
||
1379 | } else {
|
||
1380 | throw new LayerNotFoundInCollectionException(adjoiningLayer, this); |
||
1381 | } |
||
1382 | } else {
|
||
1383 | addLayer(0,layer);
|
||
1384 | } |
||
1385 | break;
|
||
1386 | case AFTER:
|
||
1387 | if (adjoiningLayer!=null){ |
||
1388 | if (this.layers.contains(adjoiningLayer)){ |
||
1389 | for(int i=0; i<this.getLayersCount(); i++){ |
||
1390 | if(adjoiningLayer==this.getLayer(i)){ |
||
1391 | addLayer(i+1, layer);
|
||
1392 | break;
|
||
1393 | } |
||
1394 | } |
||
1395 | } else {
|
||
1396 | throw new LayerNotFoundInCollectionException(adjoiningLayer, this); |
||
1397 | } |
||
1398 | } else {
|
||
1399 | this.addLayer(layer);
|
||
1400 | } |
||
1401 | break;
|
||
1402 | default: // By default add layer an the end of the collection |
||
1403 | this.addLayer(layer);
|
||
1404 | break;
|
||
1405 | } |
||
1406 | |||
1407 | } |
||
1408 | |||
1409 | 21200 | vcaballero | } |