Index: trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLayers.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLayers.java	(revision 42286)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLayers.java	(revision 42287)
@@ -3,23 +3,22 @@
  *
  * Copyright (C) 2007-2013 gvSIG Association.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later
+ * version.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * For any additional information, do not hesitate to contact us
- * at info AT gvsig.com, or visit our website www.gvsig.com.
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
  */
 package org.gvsig.fmap.mapcontext.layers;
 
@@ -70,856 +69,867 @@
 import org.gvsig.tools.visitor.VisitCanceledException;
 import org.gvsig.tools.visitor.Visitor;
 
-
 /**
- * <p>Represents a generic collection of layers, that can be represented as a node in a tree of nodes of layers.</p>
+ * <p>
+ * Represents a generic collection of layers, that can be represented as a node
+ * in a tree of nodes of layers.</p>
  *
- * <p>Adapts the basic functionality implemented for a layer in the abstract class <code>FLyrDefault</code>, to
- *  a collection of layers, implementing, as well, specific methods for this kind of object, defined in the
- *  interfaces <code>VectorialData</code>, <code>LayerCollection</code>, and <code>InfoByPoint</code>.</p>
+ * <p>
+ * Adapts the basic functionality implemented for a layer in the abstract class
+ * <code>FLyrDefault</code>, to a collection of layers, implementing, as well,
+ * specific methods for this kind of object, defined in the interfaces
+ * <code>VectorialData</code>, <code>LayerCollection</code>, and
+ * <code>InfoByPoint</code>.</p>
  *
  * @see FLyrDefault
  */
 public class FLayers extends FLyrDefault implements LayerCollection,
-InfoByPoint {
+        InfoByPoint {
 
-	
-	/**
-	 * List with all listeners registered for this kind of node.
-	 *
-	 * @see #addLayerCollectionListener(LayerCollectionListener)
-	 * @see #removeLayerCollectionListener(LayerCollectionListener)
-	 * @see #callLayerAdded(LayerCollectionEvent)
-	 * @see #callLayerAdding(LayerCollectionEvent)
-	 * @see #callLayerMoved(LayerPositionEvent)
-	 * @see #callLayerMoving(LayerPositionEvent)
-	 * @see #callLayerRemoved(LayerCollectionEvent)
-	 * @see #callLayerRemoving(LayerCollectionEvent)
-	 */
-	protected ArrayList layerCollectionListeners = null;
+    /**
+     * List with all listeners registered for this kind of node.
+     *
+     * @see #addLayerCollectionListener(LayerCollectionListener)
+     * @see #removeLayerCollectionListener(LayerCollectionListener)
+     * @see #callLayerAdded(LayerCollectionEvent)
+     * @see #callLayerAdding(LayerCollectionEvent)
+     * @see #callLayerMoved(LayerPositionEvent)
+     * @see #callLayerMoving(LayerPositionEvent)
+     * @see #callLayerRemoved(LayerCollectionEvent)
+     * @see #callLayerRemoving(LayerCollectionEvent)
+     */
+    protected ArrayList layerCollectionListeners = null;
 
-	/**
-	 * A synchronized list with the layers.
-	 *
-	 * @see #setAllVisibles(boolean)
-	 * @see #addLayer(FLayer)
-	 * @see #addLayer(int, FLayer)
-	 * @see #moveTo(int, int)
-	 * @see #removeLayer(FLayer)
-	 * @see #removeLayer(int)
-	 * @see #removeLayer(String)
-	 * @see #replaceLayer(String, FLayer)
-	 * @see #getVisibles()
-	 * @see #getLayer(int)
-	 * @see #getLayer(String)
-	 * @see #getLayersCount()
-	 * @see #getFullEnvelope()
-	 */
-	protected List layers = null;
+    /**
+     * A synchronized list with the layers.
+     *
+     * @see #setAllVisibles(boolean)
+     * @see #addLayer(FLayer)
+     * @see #addLayer(int, FLayer)
+     * @see #moveTo(int, int)
+     * @see #removeLayer(FLayer)
+     * @see #removeLayer(int)
+     * @see #removeLayer(String)
+     * @see #replaceLayer(String, FLayer)
+     * @see #getVisibles()
+     * @see #getLayer(int)
+     * @see #getLayer(String)
+     * @see #getLayersCount()
+     * @see #getFullEnvelope()
+     */
+    protected List layers = null;
 
-	/**
-	 * The model of the layer.
-	 *
-	 * @see #getMapContext()
-	 */
-	protected MapContext fmap;
+    /**
+     * The model of the layer.
+     *
+     * @see #getMapContext()
+     */
+    protected MapContext fmap;
 
-	/**
-	 * Useful for debug the problems during the implementation.
-	 */
-	private static Logger logger = LoggerFactory.getLogger(FLayers.class);
+    /**
+     * Useful for debug the problems during the implementation.
+     */
+    private static Logger logger = LoggerFactory.getLogger(FLayers.class);
 
-	public FLayers() {
-		super();
-		layerCollectionListeners = new ArrayList();
-		layers = Collections.synchronizedList(new ArrayList());
-		
-		logger = LoggerFactory.getLogger(FLayers.class);
-	}
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
-	 */
-	public void addLayerCollectionListener(LayerCollectionListener listener) {
-		if (!layerCollectionListeners.contains(listener)) {
-			layerCollectionListeners.add(listener);
-		}
-	}
+    public FLayers() {
+        super();
+        layerCollectionListeners = new ArrayList();
+        layers = Collections.synchronizedList(new ArrayList());
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllVisibles(boolean)
-	 */
-	public void setAllVisibles(boolean visible) {
-		FLayer lyr;
+        logger = LoggerFactory.getLogger(FLayers.class);
+    }
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
+     */
 
-		for (int i = 0; i < layers.size(); i++) {
-			lyr = ((FLayer) layers.get(i));
-			lyr.setVisible(visible);
+    public void addLayerCollectionListener(LayerCollectionListener listener) {
+        if (!layerCollectionListeners.contains(listener)) {
+            layerCollectionListeners.add(listener);
+        }
+    }
 
-			if (lyr instanceof LayerCollection) {
-				((LayerCollection) lyr).setAllVisibles(visible);
-			}
-		}
-	}
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllVisibles(boolean)
+     */
+    public void setAllVisibles(boolean visible) {
+        FLayer lyr;
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
-	 */
-	public void removeLayerCollectionListener(LayerCollectionListener listener) {
-		layerCollectionListeners.remove(listener);
-	}
+        for (int i = 0; i < layers.size(); i++) {
+            lyr = ((FLayer) layers.get(i));
+            lyr.setVisible(visible);
 
-	/**
-	 * Adds a layer on an specified position in this node.
-	 *
-	 * @param pos position in the inner list where the layer will be added
-	 * @param layer a layer
-	 */
-	private void doAddLayer(int pos,FLayer layer) {
-		layers.add(pos,layer);
-		ToolsLocator.getDisposableManager().bind(layer);
-		layer.setParentLayer(this);
-		IProjection layerProj = layer.getProjection();
-		if(layerProj != null && fmap != null) {
-			IProjection mapContextProj = fmap.getProjection();
+            if (lyr instanceof LayerCollection) {
+                ((LayerCollection) lyr).setAllVisibles(visible);
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayerCollectionListener(com.iver.cit.gvsig.fmap.layers.LayerCollectionListener)
+     */
+    public void removeLayerCollectionListener(LayerCollectionListener listener) {
+        layerCollectionListeners.remove(listener);
+    }
+
+    /**
+     * Adds a layer on an specified position in this node.
+     *
+     * @param pos position in the inner list where the layer will be added
+     * @param layer a layer
+     */
+    private void doAddLayer(int pos, FLayer layer) {
+        layers.add(pos, layer);
+        ToolsLocator.getDisposableManager().bind(layer);
+        layer.setParentLayer(this);
+        IProjection layerProj = layer.getProjection();
+        if (layerProj != null && fmap != null) {
+            IProjection mapContextProj = fmap.getProjection();
 			// TODO REVISAR ESTO !!!!
-			// Esta condición puede que no fuese exacta para todos los casos
-			if (!layerProj.getAbrev().equals(mapContextProj.getAbrev())) {
-				ICoordTrans ct = layerProj.getCT(mapContextProj);
-				layer.setCoordTrans(ct);
-			} else {
-				layer.setCoordTrans(null);
-			}
-		}
-		this.updateDrawVersion();
-	}
+            // Esta condición puede que no fuese exacta para todos los casos
+            if (!layerProj.getAbrev().equals(mapContextProj.getAbrev())) {
+                ICoordTrans ct = layerProj.getCT(mapContextProj);
+                layer.setCoordTrans(ct);
+            } else {
+                layer.setCoordTrans(null);
+            }
+        }
+        this.updateDrawVersion();
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
-	 */
-	public void addLayer(FLayer layer) {
-		
-		MapContext mco = this.getMapContext();
-		
-		if (mco != null) {
-			/*
-			 * Get order manager from map context
-			 */
-			int position = mco.getOrderManager().getPosition(this, layer);
-			addLayer(position, layer);
-		} else {
-			/*
-			 * This happens when FLayers object is not in a
-			 * map context, so no order manager is available.
-			 */
-			addLayer(layers.size(),layer);
-		}
-	}
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
+     */
+    public void addLayer(FLayer layer) {
 
-	/**
-	 * Adds a layer in an specified position in this node.
-	 *
-	 * @param layer a layer
-	 */
-	public void addLayer(int pos,FLayer layer) {
-		try {
-			//Notificamos a la capa que va a ser añadida
-			if (layer instanceof FLyrDefault) {
-				((FLyrDefault)layer).wakeUp();
-			}
+        MapContext mco = this.getMapContext();
 
-			if (layer instanceof FLayers){
-				FLayers layers=(FLayers)layer;
-				fmap.addAsCollectionListener(layers);
-			}
-			callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer));
+        if (mco != null) {
+            /*
+             * Get order manager from map context
+             */
+            int position = mco.getOrderManager().getPosition(this, layer);
+            addLayer(position, layer);
+        } else {
+            /*
+             * This happens when FLayers object is not in a
+             * map context, so no order manager is available.
+             */
+            addLayer(layers.size(), layer);
+        }
+    }
 
-			doAddLayer(pos,layer);
+    /**
+     * Adds a layer in an specified position in this node.
+     *
+     * @param layer a layer
+     */
+    public void addLayer(int pos, FLayer layer) {
+        try {
+            //Notificamos a la capa que va a ser añadida
+            if (layer instanceof FLyrDefault) {
+                ((FLyrDefault) layer).wakeUp();
+            }
 
-			callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer));
-		} catch (CancelationException e) {
-			logger.warn(e.getMessage());
-		} catch (LoadLayerException e) {
-			layer.setAvailable(false);
-			layer.addError(e);
-		}
-	}
+            if (layer instanceof FLayers) {
+                FLayers layers = (FLayers) layer;
+                fmap.addAsCollectionListener(layers);
+            }
+            callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer));
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#moveTo(int, int)
-	 */
-	public void moveTo(int from, int to) throws CancelationException {
-		int newfrom=layers.size()-from-1;
-		int newto=layers.size()-to-1;
-		if ( newfrom < 0 || newfrom >=layers.size() || newto < 0 || newto >= layers.size()) {
-			return;
-		}
-		FLayer aux = (FLayer) layers.get(newfrom);
-		callLayerMoving(LayerPositionEvent.createLayerMovingEvent(aux, newfrom, newto));
-		layers.remove(newfrom);
-		layers.add(newto, aux);
-		this.updateDrawVersion();
-		callLayerMoved(LayerPositionEvent.createLayerMovedEvent(aux, newfrom, newto));
-	}
+            doAddLayer(pos, layer);
 
-	/**
-	 * Removes an inner layer.
-	 *
-	 * @param lyr a layer
-	 */
-	private void doRemoveLayer(FLayer lyr) {
-		layers.remove(lyr);
-		lyr.dispose();
-		this.updateDrawVersion();
-	}
+            callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer));
+        } catch (CancelationException e) {
+            logger.warn(e.getMessage());
+        } catch (LoadLayerException e) {
+            layer.setAvailable(false);
+            layer.addError(e);
+        }
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
-	 */
-	public void removeLayer(FLayer lyr) throws CancelationException {
-		callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr));
-		doRemoveLayer(lyr);
-		callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr));
-	}
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#moveTo(int, int)
+     */
+    public void moveTo(int from, int to) throws CancelationException {
+        int newfrom = layers.size() - from - 1;
+        int newto = layers.size() - to - 1;
+        if (newfrom < 0 || newfrom >= layers.size() || newto < 0 || newto >= layers.size()) {
+            return;
+        }
+        FLayer aux = (FLayer) layers.get(newfrom);
+        callLayerMoving(LayerPositionEvent.createLayerMovingEvent(aux, newfrom, newto));
+        layers.remove(newfrom);
+        layers.add(newto, aux);
+        this.updateDrawVersion();
+        callLayerMoved(LayerPositionEvent.createLayerMovedEvent(aux, newfrom, newto));
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(int)
-	 */
-	public void removeLayer(int idLayer) {
-		FLayer lyr = (FLayer) layers.get(idLayer);
-		callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr));
-		this.doRemoveLayer(lyr);
+    /**
+     * Removes an inner layer.
+     *
+     * @param lyr a layer
+     */
+    private void doRemoveLayer(FLayer lyr) {
+        layers.remove(lyr);
+        lyr.dispose();
+        this.updateDrawVersion();
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
+     */
+    public void removeLayer(FLayer lyr) throws CancelationException {
+        callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr));
+        doRemoveLayer(lyr);
+        callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr));
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(int)
+     */
+    public void removeLayer(int idLayer) {
+        FLayer lyr = (FLayer) layers.get(idLayer);
+        callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(lyr));
+        this.doRemoveLayer(lyr);
 //		layers.remove(idLayer);
 //		this.updateDrawVersion();
-		callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr));
-	}
+        callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(lyr));
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(java.lang.String)
-	 */
-	public void removeLayer(String layerName) {
-		FLayer lyr;
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#removeLayer(java.lang.String)
+     */
+    public void removeLayer(String layerName) {
+        FLayer lyr;
 
-		for (int i = 0; i < layers.size(); i++) {
-			lyr = ((FLayer) layers.get(i));
+        for (int i = 0; i < layers.size(); i++) {
+            lyr = ((FLayer) layers.get(i));
 
-			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
-				removeLayer(i);
+            if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
+                removeLayer(i);
 
-				break;
-			}
-		}
-	}
+                break;
+            }
+        }
+    }
 
-	/**
-	 * Replace a layer identified by its name, by another.
-	 *
-	 * @param layerName the name of the layer to be replaced
-	 * @param layer the new layer
-	 * @deprecated use {@link FLayers#replaceLayer(FLayer, FLayer)}
-	 */
-	public void replaceLayer(String layerName, FLayer layer) throws LoadLayerException
-	{
-		replaceLayer(getLayer(layerName), layer);
-	}
-	
-	/**
-     * Replace a layer by another layer.  It search recursively by all the 
+    /**
+     * Replace a layer identified by its name, by another.
+     *
+     * @param layerName the name of the layer to be replaced
+     * @param layer the new layer
+     * @deprecated use {@link FLayers#replaceLayer(FLayer, FLayer)}
+     */
+    public void replaceLayer(String layerName, FLayer layer) throws LoadLayerException {
+        replaceLayer(getLayer(layerName), layer);
+    }
+
+    /**
+     * Replace a layer by another layer. It search recursively by all the
      * ILayerCollection nodes
      *
-     * @param layer
-     *          the layer to be replaced
-     * @param newLayer
-     *          the new layer
+     * @param layer the layer to be replaced
+     * @param newLayer the new layer
      */
-    public void replaceLayer(FLayer layer, FLayer newLayer) throws LoadLayerException
-    {        
+    public void replaceLayer(FLayer layer, FLayer newLayer) throws LoadLayerException {
         replaceLayer(this, layer, newLayer);
     }
-    
+
     /**
-     * Replace a layer by other layer. It search recursively by all the 
+     * Replace a layer by other layer. It search recursively by all the
      * ILayerCollection nodes
-     * @param parentLayer
-     *          the parent layer
-     * @param layer
-     *          the layer to be replaced
-     * @param newLayer
-     *          the new layer
+     *
+     * @param parentLayer the parent layer
+     * @param layer the layer to be replaced
+     * @param newLayer the new layer
      * @throws LoadLayerException
      */
-    private void replaceLayer(FLayers parentLayer, FLayer layer, FLayer newLayer) throws LoadLayerException
-    {        
-        FLayer lyr;       
+    private void replaceLayer(FLayers parentLayer, FLayer layer, FLayer newLayer) throws LoadLayerException {
+        FLayer lyr;
         for (int i = 0; i < parentLayer.getLayersCount(); i++) {
             lyr = ((FLayer) parentLayer.getLayer(i));
-            if (lyr.equals(layer)) {              
-                parentLayer.removeLayer(i);             
-                parentLayer.addLayer(i, newLayer);                
+            if (lyr.equals(layer)) {
+                parentLayer.removeLayer(i);
+                parentLayer.addLayer(i, newLayer);
                 break;
             }
-            if (lyr instanceof LayerCollection){
-                replaceLayer((FLayers)lyr, layer, newLayer);
+            if (lyr instanceof LayerCollection) {
+                replaceLayer((FLayers) lyr, layer, newLayer);
             }
         }
     }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getVisibles()
-	 */
-	public FLayer[] getVisibles() {
-		ArrayList array = new ArrayList();
-		LayersIterator iter = new LayersIterator(this) {
-			public boolean evaluate(FLayer layer) {
-				return layer.isVisible();
-			}
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getVisibles()
+     */
+    public FLayer[] getVisibles() {
+        ArrayList array = new ArrayList();
+        LayersIterator iter = new LayersIterator(this) {
+            public boolean evaluate(FLayer layer) {
+                return layer.isVisible();
+            }
 
-		};
+        };
 
-		while (iter.hasNext()) {
-			array.add(iter.nextLayer());
-		}
+        while (iter.hasNext()) {
+            array.add(iter.nextLayer());
+        }
 
-		return (FLayer[]) array.toArray(new FLayer[0]);
-	}
+        return (FLayer[]) array.toArray(new FLayer[0]);
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(int)
-	 */
-	public FLayer getLayer(int index) {
-		return (FLayer) layers.get(index);
-	}
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(int)
+     */
+    public FLayer getLayer(int index) {
+        return (FLayer) layers.get(index);
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(java.lang.String)
-	 */
-	public FLayer getLayer(String layerName) {
-		FLayer lyr;
-		FLayer lyr2;
-		ArrayList layerList;
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayer(java.lang.String)
+     */
+    public FLayer getLayer(String layerName) {
+        FLayer lyr;
+        FLayer lyr2;
+        ArrayList layerList;
 
-		for (int i = 0; i < layers.size(); i++) {
-			lyr = ((FLayer) layers.get(i));
+        for (int i = 0; i < layers.size(); i++) {
+            lyr = ((FLayer) layers.get(i));
 
-			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
-				return lyr;
-			}
+            if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
+                return lyr;
+            }
 
-			layerList = new ArrayList();
-			splitLayerGroup(lyr,layerList);
-			for(int j = 0; j<layerList.size(); j++ )
-			{
-				lyr2 = ((FLayer)layerList.get(j));
-				if (lyr2.getName().compareToIgnoreCase(layerName) == 0) {
-					return lyr2;
-				}
-			}
-		}
+            layerList = new ArrayList();
+            splitLayerGroup(lyr, layerList);
+            for (int j = 0; j < layerList.size(); j++) {
+                lyr2 = ((FLayer) layerList.get(j));
+                if (lyr2.getName().compareToIgnoreCase(layerName) == 0) {
+                    return lyr2;
+                }
+            }
+        }
 
-		return null;
-	}
+        return null;
+    }
 
-	/**
-	 * <p> Splits up a layer group in order to get a layer by name when there are layer groups</p>
-	 *
-	 * <p>In <code>result</code> always will be at least one layer.</p>
-	 *
-	 * @param layer the layer we are looking for
-	 * @param result an array list that will have the results of the search
-	 */
-	private void splitLayerGroup(FLayer layer, ArrayList result)
-	{
-		int i;
-		FLayers layerGroup;
-		if (layer instanceof FLayers)
-		{
-			layerGroup = (FLayers)layer;
-			for (i=0; i < layerGroup.getLayersCount(); i++ )
-			{
-				splitLayerGroup(layerGroup.getLayer(i),result);
-			}
-		}
-		else
-		{
-			result.add(layer);
-		}
-	}
+    /**
+     * <p>
+     * Splits up a layer group in order to get a layer by name when there are
+     * layer groups</p>
+     *
+     * <p>
+     * In <code>result</code> always will be at least one layer.</p>
+     *
+     * @param layer the layer we are looking for
+     * @param result an array list that will have the results of the search
+     */
+    private void splitLayerGroup(FLayer layer, ArrayList result) {
+        int i;
+        FLayers layerGroup;
+        if (layer instanceof FLayers) {
+            layerGroup = (FLayers) layer;
+            for (i = 0; i < layerGroup.getLayersCount(); i++) {
+                splitLayerGroup(layerGroup.getLayer(i), result);
+            }
+        } else {
+            result.add(layer);
+        }
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayersCount()
-	 */
-	public int getLayersCount() {
-		return layers.size();
-	}
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getLayersCount()
+     */
+    public int getLayersCount() {
+        return layers.size();
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * @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)
-	 */
-	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
-			Cancellable cancel, double scale) throws ReadException {
-		// FIXME Arreglar este error
-		throw new RuntimeException("Esto no deberia de llamarse");
-	}
+    /*
+     * (non-Javadoc)
+     * @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)
+     */
+    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+            Cancellable cancel, double scale) throws ReadException {
+        // FIXME Arreglar este error
+        throw new RuntimeException("Esto no deberia de llamarse");
+    }
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
-	 * com.iver.cit.gvsig.fmap.ViewPort,
-	 * com.iver.utiles.swing.threads.Cancellable, double,
-	 * javax.print.attribute.PrintAttributes)
-	 */
-	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
-			double scale, PrintAttributes properties)
-	throws ReadException {
-		throw new RuntimeException("No deberia pasar por aqui");
-	}
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
+     * com.iver.cit.gvsig.fmap.ViewPort,
+     * com.iver.utiles.swing.threads.Cancellable, double,
+     * javax.print.attribute.PrintAttributes)
+     */
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, PrintAttributes properties)
+            throws ReadException {
+        throw new RuntimeException("No deberia pasar por aqui");
+    }
 
-	public void print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel,
-			double scale, PrintAttributes properties)
-	throws ReadException {
-		this.print_old(g, viewPort, cancel, scale, properties, null);
-	}
+    public void print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, PrintAttributes properties)
+            throws ReadException {
+        this.print_old(g, viewPort, cancel, scale, properties, null);
+    }
 
-	/**
-	 * <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
-	 *  a group of layers (<code>ComposedLayer</code>), executes it's drawn.</p>
-	 *
-	 * <p>All nodes which could group with the composed layer <code>group</code>, will be drawn together. And once the <code>
-	 * group</code> is drawn, will be set to <code>null</code> if hasn't a parent layer.</p>
-	 *
-	 * <p>The particular implementation depends on the kind of each layer and composed layer. And this process can be cancelled at any
-	 *  time by the shared object <code>cancel</code>.</p>
-	 *
-	 * <p>According the print quality, labels will be printed in different resolution:
-	 *  <ul>
-	 *   <li><b>PrintQuality.DRAFT</b>: 72 dpi (dots per inch).</li>
-	 *   <li><b>PrintQuality.NORMAL</b>: 300 dpi (dots per inch).</li>
-	 *   <li><b>PrintQuality.HIGH</b>: 600 dpi (dots per inch).</li>
-	 *  </ul>
-	 * </p>
-	 *
-	 * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
-	 * @param viewPort the information for drawing the layers
-	 * @param cancel shared object that determines if this layer can continue being drawn
-	 * @param scale the scale of the view. Must be between {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}.
-	 * @param properties properties that will be print
-	 * @param group a composed layer pending to paint; if this parameter is <code>null</code>, the composed layer
-	 *
-	 * @return <code>null</code> if the layers in <code>group</code> had been drawn or were <code>null</code>; otherwise, the <code>group</code>
-	 *
-	 * @see FLayer#print(Graphics2D, ViewPort, Cancellable, double, PrintAttributes)
-	 *
-	 * @throws ReadDriverException if fails the driver reading the data.
-	 */
-	public ComposedLayer print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties, ComposedLayer group)
-	throws ReadException {
-		double dpi = 72;
+    /**
+     * <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 a group of layers (<code>ComposedLayer</code>), executes it's
+     * drawn.</p>
+     *
+     * <p>
+     * All nodes which could group with the composed layer <code>group</code>,
+     * will be drawn together. And once the <code>
+     * group</code> is drawn, will be set to <code>null</code> if hasn't a
+     * parent layer.</p>
+     *
+     * <p>
+     * The particular implementation depends on the kind of each layer and
+     * composed layer. And this process can be cancelled at any time by the
+     * shared object <code>cancel</code>.</p>
+     *
+     * <p>
+     * According the print quality, labels will be printed in different
+     * resolution:
+     * <ul>
+     * <li><b>PrintQuality.DRAFT</b>: 72 dpi (dots per inch).</li>
+     * <li><b>PrintQuality.NORMAL</b>: 300 dpi (dots per inch).</li>
+     * <li><b>PrintQuality.HIGH</b>: 600 dpi (dots per inch).</li>
+     * </ul>
+     * </p>
+     *
+     * @param g for rendering 2-dimensional shapes, text and images on the
+     * Java(tm) platform
+     * @param viewPort the information for drawing the layers
+     * @param cancel shared object that determines if this layer can continue
+     * being drawn
+     * @param scale the scale of the view. Must be between
+     * {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}.
+     * @param properties properties that will be print
+     * @param group a composed layer pending to paint; if this parameter is
+     * <code>null</code>, the composed layer
+     *
+     * @return <code>null</code> if the layers in <code>group</code> had been
+     * drawn or were <code>null</code>; otherwise, the <code>group</code>
+     *
+     * @see FLayer#print(Graphics2D, ViewPort, Cancellable, double,
+     * PrintAttributes)
+     *
+     * @throws ReadDriverException if fails the driver reading the data.
+     */
+    public ComposedLayer print_old(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties, ComposedLayer group)
+            throws ReadException {
+        double dpi = 72;
 
-		int resolution = properties.getPrintQuality();
-		if (resolution == PrintAttributes.PRINT_QUALITY_NORMAL) {
-			dpi = 300;
-		} else if (resolution == PrintAttributes.PRINT_QUALITY_HIGH){
-			dpi = 600;
-		} else if (resolution == PrintAttributes.PRINT_QUALITY_DRAFT){
-			dpi = 72;
-		}
+        int resolution = properties.getPrintQuality();
+        if (resolution == PrintAttributes.PRINT_QUALITY_NORMAL) {
+            dpi = 300;
+        } else if (resolution == PrintAttributes.PRINT_QUALITY_HIGH) {
+            dpi = 600;
+        } else if (resolution == PrintAttributes.PRINT_QUALITY_DRAFT) {
+            dpi = 72;
+        }
 
 		// TODO: A la hora de imprimir, isWithinScale falla, porque está
-		// calculando la escala en pantalla, no para el layout.
-		// Revisar esto.
+        // calculando la escala en pantalla, no para el layout.
+        // Revisar esto.
+        // TODO: We have to check when we have to call the drawLabels method when exists a ComposedLayer group.
+        for (int i = 0; i < layers.size(); i++) {
+            FLayer lyr = (FLayer) layers.get(i);
+            if (!lyr.isVisible() || !lyr.isWithinScale(scale)) {
+                continue;
+            }
 
-		// TODO: We have to check when we have to call the drawLabels method when exists a ComposedLayer group.
-		for (int i=0; i < layers.size(); i++) {
-			FLayer lyr = (FLayer) layers.get(i);
-			if (!lyr.isVisible() || !lyr.isWithinScale(scale)) {
-				continue;
-			}
+            try {
 
-			try{
-
 				///// CHEMA ComposedLayer
-				// Checks for draw group (ComposedLayer)
-				if (group != null) {
-					if (lyr instanceof FLayers){
-						group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group);
-					} else {
-						// If layer can be added to the group, does it
-						if (lyr instanceof ILabelable
-								&& ((ILabelable) lyr).isLabeled()
-								&& ((ILabelable) lyr).getLabelingStrategy() != null
-								&& ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
-							group.add(lyr);
-						} else {
-							// draw the 'pending to draw' layer group
-							group.print(g,viewPort,cancel,scale,properties);
+                // Checks for draw group (ComposedLayer)
+                if (group != null) {
+                    if (lyr instanceof FLayers) {
+                        group = ((FLayers) lyr).print_old(g, viewPort, cancel, scale, properties, group);
+                    } else {
+                        // If layer can be added to the group, does it
+                        if (lyr instanceof ILabelable
+                                && ((ILabelable) lyr).isLabeled()
+                                && ((ILabelable) lyr).getLabelingStrategy() != null
+                                && ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
+                            group.add(lyr);
+                        } else {
+                            // draw the 'pending to draw' layer group
+                            group.print(g, viewPort, cancel, scale, properties);
 
-							// gets a new group instance
-							if (lyr instanceof ILabelable
-									&& ((ILabelable) lyr).isLabeled()
-									&& ((ILabelable) lyr).getLabelingStrategy() != null
-									&& ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
-								group = lyr.newComposedLayer();
-							} else {
-								group = null;
-							}
-							// if layer hasn't group, draws it inmediately
-							if (group == null) {
-								if (lyr instanceof FLayers){
-									group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group);
-								} else {
-									lyr.print(g, viewPort, cancel,scale,properties);
-									if (lyr instanceof ILabelable
-											&& ((ILabelable) lyr).isLabeled()
-											&& ((ILabelable) lyr).getLabelingStrategy() != null
-											&& ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
-										ILabelable lLayer = (ILabelable) lyr;
-										lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
-									}
-								}
-							} else {
-								// add the layer to the group
-								group.setMapContext(fmap);
-								group.add(lyr);
+                            // gets a new group instance
+                            if (lyr instanceof ILabelable
+                                    && ((ILabelable) lyr).isLabeled()
+                                    && ((ILabelable) lyr).getLabelingStrategy() != null
+                                    && ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
+                                group = lyr.newComposedLayer();
+                            } else {
+                                group = null;
+                            }
+                            // if layer hasn't group, draws it inmediately
+                            if (group == null) {
+                                if (lyr instanceof FLayers) {
+                                    group = ((FLayers) lyr).print_old(g, viewPort, cancel, scale, properties, group);
+                                } else {
+                                    lyr.print(g, viewPort, cancel, scale, properties);
+                                    if (lyr instanceof ILabelable
+                                            && ((ILabelable) lyr).isLabeled()
+                                            && ((ILabelable) lyr).getLabelingStrategy() != null
+                                            && ((ILabelable) lyr).getLabelingStrategy().shouldDrawLabels(scale)) {
+                                        ILabelable lLayer = (ILabelable) lyr;
+                                        lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
+                                    }
+                                }
+                            } else {
+                                // add the layer to the group
+                                group.setMapContext(fmap);
+                                group.add(lyr);
 
-							}
+                            }
 
-						}
-					}
-				} else {
-					// gets a new group instance
-					group = lyr.newComposedLayer();
-					// if layer hasn't group, draws it inmediately
-					if (group == null) {
-						if (lyr instanceof FLayers){
-							group = ((FLayers)lyr).print_old(g, viewPort, cancel,scale,properties,group);
-						} else {
-							lyr.print(g, viewPort, cancel,scale,properties);
-							if (lyr instanceof ILabelable && ((ILabelable) lyr).isLabeled()) {
-								ILabelable lLayer = (ILabelable) lyr;
+                        }
+                    }
+                } else {
+                    // gets a new group instance
+                    group = lyr.newComposedLayer();
+                    // if layer hasn't group, draws it inmediately
+                    if (group == null) {
+                        if (lyr instanceof FLayers) {
+                            group = ((FLayers) lyr).print_old(g, viewPort, cancel, scale, properties, group);
+                        } else {
+                            lyr.print(g, viewPort, cancel, scale, properties);
+                            if (lyr instanceof ILabelable && ((ILabelable) lyr).isLabeled()) {
+                                ILabelable lLayer = (ILabelable) lyr;
 
-								lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
-							}
-						}
-					} else {
-						// add the layer to the group
-						group.setMapContext(fmap);
-						group.add(lyr);
+                                lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
+                            }
+                        }
+                    } else {
+                        // add the layer to the group
+                        group.setMapContext(fmap);
+                        group.add(lyr);
 
-					}
-				}
-				///// CHEMA ComposedLayer
+                    }
+                }
+                ///// CHEMA ComposedLayer
 
-			} catch (Exception e){
-				String mesg = Messages.getString("error_printing_layer")+" "+ lyr.getName() + ": " + e.getMessage();
-				fmap.addLayerError(mesg);
-				logger.error(mesg, e);
-			}
+            } catch (Exception e) {
+                String mesg = Messages.getString("error_printing_layer") + " " + lyr.getName() + ": " + e.getMessage();
+                fmap.addLayerError(mesg);
+                logger.error(mesg, e);
+            }
 
-		}
+        }
 
-		///// CHEMA ComposedLayer
-		if (group != null && this.getParentLayer() == null) {
-			//si tenemos un grupo pendiente de pintar, pintamos
-			group.print(g, viewPort, cancel,scale,properties);
-			group = null;
+        ///// CHEMA ComposedLayer
+        if (group != null && this.getParentLayer() == null) {
+            //si tenemos un grupo pendiente de pintar, pintamos
+            group.print(g, viewPort, cancel, scale, properties);
+            group = null;
 
-		}
+        }
 		///// CHEMA ComposedLayer
 
 		//		if (getVirtualLayers() != null) {
-		//			getVirtualLayers().print( g, viewPort, cancel, scale, properties);
-		//		}
+        //			getVirtualLayers().print( g, viewPort, cancel, scale, properties);
+        //		}
+        ///// CHEMA ComposedLayer
+        return group;
+        ///// CHEMA ComposedLayer
+    }
 
-		///// CHEMA ComposedLayer
-		return group;
-		///// CHEMA ComposedLayer
-	}
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
+     */
+    public Envelope getFullEnvelope() {
+        Envelope rAux = null;
+        boolean first = true;
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
-	 */
-	public Envelope getFullEnvelope() {
-		Envelope rAux = null;
-		boolean first = true;
+        for (Iterator iter = layers.iterator(); iter.hasNext();) {
+            FLayer capa = (FLayer) iter.next();
+            try {
+                if (first) {
+                    rAux = (Envelope) capa.getFullEnvelope().clone();
+                    first = false;
+                } else {
+                    rAux.add(capa.getFullEnvelope());
+                }
+            } catch (Exception e) {
+                e.printStackTrace();//TODO hay que revisar para determinar el comportamiento que espera el usuario.
+            }
+        }
 
+        return rAux;
+    }
 
-		for (Iterator iter = layers.iterator(); iter.hasNext();) {
-			FLayer capa = (FLayer) iter.next();
-			try{
-				if (first) {
-					rAux = (Envelope)capa.getFullEnvelope().clone();
-					first=false;
-				} else {
-					rAux.add(capa.getFullEnvelope());
-				}
-			}catch (Exception e) {
-				e.printStackTrace();//TODO hay que revisar para determinar el comportamiento que espera el usuario.
-			}
-		}
+    /**
+     * Notifies all listeners associated to this collection of layers, that
+     * another layer is going to be added or replaced in the internal list of
+     * layers.
+     *
+     * @param e a layer collection event with the new layer
+     */
+    protected void callLayerAdding(LayerCollectionEvent event)
+            throws CancelationException {
+        ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+        for (Iterator iter = aux.iterator(); iter.hasNext();) {
+            ((LayerCollectionListener) iter.next()).layerAdding(event);
+        }
+    }
 
-		return rAux;
-	}
+    /**
+     * Notifies all listeners associated to this collection of layers, that a
+     * layer is going to be removed from the internal list of layers.
+     *
+     * @param event a layer collection event with the layer being removed
+     *
+     * @throws CancelationException any exception produced during the
+     * cancellation of the driver.
+     */
+    protected void callLayerRemoving(LayerCollectionEvent event)
+            throws CancelationException {
+        ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+        for (Iterator iter = aux.iterator(); iter.hasNext();) {
+            ((LayerCollectionListener) iter.next()).layerRemoving(event);
+        }
+    }
 
-	/**
-	 * Notifies all listeners associated to this collection of layers,
-	 *  that another layer is going to be added or replaced in the internal
-	 *  list of layers.
-	 *
-	 * @param e a layer collection event with the new layer
-	 */
-	protected void callLayerAdding(LayerCollectionEvent event)
-	throws CancelationException {
-		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
-		for (Iterator iter = aux.iterator(); iter.hasNext();) {
-			((LayerCollectionListener) iter.next()).layerAdding(event);
-		}
-	}
+    /**
+     * Notifies all listeners associated to this collection of layers, that a
+     * layer is going to be moved in the internal list of layers.
+     *
+     * @param event a layer collection event with the layer being moved, and the
+     * initial and final positions
+     *
+     * @throws CancelationException any exception produced during the
+     * cancellation of the driver.
+     */
+    protected void callLayerMoving(LayerPositionEvent event)
+            throws CancelationException {
+        ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+        for (Iterator iter = aux.iterator(); iter.hasNext();) {
+            ((LayerCollectionListener) iter.next()).layerMoving(event);
+        }
+    }
 
-	/**
-	 * Notifies all listeners associated to this collection of layers,
-	 *  that a layer is going to be removed from the internal list of layers.
-	 *
-	 * @param event a layer collection event with the layer being removed
-	 *
-	 * @throws CancelationException any exception produced during the cancellation of the driver.
-	 */
-	protected void callLayerRemoving(LayerCollectionEvent event)
-	throws CancelationException {
-		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
-		for (Iterator iter = aux.iterator(); iter.hasNext();) {
-			((LayerCollectionListener) iter.next()).layerRemoving(event);
-		}
-	}
+    /**
+     * Notifies all listeners associated to this collection of layers, that
+     * another layer has been added or replaced in the internal list of layers.
+     *
+     * @param e a layer collection event with the new layer
+     */
+    protected void callLayerAdded(LayerCollectionEvent event) {
+        ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+        for (Iterator iter = aux.iterator(); iter.hasNext();) {
+            ((LayerCollectionListener) iter.next()).layerAdded(event);
+        }
+    }
 
-	/**
-	 * Notifies all listeners associated to this collection of layers,
-	 *  that a layer is going to be moved in the internal list of layers.
-	 *
-	 * @param event a layer collection event with the layer being moved, and the initial and final positions
-	 *
-	 * @throws CancelationException any exception produced during the cancellation of the driver.
-	 */
-	protected void callLayerMoving(LayerPositionEvent event)
-	throws CancelationException {
-		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
-		for (Iterator iter = aux.iterator(); iter.hasNext();) {
-			((LayerCollectionListener) iter.next()).layerMoving(event);
-		}
-	}
+    /**
+     * Notifies all listeners associated to this collection of layers, that
+     * another layer has been removed from the internal list of layers.
+     *
+     * @param e a layer collection event with the layer removed
+     */
+    protected void callLayerRemoved(LayerCollectionEvent event) {
+        ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+        for (Iterator iter = aux.iterator(); iter.hasNext();) {
+            ((LayerCollectionListener) iter.next()).layerRemoved(event);
+        }
+    }
 
-	/**
-	 * Notifies all listeners associated to this collection of layers,
-	 *  that another layer has been added or replaced in the internal
-	 *  list of layers.
-	 *
-	 * @param e a layer collection event with the new layer
-	 */
-	protected void callLayerAdded(LayerCollectionEvent event) {
-		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
-		for (Iterator iter = aux.iterator(); iter.hasNext();) {
-			((LayerCollectionListener) iter.next()).layerAdded(event);
-		}
-	}
+    /**
+     * Notifies all listeners associated to this collection of layers, that
+     * another layer has been moved in the internal list of layers.
+     *
+     * @param e a layer collection event with the layer moved, and the initial
+     * and final positions
+     */
+    protected void callLayerMoved(LayerPositionEvent event) {
+        ArrayList aux = (ArrayList) layerCollectionListeners.clone();
+        for (Iterator iter = aux.iterator(); iter.hasNext();) {
+            ((LayerCollectionListener) iter.next()).layerMoved(event);
+        }
+    }
 
-	/**
-	 * Notifies all listeners associated to this collection of layers,
-	 *  that another layer has been removed from the internal list of layers.
-	 *
-	 * @param e a layer collection event with the layer removed
-	 */
-	protected void callLayerRemoved(LayerCollectionEvent event) {
-		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
-		for (Iterator iter = aux.iterator(); iter.hasNext();) {
-			((LayerCollectionListener) iter.next()).layerRemoved(event);
-		}
-	}
+    public void saveToState(PersistentState state) throws PersistenceException {
 
-	/**
-	 * Notifies all listeners associated to this collection of layers,
-	 *  that another layer has been moved in the internal list of layers.
-	 *
-	 * @param e a layer collection event with the layer moved, and the initial and final positions
-	 */
-	protected void callLayerMoved(LayerPositionEvent event) {
-		ArrayList aux = (ArrayList) layerCollectionListeners.clone();
-		for (Iterator iter = aux.iterator(); iter.hasNext();) {
-			((LayerCollectionListener) iter.next()).layerMoved(event);
-		}
-	}
+        super.saveToState(state);
 
-	public void saveToState(PersistentState state) throws PersistenceException {
-		
-		super.saveToState(state);
-		
-		state.set("mapContext", fmap);
-                
-                List layersToSave = new ArrayList();
-		Iterator iter = this.layers.iterator();
-		while (iter.hasNext()) {
-			FLayer layer = (FLayer) iter.next();
-                        if( !layer.isTemporary() ) {
-                            layersToSave.add(layer); 
-                        }
-		}                
-		state.set("layers", layersToSave);
-	}
+        state.set("mapContext", fmap);
 
-	public void loadFromState(PersistentState state) throws PersistenceException {
+        List layersToSave = new ArrayList();
+        Iterator iter = this.layers.iterator();
+        while (iter.hasNext()) {
+            FLayer layer = (FLayer) iter.next();
+            if (!layer.isTemporary()) {
+                layersToSave.add(layer);
+            }
+        }
+        state.set("layers", layersToSave);
+    }
 
-		super.loadFromState(state);
+    public void loadFromState(PersistentState state) throws PersistenceException {
 
-		setMapContext((MapContext) state.get("mapContext"));
-		Iterator iter = state.getIterator("layers");
-		while (iter.hasNext()) {
-			FLayer item = (FLayer) iter.next();
-			layers.add(item); 
-		}
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMapContext()
-	 */
-	public MapContext getMapContext() {
-		return fmap;
-	}
+        super.loadFromState(state);
 
-	/*
-	 * I don't think this implementation makes any sense.
-	 * We can group layers with different transformations,
-	 * we cannot set the ICoordTrans for all (?)
-	 * 
-	public void setCoordTrans(ICoordTrans ct) {
-		super.setCoordTrans(ct);
+        setMapContext((MapContext) state.get("mapContext"));
+        Iterator iter = state.getIterator("layers");
+        while (iter.hasNext()) {
+            FLayer item = (FLayer) iter.next();
+            layers.add(item);
+        }
+    }
 
-		for (Iterator iter = layers.iterator(); iter.hasNext();) {
-			FLayer layer = (FLayer) iter.next();
-			layer.setCoordTrans(ct);
-		}
-	}
-	*/
-	
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllActives(boolean)
-	 */
-	public void setAllActives(boolean active) {
-		FLayer lyr;
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMapContext()
+     */
+    public MapContext getMapContext() {
+        return fmap;
+    }
 
-		for (int i = 0; i < layers.size(); i++) {
-			lyr = ((FLayer) layers.get(i));
-			lyr.setActive(active);
+    /*
+     * I don't think this implementation makes any sense.
+     * We can group layers with different transformations,
+     * we cannot set the ICoordTrans for all (?)
+     * 
+     public void setCoordTrans(ICoordTrans ct) {
+     super.setCoordTrans(ct);
 
-			if (lyr instanceof LayerCollection) {
-				((LayerCollection) lyr).setAllActives(active);
-			}
-		}
-	}
+     for (Iterator iter = layers.iterator(); iter.hasNext();) {
+     FLayer layer = (FLayer) iter.next();
+     layer.setCoordTrans(ct);
+     }
+     }
+     */
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllActives(boolean)
+     */
+    public void setAllActives(boolean active) {
+        FLayer lyr;
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getActives()
-	 */
-	public FLayer[] getActives() {
-		ArrayList ret = new ArrayList();
-		LayersIterator it = new LayersIterator(this) {
+        for (int i = 0; i < layers.size(); i++) {
+            lyr = ((FLayer) layers.get(i));
+            lyr.setActive(active);
 
-			public boolean evaluate(FLayer layer) {
-				return layer.isActive();
-			}
+            if (lyr instanceof LayerCollection) {
+                ((LayerCollection) lyr).setAllActives(active);
+            }
+        }
+    }
 
-		};
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#getActives()
+     */
+    public FLayer[] getActives() {
+        ArrayList ret = new ArrayList();
+        LayersIterator it = new LayersIterator(this) {
 
-		while (it.hasNext())
-		{
-			ret.add(it.next());
-		}
-		return (FLayer[]) ret.toArray(new FLayer[0]);
-	}
+            public boolean evaluate(FLayer layer) {
+                return layer.isActive();
+            }
 
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMinScale()
-	 */
-	public double getMinScale() {
-		return -1; // La visibilidad o no la controla cada capa
-		// dentro de una colección
-	}
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMaxScale()
-	 */
-	public double getMaxScale() {
-		return -1;
-	}
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMinScale(double)
-	 */
-	public void setMinScale(double minScale)
-	{
-		for (Iterator iter = layers.iterator(); iter.hasNext();) {
-			FLayer lyr = (FLayer) iter.next();
-			lyr.setMinScale(minScale);
-		}
-	}
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMaxScale(double)
-	 */
-	public void setMaxScale(double maxScale)
-	{
-		for (Iterator iter = layers.iterator(); iter.hasNext();) {
-			FLayer lyr = (FLayer) iter.next();
-			lyr.setMinScale(maxScale);
-		}
-	}
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setActive(boolean)
-	 */
-	public void setActive(boolean b){
-		super.setActive(b);
-		for (int i=0;i<layers.size();i++){
-			((FLayer)layers.get(i)).setActive(b);
-		}
-	}
-	/* (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
-	 */
-	public boolean addLayerListener(LayerListener o) {
-		for (int i = 0; i < layers.size(); i++) {
-			((FLayer) layers.get(i)).addLayerListener(o);
-		}
-		return true;
-	}
+        };
 
+        while (it.hasNext()) {
+            ret.add(it.next());
+        }
+        return (FLayer[]) ret.toArray(new FLayer[0]);
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMinScale()
+     */
+    public double getMinScale() {
+        return -1; // La visibilidad o no la controla cada capa
+        // dentro de una colección
+    }
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getMaxScale()
+     */
+
+    public double getMaxScale() {
+        return -1;
+    }
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMinScale(double)
+     */
+
+    public void setMinScale(double minScale) {
+        for (Iterator iter = layers.iterator(); iter.hasNext();) {
+            FLayer lyr = (FLayer) iter.next();
+            lyr.setMinScale(minScale);
+        }
+    }
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setMaxScale(double)
+     */
+
+    public void setMaxScale(double maxScale) {
+        for (Iterator iter = layers.iterator(); iter.hasNext();) {
+            FLayer lyr = (FLayer) iter.next();
+            lyr.setMinScale(maxScale);
+        }
+    }
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setActive(boolean)
+     */
+
+    public void setActive(boolean b) {
+        super.setActive(b);
+        for (int i = 0; i < layers.size(); i++) {
+            ((FLayer) layers.get(i)).setActive(b);
+        }
+    }
+    /* (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
+     */
+
+    public boolean addLayerListener(LayerListener o) {
+        for (int i = 0; i < layers.size(); i++) {
+            ((FLayer) layers.get(i)).addLayerListener(o);
+        }
+        return true;
+    }
+
     public DynObjectSet getInfo(Point p, double tolerance,
-			Cancellable cancel) throws LoadLayerException, DataException {
-    	return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance);
+            Cancellable cancel) throws LoadLayerException, DataException {
+        return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance);
     }
 
     public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel,
-        boolean fast) throws LoadLayerException, DataException {
-    	return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance);
+            boolean fast) throws LoadLayerException, DataException {
+        return getInfo(this.getMapContext().getViewPort().convertToMapPoint(p), tolerance);
     }
-    
+
     public DynObjectSet getInfo(org.gvsig.fmap.geom.primitive.Point p,
-    		double tolerance) throws LoadLayerException, DataException {
+            double tolerance) throws LoadLayerException, DataException {
         int i;
         FLayer layer;
         List res = new ArrayList();
@@ -930,39 +940,41 @@
                 res.add(queryable_layer.getInfo(p, tolerance));
             }
         }
-        DynObjectSet[] innerSets =
-            (DynObjectSet[]) res.toArray(new DynObjectSet[res.size()]);
+        DynObjectSet[] innerSets
+                = (DynObjectSet[]) res.toArray(new DynObjectSet[res.size()]);
         return new MultiDynObjectSet(innerSets);
     }
-    
-	/*
-	 * (non-Javadoc)
-	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getTocImageIcon()
-	 */
-	public String getTocImageIcon() {
-		return "layer-icon-group";
-	}
 
-	/**
-	 * <p>Adds the layer with the information in an XML entity and the specified name, to this collection of layers. And
-	 *  returns <code>true</code> if there hasn't been errors.</p>
-	 *
-	 * @see CopyOfFLayers#addLayerFromXML(XMLEntity, String)
-	 *
-	 * @param xml tree-node structure with information about layers
-	 * @param name name of the layer to add
-	 * @return <code>true</code> if there were no errors adding the layer, <code>false</code> otherwise
-	 *
-	 * @throws LoadLayerException if fails loading this layer.
-	 */
+    /*
+     * (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#getTocImageIcon()
+     */
+    public String getTocImageIcon() {
+        return "layer-icon-group";
+    }
+
+    /**
+     * <p>
+     * Adds the layer with the information in an XML entity and the specified
+     * name, to this collection of layers. And returns <code>true</code> if
+     * there hasn't been errors.</p>
+     *
+     * @see CopyOfFLayers#addLayerFromXML(XMLEntity, String)
+     *
+     * @param xml tree-node structure with information about layers
+     * @param name name of the layer to add
+     * @return <code>true</code> if there were no errors adding the layer,
+     * <code>false</code> otherwise
+     *
+     * @throws LoadLayerException if fails loading this layer.
+     */
 	//	public boolean addLayerFromXMLEntity(XMLEntity xml, String name) throws LoadLayerException {
-	//		fmap.clearErrors();
-	//		this.addLayerFromXML(xml,name);
-	//
-	//		return (fmap.getLayersError().size() == 0);
-	//
-	//	}
-
+    //		fmap.clearErrors();
+    //		this.addLayerFromXML(xml,name);
+    //
+    //		return (fmap.getLayersError().size() == 0);
+    //
+    //	}
 //	/**
 //	 * <p>Adds the layer with the information in an XML entity and the specified name, to this collection of layers.</p>
 //	 *
@@ -1160,16 +1172,17 @@
 //			throw e;
 //		}
 //	}
+    /**
+     * <p>
+     * Sets the <code>MapContext</code> that contains this layer node.</p>
+     *
+     * @param mapContext the <code>MapContext</code> that contains this layer
+     * node
+     */
+    public void setMapContext(MapContext mapContext) {
+        this.fmap = mapContext;
+    }
 
-	/**
-	 * <p>Sets the <code>MapContext</code> that contains this layer node.</p>
-	 *
-	 * @param mapContext the <code>MapContext</code> that contains this layer node
-	 */
-	public void setMapContext(MapContext mapContext) {
-		this.fmap = mapContext;
-	}
-
 //	/**
 //	 * <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
 //	 *  and loads the layer. Then, adds the layer to this collection of layers, and if there is a projection defined,
@@ -1248,197 +1261,196 @@
 //		//					+Messages.getString("reason")+":", e);
 //		//		}
 //	}
-        public void accept(Visitor visitor) throws BaseException {
-            for (int i = 0; i < this.getLayersCount(); i++) {
-                FLayer layer = this.getLayer(i);
-                try {
-                    if (layer instanceof LayersVisitable) {
-                        ((LayersVisitable) layer).accept(visitor);
-                    } else {
-                        visitor.visit(layer);
-                    }
-                } catch (VisitCanceledException ex) {
-                    break;
+    public void accept(Visitor visitor) throws BaseException {
+        for (int i = 0; i < this.getLayersCount(); i++) {
+            FLayer layer = this.getLayer(i);
+            try {
+                if (layer instanceof LayersVisitable) {
+                    ((LayersVisitable) layer).accept(visitor);
+                } else {
+                    visitor.visit(layer);
                 }
+            } catch (VisitCanceledException ex) {
+                break;
             }
         }
+    }
 
-	public void accept(LayersVisitor visitor) throws BaseException {
-		for (int i = 0; i < this.getLayersCount(); i++) {
-			FLayer layer = this.getLayer(i);
-			if (layer instanceof LayersVisitable) {
-				((LayersVisitable) layer).accept(visitor);
-			} else {
-				visitor.visit(layer);
-			}
-		}
-	}
+    public void accept(LayersVisitor visitor) throws BaseException {
+        for (int i = 0; i < this.getLayersCount(); i++) {
+            FLayer layer = this.getLayer(i);
+            if (layer instanceof LayersVisitable) {
+                ((LayersVisitable) layer).accept(visitor);
+            } else {
+                visitor.visit(layer);
+            }
+        }
+    }
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see org.gvsig.metadata.Metadata#getMetadataID()
-	 */
-	public Object getMetadataID() throws MetadataException {
-		StringBuffer strb = new StringBuffer();
-		strb.append("Layers(");
-		strb.append(this.getName());
-		strb.append("):{");
-		Iterator iter = this.layers.iterator();
-		while (iter.hasNext()) {
-			strb.append(((FLayer) iter.next()).getMetadataID());
-			strb.append(",");
-		}
-		strb.append("}");
-		return strb.toString();
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.gvsig.metadata.Metadata#getMetadataID()
+     */
+    public Object getMetadataID() throws MetadataException {
+        StringBuffer strb = new StringBuffer();
+        strb.append("Layers(");
+        strb.append(this.getName());
+        strb.append("):{");
+        Iterator iter = this.layers.iterator();
+        while (iter.hasNext()) {
+            strb.append(((FLayer) iter.next()).getMetadataID());
+            strb.append(",");
+        }
+        strb.append("}");
+        return strb.toString();
 
-	}
+    }
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
-	 */
-	public Set getMetadataChildren() {
-		Set ret = new TreeSet();
-		Iterator iter = this.layers.iterator();
-		while (iter.hasNext()) {
-			ret.add(iter.next());
-		}
-		return ret;
-	}
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+     */
+    public Set getMetadataChildren() {
+        Set ret = new TreeSet();
+        Iterator iter = this.layers.iterator();
+        while (iter.hasNext()) {
+            ret.add(iter.next());
+        }
+        return ret;
+    }
 
-	/*
-	 * (non-Javadoc)
-	 *
-	 * @see org.gvsig.metadata.Metadata#getMetadataName()
-	 */
-	public String getMetadataName() throws MetadataException {
-		StringBuffer strb = new StringBuffer();
-		strb.append("Layer Group '");
-		strb.append(this.getName());
-		strb.append("': {");
-		Iterator iter = this.layers.iterator();
-		while (iter.hasNext()) {
-			strb.append(((FLayer) iter.next()).getMetadataName());
-			strb.append(",");
-		}
-		strb.append("}");
-		return strb.toString();
-	}
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.gvsig.metadata.Metadata#getMetadataName()
+     */
+    public String getMetadataName() throws MetadataException {
+        StringBuffer strb = new StringBuffer();
+        strb.append("Layer Group '");
+        strb.append(this.getName());
+        strb.append("': {");
+        Iterator iter = this.layers.iterator();
+        while (iter.hasNext()) {
+            strb.append(((FLayer) iter.next()).getMetadataName());
+            strb.append(",");
+        }
+        strb.append("}");
+        return strb.toString();
+    }
 
+    public void beginDraw(Graphics2D g, ViewPort viewPort) {
+        LayerDrawEvent beforeEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_BEFORE_DRAW);
+        fmap.fireLayerDrawingEvent(beforeEvent);
+    }
 
-	public void beginDraw(Graphics2D g, ViewPort viewPort) {
-		LayerDrawEvent beforeEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_BEFORE_DRAW);
-		fmap.fireLayerDrawingEvent(beforeEvent);
-	}
+    public void endDraw(Graphics2D g, ViewPort viewPort) {
+        LayerDrawEvent afterEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW);
+        fmap.fireLayerDrawingEvent(afterEvent);
+    }
 
-	public void endDraw(Graphics2D g, ViewPort viewPort) {
-		LayerDrawEvent afterEvent = new LayerDrawEvent(this, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW);
-		fmap.fireLayerDrawingEvent(afterEvent);
-	}
-
     public static class RegisterPersistence implements Callable {
 
         public Object call() {
-		
-		PersistenceManager manager = ToolsLocator.getPersistenceManager();
-		DynStruct definition = manager.addDefinition(
-				FLayers.class,
-				"FLayers",
-				"FLayers Persistence definition",
-				null, 
-				null
-		);
-		definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, "FLyrDefault");
-		
-		definition.addDynFieldObject("mapContext").setClassOfValue(MapContext.class).setMandatory(true);
-		definition.addDynFieldList("layers").setClassOfItems(FLayer.class).setMandatory(true);
-            
+
+            PersistenceManager manager = ToolsLocator.getPersistenceManager();
+            DynStruct definition = manager.addDefinition(
+                    FLayers.class,
+                    "FLayers",
+                    "FLayers Persistence definition",
+                    null,
+                    null
+            );
+            definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, "FLyrDefault");
+
+            definition.addDynFieldObject("mapContext").setClassOfValue(MapContext.class).setMandatory(true);
+            definition.addDynFieldList("layers").setClassOfItems(FLayer.class).setMandatory(true);
+
             return Boolean.TRUE;
         }
     }
 
-	protected void doDispose() throws BaseException {
-		if (layers != null) {
-			for (int i = 0; i < layers.size(); i++) {
-				dispose((Disposable) layers.get(i));
-			}
-		}
-	}
-	
-	public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException{
-			
-		callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(layer));
-		group.addLayer(layer, where, adjoiningLayer);
-		removeLayer(layer);
-		this.updateDrawVersion();
-		callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(layer));
+    protected void doDispose() throws BaseException {
+        if (layers != null) {
+            for (int i = 0; i < layers.size(); i++) {
+                dispose((Disposable) layers.get(i));
+            }
+        }
+    }
 
-	}
-	
-	public void join(FLayer layer, LayerCollection group) {
-		try {
-			layers.remove(layer);
-			group.addLayer(layer, END, null);
-			this.updateDrawVersion();
-		} catch (LayerNotFoundInCollectionException e){
-			throw new MapContextRuntimeException(e);
-		}
-	}
+    public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException {
 
-	public void move(FLayer layer, LayerCollection group) {
-		try {
-			move(layer, group, END, null);
-		} catch (LayerNotFoundInCollectionException e){
-			throw new MapContextRuntimeException(e);
-		}
-	}
-	
-	public void addLayer(FLayer layer, int where, FLayer adjoiningLayer)
-	throws LayerNotFoundInCollectionException {
+        callLayerRemoving(LayerCollectionEvent.createLayerRemovingEvent(layer));
+        group.addLayer(layer, where, adjoiningLayer);
+        removeLayer(layer);
+        this.updateDrawVersion();
+        callLayerRemoved(LayerCollectionEvent.createLayerRemovedEvent(layer));
 
-		switch (where) {
-		case BEGIN:
-			addLayer(0,layer);
-			break;
-		case BEFORE:
-			if (adjoiningLayer!=null){
-				if (this.layers.contains(adjoiningLayer)){
-					for(int i=0; i<this.getLayersCount(); i++){
-						if(adjoiningLayer==this.getLayer(i)){
-							addLayer(i, layer);
-							break;
-						}
-					}
-				} else {
-					throw new LayerNotFoundInCollectionException(adjoiningLayer, this);
-				}
-			} else {
-				addLayer(0,layer);
-			}
-			break;
-		case AFTER:
-			if (adjoiningLayer!=null){
-				if (this.layers.contains(adjoiningLayer)){
-					for(int i=0; i<this.getLayersCount(); i++){
-						if(adjoiningLayer==this.getLayer(i)){
-							addLayer(i+1, layer);
-							break;
-						}
-					}
-				} else {
-					throw new LayerNotFoundInCollectionException(adjoiningLayer, this);
-				}
-			} else {
-				this.addLayer(layer);
-			}
-			break;
-		default: // By default add layer an the end of the collection
-			this.addLayer(layer);
-			break;
-		}
+    }
 
-	}
+    public void join(FLayer layer, LayerCollection group) {
+        try {
+            layers.remove(layer);
+            group.addLayer(layer, END, null);
+            this.updateDrawVersion();
+        } catch (LayerNotFoundInCollectionException e) {
+            throw new MapContextRuntimeException(e);
+        }
+    }
 
+    public void move(FLayer layer, LayerCollection group) {
+        try {
+            move(layer, group, END, null);
+        } catch (LayerNotFoundInCollectionException e) {
+            throw new MapContextRuntimeException(e);
+        }
+    }
+
+    public void addLayer(FLayer layer, int where, FLayer adjoiningLayer)
+            throws LayerNotFoundInCollectionException {
+
+        switch (where) {
+            case BEGIN:
+                addLayer(0, layer);
+                break;
+            case BEFORE:
+                if (adjoiningLayer != null) {
+                    if (this.layers.contains(adjoiningLayer)) {
+                        for (int i = 0; i < this.getLayersCount(); i++) {
+                            if (adjoiningLayer == this.getLayer(i)) {
+                                addLayer(i, layer);
+                                break;
+                            }
+                        }
+                    } else {
+                        throw new LayerNotFoundInCollectionException(adjoiningLayer, this);
+                    }
+                } else {
+                    addLayer(0, layer);
+                }
+                break;
+            case AFTER:
+                if (adjoiningLayer != null) {
+                    if (this.layers.contains(adjoiningLayer)) {
+                        for (int i = 0; i < this.getLayersCount(); i++) {
+                            if (adjoiningLayer == this.getLayer(i)) {
+                                addLayer(i + 1, layer);
+                                break;
+                            }
+                        }
+                    } else {
+                        throw new LayerNotFoundInCollectionException(adjoiningLayer, this);
+                    }
+                } else {
+                    this.addLayer(layer);
+                }
+                break;
+            default: // By default add layer an the end of the collection
+                this.addLayer(layer);
+                break;
+        }
+
+    }
+
 }
