Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/ExtentHistoryTest.java	(revision 36112)
@@ -0,0 +1,139 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Rectangle;
+import java.awt.geom.Rectangle2D;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests for the class {@link ExtentHistory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class ExtentHistoryTest extends TestCase {
+
+	protected void setUp() throws Exception {
+		super.setUp();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.ExtentHistory#put(java.awt.geom.Rectangle2D)}
+	 * .
+	 */
+	public void testPut() {
+		ExtentHistory history = new ExtentHistory();
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
+		Rectangle2D rectangle3 = new Rectangle2D.Double(3, 3, 4, 4);
+		history.put(rectangle3);
+		history.put(rectangle2);
+		history.put(rectangle);
+
+		assertEquals(rectangle, history.get());
+
+		history = new ExtentHistory(2);
+
+		history.put(rectangle);
+		history.put(rectangle2);
+		history.put(rectangle3);
+
+		assertEquals(rectangle3, history.get());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.ExtentHistory#hasPrevious()}.
+	 */
+	public void testHasPrevious() {
+		ExtentHistory history = new ExtentHistory();
+
+		assertFalse(history.hasPrevious());
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		history.put(rectangle);
+
+		assertTrue(history.hasPrevious());
+
+		history.removePrev();
+		assertFalse(history.hasPrevious());
+	}
+
+	/**
+	 * Test method for {@link org.gvsig.fmap.mapcontext.ExtentHistory#get()}.
+	 */
+	public void testGet() {
+		ExtentHistory history = new ExtentHistory();
+
+		assertNull("The ExtentHistory has got an element without adding one",
+				history.get());
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
+
+		history.put(rectangle);
+		assertEquals(rectangle, history.get());
+
+		history.put(rectangle2);
+		assertEquals(rectangle2, history.get());
+
+		history.removePrev();
+		assertEquals(rectangle, history.get());
+
+		history.removePrev();
+		assertNull("The ExtentHistory has got an element, "
+				+ "but all have been previously removed", history.get());
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.ExtentHistory#removePrev()}.
+	 */
+	public void testRemovePrev() {
+		ExtentHistory history = new ExtentHistory();
+
+		assertNull(
+				"The ExtentHistory allows removing an element without adding "
+						+ "at least one", history.removePrev());
+
+		Rectangle2D rectangle = new Rectangle2D.Double(1, 1, 2, 2);
+		Rectangle2D rectangle2 = new Rectangle2D.Double(2, 2, 3, 3);
+
+		history.put(rectangle);
+		history.put(rectangle2);
+
+		history.removePrev();
+		assertEquals(rectangle, history.get());
+
+		history.removePrev();
+		assertNull("The ExtentHistory allows to remove the last element, "
+				+ "but all have been previously removed", history.removePrev());
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java	(revision 36112)
@@ -0,0 +1,208 @@
+package org.gvsig.fmap.mapcontext.rendering.symbol;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+
+public class DummyVectorLegend implements IVectorLegend {
+
+    private long shpType = -1;
+
+    private ISymbol sym = new DummySymbol(Color.RED, TYPES.SOLID);
+
+    public DummyVectorLegend() {
+        shpType = System.currentTimeMillis() % 1000000;
+    }
+
+    public DummyVectorLegend(int type) {
+        shpType = type; // System.currentTimeMillis() % 1000000;
+    }
+
+    public void draw(BufferedImage image, Graphics2D graphics2D,
+        ViewPort viewPort, Cancellable cancel, double scale,
+        Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, FeatureQuery featureQuery) throws LegendException {
+
+    }
+    public void draw(BufferedImage image, Graphics2D graphics2D,
+        ViewPort viewPort, Cancellable cancel, double scale,
+        Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore) throws LegendException {
+
+        try {
+            FeatureSet fs = featureStore.getFeatureSet();
+            Iterator iter = fs.iterator();
+            Feature feat = null;
+            ISymbol symb = null;
+            while (iter.hasNext()) {
+                feat = (Feature) iter.next();
+                symb = this.getSymbolByFeature(feat);
+                symb.draw(graphics2D, viewPort.getAffineTransform(), feat.getDefaultGeometry(), feat, null);
+            }
+        } catch (DataException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        // TODO Auto-generated method stub
+
+    }
+
+    public int getShapeType() {
+        // TODO Auto-generated method stub
+        return (int) shpType;
+    }
+
+    public ISymbol getSymbolByFeature(Feature feat) {
+        return sym;
+    }
+
+    public boolean isSuitableForShapeType(int shapeType) {
+        return sym.getSymbolType() == shapeType;
+    }
+
+    public boolean isUseDefaultSymbol() {
+        return true;
+    }
+
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Object object, ICoordTrans coordTrans,
+        FeatureStore featureStore, Evaluator evaluator, PrintAttributes properties)
+    throws LegendException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setDefaultSymbol(ISymbol s) throws IllegalArgumentException {
+        sym = s;
+    }
+
+    public void setShapeType(int shapeType) {
+        shpType = shapeType;
+    }
+
+    public void useDefaultSymbol(boolean b) {
+    }
+
+    public void addLegendListener(LegendContentsChangedListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public ILegend cloneLegend() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public ISymbol getDefaultSymbol() {
+        return sym;
+    }
+
+    public LegendContentsChangedListener[] getListeners() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void removeLegendListener(LegendContentsChangedListener listener) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public String getClassName() {
+        return this.getClass().getName();
+    }
+
+
+
+
+    public void addDrawingObserver(Observer observer) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void deleteDrawingObserver(Observer observer) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void deleteDrawingObservers() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+        shpType = state.getLong("shpType");
+    }
+
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+        state.set("shpType", shpType);
+    }
+
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties)
+    throws LegendException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, PrintAttributes properties)
+    throws LegendException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public static void registerPersistent() {
+        PersistenceManager manager = ToolsLocator.getPersistenceManager();
+        DynStruct definition = manager.addDefinition(
+            DummyVectorLegend.class,
+            "DummyVectorLegend",
+            "DummyVectorLegend Persistence definition",
+            null, 
+            null
+        );
+        definition.addDynFieldLong("shpType")
+        .setMandatory(true);
+    }
+
+
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
+    }
+
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummyVectorLegend.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java	(revision 36112)
@@ -0,0 +1,158 @@
+package org.gvsig.fmap.mapcontext.rendering.symbol;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.PathIterator;
+import java.util.ArrayList;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+
+public class DummySymbol implements ISymbol {
+
+	private Color color = Color.GREEN;
+	private int type = TYPES.SOLID;
+	
+	public DummySymbol(Color c, int geomtype) {
+		color = c;
+		type = geomtype;
+	}
+	
+	public Object clone() {
+		return null;
+	}
+	
+	public void draw(Graphics2D g, AffineTransform affineTransform,
+			Geometry geom, Feature f, Cancellable cancel) {
+		
+		g.setColor(color);
+		
+		if (geom instanceof Point) {
+			Point p = (Point) geom;
+			p.transform(affineTransform);
+			g.drawRect((int) p.getX(), (int) p.getY(), 3, 3);
+		} else {
+			PathIterator piter = geom.getPathIterator(affineTransform); 
+			drawPathIterator(g, piter);
+		}
+	}
+
+	public void drawInsideRectangle(Graphics2D g,
+			AffineTransform scaleInstance, Rectangle r,
+			PrintAttributes properties) throws SymbolDrawingException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Color getColor() {
+		return color;
+	}
+
+	public String getDescription() {
+		return "a dummy symbol";
+	}
+
+	public int getOnePointRgb() {
+		return color.getRGB();
+	}
+
+	public void getPixExtentPlus(Geometry geom, float[] distances,
+			ViewPort viewPort, int dpi) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public ISymbol getSymbolForSelection() {
+		return new DummySymbol(Color.YELLOW, type);
+	}
+
+	public int getSymbolType() {
+		return type;
+	}
+
+	public boolean isOneDotOrPixel(Geometry geom,
+			double[] positionOfDotOrPixel, ViewPort viewPort, int dpi) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isShapeVisible() {
+		return true;
+	}
+
+	public boolean isSuitableFor(Geometry geom) {
+		return type == geom.getType();
+	}
+
+	public void setColor(Color c) {
+		color = c;
+	}
+
+	public void setDescription(String desc) {
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+	}
+
+	public void print(Graphics2D g, AffineTransform at, Geometry shape,
+			PrintAttributes properties) {
+	}
+	
+	
+	
+	/**
+	 * Draws the general path on the graphics object with the given affine transformation
+	 * @param g the graphics object
+	 * @param gp the general path
+	 */
+	public static void drawPathIterator(Graphics2D g, PathIterator pit) {
+		
+		ArrayList x = new ArrayList();
+		ArrayList y = new ArrayList();
+		double[] current = new double[6];
+		
+		while (!pit.isDone()) {
+			pit.currentSegment(current);
+			x.add(new Integer((int) current[0]));
+			y.add(new Integer((int) current[1]));
+			pit.next();
+		}
+		
+		int[] gx = integerArrayListToIntArray(x);
+		int[] gy = integerArrayListToIntArray(y);
+
+		g.drawPolyline(gx, gy, gx.length);
+	}
+	
+	
+	/**
+	 * Converts array list of Integer objects into array of int
+	 * @param l
+	 * @return array of int
+	 */
+	public static int[] integerArrayListToIntArray(ArrayList l) {
+
+		int size = l.size();
+		int[] resp = new int[size];
+		for (int i=0; i<size; i++) {
+			resp[i] = ((Integer) l.get(i)).intValue();
+		}
+		return resp;
+	}
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/rendering/symbol/DummySymbol.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactoryTest.java	(revision 36112)
@@ -0,0 +1,95 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Dimension;
+
+import org.easymock.MockControl;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link DimensionPersistenceFactory}.
+ * 
+ * @author gvSIG team
+ */
+public class DimensionPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private DimensionPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Dimension dimension;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (DimensionPersistenceFactory) persistenceManager
+				.getFactories().get(Dimension.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		dimension = new Dimension(320, 200);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getInt(DimensionPersistenceFactory.FIELD_WIDTH), dimension.width);			
+		stateControl.expectAndReturn(state
+				.getInt(DimensionPersistenceFactory.FIELD_HEIGHT), dimension.height);				
+		stateControl.replay();
+
+		Dimension newDimension = (Dimension) factory.createFromState(state);
+		assertTrue(newDimension.equals(dimension));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(DimensionPersistenceFactory.FIELD_WIDTH, dimension.width);
+		state.set(DimensionPersistenceFactory.FIELD_HEIGHT, dimension.height);
+				
+		stateControl.replay();
+
+		factory.saveToState(state, dimension);
+
+		stateControl.verify();
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactoryTest.java	(revision 36112)
@@ -0,0 +1,95 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Font;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link FontPersistenceFactory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class FontPersistenceFactoryTest extends AbstractLibraryAutoInitTestCase {
+
+	private FontPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Font font;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (FontPersistenceFactory) persistenceManager.getFactories()
+				.get(Font.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		font = new Font("Arial", Font.BOLD, 18);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getString(FontPersistenceFactory.FIELD_NAME), font.getName());
+		stateControl.expectAndReturn(state
+				.getInt(FontPersistenceFactory.FIELD_STYLE), font.getStyle());
+		stateControl.expectAndReturn(state
+				.getInt(FontPersistenceFactory.FIELD_SIZE), font.getSize());
+		stateControl.replay();
+
+		Font newFont = (Font) factory.createFromState(state);
+		assertTrue(newFont.equals(font));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(FontPersistenceFactory.FIELD_NAME, font.getName());
+		state.set(FontPersistenceFactory.FIELD_STYLE, font.getStyle());
+		state.set(FontPersistenceFactory.FIELD_SIZE, font.getSize());
+		stateControl.replay();
+
+		factory.saveToState(state, font);
+
+		stateControl.verify();
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactoryTest.java	(revision 36112)
@@ -0,0 +1,120 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Rectangle2D;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link Rectangle2DPersistenceFactory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class Rectangle2DPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private Rectangle2DPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Rectangle2D rectangle;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (Rectangle2DPersistenceFactory) persistenceManager
+				.getFactories().get(Rectangle2D.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		double x = Math.random() * 1000d;
+		double y = Math.random() * 1000d;
+		rectangle = new Rectangle2D.Double(x, y, 320, 200);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#createFromState(PersistentState, Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_X), rectangle
+				.getX());
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_Y), rectangle
+				.getY());
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_WIDTH),
+				rectangle.getWidth());
+		stateControl.expectAndReturn(state
+				.getDouble(Rectangle2DPersistenceFactory.FIELD_HEIGHT),
+				rectangle.getHeight());
+		stateControl.replay();
+
+		Rectangle2D newRectangle = (Rectangle2D) factory.createFromState(state);
+
+		System.out.println("Orig x = " + rectangle.getX() + " - New x = "
+				+ newRectangle.getX());
+		assertEquals(rectangle.getX(), newRectangle.getX(), 0.0d);
+		System.out.println("Orig y = " + rectangle.getY() + " - New y = "
+				+ newRectangle.getY());
+		assertEquals(rectangle.getY(), newRectangle.getY(), 0.0d);
+		System.out.println("Orig width = " + rectangle.getWidth()
+				+ " - New width = " + newRectangle.getWidth());
+		assertEquals(rectangle.getWidth(), newRectangle.getWidth(), 0.0d);
+		System.out.println("Orig height = " + rectangle.getHeight()
+				+ " - New height = " + newRectangle.getHeight());
+		assertEquals(rectangle.getHeight(), newRectangle.getHeight(), 0.0d);
+
+		assertTrue(newRectangle.equals(rectangle));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(Rectangle2DPersistenceFactory.FIELD_X, rectangle.getX());
+		state.set(Rectangle2DPersistenceFactory.FIELD_Y, rectangle.getY());
+		state.set(Rectangle2DPersistenceFactory.FIELD_WIDTH, rectangle
+				.getWidth());
+		state.set(Rectangle2DPersistenceFactory.FIELD_HEIGHT, rectangle
+				.getHeight());
+		stateControl.replay();
+
+		factory.saveToState(state, rectangle);
+
+		stateControl.verify();
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactoryTest.java	(revision 36112)
@@ -0,0 +1,99 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Color;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link ColorPersistenceFactory}.
+ * 
+ * @author gvSIG team
+ */
+public class ColorPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private ColorPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Color color;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (ColorPersistenceFactory) persistenceManager.getFactories()
+				.get(Color.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		color = Color.magenta;
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#createFromState(org.gvsig.tools.persistence.PersistentState, java.lang.Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_RED), color.getRed());
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_GREEN), color.getGreen());
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_BLUE), color.getBlue());
+		stateControl.expectAndReturn(state
+				.getInt(ColorPersistenceFactory.FIELD_ALPHA), color.getAlpha());
+		stateControl.replay();
+
+		Color newColor = (Color) factory.createFromState(state);
+		assertTrue(newColor.equals(color));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(ColorPersistenceFactory.FIELD_RED, color.getRed());
+		state.set(ColorPersistenceFactory.FIELD_GREEN, color.getGreen());
+		state.set(ColorPersistenceFactory.FIELD_BLUE, color.getBlue());
+		state.set(ColorPersistenceFactory.FIELD_ALPHA, color.getAlpha());
+		stateControl.replay();
+
+		factory.saveToState(state, color);
+
+		stateControl.verify();
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactoryTest.java	(revision 36112)
@@ -0,0 +1,94 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Point2D;
+
+import org.easymock.MockControl;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Unit tests for the class {@link Point2DPersistenceFactory}.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class Point2DPersistenceFactoryTest extends
+		AbstractLibraryAutoInitTestCase {
+
+	private Point2DPersistenceFactory factory;
+	private MockControl stateControl;
+	private PersistentState state;
+	private Point2D point;
+
+	protected void doSetUp() throws Exception {
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+		factory = (Point2DPersistenceFactory) persistenceManager.getFactories()
+				.get(Point2D.class);
+		stateControl = MockControl.createNiceControl(PersistentState.class);
+		state = (PersistentState) stateControl.getMock();
+		double x = Math.random() * 1000d;
+		double y = Math.random() * 1000d;
+		point = new Point2D.Double(x, y);
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#createFromState(PersistentState, Class)}
+	 * .
+	 */
+	public void testCreateFromState() throws Exception {
+		stateControl.expectAndReturn(state
+				.getDouble(Point2DPersistenceFactory.FIELD_X), point.getX());
+		stateControl.expectAndReturn(state
+				.getDouble(Point2DPersistenceFactory.FIELD_Y), point.getY());
+		stateControl.replay();
+
+		Point2D newPoint = (Point2D) factory.createFromState(state);
+		assertTrue(newPoint.equals(point));
+
+		stateControl.verify();
+	}
+
+	/**
+	 * Test method for
+	 * {@link org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory#saveToState(org.gvsig.tools.persistence.PersistentState, java.lang.Object)}
+	 * .
+	 */
+	public void testSaveToState() throws Exception {
+		state.set(Point2DPersistenceFactory.FIELD_X, point.getX());
+		state.set(Point2DPersistenceFactory.FIELD_Y, point.getY());
+		stateControl.replay();
+
+		factory.saveToState(state, point);
+
+		stateControl.verify();
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManagerTest.java	(revision 36112)
@@ -0,0 +1,321 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextDrawer;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class DefaultMapContextManagerTest extends
+AbstractLibraryAutoInitTestCase {
+
+    private DefaultMapContextManager manager;
+
+    protected void doSetUp() throws Exception {
+        manager = new DefaultMapContextManager();
+
+        manager.registerLegend("DummyLegend", DummyVectorLegend.class);
+        manager.setDefaultVectorLegend("DummyLegend");
+        manager.registerLegendReader("Dummy", DummyLegendReader.class);
+        manager.registerLegendWriter("DummyLegend", "Dummy", DummyLegendWriter.class);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.mapcontext.impl.DefaultMapContextManager#createDefaultMapContextDrawerInstance()}
+     * .
+     */
+    public void testGetDefaultMapContextDrawerInstance() throws Exception {
+
+        manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class);
+
+        MapContextDrawer drawer = manager
+        .createDefaultMapContextDrawerInstance();
+
+        assertNotNull("The created MapContextDrawer instance can't be null",
+            drawer);
+        assertTrue(
+            "The created MapContextDrawer is not instance of the registered class"
+            + DummyMapContextDrawer.class,
+            drawer instanceof DummyMapContextDrawer);
+    }
+
+    /**
+     * Test method for
+     * {@link org.gvsig.fmap.mapcontext.impl.DefaultMapContextManager#setDefaultMapContextDrawer(java.lang.Class)}
+     * .
+     */
+    public void testSetDefaultMapContextDrawer() throws Exception {
+
+        // First, try to register an invalid class
+        try {
+            manager.setDefaultMapContextDrawer(Object.class);
+            fail("Error, a class that does not implement the MapContextDrawer "
+                + "interface has been accepted");
+        } catch (MapContextRuntimeException e) {
+            // OK
+        }
+
+        // Next, try to register a valid class
+        manager.setDefaultMapContextDrawer(DummyMapContextDrawer.class);
+    }
+
+    public void testCreateGraphicsLayer() throws Exception {
+        assertNotNull(manager.createGraphicsLayer(CRSFactory.getCRS("EPSG:23030")));
+    }
+
+    public void testCreateDefaultVectorLegend() throws Exception {
+
+        IVectorLegend legend = manager.createDefaultVectorLegend(1);
+        assertNotNull(legend);
+        assertTrue(legend instanceof DummyVectorLegend);
+    }
+
+    public void testRegisterCreateLegend() throws Exception {
+
+        manager.registerLegend("DummyLegend", DummyVectorLegend.class);
+
+        ILegend legend = manager.createLegend("DummyLegend");
+        assertNotNull(legend);
+        assertTrue(legend instanceof DummyVectorLegend);
+
+        assertNull(manager.createLegend("NONE"));
+    }
+
+    public void testRegisterCreateLegendReader() throws Exception {
+
+        manager.registerLegendReader("Dummy", DummyLegendReader.class);
+
+        ILegendReader legendReader = manager.createLegendReader("Dummy");
+        assertNotNull(legendReader);
+        assertTrue(legendReader instanceof DummyLegendReader);
+
+        assertNull(manager.createLegendReader("NONE"));
+    }
+
+    public void testRegisterCreateLegendWriter() throws Exception {
+
+        manager.registerLegend("DummyLegend", DummyVectorLegend.class);
+
+        manager.registerLegendWriter("DummyLegend", "Dummy",
+            DummyLegendWriter.class);
+
+        // Test the registered writer is created
+        ILegendWriter legendWriter = manager.createLegendWriter("DummyLegend",
+        "Dummy");
+        assertNotNull(legendWriter);
+        assertTrue(legendWriter instanceof DummyLegendWriter);
+
+        // Test non registered cases
+        assertNull(manager.createLegendWriter("NONE", "Dummy"));
+        assertNull(manager.createLegendWriter("DummyLegend", "NONE"));
+        assertNull(manager.createLegendWriter("NONE", "NONE"));
+    }
+
+    public static class DummyMapContextDrawer implements MapContextDrawer {
+
+        public void dispose() {
+        }
+
+        public void draw(FLayers root, BufferedImage image, Graphics2D g,
+            Cancellable cancel, double scale) throws ReadException {
+        }
+
+        public void print(FLayers root, Graphics2D g, Cancellable cancel,
+            double scale, PrintAttributes properties) throws ReadException {
+        }
+
+        public void setMapContext(MapContext mapContext) {
+        }
+
+        public void setViewPort(ViewPort viewPort) {
+        }
+
+    }
+
+    public static class DummyLegendReader implements ILegendReader {
+
+    }
+
+    public static class DummyLegendWriter implements ILegendWriter {
+
+    }
+
+    public static class DummyVectorLegend implements IVectorLegend {
+
+        public void draw(BufferedImage image, Graphics2D graphics2d,
+            ViewPort viewPort, Cancellable cancel, double scale,
+            Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore, FeatureQuery featureQuery) throws LegendException {
+            // Empty method
+        }
+
+        public void draw(BufferedImage image, Graphics2D graphics2d,
+            ViewPort viewPort, Cancellable cancel, double scale,
+            Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore) throws LegendException {
+            // Empty method
+        }
+
+        public int getShapeType() {
+            // Empty method
+            return 0;
+        }
+
+        public ISymbol getSymbolByFeature(Feature feat)
+        throws MapContextException {
+            // Empty method
+            return null;
+        }
+
+        public boolean isSuitableForShapeType(int shapeType) {
+            // Empty method
+            return false;
+        }
+
+        public boolean isUseDefaultSymbol() {
+            // Empty method
+            return false;
+        }
+
+        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore, PrintAttributes properties)
+        throws LegendException {
+            // Empty method
+        }
+
+        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, Map queryParameters, ICoordTrans coordTrans,
+            FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties)
+        throws LegendException {
+            // Empty method
+        }
+
+        public void setDefaultSymbol(ISymbol s) {
+            // Empty method
+        }
+
+        public void setShapeType(int shapeType) {
+            // Empty method
+        }
+
+        public void useDefaultSymbol(boolean b) {
+            // Empty method
+        }
+
+        public void addLegendListener(LegendContentsChangedListener listener) {
+            // Empty method
+        }
+
+        public ILegend cloneLegend() {
+            // Empty method
+            return null;
+        }
+
+        public Object clone() throws CloneNotSupportedException {
+            // TODO Auto-generated method stub
+            return super.clone();
+        }
+
+        public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event) {
+            // Empty method
+        }
+
+        public ISymbol getDefaultSymbol() {
+            // Empty method
+            return null;
+        }
+
+        public LegendContentsChangedListener[] getListeners() {
+            // Empty method
+            return null;
+        }
+
+        public void removeLegendListener(LegendContentsChangedListener listener) {
+            // Empty method
+        }
+
+        public void loadFromState(PersistentState state)
+        throws PersistenceException {
+            // Empty method
+        }
+
+        public void saveToState(PersistentState state)
+        throws PersistenceException {
+            // Empty method
+        }
+
+        public void addDrawingObserver(Observer observer) {
+            // Empty method
+        }
+
+        public void deleteDrawingObserver(Observer observer) {
+            // Empty method
+        }
+
+        public void deleteDrawingObservers() {
+            // Empty method
+        }
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java	(revision 36112)
@@ -0,0 +1,1320 @@
+package org.gvsig.fmap.mapcontext.persistence;
+
+import java.text.DateFormat;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataQuery;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
+import org.gvsig.fmap.dal.feature.FeatureCache;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureIndexes;
+import org.gvsig.fmap.dal.feature.FeatureLocks;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureRules;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.CoercionException;
+import org.gvsig.tools.dataTypes.DataType;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynField;
+import org.gvsig.tools.dynobject.DynMethod;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynObjectValueItem;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynFieldValidateException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynObjectValidateException;
+import org.gvsig.tools.evaluator.Evaluator;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.visitor.Visitor;
+
+public class DummyFileFeatureStore implements FeatureStore {
+
+	public static class DummyFeatureAttributeDescriptor implements
+			FeatureAttributeDescriptor {
+
+		public boolean allowNull() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public Object getAdditionalInfo(String infoName) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getCopy() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public DataType getDataType() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public String getDataTypeName() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public DateFormat getDateFormat() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Object getDefaultValue() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Evaluator getEvaluator() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getGeometrySubType() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getGeometryType() {
+			return Geometry.TYPES.POINT;
+		}
+
+		public int getIndex() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getMaximumOccurrences() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getMinimumOccurrences() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public String getName() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Class getObjectClass() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getPrecision() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public IProjection getSRS() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getSize() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public int getType() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public boolean isAutomatic() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public boolean isPrimaryKey() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public boolean isReadOnly() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+      
+        public String getSubtype() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public int getTheTypeOfAvailableValues() {
+            // TODO Auto-generated method stub
+            return 0;
+        }
+
+        public boolean isContainer() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public boolean isHidden() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public boolean isMandatory() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public boolean isPersistent() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public DynField setAvailableValues(DynObjectValueItem[] values) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setAvailableValues(List values) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setClassOfItems(Class theClass)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setClassOfValue(Class theClass)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setDefaultDynValue(Object defaultValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setDefaultFieldValue(Object defaultValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setDescription(String description) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setElementsType(int type)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setElementsType(DynStruct type)
+            throws DynFieldIsNotAContainerException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setGroup(String groupName) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setHidden(boolean hidden) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setMandatory(boolean mandatory) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setMaxValue(Object maxValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setMinValue(Object minValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setOrder(int order) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setPersistent(boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setReadOnly(boolean isReadOnly) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setSubtype(String subtype) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setTheTypeOfAvailableValues(int type) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setType(int type) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField setType(DataType type) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void validate(Object value) throws DynFieldValidateException {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public Object coerce(Object value) throws CoercionException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynObjectValueItem[] getAvailableValues() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Class getClassOfItems() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Class getClassOfValue() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getDescription() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField getElementsType() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getGroup() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Object getMaxValue() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public Object getMinValue() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public int getOder() {
+            // TODO Auto-generated method stub
+            return 0;
+        }
+
+        public boolean isTime() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public FeatureAttributeGetter getFeatureAttributeGetter() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void setFeatureAttributeGetter(
+            FeatureAttributeGetter featureAttributeGetter) {
+            // TODO Auto-generated method stub
+            
+        }
+
+	}
+
+	public static class DummyFeatureType implements FeatureType {
+
+		public boolean allowAutomaticValues() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public Object get(String name) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public Object get(int index) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getAttributeDescriptor(String name) {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getAttributeDescriptor(int index) {
+			return new DummyFeatureAttributeDescriptor();
+		}
+
+		public FeatureAttributeDescriptor[] getAttributeDescriptors() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureType getCopy() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureAttributeDescriptor getDefaultGeometryAttribute() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getDefaultGeometryAttributeIndex() {
+			return 0;
+		}
+
+		public String getDefaultGeometryAttributeName() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public IProjection getDefaultSRS() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public EditableFeatureType getEditable() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public String getId() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int getIndex(String name) {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+		public FeatureAttributeDescriptor[] getPrimaryKey() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public FeatureRules getRules() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public List getSRSs() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public boolean hasEvaluators() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public boolean hasOID() {
+			// TODO Auto-generated method stub
+			return false;
+		}
+
+		public Iterator iterator() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		public int size() {
+			// TODO Auto-generated method stub
+			return 0;
+		}
+
+        public DynClass[] getSuperDynClasses() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void removeDynMethod(String name) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public DynField addDynField(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldArray(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldBoolean(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldChoice(String name, int type,
+            Object defaultValue, DynObjectValueItem[] values,
+            boolean mandatory, boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldChoice(String name, int type,
+            Object defaultValue, DynObjectValueItem[] values) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldDate(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldDouble(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldFile(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldFloat(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldFolder(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldInt(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldList(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldLong(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldMap(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldObject(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldRange(String name, int type,
+            Object defaultValue, Object min, Object max, boolean mandatory,
+            boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldRange(String name, int type,
+            Object defaultValue, Object min, Object max) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldSet(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldSingle(String name, int type,
+            Object defaultValue, boolean mandatory, boolean persistent) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldSingle(String name, int type,
+            Object defaultValue) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldString(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldURI(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField addDynFieldURL(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void extend(DynStruct struct) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void extend(String namespace, String structName) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void extend(String structName) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public DynField getDeclaredDynField(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField[] getDeclaredDynFields() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getDescription() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField getDynField(String name) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynField[] getDynFields() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getFullName() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getName() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getNamespace() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynStruct[] getSuperDynStructs() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public boolean isInstance(DynObject dynObject) {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public DynObject newInstance() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public void removeDynField(String name) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void setDescription(String description) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void setNamespace(String namespace) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void validate(DynObject object)
+            throws DynObjectValidateException {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void addDynMethod(DynMethod dynMethod) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public DynMethod getDeclaredDynMethod(String name)
+            throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod[] getDeclaredDynMethods() throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod getDynMethod(String name) throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod getDynMethod(int code) throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public DynMethod[] getDynMethods() throws DynMethodException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public boolean isExtendable(DynStruct dynStruct) {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+		public void extend(DynStruct[] structs) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void remove(DynStruct superDynStruct) {
+			// TODO Auto-generated method stub
+			
+		}
+
+		public void removeAll(DynStruct[] superDynStruct) {
+			// TODO Auto-generated method stub
+			
+		}
+
+        public FeatureAttributeDescriptor getDefaultTimeAttribute() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+	}
+
+	private String name = "[empty]";
+	
+	public DummyFileFeatureStore() {
+		
+	}
+	
+	public DummyFileFeatureStore(String id) {
+		name = "[FILE FEATURE STORE - " + id + "]";
+	}
+	
+	public boolean allowWrite() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void beginEditingGroup(String description)
+			throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void cancelEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureQuery createFeatureQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSelection createFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			Feature defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			boolean defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(boolean defaultValues)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delete(Feature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endEditingGroup() throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void finishEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getDefaultFeatureType() throws DataException {
+		return new DummyFeatureType();
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference,
+			FeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public long getFeatureCount() throws DataException {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public FeatureSelection getFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet(FeatureQuery featureQuery)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getFeatureSet(FeatureQuery featureQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getFeatureSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getFeatureType(String featureTypeId)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getFeatureTypes() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndexes getIndexes() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureLocks getLocks() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataStoreParameters getParameters() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public IProjection getSRSDefaultGeometry() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureStoreTransforms getTransforms() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void insert(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean isAppendModeSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isAppending() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isEditing() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isLocksSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void setSelection(FeatureSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void validateFeatures(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataQuery createQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet createSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Iterator getChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet(DataQuery dataQuery) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getDataSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getDataSet(DataQuery dataQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataServerExplorer getExplorer() throws DataException,
+			ValidateDataParametersException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public DataSet getSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void refresh() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setSelection(DataSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void beginComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void disableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void enableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObservers() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		name = state.getString("name");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("name", name);
+	}
+
+	public Set getMetadataChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getMetadataID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getMetadataName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delegate(DynObject dynObject) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DynClass getDynClass() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public boolean hasDynValue(String name) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void implement(DynClass dynClass) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canRedo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean canUndo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public List getRedoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getUndoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void redo() throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void redo(int num) throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo() throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo(int num) throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+	
+	
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				DummyFileFeatureStore.class,
+				"DummyFileFeatureStore",
+				"DummyFileFeatureStore Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldString("name")
+			.setMandatory(true);
+	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void accept(Visitor visitor, DataQuery dataQuery)
+			throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void createCache(String name, DynObject parameters)
+			throws DataException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public FeatureCache getCache() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void clear() {
+		// Nothing to do
+	}
+
+	public void export(DataServerExplorer explorer, String provider,
+			NewFeatureStoreParameters params) throws DataException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public String getProviderName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getFullName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    public boolean isKnownEnvelope() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean hasRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public int getRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public Interval getInterval() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes(Interval interval) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName)
+        throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        Observer observer) throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java	(revision 36112)
@@ -0,0 +1,350 @@
+package org.gvsig.fmap.mapcontext.persistence;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.geom.Rectangle2D;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import org.gvsig.fmap.crs.CRSFactory;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.impl.Envelope2D;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbol.DummyVectorLegend;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MapContextPersistenceTest extends AbstractLibraryAutoInitTestCase {
+
+	final static private Logger logger =
+			LoggerFactory.getLogger(MapContextPersistenceTest.class);
+
+	protected void doSetUp() throws Exception {
+		DummyVectorLegend.registerPersistent();
+		DummyDBFeatureStore.registerPersistent();
+		DummyFileFeatureStore.registerPersistent();
+
+		MapContextLocator.getMapContextManager().registerLegend("DummyLegend",
+				DummyVectorLegend.class);
+		MapContextLocator.getMapContextManager().setDefaultVectorLegend(
+				"DummyLegend");
+	}
+	
+	private File getTempFile() throws Exception {
+
+		File tempFile = File.createTempFile("persisted_mapcontext", ".xml");
+		if (tempFile.exists())
+			tempFile.delete();
+		tempFile.createNewFile();
+		
+		System.out.println("TEMP FILE: " + tempFile.getAbsolutePath());
+		return tempFile;
+	}
+	
+	public void testMapContext() throws Exception {
+		ViewPort vp = getViewPort();
+		logger.debug("Creating mapcontext...");
+		MapContext mc = new MapContext(vp);
+		addDummyLayers(mc);
+		doTestPersist(mc);
+	}
+
+	public void noTestFLyrs() throws Exception {
+		
+		int lyr_count = 3;
+		// testPersist(mc);
+		FLyrVect[] lyr = new FLyrVect[lyr_count];
+		FeatureStore[] fs = new FeatureStore[lyr_count];
+		FLayers lyrs = new FLayers();
+		
+		for (int i=0; i<lyr_count; i++) {
+			fs[i] = new DummyFileFeatureStore("" + System.currentTimeMillis());
+			lyr[i] = createLayer(fs[i]);
+			lyr[i].setName("Layer " + (i+System.currentTimeMillis()));
+			lyr[i].setIsLabeled(false);
+			try { lyr[i].setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) {
+				assertTrue("Error while creating legend: " + e.getMessage(), false);
+			}
+			lyrs.addLayer(lyr[i]);
+			lyr[i].dispose();
+		}
+		
+		for (int i=0; i<lyr_count; i++) {
+			fs[i] = new DummyDBFeatureStore("" + System.currentTimeMillis());
+			lyr[i] = createLayer(fs[i]);
+			lyr[i].setName("Layer " + (10000 + i + System.currentTimeMillis()));
+			lyr[i].setIsLabeled(false);
+			try { lyr[i].setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) {
+				assertTrue("Error while creating legend: " + e.getMessage(), false);
+			}
+			lyrs.addLayer(lyr[i]);
+			lyr[i].dispose();
+		}
+		
+		doTestPersist(lyrs);
+	}
+	
+	
+	
+	private ViewPort getViewPort() {
+		
+		ViewPort vp = new ViewPort(CRSFactory.getCRS("EPSG:4326"));
+		vp.setImageSize(new Dimension(640, 480));
+		Envelope env = new Envelope2D(0, 0, 1000000, 1000000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(200000, 200000, 500000, 500000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(300000, 300000, 300000, 300000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(400000, 400000, 200000, 200000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(440000, 440000, 100000, 100000);
+		vp.setEnvelope(env);
+		env = new Envelope2D(480000, 480000, 30000, 30000);
+		vp.setEnvelope(env);
+		vp.setBackColor(Color.YELLOW);
+		vp.setClipRect(new Rectangle2D.Double(0, 0, 10, 10));
+		return vp;
+	}
+
+	private void addDummyLayers(MapContext mcon) throws Exception {
+		
+		FLayers resp = new FLayers();
+		resp.setMapContext(mcon);
+		resp.setName("root layer");
+		
+		FLayers aux = new FLayers();
+		aux.setMapContext(mcon);
+		aux.setName("Group");
+		
+		FLyrVect lyr = null;
+		IVectorLegend lgn = null;
+		FeatureStore fs = null;
+		
+		logger.debug("Adding dummy layers...");
+			
+		fs = new DummyFileFeatureStore("1");
+		lyr = createLayer(fs);
+		lyr.setName("Layer 1");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+		
+		aux.addLayer(lyr);
+		lyr.dispose();
+		
+		fs = new DummyDBFeatureStore("A");
+		lyr = createLayer(fs);
+		lyr.setName("Layer A");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+
+		aux.addLayer(lyr);
+		lyr.dispose();
+		
+		fs = new DummyFileFeatureStore("2");
+		lyr = createLayer(fs);
+		lyr.setName("Layer 2");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+
+		aux.addLayer(lyr);
+		lyr.dispose();
+		
+		fs = new DummyDBFeatureStore("B");
+		lyr = createLayer(fs);
+		lyr.setName("Layer 1");
+		try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { }
+		
+		resp.addLayer(lyr);
+		resp.addLayer(aux);
+		lyr.dispose();
+		aux.dispose();
+		
+		mcon.getLayers().addLayer(resp);
+		resp.dispose();
+	}
+
+	private FLyrVect createLayer(FeatureStore fs) throws Exception {
+		
+		FLyrVect resp = new FLyrVect();
+		resp.setDataStore(fs);
+		resp.wakeUp();
+		resp.load();
+		return resp;
+	}
+
+	private void doTestPersist(Persistent p) throws Exception {
+		
+		System.out.println("Starting persistence test for class: " + p.getClass().getName());
+
+		File perfile = getTempFile();
+		FileOutputStream fos = new FileOutputStream(perfile);
+		System.out.println("Getting state for class: " + p.getClass().getName());
+		PersistentState pst = ToolsLocator.getPersistenceManager().getState(p);
+		System.out.println("Saving state...");
+
+		System.out.println("Saving state...");
+		ToolsLocator.getPersistenceManager().saveState(pst, fos);
+		System.out.println("Saving state... done.");
+
+		fos.close();
+
+		// ==============================================
+		// ==============================================
+		System.out.println("Is now persisted: " + p.getClass().getName());
+		// ==============================================
+
+		// if (true) return;
+
+		System.out.println("Opening persistence file...");
+		FileInputStream fis = new FileInputStream(perfile);
+
+		System.out.println("Loading state from file...");
+		pst = ToolsLocator.getPersistenceManager().loadState(fis);
+
+		System.out.println("Instantiating " + p.getClass().getName()
+				+ " from state, pst = " + pst);
+		Object p2 = ToolsLocator.getPersistenceManager().create(pst);
+
+		System.out.println("Comparing original and current...");
+		comparePersistent(p, p2);
+
+		System.out.println("Successful mapcontext persistence test!");
+		
+	}
+
+	
+	// FeatureStore, ILegend, ViewPort
+	private void comparePersistent(Persistent p, Object p2) {
+		
+		if (p2.getClass().getName().compareTo(p.getClass().getName()) == 0) {
+			
+			if (p instanceof MapContext) {
+				compareMapContexts((MapContext) p, (MapContext) p2);
+			} else {
+				if (p instanceof FLayer) {
+					compareLayers((FLayer) p, (FLayer) p2);
+				} else {
+					if (p instanceof FeatureStore) {
+						compareStore((FeatureStore) p, (FeatureStore) p2);
+					} else {
+						if (p instanceof ILegend) {
+							compareLegend((ILegend) p, (ILegend) p2);
+						} else {
+							if (p instanceof ViewPort) {
+								compareViewPorts((ViewPort) p, (ViewPort) p2);
+							} else {
+								fail("Did not compare: " + p.getClass().getName());
+							}
+						}
+					}
+				}
+			}
+		} else {
+			fail("Comparing different classes (?)");
+		}
+		
+	}
+
+	private void compareMapContexts(MapContext m1, MapContext m2) {
+		
+		logger.debug("Getting viewports to compare...");
+		ViewPort vp1 = m1.getViewPort();
+		ViewPort vp2 = m2.getViewPort();
+		
+		compareViewPorts(vp1, vp2);
+
+		logger.debug("Getting root flayers to compare...");
+		FLayers lyr1 = m1.getLayers();
+		FLayers lyr2 = m2.getLayers();
+		compareLayers(lyr1, lyr2);
+	}
+
+	private void compareLayers(FLayer l1, FLayer l2) {
+		
+		logger.debug("Comparing layers...");
+
+		assertTrue("Layers of diff type!", l1.getClass().getName().compareTo(l2.getClass().getName()) == 0);
+		if (l1 instanceof FLayers) {
+			
+			logger.debug("(type FLayers)...");
+			FLayers ls1 = (FLayers) l1;
+			FLayers ls2 = (FLayers) l2;
+			assertEquals(ls1.getLayersCount(), ls2.getLayersCount());
+			int sz = ls2.getLayersCount();
+			for (int i=0; i<sz; i++) {
+				compareLayers(ls1.getLayer(i), ls2.getLayer(i));
+			}
+			
+		} else {
+			if (l1 instanceof FLyrVect) {
+				
+				logger.debug("(type FLyrVect)...");
+				FLyrVect ls1 = (FLyrVect) l1;
+				FLyrVect ls2 = (FLyrVect) l2;
+				compareVectLayers(ls1, ls2);
+				
+			} else {
+				
+			}
+		}
+
+	}
+
+	private void compareVectLayers(FLyrVect l1, FLyrVect l2) {
+		compareLegend(l1.getLegend(), l2.getLegend());
+		compareStore(l1.getFeatureStore(), l2.getFeatureStore());
+	}
+
+	private void compareStore(FeatureStore fs1,
+			FeatureStore fs2) {
+		
+		logger.debug("Comparing stores...");
+		assertTrue("Diff stores!", fs1.getName().compareTo(fs2.getName()) == 0);
+	}
+
+	private void compareLegend(ILegend l1, ILegend l2) {
+
+		logger.debug("Comparing legends...");
+		IVectorLegend vl1 = (IVectorLegend) l1;
+		IVectorLegend vl2 = (IVectorLegend) l2;
+		assertTrue("Diff legends!", vl1.getShapeType() == vl2.getShapeType());
+		
+	}
+
+	private void compareViewPorts(ViewPort vp1, ViewPort vp2) {
+
+
+		logger.debug("Comparing viewports...");
+		
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMinimum(0),
+				vp2.getAdjustedEnvelope().getMinimum(0),
+				0.00000000000001);
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMinimum(1),
+				vp2.getAdjustedEnvelope().getMinimum(1),
+				0.00000000000001);
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMaximum(0),
+				vp2.getAdjustedEnvelope().getMaximum(0),
+				0.00000000000001);
+		assertEquals(
+				vp1.getAdjustedEnvelope().getMaximum(1),
+				vp2.getAdjustedEnvelope().getMaximum(1),
+				0.00000000000001);
+	}
+	
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL
Added: svn:mergeinfo
Added: svn:eol-style
   + native

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java	(revision 36112)
@@ -0,0 +1,593 @@
+package org.gvsig.fmap.mapcontext.persistence;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DataQuery;
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureCache;
+import org.gvsig.fmap.dal.feature.FeatureIndex;
+import org.gvsig.fmap.dal.feature.FeatureIndexes;
+import org.gvsig.fmap.dal.feature.FeatureLocks;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.dal.feature.FeatureSelection;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreTransforms;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
+import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Interval;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.undo.RedoException;
+import org.gvsig.tools.undo.UndoException;
+import org.gvsig.tools.visitor.Visitor;
+
+public class DummyDBFeatureStore implements FeatureStore {
+
+	private String name = "[empty]";
+
+	public DummyDBFeatureStore() {
+		
+	}
+	
+	public DummyDBFeatureStore(String id) {
+		name = "[DATABASE FEATURE STORE - " + id + "]";
+	}
+
+	public boolean allowWrite() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void beginEditingGroup(String description)
+			throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void cancelEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureQuery createFeatureQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSelection createFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndex createIndex(FeatureType featureType,
+			String attributeName, String indexName, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			Feature defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(FeatureType type,
+			boolean defaultValues) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public EditableFeature createNewFeature(boolean defaultValues)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delete(Feature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void edit(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endEditingGroup() throws NeedEditingModeException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void export(DataServerExplorer explorer,
+			String providerName,
+			NewFeatureStoreParameters params) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void finishEditing() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getDefaultFeatureType() throws DataException {
+		return new DummyFileFeatureStore.DummyFeatureType();
+	}
+
+	public Envelope getEnvelope() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Feature getFeatureByReference(FeatureReference reference,
+			FeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public long getFeatureCount() throws DataException {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	public FeatureSelection getFeatureSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureSet getFeatureSet(FeatureQuery featureQuery)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getFeatureSet(FeatureQuery featureQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getFeatureSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public FeatureType getFeatureType(String featureTypeId)
+			throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getFeatureTypes() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureIndexes getIndexes() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureLocks getLocks() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataStoreParameters getParameters() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public IProjection getSRSDefaultGeometry() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public FeatureStoreTransforms getTransforms() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void insert(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean isAppendModeSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isAppending() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isEditing() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean isLocksSupported() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void setSelection(FeatureSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeatureType featureType) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void update(EditableFeature feature) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void validateFeatures(int mode) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataQuery createQuery() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet createSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Iterator getChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public DataSet getDataSet(DataQuery dataQuery) throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void getDataSet(Observer observer) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void getDataSet(DataQuery dataQuery, Observer observer)
+			throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DataServerExplorer getExplorer() throws DataException,
+			ValidateDataParametersException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getName() {
+		// TODO Auto-generated method stub
+		return name;
+	}
+
+	public DataSet getSelection() throws DataException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void refresh() throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setSelection(DataSet selection) throws DataException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void beginComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void disableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void enableNotifications() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void endComplexNotification() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void addObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObserver(Observer o) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void deleteObservers() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		name = state.getString("name");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("name", name);
+	}
+
+	public Set getMetadataChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getMetadataID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getMetadataName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void delegate(DynObject dynObject) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public DynClass getDynClass() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public boolean hasDynValue(String name) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void implement(DynClass dynClass) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+			throws DynMethodException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void setDynValue(String name, Object value)
+			throws DynFieldNotFoundException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public boolean canRedo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean canUndo() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public List getRedoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public List getUndoInfos() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void redo() throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void redo(int num) throws RedoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo() throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void undo(int num) throws UndoException {
+		// TODO Auto-generated method stub
+
+	}
+	
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				DummyDBFeatureStore.class,
+				"DummyDBFeatureStore",
+				"DummyDBFeatureStore Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldString("name");
+	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void accept(Visitor visitor, DataQuery dataQuery)
+			throws BaseException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void createCache(String name, DynObject parameters)
+			throws DataException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public FeatureCache getCache() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public void clear() {
+		// Nothing to do
+	}
+
+	public String getProviderName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getFullName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    public boolean isKnownEnvelope() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean hasRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public int getRetrievedFeaturesLimit() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    public Interval getInterval() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Collection getTimes(Interval interval) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName)
+        throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public FeatureIndex createIndex(String indexTypeName,
+        FeatureType featureType, String attributeName, String indexName,
+        Observer observer) throws DataException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src-test/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Id URL

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources-test/log4j.xml
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources-test/log4j.xml	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources-test/log4j.xml	(revision 36112)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+		<layout class="org.apache.log4j.PatternLayout">
+			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
+		</layout>
+	</appender>
+
+	<category name="org.gvsig.tools">
+		<priority value="DEBUG" />
+	</category>
+	<category name="org.gvsig.fmap.mapcontext">
+		<priority value="DEBUG" /> 
+	</category>
+
+	<root>
+		<priority value="INFO" />
+		<appender-ref ref="CONSOLE" />
+	</root>
+</log4j:configuration>
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java	(revision 36112)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.tools.task.Cancellable;
+
+public interface MapContextDrawer {
+
+	public void setMapContext(MapContext mapContext);
+	public void setViewPort(ViewPort viewPort);
+	public void draw(FLayers root, BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException;
+	public void print(FLayers root, Graphics2D g, Cancellable cancel,
+			double scale, PrintAttributes properties) throws ReadException;
+	public void dispose();
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java	(revision 36112)
@@ -0,0 +1,218 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * <p><code>ExtentHistory</code> is designed for managing a history of extents.</p>
+ *
+ * <p>Note: An <i>extent</i> is a re.setMandatory(true)ctangular area, with information of its top-left 2D corner.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class ExtentHistory implements Persistent {
+	
+	/**
+	 * <p>Maximum number of extents that can store.</p>
+	 */
+	private int NUMREC;
+
+	/**
+	 * <p>Array with the extents.</p>
+	 *
+	 * @see #hasPrevious()
+	 * @see #put(Rectangle2D)
+	 * @see #get()
+	 * @see #removePrev()
+	 */
+	private Rectangle2D[] extents;
+
+	/**
+	 * <p>Number of extents stored.</p>
+	 *
+	 * @see #hasPrevious()
+	 * @see #put(Rectangle2D)
+	 * @see #get()
+	 * @see #removePrev()
+	 */
+	private int num = 0;
+
+	
+	/**
+	 * <p>Creates a new instance of <code>ExtentsHistory</code> with an history of 10 extents.</p>
+	 */
+	public ExtentHistory() {
+		this(10);
+	}
+
+	
+	/**
+	 * <p>Creates a new instance of <code>ExtentsHistory</code> with an history of <code>numEntries</code> extents.</p>
+	 *
+	 * @param numEntries the maximum number of extents that will store the instance
+	 */
+	public ExtentHistory(int numEntries) {
+		NUMREC = numEntries;
+		extents = new Rectangle2D[NUMREC];
+	}
+
+	/**
+	 * <p>Appends the specified extent to the end of this history.</p>
+	 *
+	 * @param ext the new extent
+	 *
+	 * @see #get()
+	 * @see #hasPrevious()
+	 */
+	public void put(Rectangle2D ext) {
+		if ((ext != null) && ((num < 1) || (ext != extents[num - 1]))) {
+			if (num < (NUMREC)) {
+				extents[num] = ext;
+				num = num + 1;
+			} else {
+				for (int i = 0; i < (NUMREC - 1); i++) {
+					extents[i] = extents[i + 1];
+				}
+
+				extents[num - 1] = ext;
+			}
+		}
+	}
+
+	/**
+	 * <p>Returns <code>true</code> if there are extents registered.</p>
+	 *
+	 * @return <code>true</code> if there are extents registered; <code>false</code> otherwise
+	 *
+	 * @see #put(Rectangle2D)
+	 * @see #removePrev()
+	 * @see #get()
+	 */
+	public boolean hasPrevious() {
+		return num > 0;
+	}
+
+	/**
+	 * <p>Returns the last extent in the history.</p>
+	 *
+	 * @return the last extent in the history
+	 *
+	 * @see #put(Rectangle2D)
+	 * @see #getXMLEntity()
+	 */
+	public Rectangle2D get() {
+		if (num <= 0) {
+			return null;
+		}
+		Rectangle2D ext = extents[num - 1];
+
+		return ext;
+	}
+
+	/**
+	 * <p>Extracts (removing) the last extent from the history.</p>
+	 *
+	 * @return last extent in the history
+	 *
+	 * @see #hasPrevious()
+	 */
+	public Rectangle2D removePrev() {
+		if (num <= 0) {
+			return null;
+		}
+		Rectangle2D ext = extents[--num];
+		return ext;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		
+		num = state.getInt("num");
+		NUMREC = state.getInt("numrec");
+		extents = (Rectangle2D[]) state.getArray("extents", Rectangle2D.class);
+	}
+
+	/**
+	 * <p>
+	 * Returns information of this object. All information is stored as
+	 * properties:<br>
+	 * </p>
+	 * <p>
+	 * <b>Properties:</b>
+	 * <ul>
+	 * <li><i>className</i>: name of this class.
+	 * <li><i>num</i>: number of extents registered.
+	 * <li><i>numrec</i>: maximum number of extents that can register.
+	 * <li><i>extents</i>: .
+	 * </ul>
+	 * </p>
+	 * 
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException {
+		
+		state.set("num", num);
+		state.set("numrec", NUMREC);
+		state.set("extents", extents);
+	}
+
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				ExtentHistory.class,
+				"ExtentHistory",
+				"ExtentHistory Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("num").setMandatory(true);
+		definition.addDynFieldInt("numrec").setMandatory(true);
+		definition.addDynFieldArray("extents").setClassOfItems(Rectangle2D.class).setMandatory(true);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java	(revision 36112)
@@ -0,0 +1,106 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+import java.awt.Color;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * Interface for the legend with unique values.
+ *
+ */
+public interface IVectorialUniqueValueLegend extends IClassifiedVectorLegend {
+	
+	public static final String LEGEND_NAME = "VectorialUniqueValue";
+	
+    /**
+     * Establishes the symbol for the value which is the argument of the function.
+     *
+     * @param id index.
+     * @param symbol symbol.
+     */
+    void setValueSymbolByID(int id, ISymbol symbol);
+
+
+    /**
+     * Returns the symbols starting from an ID. It looks in m_ArrayKeys for the
+     * element ID and with this key obtains the FSymbol.
+
+     * @param key ID.
+     *
+     * @return symbol associated with the ID
+     */
+
+    // public FSymbol getSymbolByID(int ID);
+
+    /**
+     * Returns the symbols starting from its key.
+     *
+     * @param key ID.
+     *
+     * @return symbol associated with the key.
+     * @throws MapContextException 
+     */
+    public ISymbol getSymbolByValue(Object key);
+
+	/**
+	 * Returns the key related to a registered {@link ISymbol} or null if it is
+	 * not registered.
+	 * 
+	 * @param symbol
+	 *            to look for
+	 * @return the related key
+	 */
+	Object getSymbolKey(ISymbol symbol);
+
+	ZSort getZSort();
+
+	void setZSort(ZSort zSort);
+
+	Color[] getColorScheme();
+
+	void setColorScheme(Color[] colors);
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialUniqueValueLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ILegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ILegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ILegend.java	(revision 36112)
@@ -0,0 +1,94 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * Information about the legend to be represented in the interface.
+ *
+ */
+public interface ILegend extends Persistent, Cloneable {
+	/**
+	 * Obtains the default symbol of the legend.
+	 *
+	 * @return default symbol.
+	 */
+	ISymbol getDefaultSymbol();
+
+	/**
+	 * Clones the legend.
+	 *
+	 * @return Cloned legend.
+	 *
+	 * @throws XMLException
+	 */
+	ILegend cloneLegend();
+	/**
+	 * Adds a new listener to the legend.
+	 *
+	 * @param listener to be added
+	 */
+	void addLegendListener(LegendContentsChangedListener listener);
+	/**
+	 * Removes a listener from the legend.
+	 *
+	 * @param listener to be removed
+	 */
+	public void removeLegendListener(LegendContentsChangedListener listener);
+	/**
+	 * Executed when the default symbol of a legend is changed.
+	 *
+	 * @param event
+	 */
+	public void fireDefaultSymbolChangedEvent(SymbolLegendEvent event);
+	/**
+	 * Obtains the listeners of a legend.
+	 *
+	 * @return LegendListener[] array composed by the listeners of a legend.
+	 */
+	public LegendContentsChangedListener[] getListeners();
+}
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingMethod.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingMethod.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingMethod.java	(revision 36112)
@@ -0,0 +1,131 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelingMethod.java 13913 2007-09-20 09:36:02Z jaume $
+* $Log$
+* Revision 1.4  2007-09-20 09:33:15  jaume
+* Refactored: fixed name of IPersistAnce to IPersistence
+*
+* Revision 1.3  2007/03/21 11:01:28  jaume
+* javadoc
+*
+* Revision 1.2  2007/03/09 08:33:43  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.2  2007/02/01 11:42:47  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
+* start commiting labeling stuff
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.tools.persistence.Persistent;
+
+
+/**
+ * Interface that defines provides support to a ILabelingStrategy to supply
+ * the set of <b>LabelClass</b>(es) that handle the label's style, content, etc..
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ILabelingMethod extends Persistent {
+
+	/**
+	 * Returns all the labels defined by this Labeling Method
+	 * @return all the labels in this labeling method;
+	 */
+	public ILabelClass[] getLabelClasses();
+
+	/**
+	 * Returns the LabelClass contained by this ILabelingMethod whose name matches
+	 * with the string passed in <b>labelName</b>.
+	 * @param labelName
+	 * @return
+	 */
+	public ILabelClass getLabelClassByName(String labelName);
+
+	/**
+	 * Adds a LabelClass to the set of LabelClass contained by this ILabelingMethod.
+	 * @param lbl
+	 */
+	public void addLabelClass(ILabelClass lbl);
+
+	/**
+	 * Removes the LabelClass from the set of LabelClasses contained by this
+	 * ILabelingMethod.
+	 * @param lbl, the LabelClass to be removed
+	 */
+	public void deleteLabelClass(ILabelClass lbl);
+
+	/**
+	 * Returns <b>true</b> if this ILabelingMethod allos the definition of more
+	 * LabelClasses than just the default LabelClass.
+	 * @return boolean
+	 */
+	public boolean allowsMultipleClass();
+
+	/**
+	 * Changes the mane of a given LabelClass
+	 * @param lbl, the LabelClass
+	 * @param newName, the new name
+	 */
+	public void renameLabelClass(ILabelClass lbl, String newName);
+
+	public FeatureSet getFeatureIteratorByLabelClass(FLyrVect layer, ILabelClass lc, ViewPort viewPort, String[] usedFields)
+	throws DataException;
+
+	public boolean definesPriorities();
+
+	public void setDefinesPriorities(boolean flag);
+
+	public void clearAllClasses();
+
+	public ILabelingMethod cloneMethod();
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelLocationMetrics.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelLocationMetrics.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelLocationMetrics.java	(revision 36112)
@@ -0,0 +1,18 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Point;
+import java.awt.geom.Point2D;
+
+public interface ILabelLocationMetrics {
+
+	Point2D getAnchor();
+
+	void setAnchor(Point anchor);
+
+	double getRotation();
+
+	void setRotation(double rotation);
+
+	boolean isFixed();
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingStrategy.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingStrategy.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelingStrategy.java	(revision 36112)
@@ -0,0 +1,177 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelingStrategy.java 13913 2007-09-20 09:36:02Z jaume $
+* $Log$
+* Revision 1.7  2007-09-20 09:33:15  jaume
+* Refactored: fixed name of IPersistAnce to IPersistence
+*
+* Revision 1.6  2007/09/19 16:25:39  jaume
+* ReadExpansionFileException removed from this context and removed unnecessary imports
+*
+* Revision 1.5  2007/05/17 09:32:06  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2007/03/26 14:40:07  jaume
+* added print method
+*
+* Revision 1.3  2007/03/09 11:20:57  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.2  2007/03/09 08:33:43  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.4  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.3  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+* Revision 1.1.2.2  2007/02/01 17:46:49  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
+* start commiting labeling stuff
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+/**
+ * A LabelingStrategy is a way to define how the labels are painted in a map, or potentially other object implementing ILabelable. It contains methods for allowing the definition of labeling classes through the labeling method (see <b>ILabelingMethod</b>), the placement of such labels (see <b>IPlacementConstraints</b>), and the zoom properties (see <b>ZoomConstraints</b>)
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ILabelingStrategy extends Persistent {
+
+	/**
+	 * Returns the labeling method currently in use. The labeling method handles
+	 * a list of LabelClass that allows to handle several definition of labels
+	 * in the layer.
+	 * @return ILabelingMethod, the current one.
+	 * @see ILabelingMethod
+	 */
+	public ILabelingMethod getLabelingMethod();
+
+	/**
+	 * Sets the labeling method that will be used the next time the the draw is invoked.
+	 * @param   method, the new labeling method
+	 */
+	public void setLabelingMethod(ILabelingMethod method);
+
+
+	/**
+	 * Returns the current placement constraints that determine the position
+	 * where the label is placed.
+	 * @return
+	 */
+	public IPlacementConstraints getPlacementConstraints();
+
+	/**
+	 * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
+	 * @param  constraints
+	 */
+	public void setPlacementConstraints(IPlacementConstraints constraints);
+
+	/**
+	 * Returns the current placement constraints that determine the position
+	 * where the label is placed.
+	 * @return
+	 */
+	public IZoomConstraints getZoomConstraints();
+
+	/**
+	 * Sets the PlacementConstraints that will determine where to place the labels. The change will take effect next time the draw(...) method is invoked.
+	 * @param  constraints
+	 */
+	public void setZoomConstraints(IZoomConstraints constraints);
+
+	/** Causes the labels to be drawn. The policy of process is determined by
+	 * the LabelingStrategy previously set.
+	 *
+	 * @param mapImage
+	 * @param mapGraphics
+	 * @param viewPort
+	 * @param cancel
+	 * @param dpi TODO
+	 * @throws ReadException
+	 */
+	public void draw(BufferedImage mapImage, Graphics2D mapGraphics, ViewPort viewPort,
+			Cancellable cancel, double dpi) throws ReadException;
+
+	/**
+	 * Applies the printer properties to the rendering process to match its attributes.
+	 * The result is manifested in the Graphics2D g which is the object sent to the printer.
+	 * @param g
+	 * @param viewPort
+	 * @param cancel
+	 * @param properties
+	 * @throws ReadException
+	 */
+	public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintAttributes properties)
+	throws ReadException;
+
+	/**
+	 * Returns a non-null String[] containing the names of the fields involved in the
+	 * labeling. If this strategy contains more than one LabelClass the result is an
+	 * array with all the names of the fields used by all the LabelClass, with no duplicates.
+	 * @return
+	 */
+	public String[] getUsedFields();
+
+	public void setLayer(FLayer layer) ;
+
+	public boolean shouldDrawLabels(double scale);
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IPlacementConstraints.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IPlacementConstraints.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IPlacementConstraints.java	(revision 36112)
@@ -0,0 +1,171 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: IPlacementConstraints.java 13913 2007-09-20 09:36:02Z jaume $
+ * $Log$
+ * Revision 1.12  2007-09-20 09:33:15  jaume
+ * Refactored: fixed name of IPersistAnce to IPersistence
+ *
+ * Revision 1.11  2007/09/10 15:47:11  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.10  2007/07/18 06:54:34  jaume
+ * continuing with cartographic support
+ *
+ * Revision 1.9  2007/04/18 15:35:11  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.8  2007/04/13 12:42:32  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.7  2007/04/13 11:59:30  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.6  2007/04/12 16:01:11  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.5  2007/04/12 14:28:43  jaume
+ * basic labeling support for lines
+ *
+ * Revision 1.4  2007/04/11 16:01:08  jaume
+ * maybe a label placer refactor
+ *
+ * Revision 1.3  2007/04/02 16:34:56  jaume
+ * Styled labeling (start commiting)
+ *
+ * Revision 1.2  2007/03/09 08:33:43  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.2  2007/02/15 16:23:44  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+ * Isymbol moved
+ *
+ *
+ */
+
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import org.gvsig.tools.persistence.Persistent;
+
+
+
+/**
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IPlacementConstraints extends Persistent, Cloneable {
+	public static int DefaultDuplicateLabelsMode = IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART;
+
+	// constants regarding label duplication
+	public static final int REMOVE_DUPLICATE_LABELS             =       2;
+	public static final int ONE_LABEL_PER_FEATURE               =       3;
+	public static final int ONE_LABEL_PER_FEATURE_PART          =       4;
+
+	// constants regarding point settings
+	public static final int OFFSET_HORIZONTALY_AROUND_THE_POINT =       5;
+	public static final int ON_TOP_OF_THE_POINT                 =       6;
+	public static final int AT_SPECIFIED_ANGLE                  =       7;
+	public static final int AT_ANGLE_SPECIFIED_BY_A_FIELD       =       8;
+
+	// constants regarding polygon settings (also apply for lines)
+	public static final int HORIZONTAL                          =       9;
+	public static final int PARALLEL                            =      10;
+
+	// constants regarding line settings
+	public static final int FOLLOWING_LINE                      =      11;
+	public static final int PERPENDICULAR                 	    =      12;
+
+	// constants regarding the location along the line
+	public static final int AT_THE_END_OF_THE_LINE              =      13;
+	public static final int AT_THE_MIDDLE_OF_THE_LINE           =      14;
+	public static final int AT_THE_BEGINING_OF_THE_LINE         =      15;
+	public static final int AT_BEST_OF_LINE 					=	   16;
+
+	public abstract void setPlacementMode(int mode);
+
+	// regarding label position along the line
+	public abstract boolean isBelowTheLine();
+	public abstract void setBelowTheLine(boolean b);
+	public abstract boolean isAboveTheLine();
+	public abstract void setAboveTheLine(boolean b);
+	public abstract boolean isOnTheLine();
+	public abstract void setOnTheLine(boolean b);
+	public abstract void setLocationAlongTheLine(int location);
+
+
+	// regarding the orientation system
+	public abstract boolean isPageOriented();
+	public abstract void setPageOriented(boolean b);
+
+	// regarding the label duplication
+	public abstract void setDuplicateLabelsMode(int mode);
+	public abstract int getDuplicateLabelsMode();
+
+
+	public abstract boolean isParallel();
+
+	public abstract boolean isFollowingLine();
+
+	public abstract boolean isPerpendicular();
+
+	public abstract boolean isHorizontal();
+
+	public abstract boolean isAtTheBeginingOfLine();
+
+	public abstract boolean isInTheMiddleOfLine();
+
+	public abstract boolean isAtTheEndOfLine();
+
+	public boolean isAtBestOfLine();
+
+	public abstract boolean isOnTopOfThePoint();
+
+	public abstract boolean isAroundThePoint();
+
+	public boolean isFitInsidePolygon();
+
+	public void setFitInsidePolygon(boolean b);
+
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelable.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelable.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelable.java	(revision 36112)
@@ -0,0 +1,122 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelable.java 21103 2008-06-03 10:04:57Z vcaballero $
+* $Log$
+* Revision 1.2  2007-03-09 11:20:57  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.1.2.5  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.4  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+* Revision 1.1.2.3  2007/02/02 16:21:24  jaume
+* start commiting labeling stuff
+*
+* Revision 1.1.2.2  2007/02/01 17:46:49  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/01/30 18:10:45  jaume
+* start commiting labeling stuff
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * This interface enables support for labeling an object such as a layer, but also others, if any. It gives support for detecting if labeling is being applied (<code>isLabeled()</code> and <code>setIsLabeled()</code>), to manage the labeling strategy (<code>getLabelingStrategy()</code> and <code>setLabelingStrategy</code>). The labeling is performed by the <code>drawLabels(..)</code> method.
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ILabelable {
+	/**
+	 * Returns <b>true</b> if labels are drawn, or <b>false</b> otherwise.
+	 * @return <b>boolean</b> telling if labels are drawn
+	 */
+	public boolean isLabeled();
+
+	/**
+	 * Enables or disables the label drawing.
+	 * @param isLabeled, if true then labels will be drawn
+	 */
+	public void setIsLabeled(boolean isLabeled);
+
+	/**
+	 * Returns the current labeling strategy
+	 * @return ILabelingStrategy
+	 * @see ILabelingStrategy
+	 */
+	public ILabelingStrategy getLabelingStrategy();
+
+	/**
+	 * Sets the new labeling strategy. Changes on the results will take effect next time the drawLabels(...) method is invoked.
+	 * @param  strategy
+	 * @uml.property  name="labelingStrategy"
+	 */
+	public void setLabelingStrategy(ILabelingStrategy strategy);
+
+    /**
+     * Causes the labels to be drawn. The policy of process is determined by the
+     * LabelingStrategy previously set.
+     * 
+     * @param image
+     * @param g
+     * @param viewPort
+     * @param cancel
+     * @param scale
+     * @param dpi
+     * @throws ReadException
+     */
+	public void drawLabels(BufferedImage image, Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, double dpi) throws ReadException;
+	public void printLabels(Graphics2D g, ViewPort viewPort,
+    		Cancellable cancel, double scale, PrintAttributes properties) throws ReadException;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelClass.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelClass.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/ILabelClass.java	(revision 36112)
@@ -0,0 +1,158 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.styles.ILabelStyle;
+import org.gvsig.tools.persistence.Persistent;
+
+public interface ILabelClass extends  Persistent, CartographicSupport{
+
+	/**
+	 * Returns true if the label will be showed in the map
+	 *
+	 * @return isVisible boolean
+	 */
+	boolean isVisible();
+
+	/**
+	 * Sets the visibility of the label in the map.
+	 *
+	 * @param isVisible boolean
+	 */
+	void setVisible(boolean isVisible);
+
+	/**
+	 * Returns the expression that defines the text which will be showed in
+	 * the label
+	 *
+	 * @return labelExpression String
+	 */
+	String getLabelExpression();
+
+	/**
+	 * Stablishes the expresion that, when it is evaluated, returns the text
+	 * which will be showed by the label.
+	 *
+	 * @param labelExpression String
+	 */
+	void setLabelExpression(String labelExpression);
+
+	/**
+	 * Returns the text symbol that is being used for the text(the font,
+	 * size,style,aligment)
+	 *
+	 * @return label ITextSymbol
+	 */
+	ITextSymbol getTextSymbol();
+
+	/**
+	 * Stablishes the text symbol that is going to be used for the text(the
+	 * font,size,style,aligment)
+	 *
+	 * @param textSymbol ITextSymbol
+	 */
+	void setTextSymbol(ITextSymbol textSymbol);
+
+	/**
+	 * Stablishes the style for the label.
+	 *
+	 * @param labelStyle ILabelStyle
+	 */
+	void setLabelStyle(ILabelStyle labelStyle);
+
+	/**
+	 * Returns the style of the label
+	 *
+	 */
+	ILabelStyle getLabelStyle();
+
+	/**
+	 * Returns the name of the label
+	 *
+	 */
+	String getName();
+
+	/**
+	 * Stablishes the name of the label
+	 * @param name
+	 */
+	void setName(String name);
+
+	String toString();
+
+	/**
+	 * Sets the text for the label
+	 *
+	 * @param texts String[]
+	 */
+	void setTexts(String[] texts);
+
+	/**
+	 * Return the text for the label
+	 *
+	 * @param texts String[]
+	 */
+	String[] getTexts();
+
+	/**
+	 * <p>
+	 * LabelLocationMetrics, contains the anchor point, rotation, and some
+	 * other geometric calculations computed by the PlacementManager.
+	 * </p>
+	 *
+	 * <p>
+	 * The shp argument is passed as an accessory for subclasses of this
+	 * class in case they need futher geometric calculations
+	 * </p>
+	 * @param graphics, graphics to use to paint the label.
+	 * @param llm, concrete settings of the placement of this layer
+	 * @param shp, the Shape over whose the label is painted
+	 */
+	void draw(Graphics2D graphics, ILabelLocationMetrics llm, Geometry geom);
+
+	/**
+	 * Useful to render a Label with size inside little rectangles.
+	 *
+	 * @param graphics Graphics2D
+	 * @param bounds Rectangle
+	 * @throws SymbolDrawingException
+	 */
+	void drawInsideRectangle(Graphics2D graphics, Rectangle bounds)
+			throws SymbolDrawingException;
+
+	int getPriority();
+
+	void setPriority(int priority);
+
+	Geometry getShape(ILabelLocationMetrics llm) throws CreateGeometryException;
+
+	String getClassName();
+
+	double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+	int getReferenceSystem();
+
+	int getUnit();
+
+	void setCartographicSize(double cartographicSize, Geometry geom);
+
+	void setReferenceSystem(int referenceSystem);
+
+	void setUnit(int unitIndex);
+
+	double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+	Rectangle getBounds();
+
+	String getSQLQuery();
+
+	void setSQLQuery(String sqlQuery);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IZoomConstraints.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IZoomConstraints.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/styling/IZoomConstraints.java	(revision 36112)
@@ -0,0 +1,127 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: IZoomConstraints.java 10815 2007-03-20 16:16:20Z jaume $
+ * $Log$
+ * Revision 1.3  2007-03-20 16:16:20  jaume
+ * refactored to use ISymbol instead of FSymbol
+ *
+ * Revision 1.2  2007/03/09 08:33:43  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.2  2007/02/15 16:23:44  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+ * Isymbol moved
+ *
+ *
+ */
+
+package org.gvsig.fmap.mapcontext.rendering.legend.styling;
+
+import org.gvsig.tools.persistence.Persistent;
+
+
+/**
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IZoomConstraints extends Persistent {
+	/**
+	 * Uses the same constraints than the layer. Which is the same than no constraints.
+	 */
+	public static final int DEFINED_BY_THE_LAYER = 0;
+
+	/**
+	 * The user defines when the labes will be drawn.
+	 * Notice that if the layer is not drawn it does not take effect.
+	 */
+	public static final int DEFINED_BY_THE_USER = 1;
+
+	/**
+	 * Sets the mode of the zoom constraints.
+	 * @param mode, int one of DEFINED_BY_THE_LAYER or DEFINED_BY_THE_USER.
+	 */
+	public abstract void setMode(int mode);
+
+	/**
+	 * Returns the max scale limit of the constraints.
+	 * @return   float, max limit
+	 * @uml.property  name="maxScale"
+	 */
+	public abstract long getMaxScale();
+
+	/**
+	 * Sets the max scale limit of the constraints
+	 * @param   maxScale, float
+	 * @uml.property  name="maxScale"
+	 */
+	public abstract void setMaxScale(long maxScale);
+
+	/**
+	 * Returns the min scale limit of the constraints.
+	 * @return   float, min limit
+	 * @uml.property  name="minScale"
+	 */
+	public abstract long getMinScale();
+
+	/**
+	 * Sets the min scale limit of the constraints
+	 * @param   minScale, float
+	 * @uml.property  name="minScale"
+	 */
+	public abstract void setMinScale(long minScale);
+
+	/**
+	 * Returns <b>true</b> if the mode is DEFINED_BY_THE_USER.
+	 * @return
+	 */
+	public abstract boolean isUserDefined();
+
+	/**
+	 * Returns <b>true</b> if the mode is DEFINED_BY_THE_USER.
+	 * @return
+	 */
+	public abstract boolean isLayerDefined();
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendWriter.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendWriter.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendWriter.java	(revision 36112)
@@ -0,0 +1,5 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.driver;
+
+public interface ILegendWriter {
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendReader.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendReader.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/driver/ILegendReader.java	(revision 36112)
@@ -0,0 +1,5 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.driver;
+
+public interface ILegendReader {
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/LegendException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/LegendException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/LegendException.java	(revision 36112)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Legend related exceptions.
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class LegendException extends MapContextException {
+
+	private static final long serialVersionUID = -5441479826620031136L;
+
+	/**
+	 * @see BaseException#BaseException(String, String, long)
+	 */
+	public LegendException(String message, String key, long code) {
+		super(message, key, code);
+	}
+
+	/**
+	 * @see BaseException#BaseException(String, Throwable, String, long)
+	 */
+	public LegendException(String message, Throwable cause, String key,
+			long code) {
+		super(message, cause, key, code);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java	(revision 36112)
@@ -0,0 +1,53 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IRasterLegend;
+
+
+/**
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IClassifiedRasterLegend extends IRasterLegend,
+		IClassifiedLegend {
+
+	// The interface does not add any new methods.
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedRasterLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java	(revision 36112)
@@ -0,0 +1,100 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+/**
+ * Interface that offers the methods to classify the legend.
+ */
+public interface IClassifiedVectorLegend extends IClassifiedLegend, IVectorLegend{
+	/**
+	 * Deletes all the information of classification:
+	 * intervals, values, or other classifying elements
+	 */
+	public abstract void clear();
+
+	/**
+	 * Returns the name of the field
+	 *
+	 * @return Name of the field.
+	 *
+	 * TODO refactor to allow more than one field name
+	 */
+	public abstract String[] getClassifyingFieldNames();
+
+	/**
+	 * Inserts the name of the field
+	 *
+	 * @param fieldNames Names of the fields.
+	 * TODO refactor to allow more than one field name
+	 */
+	public abstract void setClassifyingFieldNames(String[] fieldNames);
+
+	 /**
+     * Inserts a symbol.
+     *
+     * @param key.
+     * @param symbol.
+     */
+	public abstract void addSymbol(Object key, ISymbol symbol);
+
+    /**
+     * Deletes a symbol using for that its key which is the parameter of the
+     * method.
+     *
+     * @param key clave.
+     */
+	public abstract void delSymbol(Object key);
+
+	/**
+	 * Removes <b>oldSymbol</b> from the Legend and substitutes it with the <b>newSymbol</b>
+	 * @param oldSymbol
+	 * @param newSymbol
+	 */
+	public abstract void replace(ISymbol oldSymbol, ISymbol newSymbol);
+
+	public int[] getClassifyingFieldTypes();
+
+	public void setClassifyingFieldTypes(int[] fieldTypes);
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedVectorLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java	(revision 36112)
@@ -0,0 +1,354 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.IntervalLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LabelLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.ValueLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+/**
+ * Class ZSort is used in order to store information about the symbols
+ * which are placed in the Z axis (because a level of symbols has been
+ * used).
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public class ZSort implements LegendContentsChangedListener {
+	// private static final String COLUMN_SEPARATOR = ",";
+	// private static final String ROW_SEPARATOR = ";";
+	private int[][] matrix;
+	private boolean usingZSort;
+	private Map symbols = new HashMap();
+
+	public ZSort(ILegend legend) {
+		initialize(legend);
+	}
+
+	private void initialize(ILegend legend) {
+		ISymbol[] symbols;
+		if (legend instanceof IClassifiedLegend) {
+			symbols = ((IClassifiedLegend) legend).getSymbols();
+
+		} else {
+			symbols = new ISymbol[] {legend.getDefaultSymbol()};
+		}
+		matrix = new int[symbols.length][];
+
+		for (int i = 0; i < symbols.length; i++) {
+			this.symbols.put(symbols[i], new Integer(i));
+			int rowLength =  symbols[i] instanceof IMultiLayerSymbol ?
+                  	 ((IMultiLayerSymbol) symbols[i]).getLayerCount() :
+	                 1;
+			matrix[i] = new int[rowLength];
+		}
+		legend.addLegendListener(this);
+	}
+
+	private void addSymbol(ISymbol sym){
+		if (!symbols.containsKey(sym)) {
+			int rowLength =  sym instanceof IMultiLayerSymbol ?
+					((IMultiLayerSymbol) sym).getLayerCount() : 1;
+			int[][] auxMatrix = new int[matrix.length+1][];
+			int newIndex = matrix.length;
+			for (int i=0; i<newIndex; i++){
+				auxMatrix[i] = matrix[i];
+			}
+			int[] row = new int[rowLength];
+			for (int i=0; i<rowLength; i++){
+				row[i] = 0;
+			}
+			auxMatrix[newIndex] = row;
+			matrix = auxMatrix;
+			this.symbols.put(sym, new Integer(newIndex));
+		}
+	}
+
+	public void legendChanged(LegendChangedEvent e) throws MapContextException {
+		symbols.clear();
+		usingZSort = false;
+		initialize(e.getNewLegend());
+
+	}
+
+	public String getClassName() {
+		return getClass().getName();
+	}
+
+	public int getLevelCount() {
+		int count = -1;
+		for (int i = 0; i < matrix.length; i++) {
+			for (int j = 0; j < matrix[i].length; j++) {
+				count = Math.max(count, matrix[i][j]);
+			}
+		}
+		return count + 1;
+	}
+
+
+	public void setUsingZSort(boolean usingZSort) {
+		this.usingZSort = usingZSort;
+	}
+
+	public void setLevels(ISymbol sym, int[] values) {
+		setLevels(((Integer)symbols.get(sym)).intValue(), values);
+	}
+
+
+	public void setLevels(int row, int[] values) {
+		matrix[row] = values;
+	}
+
+	public int[] getLevels(ISymbol sym) {
+		Integer row = (Integer) symbols.get(sym);
+		if (row != null) {
+			return getLevels(row.intValue());
+		} else {
+			ISymbol[] theSymbols = getSymbols();
+			for (int i = 0; i < theSymbols.length; i++) {
+				ISymbol auxSymbol = theSymbols[i];
+				if (auxSymbol.equals(sym)){
+					return getLevels(((Integer)symbols.get(auxSymbol)).intValue());
+				}
+			}
+		}
+		return null;
+	}
+
+
+	public int[] getLevels(int row) {
+		return matrix[row];
+	}
+
+
+	public boolean isUsingZSort() {
+		return usingZSort;
+	}
+
+
+	public ISymbol[] getSymbols() {
+		return (ISymbol[])symbols.keySet().toArray(new ISymbol[0]);
+	}
+
+
+	public String[] getDescriptions() {
+		ISymbol[] symbols = getSymbols();
+		String[] descs = new String[symbols.length];
+		for (int i = 0; i < descs.length; i++) {
+			descs[i] = symbols[i].getDescription();
+		}
+		return descs;
+	}
+
+	/*
+	 * [PACO] Comentarizado porque no hace lo que se esperar�a de �l.
+	 * Si tenemos una leyenda con un simbolo Multilayer compuesto
+	 * por, entre otros, un simbolo simple que coincide con otro de
+	 * los simbolos de la leyenda, este metodo devuelve el nivel
+	 * del s�mbolo que encuentra primero.
+	 *
+	 * Se ha eliminado cualquier referencia a este metodo en el resto
+	 * del workspace, sustituyendola convenientemente por
+	 * referencias a getLevels.
+	 */
+//	public int getSymbolLevel(ISymbol layer) {
+//		ISymbol[] theSymbols = getSymbols();
+//
+//		for (int i = 0; i < theSymbols.length; i++) {
+//			ISymbol mySymbol = theSymbols[i];
+//
+//			if (mySymbol instanceof IMultiLayerSymbol) {
+//				IMultiLayerSymbol multiSym = (IMultiLayerSymbol) mySymbol;
+//				for (int j = 0; j < multiSym.getLayerCount(); j++) {
+//					ISymbol myInnerSymbol = multiSym.getLayer(j);
+//					if (myInnerSymbol.equals(layer)) {
+//						int row = ((Integer)symbols.get(multiSym)).intValue();
+//						return matrix[row][j];
+//					}
+//				}
+//			} else {
+//				if (mySymbol.equals(layer)) {
+//					return matrix[((Integer)symbols.get(layer)).intValue()][0];
+//				}
+//			}
+//		}
+//
+////		return 0;
+//		return -1;
+//	}
+
+	public int getTopLevelIndexAllowed() {
+		ISymbol[] symbols = getSymbols();
+		int count=0;
+		for (int i = 0; i < symbols.length; i++) {
+			if (symbols[i] instanceof IMultiLayerSymbol) {
+				IMultiLayerSymbol mSymbol = (IMultiLayerSymbol) symbols[i];
+				count = Math.max(count, mSymbol.getLayerCount());
+			} else
+				count = Math.max(count, 1);
+		}
+		return count;
+	}
+
+	public String toString() {
+		String out = "Symbols:\n---------\n\n";
+		ISymbol[] syms = getSymbols();
+		for (int i = 0; i < syms.length; i++) {
+			out += syms.getClass()+":\t"+syms[i].getDescription();
+		}
+		out += "\nMatrix:\n--------\n\n";
+		out += "    \t";
+		for (int i = 0; i < getTopLevelIndexAllowed(); i++) {
+			out += "column"+i+"\t\t";
+		}
+		out += "\n";
+		for (int i = 0; i < matrix.length; i++) {
+			out += "row "+i+":\t";
+			for (int j = 0; j < matrix[i].length; j++) {
+				out += matrix[i][j]+"\t\t";
+			}
+			out += "\n";
+		}
+		return out;
+	}
+
+	private void replaceSymbol(ISymbol oldSymbol, ISymbol newSymbol) {
+		if (oldSymbol == newSymbol) return;
+
+		if(oldSymbol != null){
+
+			Integer value = (Integer)symbols.get(oldSymbol);
+			if (value != null){
+
+				int intValue=value.intValue();
+				if (newSymbol == null) {
+					// emptying
+					symbols.remove(oldSymbol);
+					matrix[intValue] = new int[1];
+				} else {
+					symbols.remove(oldSymbol);
+
+					symbols.put(newSymbol, value);
+
+					// update matrix values if need
+					int newArrayLength = newSymbol instanceof IMultiLayerSymbol ?
+							((IMultiLayerSymbol) newSymbol).getLayerCount() : 1;
+
+							int[] newRow = new int[newArrayLength];
+							if (matrix[intValue].length == newArrayLength) {
+								/*
+								 * the new row is exactly the same long than the
+								 * old one. Will use the old values
+								 */
+								newRow = matrix[intValue];
+							} else	if (matrix[intValue].length < newArrayLength) {
+								/*
+								 * the new row is larger than the old one,
+								 * let's copy all the first values and fill
+								 * the rest with the last copied value
+								 */
+								int val=0;
+								for (int i = 0; i < newRow.length; i++) {
+									if (i<matrix[intValue].length) {
+										val = matrix[intValue][i];
+									}
+
+									newRow[i] = val;
+								}
+							} else if (matrix[intValue].length > newArrayLength) {
+								/*
+								 * the new row is smaller than the old one,
+								 * let's copy the first values
+								 */
+								for (int i = 0; i < newRow.length; i++) {
+									newRow[i] = matrix[intValue][i];
+								}
+							}
+							matrix[intValue] = newRow;
+				}
+			}
+		} else {
+			addSymbol(newSymbol);
+		}
+	}
+
+	public boolean symbolChanged(SymbolLegendEvent e) {
+		replaceSymbol(e.getOldSymbol(), e.getNewSymbol());
+		return true;
+	}
+
+
+	public boolean classifiedSymbolChange(SymbolLegendEvent e) {
+		replaceSymbol(e.getOldSymbol(), e.getNewSymbol());
+		return true;
+	}
+
+	public boolean intervalChange(IntervalLegendEvent e) {
+		return false;
+	}
+
+	public boolean valueChange(ValueLegendEvent e) {
+		System.out.println("log ValueLegendEvent:"+e.getOldValue()+"->"+e.getNewValue());
+		return false;
+	}
+
+	// TODO should not exist here
+	public boolean labelFieldChange(LabelLegendEvent e) {
+		return false;
+	}
+
+
+	public void legendCleared(LegendClearEvent event) {
+//		this.usingZSort = false;
+//		symbols.clear();
+//		matrix = null;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ZSort.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/listeners/LegendListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/listeners/LegendListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/listeners/LegendListener.java	(revision 36112)
@@ -0,0 +1,60 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events.listeners;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+
+
+
+/**
+ * Interfaz con los eventos que puede realizar una leyenda.
+ */
+public interface LegendListener {
+
+	/**
+     * Called when the legend of a vector layer has changed.
+     *
+     * @param e the <code>LegendChangedEvent</code> contains contextual information about the event
+     */
+    void legendChanged(LegendChangedEvent e);
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendChangedEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendChangedEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendChangedEvent.java	(revision 36112)
@@ -0,0 +1,136 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+
+
+
+/**
+ * <p>Event or set of events produced when changes a legend.</p>
+ * 
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class LegendChangedEvent extends LegendEvent {
+	/**
+	 * <p>Identifies this event as a changed of a legend.</p>
+ 	 */
+	private static final int LEGEND_CHANGED = 0;
+
+	/**
+	 * <p>Previous vector legend.</p>
+	 */
+	private ILegend oldLegend;
+
+	/**
+	 * <p>New vector legend.</p>
+	 */
+	private ILegend newLegend;
+
+	/**
+	 * <p>Events that constitute this one.</p>
+	 */
+	private LegendChangedEvent[] events;
+
+	/**
+	 * <p>Creates a new legend change event.</p>
+	 * 
+	 * @param oldLegend previous vector legend
+	 * @param newLegend new vector legend
+	 * 
+	 * @return a new legend change event
+	 */
+	public static LegendChangedEvent createLegendChangedEvent(ILegend oldLegend,
+			ILegend newLegend){
+		return new LegendChangedEvent(oldLegend, newLegend, LEGEND_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new legend change event.</p>
+	 *
+	 * @param oldLegend previous vector legend
+	 * @param newLegend new vector legend
+	 */
+	private LegendChangedEvent(ILegend oldLegend,
+			ILegend newLegend, int eventType) {
+		this.oldLegend = oldLegend;
+		this.newLegend = newLegend;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the previous vector legend.</p>
+	 *
+	 * @return the previous vector legend
+	 */
+	public ILegend getOldLegend() {
+		return oldLegend;
+	}
+
+	/**
+	 * <p>Gets the new vector legend.</p>
+	 *
+	 * @return the new vector legend
+	 */
+	public ILegend getNewLegend() {
+		return newLegend;
+	}
+
+	/**
+	 * <p>Gets the events that constitute this one.</p>
+	 *
+	 * @return an array with the events that constitute this one
+	 */
+	public LegendChangedEvent[] getEvents() {
+		return events;
+	}
+
+	/**
+	 * <p>Sets the events that constitute this one.</p>
+	 *
+	 * @param events an array with the events that constitute this one
+	 */
+	public void setEvents(LegendChangedEvent[] events) {
+		this.events = events;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ClassificationLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ClassificationLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ClassificationLegendEvent.java	(revision 36112)
@@ -0,0 +1,70 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+
+/**
+ * <p>Event produced on a classified legend.</p>
+ *
+ * @author Vicente Caballero Navarro
+ * @author jaume domimguez faus - jaume.dominguez@iver.es
+ */
+public class ClassificationLegendEvent extends LegendEvent {
+	/**
+	 * <p>Gets the index of the class where the classification has changed.</p>
+	 *
+	 * @return index of the class where the classification has changed
+	 */
+	public int getClassIndex() {
+		//TODO Implementar bien
+		return -1;
+	}
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_CLASSIFICATION_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_CLASSIFICATION_CHANGED;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendContentsChangedListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendContentsChangedListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendContentsChangedListener.java	(revision 36112)
@@ -0,0 +1,62 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+
+
+/**
+ * Interfaz con los eventos que puede realizar una leyenda.
+ */
+public interface LegendContentsChangedListener {
+
+	/**
+	 * Invocado cuando se cambia en el legend el s�mbolo por defecto. Si
+	 * cualquiera de los listeners devuelve false, el cambio no se realiza
+	 *
+	 * @param e SymbolLegendEvent
+	 *
+	 * @return True si ha sido correcto.
+	 */
+	boolean symbolChanged(SymbolLegendEvent e);
+
+	void legendCleared(LegendClearEvent event);
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java	(revision 36112)
@@ -0,0 +1,104 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.ClassificationLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendEvent;
+
+
+/**
+ * <p>Event produced when changes any value of a legend.</p>
+ *
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class ValueLegendEvent extends ClassificationLegendEvent {
+	/**
+	 * <p>Previous legend value.</p>
+	 */
+	private Object oldValue;
+
+	/**
+	 * <p>New legend value.</p>
+	 */
+	private Object newValue;
+
+	/**
+	 * <p>Creates a new value legend event.</p>
+	 *
+	 * @param oldValue previous legend value
+	 * @param newValue new legend value
+	 */
+	public ValueLegendEvent(Object oldValue, Object newValue) {
+		this.oldValue = oldValue;
+		this.newValue = newValue;
+	}
+
+	/**
+	 * <p>Gets the previous value.</p>
+	 *
+	 * @return the previous value
+	 */
+	public Object getOldValue() {
+		return oldValue;
+	}
+
+	/**
+	 * <p>Gets the new value.</p>
+	 *
+	 * @return the new value
+	 */
+	public Object getNewValue() {
+		return newValue;
+	}
+
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return the type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_VALUE_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_VALUE_CHANGED;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/ValueLegendEvent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/FeatureDrawnNotification.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/FeatureDrawnNotification.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/FeatureDrawnNotification.java	(revision 36112)
@@ -0,0 +1,16 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.geom.Geometry;
+
+public interface FeatureDrawnNotification {
+
+	Feature getFeature();
+
+	/**
+	 * @return the {@link Geometry} to be finally drawn, as it may
+	 * have been reprojected
+	 */
+	Geometry getDrawnGeometry();
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java	(revision 36112)
@@ -0,0 +1,93 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendEvent;
+
+
+
+/**
+ * <p>Event produced when changes the value in the field of labeling of a legend.</p>
+ *
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class LabelLegendEvent extends LegendEvent {
+	/**
+	 * <p>Previous field value.</p>
+	 */
+	private int oldFieldId;
+	
+	/**
+	 * <p>New field value.</p>
+	 */
+	private int newFieldId;
+
+	/**
+	 * <p>Creates a new legend label event.</p>
+	 *
+	 * @param oldFieldId previous field value
+	 * @param newFieldId new field value
+	 */
+	public LabelLegendEvent(int oldFieldId, int newFieldId) {
+		this.oldFieldId = oldFieldId;
+		this.newFieldId = newFieldId;
+	}
+
+	/**
+	 * <p>Gets the new field value.</p>
+	 *
+	 * @return the new field value
+	 */
+	public int getNewFieldId() {
+		return newFieldId;
+	}
+
+	/**
+	 * <p>Gets the previous field value.</p>
+	 *
+	 * @return the previous field value
+	 */
+	public int getOldFieldId() {
+		return oldFieldId;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LabelLegendEvent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendEvent.java	(revision 36112)
@@ -0,0 +1,109 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
+
+
+
+
+/**
+ * <p><code>LegendEvent</code> represents an event produced at a legend in a layer.</p>
+ * 
+ * @see FMapEvent
+ */
+public class LegendEvent extends FMapEvent {
+	/**
+	 * <p>Identifies this event as a change of the value of a legend.</p>
+	 */
+	public static final int LEGEND_VALUE_CHANGED = 200;
+
+	/**
+	 * <p>Identifies this event as a change of the symbol of a legend.</p>
+	 */
+	public static final int LEGEND_SYMBOL_CHANGED = 201;
+
+	/**
+	 * <p>Identifies this event as a legend interval change.</p>
+	 */
+	public static final int LEGEND_INTERVAL_CHANGED = 202;
+
+	/**
+	 * <p>Identifies this event as a clear of a legend.</p>
+	 */
+	public static final int LEGEND_CLEARED = 203;
+
+	/**
+	 * <p>Identifies this event as a change on the classification of a legend.</p>
+	 */
+	public static final int LEGEND_CLASSIFICATION_CHANGED = 204;
+
+	/**
+	 * Layer of the legend where the event was produced.
+	 * 
+	 * @see #getLayer()
+	 * @see #setLayer(ClassifiableVectorial)
+	 */
+	private ClassifiableVectorial layer;
+
+	/**
+	 * <p>Returns the layer of the legend where the event was produced, as a classifiable and vector layer.</p>
+	 *
+	 * @return the layer where the event was produced, as classifiable vector
+	 * 
+	 * @see #setLayer(ClassifiableVectorial)
+	 */
+	public ClassifiableVectorial getLayer() {
+		return layer;
+	}
+
+	/**
+	 * <p>Sets the layer of the legend where the event was produced, as a classifiable and vector layer.</p>
+	 *
+	 * @param layer the layer where the event was produced, as classifiable vector
+	 * 
+	 * @see #getLayer()
+	 */
+	public void setLayer(ClassifiableVectorial layer) {
+		this.layer = layer;
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java	(revision 36112)
@@ -0,0 +1,103 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.IInterval;
+
+
+/**
+ * <p>Event produced when changes the interval value of a classification legend.</p>
+ * 
+ * @see FMapEvent
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public class IntervalLegendEvent extends ClassificationLegendEvent {
+	/**
+	 * <p>Previous legend interval.</p> 
+	 */
+	private IInterval oldInterval;
+	/**
+	 * <p>Previous legend interval.</p> 
+	 */
+	private IInterval newInterval;
+
+	/**
+	 * <p>Creates a new legend interval event.</p>
+	 *
+	 * @param oldInterval previous legend interval
+	 * @param newInterval new legend interval
+	 */
+	public IntervalLegendEvent(IInterval oldInterval, IInterval newInterval) {
+		this.oldInterval = oldInterval;
+		this.newInterval = newInterval;
+	}
+
+	/**
+	 * <p>Gets the previous legend interval.</p>
+	 *
+	 * @return the previous legend interval
+	 */
+	public IInterval getOldInterval() {
+		return oldInterval;
+	}
+
+	/**
+	 * <p>Gets the new legend interval.</p>
+	 *
+	 * @return the new legend interval
+	 */
+	public IInterval getNewInterval() {
+		return newInterval;
+	}
+
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return the type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_INTERVAL_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_INTERVAL_CHANGED;
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/IntervalLegendEvent.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/SymbolLegendEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/SymbolLegendEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/SymbolLegendEvent.java	(revision 36112)
@@ -0,0 +1,103 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * <p>Event produced when changes one of the symbols of a classified legend.</p>
+ *
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class SymbolLegendEvent extends ClassificationLegendEvent {
+/**
+	 * <p>Previous symbol style.</p>
+	 */
+	private ISymbol oldSymbol;
+	
+	/**
+	 * <p>New symbol style.</p>
+	 */
+	private ISymbol newSymbol;
+
+	/**
+	 * <p>Creates a new symbol legend event.</p>
+	 *
+	 * @param oldValue previous symbol style
+	 * @param newValue new symbol style
+	 */
+	public SymbolLegendEvent(ISymbol oldSymbol, ISymbol newSymbol) {
+		this.oldSymbol = oldSymbol;
+		this.newSymbol = newSymbol;
+	}
+
+	/**
+	 * <p>Gets the previous symbol style.</p>
+	 *
+	 * @return the previous symbol style
+	 */
+	public ISymbol getOldSymbol() {
+		return oldSymbol;
+	}
+
+	/**
+	 * <p>Gets the new symbol style.</p>
+	 *
+	 * @return the new symbol style
+	 */
+	public ISymbol getNewSymbol() {
+		return newSymbol;
+	}
+
+	/**
+	 * <p>Returns the type of this legend event.</p>
+	 * 
+	 * @return the type of this legend event
+	 * 
+	 * @see LegendEvent#LEGEND_SYMBOL_CHANGED
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_SYMBOL_CHANGED;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendClearEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendClearEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/events/LegendClearEvent.java	(revision 36112)
@@ -0,0 +1,35 @@
+package org.gvsig.fmap.mapcontext.rendering.legend.events;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+/**
+ * <p>The class <code>LegendClearEvent</code> stores all necessary information of an event 
+ * produced when a legend is cleared.</p>
+ * 
+ * @see FMapEvent
+ * @author Vicente Caballero Navarro
+ */
+public class LegendClearEvent extends ClassificationLegendEvent {
+	private ISymbol[] oldSymbols;
+	/**
+	 * Constructor method
+	 * @param oldSymbols
+	 */
+	public LegendClearEvent(ISymbol[] oldSymbols) {
+		this.oldSymbols = oldSymbols;
+	}
+	/**
+	 * Obtains the old symbols of the legend
+	 * @return
+	 */
+	public ISymbol[] getOldSymbols() {
+		return oldSymbols;
+	}
+	/**
+	 * Returns the type of the event
+	 */
+	public int getEventType() {
+		return LegendEvent.LEGEND_CLEARED;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java	(revision 36112)
@@ -0,0 +1,94 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import java.awt.Color;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * Interface that allows the methods to classify the legend through intervals.
+ *
+ */
+public interface IVectorialIntervalLegend extends IClassifiedVectorLegend {
+	
+	public static final String LEGEND_NAME = "VectorialInterval";
+
+    public void setDefaultSymbol(ISymbol s);
+
+    public IInterval getInterval(Object v) ;
+    public int getIntervalType();
+
+	/**
+	 *
+	 * Returns the symbol starting from an interval
+	 *
+	 * @param key interval.
+	 *
+	 * @return symbol.
+	 */
+    public ISymbol getSymbolByInterval(IInterval key);
+
+
+    /**
+     * Inserts the type of the classification of the intervals.
+	 *
+	 * @param tipoClasificacion type of the classification.
+	 */
+    public void setIntervalType(int tipoClasificacion);
+
+    /**
+	 * Inserts the initial color
+	 * @param startColor initial color.
+	 */
+	public void setStartColor(Color startColor);
+
+    /**
+	 * Inserts the final color.
+	 * @param endColor final color.
+	 */
+	public void setEndColor(Color endColor);
+
+    /**
+	 * Returns the initial color.
+	 * @return  Color initial color.
+	 */
+	public Color getStartColor();
+
+    /**
+	 * Returns the final color
+	 * @return Color  final color.
+	 */
+	public Color getEndColor();
+
+	public IInterval[] calculateIntervals(FeatureStore featureStore,
+			String selectedItem, int intervalCount, int shapeType)
+			throws DataException;
+
+
+//    public ISymbol getSymbol(FeatureReference id) throws DataException;
+
+}
+

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorialIntervalLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IRasterLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IRasterLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IRasterLegend.java	(revision 36112)
@@ -0,0 +1,49 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+/**
+ * Interface of raster legend.
+ */
+public interface IRasterLegend extends ILegend {
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IVectorLegend.java	(revision 36112)
@@ -0,0 +1,199 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+/**
+ * Interface of a vectorial legend.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public interface IVectorLegend extends ILegend, DrawingObservable {
+	/**
+	 * Inserts the DataSource.
+	 *
+	 * @param ds DataSource.
+	 * @throws DataException TODO
+	 * @throws FieldNotFoundException when the field is not found.
+	 */
+//	void setFeatureStore(FeatureStore fs)
+//		throws DataException;
+
+	/**
+	 * Returns the symbol to be used to represent the feature in the i-th
+	 * record in the DataSource
+	 * @param i, the record index
+	 *
+	 * @return ISymbol.
+	 */
+//	ISymbol getSymbol(int i) throws ReadException;
+	/**
+     * Returns a symbol starting from an IFeature.
+	 *
+	 * TAKE CARE!! When we are using a feature iterator as a database
+	 * the only field that will be filled is the fieldID.
+	 * The rest of fields will be null to reduce the time of creation
+	 *
+	 * @param feat IFeature.
+	 *
+	 * @return S�mbolo.
+	 * @throws MapContextException 
+	 */
+    ISymbol getSymbolByFeature(Feature feat) throws MapContextException;
+
+	/**
+	 * Returns the type of the shape.
+	 *
+	 * @return Returns the type of the shapes that the legend is ready to use.
+	 *
+	 */
+	int getShapeType();
+
+	/**
+	 * Defines the type of the shape.
+	 *
+	 * @param shapeType type of the shape.
+	 */
+	void setShapeType(int shapeType);
+
+	/**
+	 * Establishes the default symbol of a legend. In a SingleSymbolLegend the symbol
+	 * is established by calling this method.
+	 *
+	 * @param s default symbol.
+	 */
+	void setDefaultSymbol(ISymbol s);
+
+	/**
+     * Returns true or false depending on if the rest of values are used.
+	 *
+	 * @return  True if the rest of values are used.
+	 */
+    public boolean isUseDefaultSymbol();
+
+    void useDefaultSymbol(boolean b);
+
+//   jjdc los eliminamos, y debe quedar dependiente de la implementacion y n de api
+//   public ZSort getZSort();
+//
+//	public void setZSort(ZSort zSort);
+//
+	public boolean isSuitableForShapeType(int shapeType);
+
+	/**
+	 * Draws the {@link FeatureStore} data using this legend simbology.
+	 * 
+	 * @param image
+	 *            the base image to draw over
+	 * @param graphics2D
+	 *            the {@link Graphics2D} to draw to
+	 * @param viewPort
+	 *            the ViewPort to use
+	 * @param cancel
+	 *            the {@link Cancellable} delegate object
+	 * @param scale
+	 *            the scale of the view
+	 * @param queryParameters
+	 *            the query parameters
+	 * @param coordTrans
+	 *            the transformation coordinates to use for reprojection
+	 * @param featureStore
+	 * 			  {@link FeatureStore} to load the data to draw from
+	 * @throws LegendException
+	 */
+	void draw(BufferedImage image, Graphics2D graphics2D, ViewPort viewPort,
+			Cancellable cancel, double scale, Map queryParameters,
+			ICoordTrans coordTrans, FeatureStore featureStore)
+			throws LegendException;
+	
+	 /**
+     * Draws the {@link FeatureStore} data using this legend simbology.
+     * 
+     * @param image
+     *            the base image to draw over
+     * @param graphics2D
+     *            the {@link Graphics2D} to draw to
+     * @param viewPort
+     *            the ViewPort to use
+     * @param cancel
+     *            the {@link Cancellable} delegate object
+     * @param scale
+     *            the scale of the view
+     * @param queryParameters
+     *            the query parameters
+     * @param coordTrans
+     *            the transformation coordinates to use for reprojection
+     * @param featureStore
+     *            {@link FeatureStore} to load the data to draw from
+     * @param featureQuery 
+     *            the query used to filter the features.
+     * @throws LegendException
+     */
+    void draw(BufferedImage image, Graphics2D graphics2D, ViewPort viewPort,
+            Cancellable cancel, double scale, Map queryParameters,
+            ICoordTrans coordTrans, FeatureStore featureStore, FeatureQuery featureQuery)
+            throws LegendException;
+
+	void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+			double scale, Map queryParameters, ICoordTrans coordTrans,
+			FeatureStore featureStore, PrintAttributes properties) throws LegendException;
+	
+	void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+        double scale, Map queryParameters, ICoordTrans coordTrans,
+        FeatureStore featureStore, FeatureQuery featureQuery, PrintAttributes properties) throws LegendException;
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java	(revision 36112)
@@ -0,0 +1,53 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.Persistent;
+
+public interface IInterval extends Persistent, Cloneable {
+
+	/**
+	 * Returns if the given value is included into the interval.
+	 * 
+	 * @param v
+	 *            value to check. Must be instance of {@link Number}
+	 * 
+	 * @return if the given value is included into the interval
+	 */
+	boolean isInInterval(Object v);
+
+	/**
+	 * Returns the interval minimum included value.
+	 * 
+	 * @return the minimum value
+	 */
+	double getMin();
+
+	/**
+	 * Returns the interval maximum included value.
+	 * 
+	 * @return the maximum value
+	 */
+	double getMax();
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IInterval.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java	(revision 36112)
@@ -0,0 +1,72 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+
+
+/**
+ * Information of the legend that allows to be represented graphically to the user
+ * 
+ */
+public interface IClassifiedLegend extends ILegend {
+	/**
+	 * Obtains the descriptions of the classes that are in the classification
+	 * @return DOCUMENT ME!
+	 */
+	String[] getDescriptions();
+
+	/**
+	 * Obtains the symbols of each class of the classification for the user.
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	ISymbol[] getSymbols();
+
+	/**
+	 * Obtains the values in relation with each class of the classification
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	Object[] getValues();
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/IClassifiedLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java	(revision 36112)
@@ -0,0 +1,44 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+
+/**
+ * Legend based on one single symbol to use while rendering.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface ISingleSymbolLegend extends IVectorLegend {
+	
+	public static final String LEGEND_NAME = "SingleSymbol";
+	
+	ZSort getZSort();
+
+	void setZSort(ZSort zSort);
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/ISingleSymbolLegend.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/DrawingObservable.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/DrawingObservable.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/legend/DrawingObservable.java	(revision 36112)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+package org.gvsig.fmap.mapcontext.rendering.legend;
+
+import org.gvsig.tools.observer.Observer;
+
+/**
+ * Interface for observable drawing operations.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public interface DrawingObservable {
+
+	/**
+	 * Adds a new {@link Observer}.
+	 * 
+	 * @param observer
+	 *            the {@link Observer} to add
+	 */
+	void addDrawingObserver(Observer observer);
+
+	/**
+	 * Deletes a registered drawing {@link Observer} from the list of registered
+	 * ones.
+	 * 
+	 * @param observer
+	 *            to delete from the registered ones
+	 */
+	void deleteDrawingObserver(Observer observer);
+
+	/**
+	 * Deletes all the registered drawing {@link Observer} objects. 
+	 */
+	void deleteDrawingObservers();
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/CartographicSupport.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/CartographicSupport.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/CartographicSupport.java	(revision 36112)
@@ -0,0 +1,149 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.ViewPort;
+
+/**
+ * <p>This interface enables Cartographic support for those graphical elements that require
+ * additional runtime information rather than the feature itself geometric definitions.<br></p>
+ *
+ * <p>It allows to realworld's measure units dimensioning.<br></p>
+ *
+ * <p>It also supplies a toolkit to perform operations with centralized static methods.
+ * @see CartographicSupportToolkit inner class' methods<br></p>
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface CartographicSupport {
+	public static final int WORLD = 0;
+	public static final int PAPER = 1;
+
+	/**
+	 * Defines the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array.
+	 * @param unitIndex, the index of the unit in the MapContext.NAMES array
+	 */
+	public abstract void setUnit(int unitIndex);
+	/**
+	 * Returns the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array.
+	 * @returns an <b>int</b> with the index of the unit in the MapContext.NAMES array, or -1 if the size is specified in pixel
+	 */
+	public abstract int getUnit();
+
+	/**
+	 * Returns the <b>Reference System</b> used to draw the elements of the image.<br>
+	 * <p>
+	 * The elements have to be scaled to <b>pixel</b> when the image is bein drawn in
+	 * order to compose the map. The elements of the map may define its size in
+	 * other units than pixel.<br>
+	 * </p>
+	 * <p><b>CartographicSupport</b> enables the elements to define the size in
+	 * measure units but these units may refer to different reference system. Two
+	 * kinds of Reference Systems are allowed in this context: <b>CartographicSupport.WORLD</b>,
+	 * and <b>CartographicSupport.PAPER</b>.
+	 * <br></p>
+	 * <p>
+	 * Depending on which <b>Reference System</b> is used the unit used by this element
+	 * refers to distances in the real world (then they are map's CRS-dependant)
+	 * or screen or printer output (then they are output DPI-dependant)<br>
+	 * </p>
+	 * <p>
+	 * In case the unit used is <b>pixel</b> then the reference system does not
+	 * have any effect since the source unit is the same than the target unit.
+	 * <br>
+	 * </p>
+	 * @return
+	 */
+	public abstract int getReferenceSystem();
+
+	/**
+	 * Sets the <b>Reference System</b> that defines how this units have to be
+	 * handled. Possible values are:
+	 * <ol>
+	 *   <li><b>CartographySupport.WORLD</b>: Defines that the unit values refer
+	 *   to distances in the world. So, the size of the element displayed <b>depends
+	 *   directly on the scale and CRS</b> used by the map. The size of the elements
+	 *   defined to use CartographicSupport.WORLD will match exactly to their
+	 *   actual size in the real world.</li>
+	 *   <li><b>CartographySupport.PAPER</b>: Defines that the unit values refer
+	 *   to the length that the element will have regardless where it appears. If
+	 *   ReferenceSystem is <b>CartographySupport.PAPER</b>, and the length is (e.g.)
+	 *   millimeters the element will be displayed with the <b>same</b> amount of
+	 *   millimeters of length whether in the <b>screen</b> or the <b>printer</b>
+	 *   (screen DPI and printer DPI must be correctly configured).</li>
+	 * </ol>
+	 */
+	public abstract void setReferenceSystem(int referenceSystem);
+
+	/**
+	 * Computes and sets the size (in pixels) of the cartographic element according
+	 * to the current rendering context (output dpi, map scale, map units) and the
+	 * symbol cartgraphic settings (unit, size, and unit reference system).
+	 *
+	 * @param viewPort, the ViewPort containing the symbol.
+	 * @param dpi, current output dpi (screen or printer)
+	 * @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied
+	 * @return a double containing the previous defined size
+	 */
+	public abstract double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+	/**
+	 * Sets the size of the cartographic element in pixels.
+	 *
+	 * @param cartographicSize, the size in pixels of the element
+	 * @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied
+	 */
+	public abstract void setCartographicSize(double cartographicSize, Geometry geom);
+
+	/**
+	 * Gets the size (in pixels) of the cartographic element according
+	 * to the current rendering context (output dpi, map scale, map units) and the
+	 * symbol cartgraphic settings (unit, size, and unit reference system).
+	 * @param viewPort
+	 * @param dpi
+	 * @param shp
+	 * @return double containing the size in [screen/printer] pixels for the current symbol
+	 */
+	public abstract double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom);
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ITextSymbol.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ITextSymbol.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ITextSymbol.java	(revision 36112)
@@ -0,0 +1,82 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Rectangle;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Point;
+
+
+/**
+ *
+ * ITextSymbol.java<br>
+ * Represents an ISymbol that draws a text.
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es Dec 11, 2007
+ *
+ */
+public interface ITextSymbol extends ISymbol {
+	
+	public static final String SYMBOL_NAME = "text";
+	
+	public final static int SYMBOL_STYLE_ALIGNMENT_LEFT = 94;
+	public final static int SYMBOL_STYLE_ALIGNMENT_RIGHT = 95;
+	public final static int SYMBOL_STYLE_ALIGNMENT_CENTERED = 96;
+	public final static int SYMBOL_STYLE_ALIGNMENT_JUSTIFY = 97;
+	/**
+	 * Establishes the font that will be used to render this ITextSymbol.
+	 * @param font
+	 */
+	public abstract void setFont(Font font);
+
+	/**
+	 * Returns the currently set font.
+	 * @return Font
+	 */
+	public abstract Font getFont();
+
+	/**
+	 * Returns the currently color set to be applied to the text
+	 * @return Color
+	 */
+	public abstract Color getTextColor();
+
+	/**
+	 * Sets the color of the text
+	 * @param color
+	 */
+	public abstract void setTextColor(Color color);
+
+	/**
+	 * Returns the text contained by this symbol
+	 * @return
+	 * @deprecated ?do i need it?
+	 */
+	public abstract String getText();
+
+	/**
+	 * Sets the text to be rendered by this symbol
+	 * @param text, a String
+	 */
+	public abstract void setText(String text);
+
+	/**
+	 * Sets the font size currently set to this symbol
+	 * @param d
+	 */
+	public abstract void setFontSize(double d);
+
+	/**
+	 * Computes a Geometry wrapping the text to be applied
+	 * @param p target location
+	 * @return
+	 */
+	public abstract Geometry getTextWrappingShape(Point p);
+
+	public abstract Rectangle getBounds();
+
+	public abstract void setAutoresizeEnabled(boolean autoresizeFlag);
+
+	public abstract boolean isAutoresizeEnabled();
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ILabelStyle.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ILabelStyle.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ILabelStyle.java	(revision 36112)
@@ -0,0 +1,162 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ILabelStyle.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.10  2007-08-16 06:55:30  jvidal
+* javadoc updated
+*
+* Revision 1.9  2007/08/13 11:36:30  jvidal
+* javadoc
+*
+* Revision 1.8  2007/05/08 08:47:39  jaume
+* *** empty log message ***
+*
+* Revision 1.7  2007/04/05 16:07:14  jaume
+* Styled labeling stuff
+*
+* Revision 1.6  2007/04/04 15:42:03  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2007/04/04 15:41:05  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2007/04/02 16:34:56  jaume
+* Styled labeling (start commiting)
+*
+* Revision 1.3  2007/03/29 16:02:01  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2007/03/09 11:20:56  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.1.2.1  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.styles;
+
+import java.awt.Dimension;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+
+/**
+ * Defines the style that a Label symbol can contain which typically define
+ * a background of the label as an Image, the texts that the label holds
+ * and their position within the label in rendering time.
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public interface ILabelStyle extends IStyle {
+	/**
+	 * @return int, the amount of fields this style allows
+	 */
+	public int getFieldCount();
+
+	/**
+	 * Sets the texts that will appear in the label.
+	 * @param texts
+	 */
+	public void setTextFields(String[] texts);
+
+
+	/**
+	 * Returns an array of rectangles defining the text boxes where text is
+	 * placed.
+	 * @return
+	 */
+	public Rectangle2D[] getTextBounds();
+
+	public Dimension getSize();
+
+	/**
+	 * Returns the position of the point labeled by this label in percent units relative
+	 * to the label bounds. It determines the offset to be applied to the label to be
+	 * placed and allows the user to use custom styles.
+	 */
+	public Point2D getMarkerPoint();
+
+	/**
+	 * Sets the position of the point labeled by this in percent units relative to the
+	 * label bounds
+	 * @param p
+	 * @throws IllegalArgumentException if the point coordinates are >0.0 or <1.0
+	 */
+	public void setMarkerPoint(Point2D p) throws IllegalArgumentException;
+
+	/**
+	 * Sets a TextFieldArea using its index. With this method the user can
+	 * modify the size of the rectangle for the TextFieldArea
+	 * @param index
+	 * @param rect
+	 */
+	public void setTextFieldArea(int index, Rectangle2D rect);
+	
+	/**
+	 * Adds a new TextFieldArea with an specific size which is defined as a rectangle.
+	 * @param index,int
+	 * @param rect,Rectangle2D
+	 */
+	public void addTextFieldArea(Rectangle2D rect);
+	
+	/**
+	 * Delete the TextFieldArea specified by its index.
+	 * @param index,int
+	 */
+	public void deleteTextFieldArea(int index);
+	
+	/**
+	 * Sets the size for a laber and stablishes an unit scale factor to not change
+	 * too much its content
+	 * @param width
+	 * @param height
+	 */
+	public void setSize(double width, double height);
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IStyle.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IStyle.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IStyle.java	(revision 36112)
@@ -0,0 +1,127 @@
+ /* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: IStyle.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.7  2007-09-20 09:33:15  jaume
+* Refactored: fixed name of IPersistAnce to IPersistence
+*
+* Revision 1.6  2007/09/19 16:19:27  jaume
+* removed unnecessary imports
+*
+* Revision 1.5  2007/08/22 09:49:00  jvidal
+* javadoc updated
+*
+* Revision 1.4  2007/08/16 06:55:30  jvidal
+* javadoc updated
+*
+* Revision 1.3  2007/08/13 11:36:41  jvidal
+* javadoc
+*
+* Revision 1.2  2007/04/04 15:41:05  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2007/03/09 11:20:56  jaume
+* Advanced symbology (start committing)
+*
+* Revision 1.1.2.2  2007/02/15 16:23:44  jaume
+* *** empty log message ***
+*
+* Revision 1.1.2.1  2007/02/09 07:47:05  jaume
+* Isymbol moved
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.styles;
+
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * Used by Objects that have to define an style for them.This interface has
+ * methods to stablish a description and get it,to specify if an object
+ * that implements this interface is suitable for a kind of symbol and other
+ * methods to draw symbols.
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface IStyle extends Persistent, Cloneable {
+	/**
+	 * Defines the description of a symbol.It will be specified with an
+	 * string.
+	 * @param desc,String
+	 */
+	public abstract void setDescription(String desc);
+	/**
+	 * Returns the description of a symbol
+	 * @return Description of a symbol
+	 */
+	public abstract String getDescription();
+	/**
+	 * Useful to render the symbol inside the TOC, or inside little
+	 * rectangles. For example, think about rendering a Label with size
+	 * in meters => You will need to specify a size in pixels.
+	 * Of course. You may also preffer to render a prepared image, etc.
+	 * @param g Graphics2D
+	 * @param r Rectangle
+	 */
+	public abstract void drawInsideRectangle(Graphics2D g, Rectangle r) throws SymbolDrawingException;
+
+	/**
+	 * True if this symbol is ok for the style or class.
+	 * @param symbol ISymbol
+	 */
+
+	public abstract boolean isSuitableFor(ISymbol symbol);
+
+	/**
+	 * Used to show an outline of the style to graphically show its properties.
+	 * @param g, the Graphics2D where to draw
+	 * @param r, the bounds of the style inside such Graphics2D
+	 */
+	public abstract void drawOutline(Graphics2D g, Rectangle r) throws SymbolDrawingException;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IWarningSymbol.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IWarningSymbol.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IWarningSymbol.java	(revision 36112)
@@ -0,0 +1,13 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+public interface IWarningSymbol extends ISymbol {
+	
+	public static final String SYMBOL_NAME = "warning";
+
+	void setDrawExceptionType(int symbolDrawExceptionType);
+
+	void setMessage(String message);
+	
+	void setDescription(String description);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolException.java	(revision 36112)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {gvSIG}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Parent exception of symbol related exceptions.
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class SymbolException extends MapContextException {
+
+	private static final long serialVersionUID = -5432842435290441524L;
+
+	/**
+	 * @see BaseException#BaseException(String, String, long)
+	 */
+	public SymbolException(String message, String key, long code) {
+		super(message, key, code);
+	}
+
+	/**
+	 * @see BaseException#BaseException(String, Throwable, String, long)
+	 */
+	public SymbolException(String message, Throwable cause, String key,
+			long code) {
+		super(message, cause, key, code);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IMultiLayerSymbol.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IMultiLayerSymbol.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IMultiLayerSymbol.java	(revision 36112)
@@ -0,0 +1,124 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: IMultiLayerSymbol.java 20989 2008-05-28 11:05:57Z jmvivo $
+ * $Log$
+ * Revision 1.5  2007-08-16 06:55:19  jvidal
+ * javadoc updated
+ *
+ * Revision 1.4  2007/08/09 08:04:36  jvidal
+ * javadoc
+ *
+ * Revision 1.3  2007/08/09 07:57:42  jvidal
+ * javadoc
+ *
+ * Revision 1.2  2007/03/09 11:20:56  jaume
+ * Advanced symbology (start committing)
+ *
+ * Revision 1.1.2.1  2007/02/16 10:54:12  jaume
+ * multilayer splitted to multilayerline, multilayermarker,and  multilayerfill
+ *
+ *
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+
+/**
+ * Allows to create multi layer symbols using the composition of
+ * several symbols of the same type.Depending on the type of the symbols that are
+ * used to compose the final symbol, the user will have MultiLayerMarkerSymbol,
+ * MultiLayerLineSymbol,...
+ *
+ */
+
+public interface IMultiLayerSymbol extends ISymbol {
+
+	/**
+	 * Establishes a concret symbol for a layer
+	 *
+	 * @param index, index of the layer
+	 * @param layer, symbol to be "applied" to the layer
+	 * @throws IndexOutOfBoundsException
+	 */
+	public abstract void setLayer(int index, ISymbol layer)
+	throws IndexOutOfBoundsException;
+	/**
+	 * Changes the position of two layers in a multilayersymbol
+	 * @param index1, index of the layer
+	 * @param index2, index of the layer
+	 */
+	public abstract void swapLayers(int index1, int index2);
+	/**
+	 * Obtains  the symbol that "contains" a layer whose index is the argument of the method.
+	 * @param layerIndex
+	 * @return
+	 */
+	public abstract ISymbol getLayer(int layerIndex);
+	/**
+	 * Returns the number of layers
+	 * @return int
+	 */
+	public abstract int getLayerCount();
+
+	/**
+	 * Stacks a new symbol to the symbol list. The symbol is appended to the
+	 * list and, in terms of use, it will be the last symbol to be processed.
+	 * @param ISymbol newLayer
+	 */
+	public abstract void addLayer(ISymbol newLayer);
+	/**
+	 * Stacks a new symbol to the symbol list. The symbol is appended to the
+	 * list in the specified position.
+	 * @param ISymbol newLayer
+	 */
+	public abstract void addLayer(ISymbol newLayer, int layerIndex)
+	throws IndexOutOfBoundsException;
+
+	/**
+	 * TODO maybe push it up to ISymbol
+	 * @param layer
+	 * @return true if this symbol contains the removed one
+	 */
+	public abstract boolean removeLayer(ISymbol layer);
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolPreferences.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolPreferences.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolPreferences.java	(revision 36112)
@@ -0,0 +1,201 @@
+
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.awt.Font;
+
+/**
+ * Preferences for symbol configuration and default values.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public interface SymbolPreferences {
+
+	/**
+	 * Returns the file extension to use for persisted symbols.
+	 * 
+	 * @return the symbol file extension
+	 */
+	String getSymbolFileExtension();
+
+	/**
+	 * Sets the file extension to use for persisted symbols.
+	 * 
+	 * @param extension
+	 *            the file extension to use for persisted symbols
+	 */
+	void setSymbolFileExtension(String extension);
+
+	/**
+	 * Returns the default color to use for symbols.
+	 * 
+	 * @return the symbol default color
+	 */
+	Color getDefaultSymbolColor();
+
+	/**
+	 * Sets the default color to use for symbols.
+	 * 
+	 * @param defaultSymbolColor
+	 *            the symbol default color
+	 */
+	void setDefaultSymbolColor(Color defaultSymbolColor);
+
+	/**
+	 * Sets the default color for symbols to the original value.
+	 */
+	void resetDefaultSymbolColor();
+
+	/**
+	 * Returns the default fill color to use for symbols.
+	 * 
+	 * @return the default fill color
+	 */
+	Color getDefaultSymbolFillColor();
+
+	/**
+	 * Sets the default fill color to use for symbols.
+	 * 
+	 * @param defaultSymbolFillColor
+	 *            the default fill color
+	 */
+	void setDefaultSymbolFillColor(Color defaultSymbolFillColor);
+
+	/**
+	 * Sets the default fill color for symbols to the original value.
+	 */
+	void resetDefaultSymbolFillColor();
+
+	/**
+	 * Returns if the default symbol fill color has been generated in a aleatory
+	 * way.
+	 * 
+	 * @return if the default symbol fill color is aleatory
+	 */
+	boolean isDefaultSymbolFillColorAleatory();
+
+	/**
+	 * Sets if the default symbol fill color has been generated in a aleatory
+	 * way.
+	 * 
+	 * @param defaultSymbolFillColorAleatory
+	 *            if the default symbol fill color is aleatory
+	 */
+	void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory);
+
+	/**
+	 * Sets if the default symbol fill color is aleatory to the default value.
+	 */
+	void resetDefaultSymbolFillColorAleatory();
+
+	/**
+	 * Returns the default font to use for symbols.
+	 * 
+	 * @return the default symbol font
+	 */
+	Font getDefaultSymbolFont();
+
+	/**
+	 * Sets the default font to use for symbols.
+	 * 
+	 * @param defaultSymbolFont
+	 *            the default symbol font
+	 */
+	void setDefaultSymbolFont(Font defaultSymbolFont);
+
+	/**
+	 * Sets the default font to use for symbols to the original value.
+	 */
+	void resetDefaultSymbolFont();
+
+	/**
+	 * Returns the path to the symbol library, where the persisted symbols can
+	 * be found.
+	 * 
+	 * @return the path to the symbol library
+	 */
+	String getSymbolLibraryPath();
+
+	/**
+	 * Sets the path to the symbol library, where the persisted symbols can be
+	 * found.
+	 * 
+	 * @param symbolLibraryPath
+	 *            the path to the symbol library
+	 */
+	void setSymbolLibraryPath(String symbolLibraryPath);
+
+	/**
+	 * Sets the path to the symbol library to the original value.
+	 */
+	void resetSymbolLibraryPath();
+
+	/**
+	 * Returns the unit that will be used when creating new symbols with
+	 * Cartographic support.
+	 * 
+	 * @return the default cartographic support measure unit
+	 * @see CartographicSupport#getUnit()
+	 */
+	int getDefaultCartographicSupportMeasureUnit();
+
+	/**
+	 * Sets the unit that will be used when creating new symbols with
+	 * Cartographic support.
+	 * 
+	 * @param defaultCartographicSupportMeasureUnit
+	 *            the default cartographic support measure unit
+	 * @see CartographicSupport#setUnit()
+	 */
+	void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit);
+
+	/**
+	 * Returns the reference system that will be used when creating new symbols
+	 * with Cartographic support.
+	 * 
+	 * @return the cartographic reference system
+	 * @see CartographicSupport#PAPER
+	 * @see CartographicSupport#WORLD
+	 */
+	int getDefaultCartographicSupportReferenceSystem();
+
+	/**
+	 * Sets the reference system that will be used when creating new symbols
+	 * with Cartographic support.
+	 * 
+	 * @param defaultCartographicSupportReferenceSystem
+	 *            the cartographic reference system
+	 * @see CartographicSupport#PAPER
+	 * @see CartographicSupport#WORLD
+	 */
+	void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem);
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IPrintable.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IPrintable.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IPrintable.java	(revision 36112)
@@ -0,0 +1,14 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.geom.Geometry;
+
+public interface IPrintable {
+	public void print(Graphics2D g,
+					  AffineTransform at,
+					  Geometry shape,
+					  PrintAttributes properties);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ISymbol.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ISymbol.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ISymbol.java	(revision 36112)
@@ -0,0 +1,217 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.geom.AffineTransform;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.task.Cancellable;
+import org.gvsig.tools.lang.Cloneable;
+
+
+/**
+ *
+ * Interface for symbols.It is the most general one which is implemented by other
+ * specific symbols.For this reason this interface has a method to obtain the derived
+ * version of a common symbol(apart from others). The main purpose is to offer a set of
+ * symbols that will be part of the FMap kernel and allow the developer to add new symbols
+ * without changes in the initial implementation.
+ *
+ *
+ * @author   jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public interface ISymbol extends Persistent, IPrintable, Cloneable {
+
+	public static Color SELECTION_COLOR = Color.YELLOW;
+
+	/**
+	 * Returns the derived version of the symbol that will be used to draw the
+	 * feature when it is selected.
+	 * @return <b>ISymbol</b> applied to a feature when it has been selected.
+	 */
+	public ISymbol getSymbolForSelection();
+
+	/**
+	 * Used when a symbol is going to be drawn.The method to do
+	 * it will depend on the derived version of the symbol.
+	 * @param g
+	 * @param affineTransform
+	 * @param shp
+	 * @param cancel TODO
+	 */
+	public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cancel);
+
+	/**
+	 * <p>
+	 * Returns <b>the distance between the shape's bounding box and the
+	 * symbol-that-represents-this-shape's bounding box</b> in a two-length-float
+	 * array passed as parameter.<br>
+	 * </p>
+	 * <p>
+	 * After this method returns, the float array passed will contain two values
+	 * representing <b>the amount of pixels</b> separating each of the X (first element)
+	 * and Y (second element) axes.<br>
+	 * </p>
+	 * <p>
+	 * This distance maybe dependent on:
+	 * 	<ol>
+	 * 		<li>
+	 * 			<b>The ViewPort</b>: if the symbol is an instance of CartographicSupport
+	 * 			the units it uses are not pixels and the reference system is
+	 * 			CarthographicSupport.WORLD.
+	 * 		</li>
+	 * 		<li>
+	 * 			<b>The target rendering context's dpi (dots-per-inch)</b>: if the symbol
+	 * 			is an instance of CartographicSupport the units it uses are not pixels and
+	 * 			CarthographicSupport.PAPER.
+	 * 		</li>
+	 * 	</ol>
+	 * <br>
+	 * </p>
+	 * <p>
+	 * And in any other case, if the unit of the symbol is pixels or the symbol is not
+	 * even an instance of CartographicSupport, the returning values are only
+	 * defined by the symbol and are not calculated.
+	 * </p>
+	 * @param ViewPort viewPort
+	 * @param Shape shp
+	 * @param int dpi
+	 * @param float[] distances, the array of floats where to store the distances in x and y axis
+	 */
+	public void getPixExtentPlus(Geometry geom, float[] distances, ViewPort viewPort, int dpi);
+	
+	
+	/**
+	 * Informs that the geometry will be represented with that symbol in just one pixel or dot
+	 * 
+	 * 
+	 * 
+	 * @param geom
+	 * @param positionOfDotOrPixel (out) filled with pixel or dot location
+	 * @param viewPort
+	 * @param dpi
+	 * @return
+	 */
+	public boolean isOneDotOrPixel(Geometry geom, double[] positionOfDotOrPixel,
+			ViewPort viewPort, int dpi);
+
+	/**
+	 * Returns the rgb of the symbol when it is drawn like a point.
+	 *
+	 * @return rgb of the symbol.
+	 */
+	public int getOnePointRgb();
+
+
+
+
+
+	/**
+	 * The description is a human-readable text used to label it when show in a symbol menu or something like that.
+	 * @return   description of this symbol.
+	 * @uml.property  name="description"
+	 */
+	public String getDescription();
+
+	/**
+	 * Tells whether the shape of the symbol will be drawn or not.
+	 *
+	 * @return <b>true</b> if Shape must be drawn. Useful if you are labelling
+	 */
+	public boolean isShapeVisible();
+
+	/**
+	 * Sets the description of this symbol
+	 * @param   desc, a string with the description
+	 * @see   ISymbol.getDescription();
+	 * @uml.property  name="description"
+	 */
+	public void setDescription(String desc);
+
+	/**
+	 * The use of this method -and its mechanism- is being valorated. It probably
+	 * will be <b>deprecated</b>.
+	 * @return FSymbol constants. I think it is better to use isSuitableFor
+	 *
+	 */
+	public int getSymbolType();
+
+	/**
+	 * True if this symbol is ok for the geometry. For example, a FillSymbol will
+	 * be suitable for a Polygon.
+	 * @param geom
+	 * @return
+	 */
+	public boolean isSuitableFor(Geometry geom);
+
+	/**
+	 * Useful to render the symbol inside the TOC, or inside little
+	 * rectangles. For example, think about rendering a Label with size
+	 * in meters => You will need to specify a size in pixels.
+	 * Of course, you can also to choose to render a prepared image, etc.
+	 * @param scaleInstance
+	 * @param r
+	 * @param properties TODO
+	 * @param g2
+	 * @throws SymbolDrawingException TODO
+	 */
+	public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException;
+	
+	/**
+	 * Returns the {@link Color} to use to render the symbol.
+	 * @param 
+	 * @return  the {@link Color} to use to render the symbol
+	 */
+	public Color getColor();
+	
+	/**
+	 * Sets the {@link Color} to use to render the symbol.
+	 * @param color to render the symbol
+	 */
+	public void setColor(Color color);
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolDrawingException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolDrawingException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolDrawingException.java	(revision 36112)
@@ -0,0 +1,37 @@
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import org.gvsig.fmap.mapcontext.Messages;
+
+/**
+ * Exception thrown when a symbol cannot be drawn. The type of the exception
+ * will determine the cause.
+ * <ol>
+ * 	<li><b>Unsupported set of settings</b>: getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS</li>
+ * 	<li><b>Shape type mismatch</b>: getType() == SymbolDrawingException.SHAPETYPE_MISMATCH</li>
+ * </ol>
+ * 
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public class SymbolDrawingException extends Exception {
+	private static final long serialVersionUID = 4059410328246182074L;
+	public static final int UNSUPPORTED_SET_OF_SETTINGS = 0;
+	public static final int SHAPETYPE_MISMATCH = 1;
+	public static final String STR_UNSUPPORTED_SET_OF_SETTINGS = Messages.getString("unsupported_set_of_settings");
+	
+	private int type;
+	
+	public int getType() {
+		return type;
+	}
+	/**
+	 * Creates a new instance of this exception.
+	 * <ol>
+	 * 	<li><b>Unsupported set of settings</b>: getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS</li>
+	 * 	<li><b>Shape type mismatch</b>: getType() == SymbolDrawingException.SHAPETYPE_MISMATCH</li>
+	 * </ol>
+	 */ 
+	public SymbolDrawingException(int type) {
+		this.type = type;
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolManager.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolManager.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolManager.java	(revision 36112)
@@ -0,0 +1,276 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileFilter;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.tools.persistence.PersistenceManager;
+
+/**
+ * Symbols management: creation, registration, etc.
+ * 
+ * @author gvSIG team
+ */
+public interface SymbolManager {
+
+	/**
+	 * Loads the symbols persisted into a folder. It loads the symbols through
+	 * the use of the current {@link PersistenceManager}, loading all files
+	 * found into the folder.
+	 * 
+	 * @param folder
+	 *            to load the persisted symbols from
+	 * @return the list of loaded symbols
+	 * @throws SymbolException
+	 *             if there is an error loading the symbols
+	 */
+	ISymbol[] loadSymbols(File folder) throws SymbolException;
+
+	/**
+	 * Loads the symbols persisted into a folder. It loads the symbols through
+	 * the use of the current {@link PersistenceManager}, loading the files
+	 * found into the folder which apply to the provided filter.
+	 * 
+	 * @param folder
+	 *            to load the persisted symbols from
+	 * @param filter
+	 *            to apply to know which files to load
+	 * @return the list of loaded symbols
+	 * @throws SymbolException
+	 *             if there is an error loading the symbols
+	 */
+	ISymbol[] loadSymbols(File folder, FileFilter filter)
+			throws SymbolException;
+
+	/**
+	 * Persists a {@link ISymbol} into the given folder, with the given file
+	 * name.
+	 * 
+	 * @param symbol
+	 *            to persist
+	 * @param fileName
+	 *            of the file to create
+	 * @param folder
+	 *            where to create the file
+	 * @throws SymbolException
+	 *             if there is an error persisting the symbol, or the file to
+	 *             create already exists
+	 */
+	void saveSymbol(ISymbol symbol, String fileName, File folder)
+			throws SymbolException;
+
+	/**
+	 * Persists a {@link ISymbol} into the given folder, with the given file
+	 * name.
+	 * 
+	 * @param symbol
+	 *            to persist
+	 * @param fileName
+	 *            of the file to create
+	 * @param folder
+	 *            where to create the file
+	 * @param overwrite
+	 *            what to do if the file to create already exists
+	 * @throws SymbolException
+	 *             if there is an error persisting the symbol, or the file to
+	 *             create already exists and overwrite is false
+	 */
+	void saveSymbol(ISymbol symbol, String fileName, File folder,
+			boolean overwrite) throws SymbolException;
+
+	/**
+	 * Returns the current {@link SymbolPreferences}.
+	 * 
+	 * @return the current {@link SymbolPreferences}
+	 */
+	SymbolPreferences getSymbolPreferences();
+
+	/**
+	 * Creates a new {@link ISymbol}.
+	 * 
+	 * @param symbolName
+	 *            the name of the symbol to create
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(String symbolName) throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link ISymbol} which can be used to render the given
+	 * {@link Geometry} type.
+	 * 
+	 * @param geomType
+	 *            the {@link Geometry} type to render
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(int geomType) throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link ISymbol} with the given {@link Color}.
+	 * 
+	 * @param symbolName
+	 *            the name of the symbol to create
+	 * @param color
+	 *            the color for the symbol
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(String symbolName, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link ISymbol} which can be used to render the given
+	 * {@link Geometry} type, with the given {@link Color}.
+	 * 
+	 * @param geomType
+	 *            the {@link Geometry} type to render
+	 * @param color
+	 *            the color for the symbol
+	 * @return a new {@link ISymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	ISymbol createSymbol(int geomType, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link IMultiLayerSymbol}.
+	 * 
+	 * @param symbolName
+	 *            the name of the symbol to create
+	 * @return a new {@link IMultiLayerSymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Creates a new {@link IMultiLayerSymbol} which can be used to render the
+	 * given {@link Geometry} type.
+	 * 
+	 * @param geomType
+	 *            the {@link Geometry} type to render
+	 * @return a new {@link IMultiLayerSymbol}
+	 * @throws MapContextRuntimeException
+	 *             if there is an error creating the symbol
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(int geomType)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Registers a {@link ISymbol} implementation class with a name. This way
+	 * the symbol class is not related to any geometry type, so it can be
+	 * created only through the {@link #createSymbol(String)} method.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the ISymbol
+	 *             interface
+	 */
+	void registerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Registers a {@link ISymbol} implementation class with a name and a list
+	 * of geometry types which the symbol is able to render.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param geomTypes
+	 *            the list of geometry types the symbol is able to render
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the ISymbol
+	 *             interface
+	 */
+	void registerSymbol(String symbolName, int[] geomTypes, Class symbolClass)
+			throws MapContextException;
+
+	/**
+	 * Registers a {@link IMultiLayerSymbol} implementation class with a name.
+	 * This way the symbol class is not related to any geometry type, so it can
+	 * be created only through the {@link #createMultiLayerSymbol(String)}
+	 * method.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the
+	 *             {@link IMultiLayerSymbol} interface
+	 */
+	void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * Registers a {@link IMultiLayerSymbol} implementation class with a name
+	 * and a list of geometry types which the symbol is able to render.
+	 * 
+	 * @param symbolName
+	 *            the symbol name
+	 * @param geomTypes
+	 *            the list of geometry types the symbol is able to render
+	 * @param symbolClass
+	 *            the symbol implementation class
+	 * @throws MapContextRuntimeException
+	 *             if the provided class does not implement the
+	 *             {@link IMultiLayerSymbol} interface
+	 */
+	void registerMultiLayerSymbol(String symbolName, int[] geomTypes,
+			Class symbolClass) throws MapContextRuntimeException;
+
+	/**
+	 * Returns an instance of {@link IWarningSymbol}.
+	 * 
+	 * TODO: revisar el uso de esto, a ver si es necesario o se puede ocultar
+	 * dentro de la implementaci�n.
+	 * 
+	 * @param message
+	 * @param symbolDesc
+	 * @param symbolDrawExceptionType
+	 * @return the warning symbol
+	 * @throws MapContextRuntimeException
+	 */
+	IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException;
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolPreferences.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolPreferences.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolPreferences.java	(revision 36112)
@@ -0,0 +1,165 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.File;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+
+/**
+ * Default {@link SymbolPreferences} implementation based on object attributes.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ */
+public class DefaultSymbolPreferences implements SymbolPreferences {
+
+	private String symbolFileExtension = ".gvssym";
+
+	private Color defaultSymbolColor;
+
+	private Color defaultSymbolFillColor;
+
+	private boolean defaultSymbolFillColorAleatory;
+
+	private Font defaultSymbolFont;
+
+	private String symbolLibraryPath;
+
+	/**
+	 * The unit that will be used when creating new symbols with Cartographic
+	 * support.
+	 */
+	private int defaultCartographicSupportMeasureUnit = -1;
+
+	/**
+	 * The reference system that will be used when creating new symbols with
+	 * Cartographic support.
+	 */
+	private int defaultCartographicSupportReferenceSystem =
+			CartographicSupport.WORLD;
+
+	public DefaultSymbolPreferences() {
+		resetDefaultSymbolColor();
+		resetDefaultSymbolFillColor();
+		resetDefaultSymbolFillColorAleatory();
+		resetSymbolLibraryPath();
+		resetDefaultSymbolFont();
+	}
+
+	public String getSymbolFileExtension() {
+		return symbolFileExtension;
+	}
+
+	public void setSymbolFileExtension(String symbolFileExtension) {
+		this.symbolFileExtension = symbolFileExtension;
+	}
+	public String getSymbolLibraryPath() {
+		return symbolLibraryPath;
+	}
+
+	public void setSymbolLibraryPath(String symbolLibraryPath) {
+		this.symbolLibraryPath = symbolLibraryPath;
+	}
+
+	public void resetSymbolLibraryPath() {
+		symbolLibraryPath =
+				System.getProperty("user.home") + File.separator + "gvSIG"
+						+ File.separator + "Symbols";
+	}
+
+	public Color getDefaultSymbolColor() {
+		return defaultSymbolColor;
+	}
+
+	public void setDefaultSymbolColor(Color defaultSymbolColor) {
+		this.defaultSymbolColor = defaultSymbolColor;
+	}
+
+	public void resetDefaultSymbolColor() {
+		defaultSymbolColor = Color.GRAY;
+	}
+
+	public Color getDefaultSymbolFillColor() {
+		return defaultSymbolFillColor;
+	}
+
+	public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) {
+		this.defaultSymbolFillColor = defaultSymbolFillColor;
+	}
+
+	public void resetDefaultSymbolFillColor() {
+		defaultSymbolFillColor = new Color(60, 235, 235);
+	}
+
+	public boolean isDefaultSymbolFillColorAleatory() {
+		return defaultSymbolFillColorAleatory;
+	}
+
+	public void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory) {
+		this.defaultSymbolFillColorAleatory = defaultSymbolFillColorAleatory;
+	}
+
+	public void resetDefaultSymbolFillColorAleatory() {
+		defaultSymbolFillColorAleatory = false;
+	}
+
+	public Font getDefaultSymbolFont() {
+		return defaultSymbolFont;
+	}
+
+	public void setDefaultSymbolFont(Font defaultSymbolFont) {
+		this.defaultSymbolFont = defaultSymbolFont;
+	}
+
+	public void resetDefaultSymbolFont() {
+		defaultSymbolFont = new Font("Serif", Font.PLAIN, 8);
+	}
+
+	public int getDefaultCartographicSupportMeasureUnit() {
+		return defaultCartographicSupportMeasureUnit;
+	}
+
+	public void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit) {
+		this.defaultCartographicSupportMeasureUnit =
+				defaultCartographicSupportMeasureUnit;
+	}
+
+	public int getDefaultCartographicSupportReferenceSystem() {
+		return defaultCartographicSupportReferenceSystem;
+	}
+
+	public void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem) {
+		this.defaultCartographicSupportReferenceSystem =
+				defaultCartographicSupportReferenceSystem;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SaveSymbolException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SaveSymbolException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SaveSymbolException.java	(revision 36112)
@@ -0,0 +1,46 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+
+/**
+ * Exception thrown when there is an error while a symbol is being persisted. 
+ * @author gvSIG team
+ */
+public class SaveSymbolException extends SymbolException {
+
+	private static final long serialVersionUID = 2386696269496820720L;
+
+	private static final String KEY = "SaveSymbolException";
+
+    private static final String MESSAGE = "Error while persisting a symbol";
+    
+	public SaveSymbolException(Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/LoadSymbolException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/LoadSymbolException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/LoadSymbolException.java	(revision 36112)
@@ -0,0 +1,48 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG} {Create Symbol management API}
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+
+/**
+ * Exception thrown when there is an error while a persisted symbol is being
+ * loaded.
+ * 
+ * @author gvSIG team
+ */
+public class LoadSymbolException extends SymbolException {
+
+	private static final long serialVersionUID = 3182880573327780775L;
+
+	private static final String KEY = "LoadSymbolException";
+
+	private static final String MESSAGE = "Error while loading a persisted symbol";
+
+	public LoadSymbolException(Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java	(revision 36112)
@@ -0,0 +1,299 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.impl.InvalidRegisteredClassException;
+import org.gvsig.fmap.mapcontext.impl.RegisteredClassInstantiationException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions;
+
+/**
+ * Default {@link SymbolManager} implementation.
+ * 
+ * @author gvSIG team
+ */
+public class DefaultSymbolManager implements SymbolManager {
+
+	private SymbolPreferences symbolPreferences =
+			new DefaultSymbolPreferences();
+
+	private Map symbolsByName = Collections.synchronizedMap(new HashMap());
+
+	private Map symbolsByShapeType = Collections.synchronizedMap(new HashMap());
+
+	private Map multiLineSymbolsByName =
+			Collections.synchronizedMap(new HashMap());
+
+	private Map multiLineSymbolsByShapeType =
+			Collections.synchronizedMap(new HashMap());
+
+	private IWarningSymbol warningSymbol;
+
+	private Object warningSymbolLock = new Object();
+
+	public ISymbol[] loadSymbols(File folder) throws SymbolException {
+		return loadSymbols(folder, null);
+	}
+
+	public ISymbol[] loadSymbols(File folder, FileFilter fileFilter)
+			throws SymbolException {
+		// TODO: add symbol caching
+
+		if (folder.exists()) {
+
+			File[] symbolFiles = null;
+			if (fileFilter == null) {
+				symbolFiles = folder.listFiles();
+			} else {
+				symbolFiles = folder.listFiles(fileFilter);
+			}
+
+			if (symbolFiles != null) {
+				ISymbol[] symbols = new ISymbol[symbolFiles.length];
+				for (int i = 0; i < symbolFiles.length; i++) {
+					symbols[i] = loadSymbol(symbolFiles[i]);
+				}
+				return symbols;
+			}
+		}
+
+		return null;
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder)
+			throws SymbolException {
+		saveSymbol(symbol, fileName, folder, false);
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder,
+			boolean overwrite) throws SymbolException {
+		// TODO: add symbol caching
+
+		PersistenceManager persistenceManager = ToolsLocator
+				.getPersistenceManager();
+
+		File symbolFile = new File(folder, fileName);
+		if (!overwrite && symbolFile.exists()) {
+			throw new SymbolFileAlreadyExistsException(symbolFile);
+		}
+
+		try {
+			FileOutputStream fos = new FileOutputStream(symbolFile);
+
+			persistenceManager.saveState(persistenceManager.getState(symbol),
+					fos);
+
+			fos.flush();
+			fos.close();
+		} catch (PersistenceException e) {
+			throw new SaveSymbolException(e);
+		} catch (IOException e) {
+			throw new SaveSymbolException(e);
+		}
+	}
+
+	/**
+	 * Loads a persisted symbol from the given file.
+	 */
+	private ISymbol loadSymbol(File file) throws SymbolException {
+		if (file.exists()) {
+			try {
+				FileInputStream fis = new FileInputStream(file);
+
+				PersistenceManager persistenceManager = ToolsLocator
+						.getPersistenceManager();
+
+				PersistentState state = persistenceManager.loadState(fis);
+				ISymbol symbol = (ISymbol) persistenceManager.create(state);
+
+				fis.close();
+				return symbol;
+			} catch (PersistenceException e) {
+				throw new LoadSymbolException(e);
+			} catch (IOException e) {
+				throw new LoadSymbolException(e);
+			}
+		}
+
+		return null;
+	}
+
+	public SymbolPreferences getSymbolPreferences() {
+		return symbolPreferences;
+	}
+
+	public ISymbol createSymbol(String symbolName)
+			throws MapContextRuntimeException {
+		return createSymbol(symbolName, (Class) symbolsByName.get(symbolName),
+				ISymbol.class);
+	}
+
+	public ISymbol createSymbol(int shapeType)
+			throws MapContextRuntimeException {
+		String symbolName =
+				(String) symbolsByShapeType.get(new Integer(shapeType));
+
+		return symbolName == null ? null : createSymbol(symbolName);
+	}
+
+	public ISymbol createSymbol(String symbolName, Color color)
+			throws MapContextRuntimeException {
+		ISymbol symbol = createSymbol(symbolName);
+
+		if (symbol != null) {
+			symbol.setColor(color);
+		}
+
+		return symbol;
+	}
+
+	public ISymbol createSymbol(int shapeType, Color color)
+			throws MapContextRuntimeException {
+		String symbolName =
+				(String) symbolsByShapeType.get(new Integer(shapeType));
+
+		return symbolName == null ? null : createSymbol(symbolName, color);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+			throws MapContextRuntimeException {
+		return (IMultiLayerSymbol) createSymbol(symbolName,
+				(Class) multiLineSymbolsByName.get(symbolName),
+				IMultiLayerSymbol.class);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
+			throws MapContextRuntimeException {
+		String symbolName =
+				(String) multiLineSymbolsByShapeType.get(new Integer(shapeType));
+
+		return symbolName == null ? null : createMultiLayerSymbol(symbolName);
+	}
+
+	public void registerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException {
+		if (symbolClass == null || !ISymbol.class.isAssignableFrom(symbolClass)) {
+			throw new InvalidRegisteredClassException(ISymbol.class,
+					symbolClass, symbolName);
+		}
+		symbolsByName.put(symbolName, symbolClass);
+	}
+
+	public void registerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException {
+		registerSymbol(symbolName, symbolClass);
+		if (shapeTypes != null) {
+			for (int i = 0; i < shapeTypes.length; i++) {
+				symbolsByShapeType.put(new Integer(shapeTypes[i]), symbolName);
+			}
+		}
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException {
+		if (symbolClass == null
+				|| !IMultiLayerSymbol.class.isAssignableFrom(symbolClass)) {
+			throw new InvalidRegisteredClassException(IMultiLayerSymbol.class,
+					symbolClass, symbolName);
+		}
+
+		multiLineSymbolsByName.put(symbolName, symbolClass);
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException {
+		registerMultiLayerSymbol(symbolName, symbolClass);
+		if (shapeTypes != null) {
+			for (int i = 0; i < shapeTypes.length; i++) {
+				multiLineSymbolsByShapeType.put(new Integer(shapeTypes[i]),
+						symbolName);
+			}
+		}
+	}
+
+	public IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException {
+		synchronized (warningSymbolLock) {
+			if (warningSymbol == null) {
+				warningSymbol = (IWarningSymbol) createSymbol("warning");
+			}
+		}
+
+		// TODO: set those values as parameter values in the draw method.
+		warningSymbol.setDescription(symbolDesc);
+		warningSymbol.setMessage(message);
+		warningSymbol.setDrawExceptionType(symbolDrawExceptionType);
+
+		return warningSymbol;
+	}
+
+	private ISymbol createSymbol(String symbolName, Class symbolClass,
+			Class expectedType) throws MapContextRuntimeException {
+		ISymbol symbol;
+		try {
+			symbol =
+					(ISymbol) (symbolClass == null ? null
+							: symbolClass.newInstance());
+		} catch (InstantiationException e) {
+			throw new RegisteredClassInstantiationException(expectedType,
+					symbolClass, symbolName, e);
+		} catch (IllegalAccessException e) {
+			throw new RegisteredClassInstantiationException(expectedType,
+					symbolClass, symbolName, e);
+		}
+
+		// Perform this initialization into the Symbol implementation
+		// if (symbol instanceof CartographicSupport) {
+		// CartographicSupport cs = (CartographicSupport) symbol;
+		// cs.setUnit(getDefaultCartographicSupportMeasureUnit());
+		// cs
+		// .setReferenceSystem(getDefaultCartographicSupportReferenceSystem();
+		// }
+
+		return symbol;
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SymbolFileAlreadyExistsException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SymbolFileAlreadyExistsException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/SymbolFileAlreadyExistsException.java	(revision 36112)
@@ -0,0 +1,51 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
+
+import java.io.File;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+
+/**
+ * Exception thrown when a symbol file is going to be created and the file
+ * already exists. 
+ * @author gvSIG team
+ */
+public class SymbolFileAlreadyExistsException extends SymbolException {
+
+	private static final long serialVersionUID = 2327496845968384363L;
+
+    private static final String KEY = "SymbolFileAlreadyExistsException";
+
+    private static final String MESSAGE = "A symbol was going to be stored on " +
+    		"the file %(file), which already exists";
+    
+	public SymbolFileAlreadyExistsException(File symbolFile) {
+		super(MESSAGE, KEY, serialVersionUID);
+		setValue("file", symbolFile);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/ShapeInfo.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/ShapeInfo.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/ShapeInfo.java	(revision 36112)
@@ -0,0 +1,90 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.strategies;
+
+import java.awt.geom.Rectangle2D;
+
+
+/**
+ * Estructura de datos con la informaci�n relativa a las geometr�as de una
+ * fuente de datos necesaria para acelerar el procesado de la capa
+ */
+public interface ShapeInfo {
+	/**
+	 * A�ade al final de la estructura de datos la informaci�n de una geometr�a
+	 *
+	 * @param boundingBox Extent del shape.
+	 * @param type Tipo de shape.
+	 */
+	void addShapeInfo(Rectangle2D boundingBox, int type);
+
+	/**
+	 * Establece en la posici�n index-�sima de la estructura de datos la
+	 * informaci�n de una geometr�a
+	 *
+	 * @param index �ndice.
+	 * @param boundingBox Extent del shape.
+	 * @param type Tipo de shape.
+	 *
+	 * @throws ArrayIndexOutOfBoundsException Si se intenta establecer la
+	 * 		   informaci�n para una geometr�a que no existe
+	 */
+	void setShapeInfo(int index, Rectangle2D boundingBox, int type)
+		throws ArrayIndexOutOfBoundsException;
+
+	/**
+	 * Obtiene el bounding box de la geometr�a index-�sima
+	 *
+	 * @param index �ndice de la geometr�a.
+	 *
+	 * @return Extent de la geometr�a.
+	 */
+	Rectangle2D getBoundingBox(int index);
+
+	/**
+	 * Obtiene el tipo de la geometr�a index-�sima
+	 *
+	 * @param index �ndice.
+	 *
+	 * @return Tipo de geometr�a.
+	 */
+	int getType(int index);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/SelectedZoomVisitor.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/SelectedZoomVisitor.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/SelectedZoomVisitor.java	(revision 36112)
@@ -0,0 +1,123 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.strategies;
+
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.NotSupportedOperationException;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+
+
+/**
+ * Visitor de zoom a lo seleccionado.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SelectedZoomVisitor implements LayersVisitor, Visitor {
+	private Envelope rectangle = null;
+
+	/**
+	 * Devuelve el Extent de los shapes seleccionados, y si no hay ning�n shape
+	 * seleccionado devuelve null.
+	 *
+	 * @return Extent de los shapes seleccionados.
+	 */
+	public Envelope getSelectBound() {
+		return rectangle;
+	}
+
+	public String getProcessDescription() {
+		return "Defining rectangle to zoom from selected geometries";
+	}
+
+	public void visit(Feature feature) throws BaseException {
+		if (rectangle == null) {
+			rectangle = (feature.getDefaultGeometry()).getEnvelope();
+		} else {
+			rectangle.add((feature.getDefaultGeometry())
+					.getEnvelope());
+		}
+	}
+
+	public void visit(FeatureReference featureRefence) throws BaseException {
+		this.visit(featureRefence.getFeature());
+	}
+
+	public void visit(Object obj) throws BaseException {
+		if (obj instanceof FeatureReference) {
+			this.visit((FeatureReference) obj);
+			return;
+		}
+		if (obj instanceof Feature) {
+			this.visit((Feature) obj);
+			return;
+		}
+		if (obj instanceof FLayer) {
+			this.visit((FLayer) obj);
+			return;
+		}
+
+		throw new NotSupportedOperationException(this, obj);
+	}
+
+	public void visit(FLayer layer) throws BaseException {
+		if (!(layer instanceof SingleLayer)) {
+			return;
+		} else if (!layer.isActive()) {
+			return;
+		}
+		DataSet selection = ((SingleLayer) layer).getDataStore()
+				.getSelection();
+
+		if (selection instanceof Visitable) {
+			((Visitable) selection).accept(this);
+		}
+	}
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/MemoryShapeInfo.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/MemoryShapeInfo.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/strategies/MemoryShapeInfo.java	(revision 36112)
@@ -0,0 +1,126 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.rendering.strategies;
+
+import java.awt.geom.Rectangle2D;
+import java.util.ArrayList;
+
+
+
+/**
+ * Estructura de datos con la informaci�n relativa a las geometr�as de una
+ * fuente de datos necesaria para acelerar el procesado de la capa en memoria.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class MemoryShapeInfo implements ShapeInfo {
+	ArrayList infos = new ArrayList();
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#addShapeInfo(java.awt.geom.Rectangle2D,
+	 * 		int)
+	 */
+	public void addShapeInfo(Rectangle2D boundingBox, int type) {
+		infos.add(new Info(boundingBox, type));
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#addShapeInfo(int,
+	 * 		java.awt.geom.Rectangle2D, int)
+	 */
+	public void setShapeInfo(int index, Rectangle2D boundingBox, int type)
+		throws ArrayIndexOutOfBoundsException {
+		infos.set(index, new Info(boundingBox, type));
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#getBoundingBox(int)
+	 */
+	public Rectangle2D getBoundingBox(int index) {
+		return ((Info) infos.get(index)).getRect();
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.ShapeInfo#getType(int)
+	 */
+	public int getType(int index) {
+		return ((Info) infos.get(index)).getType();
+	}
+
+	/**
+	 * Clase con el rect�ngulo y el tipo de shape.
+	 *
+	 * @author Vicente Caballero Navarro
+	 */
+	class Info {
+		private Rectangle2D rect;
+		private int type;
+
+		/**
+		 * Crea un nuevo Info.
+		 *
+		 * @param rect Extent del shape.
+		 * @param type Tipo de shape.
+		 */
+		public Info(Rectangle2D rect, int type) {
+			this.rect = rect;
+			this.type = type;
+		}
+
+		/**
+		 * Devuelve el extent del shape.
+		 *
+		 * @return Extent del shape.
+		 */
+		public Rectangle2D getRect() {
+			return rect;
+		}
+
+		/**
+		 * Devuelve el tipo de shape.
+		 *
+		 * @return Tipo de shape.
+		 */
+		public int getType() {
+			return type;
+		}
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextException.java	(revision 36112)
@@ -0,0 +1,63 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.tools.exception.BaseException;
+
+/**
+ * Parent class for MapContext exceptions.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public abstract class MapContextException extends BaseException {
+
+    private static final long serialVersionUID = 8122532768532097211L;
+
+    /**
+     * @see BaseException#BaseException(String, String, long)
+     */
+    protected MapContextException(String message, String key, long code) {
+        super(message, key, code);
+    }
+
+    /**
+     * @see BaseException#BaseException(String, Throwable, String, long)
+     */
+    protected MapContextException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+
+    public MapContextException(Throwable cause) {
+        this(
+        		"MapContext related error",
+        		cause,
+        		"_MapContext_related_error", 
+        		serialVersionUID
+        );
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/DriverLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/DriverLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/DriverLayerException.java	(revision 36112)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class DriverLayerException extends LoadLayerException {
+
+	public DriverLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_driver_layer";
+		formatString = "Can�t load driver of the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReprojectLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReprojectLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReprojectLayerException.java	(revision 36112)
@@ -0,0 +1,20 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ReprojectLayerException extends LoadLayerException {
+
+	public ReprojectLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_projection_layer";
+		formatString = "Can�t reproject the layer: %(layer) ";
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LegendLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LegendLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LegendLayerException.java	(revision 36112)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class LegendLayerException extends LoadLayerException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -4033030636689365030L;
+
+    protected LegendLayerException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+	public LegendLayerException(String layer,Throwable cause) {
+		super(
+				"Can�t load the legend for layer %(layer).",
+				cause,
+				"Cant_load_the_legend_for_layer_XlayerX",
+				serialVersionUID
+		);
+		setValue("layer", layer);
+	}
+	
+	public LegendLayerException(String layer) {
+		this(layer,null);
+	}
+	
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/UnsupportedVersionLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/UnsupportedVersionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/UnsupportedVersionLayerException.java	(revision 36112)
@@ -0,0 +1,62 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+
+/**
+ * Excepci�n provocada por el WMS.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class UnsupportedVersionLayerException extends LoadLayerException {
+	public UnsupportedVersionLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_version_layer";
+		formatString = "Can�t use this version of the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StopEditionLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StopEditionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StopEditionLayerException.java	(revision 36112)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class StopEditionLayerException extends BaseException{
+
+	private String layer;
+	public StopEditionLayerException(String l,Throwable exception) {
+		this.layer=l;
+		init();
+		initCause(exception);
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_stop_editing_layer";
+		formatString = "Can�t stop editing the layer: %(tag) ";
+	}
+
+
+	protected Map values() {
+		Hashtable params = new Hashtable();
+		params.put("layer",layer);
+		return params;
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/URLLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/URLLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/URLLayerException.java	(revision 36112)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class URLLayerException extends LoadLayerException {
+
+	public URLLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_url_layer";
+		formatString = "Can�t create the url of the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java	(revision 36112)
@@ -0,0 +1,41 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class CreateLayerException extends MapContextException {
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 7923597739786110983L;
+
+
+    protected CreateLayerException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+
+    public CreateLayerException(String layer,Throwable cause) {
+        super(
+                "Can�t create the layer %(layer).",
+                cause,
+                "Cant_create_the_layer_XlayerX",
+                serialVersionUID
+        );
+        setValue("layer", layer);
+    }
+
+
+    public CreateLayerException(String layer) {
+        super(
+                "Can�t create the layer %(layer).",
+                "Cant_create_the_layer_XlayerX",
+                serialVersionUID
+        );
+        setValue("layer", layer);
+    }
+    
+    
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CreateLayerException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReloadLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReloadLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ReloadLayerException.java	(revision 36112)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ReloadLayerException extends LoadLayerException {
+
+	public ReloadLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_reload_layer";
+		formatString = "Can�t reload the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ConnectionErrorLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ConnectionErrorLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ConnectionErrorLayerException.java	(revision 36112)
@@ -0,0 +1,61 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ConnectionErrorLayerException extends LoadLayerException {
+
+	public ConnectionErrorLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_connection_layer";
+		formatString = "Can�t connet the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StartEditionLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StartEditionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/StartEditionLayerException.java	(revision 36112)
@@ -0,0 +1,32 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class StartEditionLayerException extends BaseException {
+	private String layer;
+	public StartEditionLayerException(String l,Throwable exception) {
+		this.layer=l;
+		init();
+		initCause(exception);
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_start_editing_layer";
+		formatString = "Can�t start editing the layer: %(tag) ";
+	}
+
+
+	protected Map values() {
+		Hashtable params = new Hashtable();
+		params.put("layer",layer);
+		return params;
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ProjectionLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ProjectionLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/ProjectionLayerException.java	(revision 36112)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class ProjectionLayerException extends LoadLayerException {
+
+	public ProjectionLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_projection_layer";
+		formatString = "Can�t project the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/FileLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/FileLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/FileLayerException.java	(revision 36112)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class FileLayerException extends LoadLayerException {
+
+	public FileLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_file_layer";
+		formatString = "Can�t found the file of the layer: %(layer) ";
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LoadLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LoadLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/LoadLayerException.java	(revision 36112)
@@ -0,0 +1,40 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import org.gvsig.fmap.mapcontext.MapContextException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class LoadLayerException extends MapContextException {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7500729722899605739L;
+
+    protected LoadLayerException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+
+	public LoadLayerException(String layer,Throwable cause) {
+		super(
+				"Can�t load the layer %(layer).",
+				cause,
+				"Cant_load_the_layer_XlayerX",
+				serialVersionUID
+		);
+		setValue("layer", layer);
+	}
+
+
+	public LoadLayerException(String layer) {
+		super(
+				"Can�t load the layer %(layer).",
+				"Cant_load_the_layer_XlayerX",
+				serialVersionUID
+		);
+		setValue("layer", layer);
+	}
+	
+	
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/NameLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/NameLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/NameLayerException.java	(revision 36112)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class NameLayerException extends LoadLayerException {
+
+	public NameLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_name_layer";
+		formatString = "Can�t named the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/TypeLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/TypeLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/TypeLayerException.java	(revision 36112)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class TypeLayerException extends LoadLayerException {
+
+	public TypeLayerException(String l,Throwable exception) {
+		super(l,exception);
+		init();
+	}
+	/**
+	 *
+	 */
+	private void init() {
+		messageKey = "error_type_layer";
+		formatString = "Can�t use type of the layer: %(layer) ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CancelEditingLayerException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CancelEditingLayerException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/exceptions/CancelEditingLayerException.java	(revision 36112)
@@ -0,0 +1,31 @@
+package org.gvsig.fmap.mapcontext.exceptions;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.gvsig.tools.exception.BaseException;
+/**
+ * @author Vicente Caballero Navarro
+ */
+public class CancelEditingLayerException extends BaseException {
+
+	private String layer = null;
+
+	public CancelEditingLayerException(String layer,Throwable exception) {
+		this.layer = layer;
+		init();
+		initCause(exception);
+	}
+
+	private void init() {
+		messageKey = "error_cancel_editing_layer";
+		formatString = "Can�t cancel editing the layer: %(layer) ";
+	}
+
+	protected Map values() {
+		Hashtable params = new Hashtable();
+		params.put("layer",layer);
+		return params;
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextRuntimeException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextRuntimeException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextRuntimeException.java	(revision 36112)
@@ -0,0 +1,64 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {DiSiD Technologies}  {{Task}}
+*/
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.exception.BaseRuntimeException;
+
+/**
+ * Parent class for MapContext runtime exceptions.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class MapContextRuntimeException extends BaseRuntimeException {
+
+	private static final long serialVersionUID = 3993964182701795153L;
+
+	/**
+     * @see BaseException#BaseException(String, String, long)
+     */
+    protected MapContextRuntimeException(String message, String key, long code) {
+        super(message, null, key, code);
+    }
+
+    /**
+     * @see BaseException#BaseException(String, Throwable, String, long)
+     */
+    protected MapContextRuntimeException(String message, Throwable cause, String key,
+            long code) {
+        super(message, cause, key, code);
+    }
+    
+    public MapContextRuntimeException(Throwable cause) {
+        this(
+        		"MapContext related error",
+        		cause,
+        		"_MapContext_related_error", 
+        		serialVersionUID
+        );
+    }
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLocator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLocator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLocator.java	(revision 36112)
@@ -0,0 +1,111 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.tools.locator.BaseLocator;
+import org.gvsig.tools.locator.Locator;
+import org.gvsig.tools.locator.LocatorException;
+
+/**
+ * Locator for the MapContext library.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class MapContextLocator extends BaseLocator {
+
+	public static final String MAPCONTEXT_MANAGER_NAME = "mapcontextlocator.manager";
+
+	private static final String MAPCONTEXT_MANAGER_DESCRIPTION = "MapContext Library manager";
+
+	public static final String SYMBOL_MANAGER_NAME = "symbol.manager";
+
+	private static final String SYMBOL_MANAGER_DESCRIPTION = "Symbols manager";
+
+	private static final MapContextLocator instance = new MapContextLocator();
+
+	/**
+	 * Private constructor, we don't want it to be able to be instantiated
+	 * outside this class.
+	 */
+	private MapContextLocator() {
+		// Nothing to do
+	}
+
+	public static MapContextLocator getInstance() {
+		return instance;
+	}
+
+	/**
+	 * Return a reference to MapContextManager.
+	 * 
+	 * @return a reference to MapContextManager
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static MapContextManager getMapContextManager()
+			throws LocatorException {
+		return (MapContextManager) getInstance().get(MAPCONTEXT_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the MapContextManager interface.
+	 * 
+	 * @param clazz
+	 *            implementing the MapContextManager interface
+	 */
+	public static void registerMapContextManager(Class clazz) {
+		getInstance().register(MAPCONTEXT_MANAGER_NAME,
+				MAPCONTEXT_MANAGER_DESCRIPTION, clazz);
+	}
+
+	/**
+	 * Return a reference to the {@link SymbolManager}.
+	 * 
+	 * @return a reference to the SymbolManager.
+	 * @throws LocatorException
+	 *             if there is no access to the class or the class cannot be
+	 *             instantiated
+	 * @see Locator#get(String)
+	 */
+	public static SymbolManager getSymbolManager() throws LocatorException {
+		return (SymbolManager) getInstance().get(SYMBOL_MANAGER_NAME);
+	}
+
+	/**
+	 * Registers the Class implementing the SymbolManager interface.
+	 * 
+	 * @param clazz
+	 *            implementing the SymbolManager interface
+	 */
+	public static void registerSymbolManager(Class clazz) {
+		getInstance().register(SYMBOL_MANAGER_NAME, SYMBOL_MANAGER_DESCRIPTION,
+				clazz);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java	(revision 36112)
@@ -0,0 +1,134 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * 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 2
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2008 IVER T.I. S.A.   {{Task}}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.CompatLibrary;
+import org.gvsig.fmap.dal.DALLibrary;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.impl.DefaultMapContextDrawer;
+import org.gvsig.fmap.mapcontext.layers.FLayerStatus;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.FLyrDefault;
+import org.gvsig.fmap.mapcontext.layers.LayerFactory;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.layers.vectorial.ReprojectDefaultGeometry;
+import org.gvsig.fmap.mapcontext.tools.persistence.ColorPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.DimensionPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.FontPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.Point2DPersistenceFactory;
+import org.gvsig.fmap.mapcontext.tools.persistence.Rectangle2DPersistenceFactory;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+import org.gvsig.tools.locator.ReferenceNotRegisteredException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.util.Caller;
+import org.gvsig.tools.util.impl.DefaultCaller;
+
+/**
+ * Library for the MapContext library API.
+ * @author jmvivo
+ */
+public class MapContextLibrary extends AbstractLibrary {
+	final static private Logger LOG = LoggerFactory.getLogger(FLyrDefault.class);
+
+    public void doRegistration() {
+        registerAsAPI(MapContextLibrary.class);
+        require(DALLibrary.class);
+        require(CompatLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+		LayerFactory.getInstance().registerLayerToUseForStore(
+				FeatureStore.class, FLyrVect.class);
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+        Caller caller = new DefaultCaller();
+
+        FLyrDefault.registerMetadata();	
+
+		MapContextManager manager = MapContextLocator.getMapContextManager();
+
+		if (manager == null) {
+			throw new ReferenceNotRegisteredException(
+					MapContextLocator.MAPCONTEXT_MANAGER_NAME,
+					MapContextLocator.getInstance());
+		}
+
+		try {
+			manager.setDefaultMapContextDrawer(DefaultMapContextDrawer.class);
+		} catch (MapContextException ex) {
+			throw new LibraryException(getClass().getName(), ex);
+		}
+		
+        caller.add( new ViewPort.RegisterPersistence() );
+
+        /*
+         * Do register of all
+         */
+        if( !caller.call() ) {
+        	throw new LibraryException(MapContextLibrary.class, caller.getExceptions());
+        }
+
+        // persistent classes
+		MapContext.registerPersistent();
+		
+		ExtentHistory.registerPersistent();
+		
+//		MappingAnnotation.registerPersistent();
+		ReprojectDefaultGeometry.registerPersistent();
+
+//		FLayerVectorialDB.registerPersistent();
+//		FLayerFileVectorial.registerPersistent();
+		
+		FLayerStatus.registerPersistent();
+		FLyrDefault.registerPersistent();
+		FLyrVect.registerPersistent();
+		FLayers.registerPersistent();
+				
+		////////////////////////////////////////
+		// Register the persistence factories //
+		////////////////////////////////////////
+		PersistenceManager persistenceManager =
+				ToolsLocator.getPersistenceManager();
+		// Color
+		persistenceManager.registerFactory(new ColorPersistenceFactory());
+		// Point2D
+		persistenceManager.registerFactory(new Point2DPersistenceFactory());
+		// Font
+		persistenceManager.registerFactory(new FontPersistenceFactory());
+		// Rectangle2D
+		persistenceManager.registerFactory(new Rectangle2DPersistenceFactory());
+		// awt Dimension
+		persistenceManager.registerFactory(new DimensionPersistenceFactory());
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Messages.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Messages.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Messages.java	(revision 36112)
@@ -0,0 +1,88 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+/**
+ * Clase que accede a los recursos para la i18n
+ */
+public class Messages {
+    /** DOCUMENT ME! */
+    private static final String BUNDLE_NAME = "com.iver.cit.gvsig.fmap.FMap";
+
+    /** DOCUMENT ME! */
+    private static ResourceBundle RESOURCE_BUNDLE = null;
+
+    /**
+     * Inicializa la clase con el locale adecuado
+     *
+     * @param loc Locale de la aplicaci�n
+     */
+    private static void init() {
+        Locale loc = Locale.getDefault();
+        RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME, loc);
+    }
+
+    
+    /**
+     * Obtiene el valor del recurso con clave 'key'
+     *
+     * @param key clave del recurso que se quiere obtener
+     *
+     * @return recurso que se quiere obtener o !key! en caso de no encontrarlo.
+     *         En dicho caso no se notifica al framework ya que  estos son los
+     *         mensajes propios de la aplicaci�n y deben de estar todos
+     */
+    public static String getString(String key) {
+        try {
+            // La primera vez, cargamos las cadenas.
+            if (RESOURCE_BUNDLE == null)
+                init();
+            return RESOURCE_BUNDLE.getString(key);
+        } catch (MissingResourceException e) {
+            return '!' + key + '!';
+        }
+    }
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextManager.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextManager.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextManager.java	(revision 36112)
@@ -0,0 +1,359 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {Create Manager to register MapContextDrawer implementation}
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+
+/**
+ * Manager of the MapContext library.
+ * 
+ * Holds the default implementation of the {@link MapContextDrawer}.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ * @author <a href="mailto:jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a>
+ */
+public interface MapContextManager {
+
+	/**
+	 * Create a new layer from the data parameters passed as parameter.
+	 * 
+	 * @param layerName name used in for the new layer. 
+	 * @param parameters used for create the {@link DataStore} of the new layer
+	 * 
+	 * @return the new FLayer
+	 * 
+	 * @throws LoadLayerException
+	 */
+	public FLayer createLayer(String layerName,
+			DataStoreParameters parameters) throws LoadLayerException;
+
+	/**
+	 * Create a layer from a {@link DataStore}.
+	 * 
+	 * @param layerName name used in for the new layer. 
+	 * @param store used for the new layer
+	 * 
+	 * @return the new FLayer
+	 * 
+	 * @throws LoadLayerException
+	 */
+	public FLayer createLayer(String layerName, DataStore store)
+			throws LoadLayerException;
+
+	/**
+	 * Create a layer to be used as the {@link GraphicLayer}.
+	 * 
+	 * @param projection used in the layer.
+	 * 
+	 * @return the new {@link GraphicLayer}.
+	 */
+	public GraphicLayer createGraphicsLayer(IProjection projection);
+
+	/**
+	 * Returns the current {@link SymbolManager}.
+	 * 
+	 * @return the {@link SymbolManager}
+	 */
+	SymbolManager getSymbolManager();
+
+	/**
+	 * Sets the class to use as the default implementation for the
+	 * {@link MapContextDrawer}.
+	 * 
+	 * @param drawerClazz
+	 *            the {@link MapContextDrawer} class to use
+	 * @throws MapContextException
+	 *             if there is any error setting the class
+	 */
+	public void setDefaultMapContextDrawer(Class drawerClazz)
+			throws MapContextException;
+
+	public void validateMapContextDrawer(Class drawerClazz) throws MapContextException;
+
+	/**
+	 * Creates a new instance of the default {@link MapContextDrawer}
+	 * implementation.
+	 * 
+	 * @return the new {@link MapContextDrawer} instance
+	 * @throws MapContextException
+	 *             if there is an error creating the new object instance
+	 */
+	public MapContextDrawer createDefaultMapContextDrawerInstance()
+			throws MapContextException;
+
+	/**
+	 * Creates a new instance of the provided {@link MapContextDrawer}
+	 * implementation.
+	 * 
+	 * @param drawerClazz
+	 *            the {@link MapContextDrawer} implementation class
+	 * @return the new {@link MapContextDrawer} instance
+	 * @throws MapContextException
+	 *             if there is an error creating the new object instance
+	 */
+	public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz)
+			throws MapContextException;
+
+	
+	
+	void registerLegend(String legendName, Class legendClass)
+			throws MapContextRuntimeException;
+
+	ILegend createLegend(String legendName) throws MapContextRuntimeException;
+
+	void setDefaultVectorLegend(String legendName);
+
+	IVectorLegend createDefaultVectorLegend(int shapeType)
+			throws MapContextRuntimeException;
+
+	void registerLegendWriter(String legendName, String format,
+			Class writerClass) throws MapContextRuntimeException;
+
+	void registerLegendReader(String format, Class readerClass)
+			throws MapContextRuntimeException;
+
+	ILegendWriter createLegendWriter(String legendName, String format)
+			throws MapContextException;
+
+	ILegendReader createLegendReader(String format)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	int getDefaultCartographicSupportMeasureUnit();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	int getDefaultCartographicSupportReferenceSystem();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	Color getDefaultSymbolColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolColor(Color defaultSymbolColor);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	Color getDefaultSymbolFillColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolFillColor(Color defaultSymbolFillColor);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolFillColor();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	boolean isDefaultSymbolFillColorAleatory();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolFillColorAleatory();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	Font getDefaultSymbolFont();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setDefaultSymbolFont(Font defaultSymbolFont);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetDefaultSymbolFont();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	String getSymbolLibraryPath();
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void setSymbolLibraryPath(String symbolLibraryPath);
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0
+	 * @see {@link SymbolPreferences}.
+	 */
+	void resetSymbolLibraryPath();
+	
+	
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(String symbolName) throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(int shapeType) throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(String symbolName, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	ISymbol createSymbol(int shapeType, Color color)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerSymbol(String symbolName, int[] shapeTypes, Class symbolClass)
+			throws MapContextException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+			throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException;
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.0 @see {@link SymbolManager}
+	 */
+	IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException;
+	
+	/**
+	 * It returns the legend associated with a {@link DataStore}.
+	 * If the legend doesn't exist it returns <code>null</code>.
+	 * @param dataStore
+	 * the store that could have a legend.
+	 * @return
+	 * the legend or <code>null</code>.
+	 */
+	ILegend getLegend(DataStore dataStore);	
+
+
+    // TODO:
+    // DynObjectModel getFeatureTypeUIModel(DataStore store,
+    // FeatureType featureType);
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/SelectedZoomVisitor.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/SelectedZoomVisitor.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/SelectedZoomVisitor.java	(revision 36112)
@@ -0,0 +1,123 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import org.gvsig.fmap.dal.DataSet;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureReference;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.NotSupportedOperationException;
+import org.gvsig.tools.visitor.Visitable;
+import org.gvsig.tools.visitor.Visitor;
+
+
+/**
+ * Visitor de zoom a lo seleccionado.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class SelectedZoomVisitor implements LayersVisitor, Visitor {
+	private Envelope rectangle = null;
+
+	/**
+	 * Devuelve el Extent de los shapes seleccionados, y si no hay ning�n shape
+	 * seleccionado devuelve null.
+	 *
+	 * @return Extent de los shapes seleccionados.
+	 */
+	public Envelope getSelectBound() {
+		return rectangle;
+	}
+
+	public String getProcessDescription() {
+		return "Defining rectangle to zoom from selected geometries";
+	}
+
+	public void visit(Feature feature) throws BaseException {
+		if (rectangle == null) {
+			rectangle = (feature.getDefaultGeometry()).getEnvelope();
+		} else {
+			rectangle.add((feature.getDefaultGeometry())
+					.getEnvelope());
+		}
+	}
+
+	public void visit(FeatureReference featureRefence) throws BaseException {
+		this.visit(featureRefence.getFeature());
+	}
+
+	public void visit(Object obj) throws BaseException {
+		if (obj instanceof FeatureReference) {
+			this.visit((FeatureReference) obj);
+			return;
+		}
+		if (obj instanceof Feature) {
+			this.visit((Feature) obj);
+			return;
+		}
+		if (obj instanceof FLayer) {
+			this.visit((FLayer) obj);
+			return;
+		}
+
+		throw new NotSupportedOperationException(this, obj);
+	}
+
+	public void visit(FLayer layer) throws BaseException {
+		if (!(layer instanceof SingleLayer)) {
+			return;
+		} else if (!layer.isActive()) {
+			return;
+		}
+		DataSet selection = ((SingleLayer) layer).getDataStore()
+				.getSelection();
+
+		if (selection instanceof Visitable) {
+			((Visitable) selection).accept(this);
+		}
+	}
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Record.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Record.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/Record.java	(revision 36112)
@@ -0,0 +1,49 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+public interface Record {
+    int getFieldCount() ;
+
+    String getFieldName(int index) ;
+
+    String getFieldValue(int index) ;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java	(revision 36112)
@@ -0,0 +1,1921 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.ArrayList;
+
+import org.cresques.cts.GeoCalc;
+import org.cresques.cts.IProjection;
+import org.cresques.cts.UTM;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.mapcontext.events.ColorEvent;
+import org.gvsig.fmap.mapcontext.events.ExtentEvent;
+import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
+import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener;
+import org.gvsig.timesupport.Time;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.lang.Cloneable;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.util.Callable;
+
+/**
+ * <p>
+ * <code>ViewPort</code> class represents the logic needed to transform a
+ * rectangular area of a map to the available area in screen to display it.
+ * </p>
+ * 
+ * <p>
+ * Includes an affine transformation, between the rectangular area selected of
+ * the external map, in its own <i>map coordinates</i>, to the rectangular area
+ * available of a view in <i>screen coordinates</i>.
+ * </p>
+ * 
+ * <p>
+ * Elements:
+ * <ul>
+ * <li><i>extent</i>: the area selected of the map, in <i>map coordinates</i>.
+ * <li><i>imageSize</i>: width and height in pixels (<i>screen coordinates</i>)
+ * of the area available in screen to display the area selected of the map.
+ * <li><i>adjustedExtent</i>: the area selected must be an scale of
+ * <i>imageSize</i>.<br>
+ * This implies adapt the extent, preserving and centering it, and adding around
+ * the needed area to fill all the image size. That added area will be extracted
+ * from the original map, wherever exists, and filled with the background color
+ * wherever not.
+ * <li><i>scale</i>: the scale between the adjusted extent and the image size.
+ * <li><i>backColor</i>: the default background color in the view, if there is
+ * no map.
+ * <li><i>trans</i>: the affine transformation.
+ * <li><i>proj</i>: map projection used in this view.
+ * <li><i>distanceUnits</i>: distance measurement units, of data in screen.
+ * <li><i>mapUnits</i>: measurement units, of data in map.
+ * <li><i>extents</i>: an {@link ExtentHistory ExtentHistory} with the last
+ * previous extents.
+ * <li><i>offset</i>: position in pixels of the available rectangular area,
+ * where start drawing the map.
+ * <li><i>dist1pixel</i>: the distance in <i>world coordinates</i> equivalent to
+ * 1 pixel in the view with the current extent.
+ * <li><i>dist3pixel</i>: the distance in <i>world coordinates</i> equivalent to
+ * 3 pixels in the view with the current extent.
+ * <li><i>listeners</i>: list with the {@link ViewPortListener ViewPortListener}
+ * registered.
+ * </ul>
+ * </p>
+ * 
+ * @author Vicente Caballero Navarro
+ */
+public class ViewPort implements Persistent, Cloneable {
+
+    private static final String FIELD_DISTANCE_AREA = "distanceArea";
+    private static final String FIELD_IMAGE_SIZE = "imageSize";
+    private static final String FIELD_PROJ = "proj";
+    private static final String FIELD_OFFSET = "offset";
+    private static final String FIELD_MAP_UNITS = "mapUnits";
+    private static final String FIELD_EXTENT = "extent";
+    private static final String FIELD_EXTENTS = "extents";
+    private static final String FIELD_DISTANCE_UNITS = "distanceUnits";
+    private static final String FIELD_DIST3PIXEL = "dist3pixel";
+    private static final String FIELD_DIST1PIXEL = "dist1pixel";
+    private static final String FIELD_CLIP = "clip";
+    private static final String FIELD_BACK_COLOR = "backColor";
+    private static final String FIELD_ADJUSTED_EXTENT = "adjustedExtent";
+
+    private static final GeometryManager geomManager =
+        GeometryLocator.getGeometryManager();
+    private static final Logger logger =
+        LoggerFactory.getLogger(ViewPort.class);
+
+    /**
+     * <p>
+     * Screen resolution in <i>dots-per-inch</i>. Useful to calculate the
+     * geographic scale of the view.
+     * </p>
+     * 
+     * @see Toolkit#getScreenResolution()
+     * @see #getScale()
+     */
+    private static int dpi = java.awt.Toolkit.getDefaultToolkit()
+        .getScreenResolution();
+
+    /**
+     * <p>
+     * Area selected by user using some tool.
+     * </p>
+     * 
+     * <p>
+     * When the zoom changes (for instance when using the zoom in or zoom out
+     * tools, but also zooming to a selected feature or shape) the extent that
+     * covers that area is the value returned by this method. It is not the
+     * actual area shown in the view because it does not care about the aspect
+     * ratio of the available area. However, any part of the real world
+     * contained in this extent is shown in the view.
+     * </p>
+     * <p>
+     * Probably this is not what you are looking for. If you are looking for the
+     * complete extent currently shown, you must use
+     * {@linkplain #getAdjustedExtent()} method which returns the extent that
+     * contains this one but regarding the current view's aspect ratio.
+     * </p>
+     * 
+     * @see #getExtent()
+     * @see #setEnvelope(Envelope)
+     */
+    protected Rectangle2D extent;
+    
+    protected Time time;
+
+    /**
+     * <p>
+     * Location and dimensions of the extent adjusted to the image size.
+     * </p>
+     * 
+     * @see #getAdjustedExtent()
+     */
+    protected Rectangle2D adjustedExtent;
+
+    /**
+     * Draw version of the context. It's used for know when de componend has
+     * changed any visualization property
+     * 
+     * @see getDrawVersion
+     * @see updateDrawVersion
+     */
+    private long drawVersion = 0L;
+
+    /**
+     * <p>
+     * History with the last extents of the view.
+     * </p>
+     * 
+     * @see #setPreviousExtent()
+     * @see #getExtents()
+     */
+    protected ExtentHistory extents = new ExtentHistory();
+
+    /**
+     * <p>
+     * Size in <i>screen coordinates</i> of the rectangle where the image is
+     * displayed.
+     * </p>
+     * <p>
+     * Used by {@linkplain #calculateAffineTransform()} to calculate:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustableExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getImageSize()
+     * @see #getImageHeight()
+     * @see #getImageWidth()
+     * @see #setImageSize(Dimension)
+     */
+    private Dimension imageSize;
+
+    /**
+     * <p>
+     * the affine transformation between the {@link #extent extent} in <i>map 2D
+     * coordinates</i> to the image area in the screen, in <i>screen 2D
+     * coordinates</i> (pixels).
+     * </p>
+     * 
+     * @see AffineTransform
+     * 
+     * @see #getAffineTransform()
+     * @see #setAffineTransform(AffineTransform)
+     * @see #calculateAffineTransform()
+     */
+    private AffineTransform trans = new AffineTransform();
+
+    /**
+     * <p>
+     * Measurement unit used for measuring distances and displaying information.
+     * </p>
+     * 
+     * @see #getDistanceUnits()
+     * @see #setDistanceUnits(int)
+     */
+    private int distanceUnits = 1;
+    /**
+     * <p>
+     * Measurement unit used for measuring areas and displaying information.
+     * </p>
+     * 
+     * @see #getDistanceArea()
+     * @see #setDistanceArea(int)
+     */
+    private int distanceArea = 1;
+    /**
+     * <p>
+     * Measurement unit used by this view port for the map.
+     * </p>
+     * 
+     * @see #getMapUnits()
+     * @see #setMapUnits(int)
+     */
+    private int mapUnits = 1;
+
+    /**
+     * <p>
+     * Array with the {@link ViewPortListener ViewPortListener}s registered to
+     * this view port.
+     * </p>
+     * 
+     * @see #addViewPortListener(ViewPortListener)
+     * @see #removeViewPortListener(ViewPortListener)
+     */
+    private ArrayList listeners = new ArrayList();
+
+    /**
+     * <p>
+     * The offset is the position where start drawing the map.
+     * </p>
+     * <p>
+     * The offset of a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s
+     * <i>View</i> is always (0, 0) because the drawing area fits with the full
+     * window area. But in a <a href="http://www.gvsig.gva.es/">gvSIG</a>'s
+     * <i>Layout</i> it's up to the place where the <code>FFrameView</code> is
+     * located.
+     * </p>
+     * 
+     * @see #getOffset()
+     * @see #setOffset(Point2D)
+     */
+    private Point2D offset = new Point2D.Double(0, 0);
+
+    /**
+     * <p>
+     * Clipping area.
+     * </p>
+     */
+    // private Rectangle2D clip;
+
+    /**
+     * <p>
+     * Background color of this view.
+     * </p>
+     * 
+     * @see #getBackColor()
+     * @see #setBackColor(Color)
+     */
+    private Color backColor = null; // Color.WHITE;
+
+    /**
+     * <p>
+     * Information about the map projection used in this view.
+     * </p>
+     * 
+     * @see #getProjection()
+     * @see #setProjection(IProjection)
+     */
+    private IProjection proj;
+
+    /**
+     * <p>
+     * Represents the distance in <i>world coordinates</i> equivalent to 1 pixel
+     * in the view with the current extent.
+     * </p>
+     * 
+     * @see #getDist1pixel()
+     * @see #setDist1pixel(double)
+     */
+    private double dist1pixel;
+
+    /**
+     * <p>
+     * Represents the distance in <i>world coordinates</i> equivalent to 3
+     * pixels in the view with the current extent.
+     * </p>
+     * 
+     * @see #getDist3pixel()
+     * @see #setDist3pixel(double)
+     */
+    private double dist3pixel;
+
+    /**
+     * <p>
+     * Ratio between the size of <code>imageSize</code> and <code>extent</code>:
+     * <br>
+     * <i>
+     * 
+     * <pre>
+     * min{(imageSize.getHeight()/extent.getHeight(), imageSize.getWidth()/extent.getWidth())}
+     * </pre>
+     * 
+     * </i>
+     * </p>
+     */
+    private double scale;
+
+    /**
+     * <p>
+     * Clipping area.
+     * </p>
+     * 
+     * @see #setClipRect(Rectangle2D)
+     */
+    private Rectangle2D cliprect;
+
+    /**
+     * <p>
+     * Enables or disables the <i>"adjustable extent"</i> mode.
+     * </p>
+     * 
+     * <p>
+     * When calculates the affine transform, if
+     * <ul>
+     * <li><i>enabled</i>: the new <code>adjustedExtent</code> will have the (X,
+     * Y) coordinates of the <code>extent</code> and an area that will be an
+     * scale of the image size. That area will have different height or width
+     * (not both) of the extent according the least ratio (height or width) in
+     * 
+     * <pre>
+     * image.size/extent.size&quot;
+     * </pre>.
+     * <li><i>disabled</i>: the new <code>adjustedExtent</code> will be like
+     * <code>extent</code>.
+     * </ul>
+     * </p>
+     * 
+     * @see #setAdjustable(boolean)
+     */
+    private boolean adjustableExtent = true;
+
+    public ViewPort() {
+
+    }
+
+    /**
+     * <p>
+     * Creates a new view port with the information of the projection in
+     * <code>proj</code> argument, and default configuration:
+     * </p>
+     * <p>
+     * <ul>
+     * <li><i><code>distanceUnits</code></i> = meters
+     * <li><i><code>mapUnits</code></i> = meters
+     * <li><i><code>backColor</code></i> = <i>undefined</i>
+     * <li><i><code>offset</code></i> = <code>new Point2D.Double(0, 0);</code>
+     * </ul>
+     * </p>
+     * 
+     * @param proj
+     *            information of the projection for this view port
+     */
+    public ViewPort(IProjection proj) {
+        // Por defecto
+        this.proj = proj;
+    }
+
+    /**
+     * <p>
+     * Changes the status of the <i>"adjustable extent"</i> option to enabled or
+     * disabled.
+     * </p>
+     * 
+     * <p>
+     * If view port isn't adjustable, won't bear in mind the aspect ratio of the
+     * available rectangular area to calculate the affine transform from the
+     * original map in real coordinates. (Won't scale the image to adapt it to
+     * the available rectangular area).
+     * </p>
+     * 
+     * @param boolean the boolean to be set
+     */
+    public void setAdjustable(boolean adjustable) {
+        if (adjustable == adjustableExtent) {
+            return;
+        }
+        adjustableExtent = adjustable;
+        this.updateDrawVersion();
+    }
+
+    /**
+     * <p>
+     * Appends the specified {@link ViewPortListener ViewPortListener} listener
+     * if weren't.
+     * </p>
+     * 
+     * @param arg0
+     *            the listener to add
+     * 
+     * @return <code>true</code> if has been added successfully
+     * 
+     * @see #removeViewPortListener(ViewPortListener)
+     */
+    public boolean addViewPortListener(ViewPortListener arg0) {
+        if (!listeners.contains(arg0)) {
+            return listeners.add(arg0);
+        }
+        return false;
+    }
+
+    /**
+     * <p>
+     * Removes the specified {@link ViewPortListener ViewPortListener} listener,
+     * if existed.
+     * </p>
+     * 
+     * @param arg0
+     *            the listener to remove
+     * 
+     * @return <code>true</code> if the contained the specified listener.
+     * 
+     * @see #addViewPortListener(ViewPortListener)
+     */
+    public boolean removeViewPortListener(ViewPortListener arg0) {
+        return listeners.remove(arg0);
+    }
+
+    /**
+     * <p>
+     * Converts and returns the distance <code>d</code>, that is in <i>map
+     * coordinates</i> to <i>screen coordinates</i> using a <i>delta
+     * transform</i> with the transformation affine information in the
+     * {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param d
+     *            distance in <i>map coordinates</i>
+     * 
+     * @return distance equivalent in <i>screen coordinates</i>
+     * 
+     * @see #toMapDistance(int)
+     * @see AffineTransform#deltaTransform(Point2D, Point2D)S
+     */
+    public int fromMapDistance(double d) {
+        Point2D.Double pWorld = new Point2D.Double(1, 1);
+        Point2D.Double pScreen = new Point2D.Double();
+
+        try {
+            trans.deltaTransform(pWorld, pScreen);
+        } catch (Exception e) {
+            System.err.print(e.getMessage());
+        }
+
+        return (int) (d * pScreen.x);
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point <code>(x,y)</code>, that is in <i>map
+     * coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
+     * transformation in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param x
+     *            the <code>x</code> <i>map coordinate</i> of a 2D point
+     * @param y
+     *            the <code>y</code> <i>map coordinate</i> of a 2D point
+     * 
+     * @return 2D point equivalent in <i>screen coordinates</i> (pixels)
+     * 
+     * @see #fromMapPoint(Point2D)
+     * @see AffineTransform#transform(Point2D, Point2D)
+     */
+    public Point2D fromMapPoint(double x, double y) {
+        Point2D.Double pWorld = new Point2D.Double(x, y);
+        Point2D.Double pScreen = new Point2D.Double();
+
+        try {
+            trans.transform(pWorld, pScreen);
+        } catch (Exception e) {
+            System.err.print(e.getMessage());
+        }
+
+        return pScreen;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point argument, that is in <i>map
+     * coordinates</i> to <i>screen coordinates</i> (pixels) using the affine
+     * transformation in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param point
+     *            the 2D point in <i>map coordinates</i>
+     * 
+     * @return 2D point equivalent in <i>screen coordinates</i> (pixels)
+     * 
+     * @see #toMapPoint(Point2D)
+     * @see #fromMapPoint(double, double)
+     */
+    public Point2D fromMapPoint(Point2D point) {
+        return fromMapPoint(point.getX(), point.getY());
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point <code>(x,y)</code>, that is in
+     * <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using the
+     * affine transformation in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param x
+     *            the <code>x</code> <i>screen coordinate</i> of a 2D point
+     * @param y
+     *            the <code>y</code> <i>screen coordinate</i> of a 2D point
+     * 
+     * @return 2D point equivalent in <i>map coordinates</i>
+     * 
+     * @see #toMapPoint(Point2D)
+     * @see #fromMapPoint(double, double)
+     * @deprecated use {@link #convertToMapPoint(int, int)}
+     */
+    public Point2D toMapPoint(int x, int y) {
+        Point2D pScreen = new Point2D.Double(x, y);
+
+        return toMapPoint(pScreen);
+    }
+
+    /**
+     * <p>
+     * Converts and returns the {@link Rectangle2D Rectangle2D}, that is in
+     * <i>screen coordinates</i> (pixels) to <i>map coordinates</i> using
+     * {@linkplain #toMapDistance(int)}, and {@linkplain #toMapPoint(int, int)}.
+     * </p>
+     * 
+     * @param r
+     *            the 2D rectangle in <i>screen coordinates</i> (pixels)
+     * @return 2D rectangle equivalent in <i>map coordinates</i>
+     * 
+     * @see #fromMapRectangle(Rectangle2D)
+     * @see #toMapDistance(int)
+     * @see #toMapPoint(int, int)
+     */
+    public Rectangle2D toMapRectangle(Rectangle2D r) {
+        Rectangle2D rect = new Rectangle2D.Double();
+        Point2D p1 = toMapPoint((int) r.getX(), (int) r.getY());
+        Point2D p2 = toMapPoint((int) r.getMaxX(), (int) r.getMaxY());
+        rect.setFrameFromDiagonal(p1, p2);
+        return rect;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the distance <code>d</code>, that is in <i>screen
+     * coordinates</i> to <i>map coordinates</i> using the transformation affine
+     * information in the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param d
+     *            distance in pixels
+     * 
+     * @return distance equivalent in <i>map coordinates</i>
+     * 
+     * @see #fromMapDistance(double)
+     * @see AffineTransform
+     */
+    public double toMapDistance(int d) {
+        double dist = d / trans.getScaleX();
+
+        return dist;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the 2D point argument, that is in <i>screen
+     * coordinates</i> (pixels) to <i>map coordinates</i> using the inverse
+     * affine transformation of the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param pScreen
+     *            the 2D point in <i>screen coordinates</i> (pixels)
+     * 
+     * @return 2D point equivalent in <i>map coordinates</i>
+     * 
+     * @see #toMapPoint(int, int)
+     * @see AffineTransform#createInverse()
+     * @see AffineTransform#transform(Point2D, Point2D)
+     * @deprecated use {@link #convertToMapPoint(Point2D)}
+     */
+    public Point2D toMapPoint(Point2D pScreen) {
+        Point2D.Double pWorld = new Point2D.Double();
+        AffineTransform at;
+
+        try {
+            at = trans.createInverse();
+            at.transform(pScreen, pWorld);
+        } catch (NoninvertibleTransformException e) {
+            throw new RuntimeException("Non invertible transform Exception", e);
+        }
+
+        return pWorld;
+    }
+
+    public Point convertToMapPoint(Point2D pScreen) {
+    	Point2D p = toMapPoint(pScreen);
+		try {
+			return geomManager.createPoint(
+				p.getX(), 
+				p.getY(), 
+				Geometry.SUBTYPES.GEOM2D
+			);
+		} catch (CreateGeometryException e) {
+			// FIXME: Use a most especific exception.
+			throw new RuntimeException(e);
+		}
+    }
+    
+    public Point convertToMapPoint(int x, int y) {
+        Point2D pScreen = new Point2D.Double(x, y);
+
+        return convertToMapPoint(pScreen);
+    }
+
+    
+    /**
+     * <p>
+     * Returns the real distance (in <i>world coordinates</i>) at the graphic
+     * layers of two 2D points (in <i>map coordinates</i>) of the plane where is
+     * selected the <i>extent</i>.
+     * </p>
+     * <p>
+     * If the projection of this view is UTM, considers the Earth curvature.
+     * </p>
+     * 
+     * @param pt1
+     *            a 2D point in <i>map coordinates</i>
+     * @param pt2
+     *            another 2D point in <i>map coordinates</i>
+     * 
+     * @return the distance in meters between the two points 2D
+     * 
+     * @see GeoCalcImpl#distanceVincenty(Point2D, Point2D)
+     */
+    public double distanceWorld(Point2D pt1, Point2D pt2) {
+        double dist = -1;
+        dist = pt1.distance(pt2);
+
+        if ((proj != null) && !(proj instanceof UTM)) {
+            dist =
+                new GeoCalc(proj).distanceVincenty(proj.toGeo(pt1),
+                    proj.toGeo(pt2));
+            return dist;
+        }
+        return (dist * MapContext.getDistanceTrans2Meter()[getMapUnits()]);
+    }
+
+    /**
+     * <p>
+     * Sets as extent and adjusted extent of this view port, the previous.
+     * Recalculating its parameters.
+     * </p>
+     * 
+     * @see #getExtents()
+     * @see #calculateAffineTransform()
+     * @deprecated use {@link ViewPort#setPreviousEnvelope()}
+     */
+    public void setPreviousExtent() {
+        setPreviousEnvelope();
+    }
+
+    /**
+     * <p>
+     * Sets as envelope and adjusted envelope of this view port, the previous.
+     * Recalculating its parameters.
+     * </p>
+     * 
+     * @see #getExtents()
+     * @see #calculateAffineTransform()
+     */
+    public void setPreviousEnvelope() {
+        this.updateDrawVersion();
+        extent = extents.removePrev();
+
+        // Calcula la transformaci�n af�n
+        calculateAffineTransform();
+
+        // Lanzamos los eventos de extent cambiado
+        callExtentChanged(getAdjustedExtent());
+    }
+
+    /**
+     * <p>
+     * Gets the area selected by user using some tool.
+     * </p>
+     * 
+     * <p>
+     * When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom
+     * out</i> tools, but also zooming to a selected feature or shape) the
+     * extent that covers that area is the value returned by this method. It is
+     * not the actual area shown because it doesn't care about the aspect ratio
+     * of the image size of the view. However, any part of the real world
+     * contained in this extent is shown in the view.
+     * </p>
+     * 
+     * <p>
+     * If you are looking for the complete extent currently shown, you must use
+     * the {@linkplain #getAdjustedExtent()} method.
+     * </p>
+     * 
+     * @return the current extent
+     * 
+     * @see #setEnvelope(Envelope)
+     * @see #getAdjustedExtent()
+     * @see #setPreviousExtent()
+     * @see #getExtents()
+     * 
+     * @deprecated use {@link ViewPort#getEnvelope()}
+     */
+    public Rectangle2D getExtent() {
+        return extent;
+    }
+
+    /**
+     * <p>
+     * Gets the envelope selected by user using some tool.
+     * </p>
+     * 
+     * <p>
+     * When the zoom changes (for instance using the <i>zoom in</i> or <i>zoom
+     * out</i> tools, but also zooming to a selected feature or shape) the
+     * envelope that covers that area is the value returned by this method. It
+     * is not the actual envelope shown because it doesn't care about the aspect
+     * ratio of the image size of the view. However, any part of the real world
+     * contained in this envelope is shown in the view.
+     * </p>
+     * 
+     * <p>
+     * If you are looking for the complete extent currently shown, you must use
+     * the {@linkplain #getAdjustedEnvelope()} method.
+     * </p>
+     * 
+     * @return the current envelope
+     * 
+     * @see #setEnvelope(Envelope)
+     * @see #getAdjustedEnvelope()
+     * @see #setPreviousEnvelope()
+     * @see #getEnvelopes()
+     */
+    public Envelope getEnvelope() {
+        if (this.extent == null) {
+            return null;
+        }
+        try {
+            return geomManager.createEnvelope(extent.getMinX(),
+                extent.getMinY(),
+                extent.getMaxX(),
+                extent.getMaxY(),
+                SUBTYPES.GEOM2D);
+            // This class has to use Envelope instead of Rectangle2D. This catch
+            // will disappear
+        } catch (CreateEnvelopeException e) {
+            logger.error("Error creating the envelope");
+        }
+        return null;
+    }
+
+    /**
+     * <p>
+     * Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br>
+     * <ul>
+     * <li>Stores the previous extent.
+     * <li>Calculates the new extent using <code>r</code>:
+     * 
+     * <pre>
+     * extent =
+     *     new Rectangle2D.Double(r.getMinX() - 0.1,
+     *         r.getMinY() - 0.1,
+     *         r.getWidth() + 0.2,
+     *         r.getHeight() + 0.2);
+     * </pre>
+     * 
+     * <li>Executes {@linkplain #calculateAffineTransform()}: getting the new
+     * scale, adjusted extent, affine transformation between map and screen
+     * coordinates, the real world coordinates equivalent to 1 pixel, and the
+     * real world coordinates equivalent to 3 pixels.
+     * <li>Notifies all {@link ViewPortListener ViewPortListener} registered
+     * that the extent has changed.
+     * </ul>
+     * </p>
+     * 
+     * @param r
+     *            the new extent
+     * 
+     * @see #getExtent()
+     * @see #getExtents()
+     * @see #calculateAffineTransform()
+     * @see #setPreviousExtent()
+     */
+    public void setEnvelope(Envelope r) {
+        Rectangle2D newExtent = null;
+        // Esto comprueba que el extent no es de anchura o altura = "0"
+        // y si es as� lo redimensiona.
+        if (r != null) {
+            if ((r.getMaximum(0) - r.getMinimum(0) == 0)
+                || (r.getMaximum(1) - r.getMinimum(1) == 0)) {
+                newExtent =
+                    new Rectangle2D.Double(r.getMinimum(0) - 0.1,
+                        r.getMinimum(1) - 0.1,
+                        r.getMaximum(0) - r.getMinimum(0) + 0.2,
+                        r.getMaximum(1) - r.getMinimum(1) + 0.2);
+            } else {
+                newExtent =
+                    new Rectangle2D.Double(r.getMinimum(0),
+                        r.getMinimum(1),
+                        Math.abs(r.getMaximum(0) - r.getMinimum(0)),
+                        Math.abs(r.getMaximum(1) - r.getMinimum(1)));
+            }
+        }
+
+        if (this.extent != null && this.extent.equals(newExtent)) {
+            return;
+        }
+        if (extent != null) {
+            extents.put(extent);
+        }
+        this.updateDrawVersion();
+        this.extent = newExtent;
+
+        // Calcula la transformaci�n af�n
+        calculateAffineTransform();
+
+        // Lanzamos los eventos de extent cambiado
+        callExtentChanged(getAdjustedExtent());
+    }
+
+    /**
+     * <p>
+     * Changes the <i>extent</i> and <i>adjusted extent</i> of this view port:<br>
+     * <ul>
+     * <li>Executes {@linkplain #calculateAffineTransform()}: getting the new
+     * scale, adjusted extent, affine transformation between map and screen
+     * coordinates, the real world coordinates equivalent to 1 pixel, and the
+     * real world coordinates equivalent to 3 pixels.
+     * <li>Notifies to all {@link ViewPortListener ViewPortListener} registered
+     * that the extent has changed.
+     * </ul>
+     * </p>
+     * 
+     * @see #setEnvelope(Envelope)
+     * @see #calculateAffineTransform()
+     */
+    public void refreshExtent() {
+        // this.scale = scale;
+
+        // Calcula la transformaci�n af�n
+        calculateAffineTransform();
+
+        // Lanzamos los eventos de extent cambiado
+        callExtentChanged(getAdjustedExtent());
+    }
+
+    /**
+     * <p>
+     * Calculates and returns using the current projection of this view port,
+     * the scale that is the extent in <i>screen coordinates</i> from the image
+     * in <i>map coordinates</i>.
+     * </p>
+     * 
+     * @return the scale <i>extent / image size</i> projected by this view port
+     * 
+     * @deprecated since 07/09/07, use {@linkplain MapContext#getScaleView()}
+     */
+    public double getScale() {
+        return proj.getScale(extent.getMinX(),
+            extent.getMaxX(),
+            imageSize.width,
+            dpi);
+    }
+
+    /**
+     * <p>
+     * Affine transformation between <i>map 2D coordinates</i> to <i>screen 2D
+     * coordinates</i> (pixels), preserving the "straightness" and "parallelism"
+     * of the lines.
+     * </p>
+     * 
+     * @return the affine transformation
+     * 
+     * @see #setAffineTransform(AffineTransform)
+     * @see #calculateAffineTransform()
+     */
+    public AffineTransform getAffineTransform() {
+        return trans;
+    }
+
+    /**
+     * <p>
+     * Returns the size of the image projected.
+     * </p>
+     * 
+     * @return the image size
+     * 
+     * @see #setImageSize(Dimension)
+     * @see #getImageHeight()
+     * @see #getImageWidth()
+     */
+    public Dimension getImageSize() {
+        return imageSize;
+    }
+
+    /**
+     * <p>
+     * Sets the size of the image projected, recalculating the parameters of
+     * this view port.
+     * </p>
+     * 
+     * @param imageSize
+     *            the image size
+     * 
+     * @see #getImageSize()
+     * @see #calculateAffineTransform()
+     */
+    public void setImageSize(Dimension imageSize) {
+
+        if (this.imageSize == null || (!this.imageSize.equals(imageSize))) {
+            this.updateDrawVersion();
+            this.imageSize = imageSize;
+            calculateAffineTransform();
+        }
+    }
+
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the adjusted extent
+     * of this view port has changed.
+     * </p>
+     * 
+     * @param newRect
+     *            the new adjusted extend
+     * 
+     * @see #refreshExtent()
+     * @see #setEnvelope(Envelope)
+     * @see #setPreviousExtent()
+     * @see ExtentEvent
+     * @see ViewPortListener
+     */
+    protected void callExtentChanged(Envelope newRect) {
+        ExtentEvent ev = ExtentEvent.createExtentEvent(newRect);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.extentChanged(ev);
+        }
+    }
+    
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the time
+     * of this view port has changed.
+     * </p>
+     * 
+     * @param newTime
+     *            the new time
+     * 
+     * @see #refreshExtent()
+     * @see #setTime(Time)   
+     * @see ExtentEvent
+     * @see ViewPortListener
+     */
+    protected void callTimeChanged(Time newTime) {
+        ExtentEvent viewPortEvent = new ExtentEvent(newTime);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.extentChanged(viewPortEvent);
+        }
+    }
+
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the background color
+     * of this view port has changed.
+     * </p>
+     * 
+     * @param c
+     *            the new background color
+     * 
+     * @see #setBackColor(Color)
+     * @see ColorEvent
+     * @see ViewPortListener
+     */
+    private void callColorChanged(Color c) {
+        ColorEvent ce = ColorEvent.createColorEvent(c);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.backColorChanged(ce);
+        }
+    }
+
+    /**
+     * <p>
+     * Notifies to all view port listeners registered, that the projection of
+     * this view port has changed.
+     * </p>
+     * 
+     * @param projection
+     *            the new projection
+     * 
+     * @see #setProjection(IProjection)
+     * @see ProjectionEvent
+     * @see ViewPortListener
+     */
+    private void callProjectionChanged(IProjection projection) {
+        ProjectionEvent ev = ProjectionEvent.createProjectionEvent(projection);
+
+        for (int i = 0; i < listeners.size(); i++) {
+            ViewPortListener listener = (ViewPortListener) listeners.get(i);
+            listener.projectionChanged(ev);
+        }
+    }
+
+    /**
+     * <p>
+     * Calculates the affine transformation between the {@link #extent extent}
+     * in <i>map 2D coordinates</i> to the image area in the screen, in
+     * <i>screen 2D coordinates</i> (pixels).
+     * </p>
+     * 
+     * <p>
+     * This process recalculates some parameters of this view port:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustedExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getAffineTransform()
+     * @see #setAffineTransform(AffineTransform)
+     * @see #refreshExtent()
+     * @see #setEnvelope(Envelope)
+     * @see #setImageSize(Dimension)
+     * @see #setPreviousExtent()
+     * @see #createFromXML(XMLEntity)
+     * @see AffineTransform
+     */
+    private void calculateAffineTransform() {
+        if ((imageSize == null) || (extent == null) || (imageSize.width <= 0)
+            || (imageSize.height <= 0)) {
+            return;
+        }
+
+        AffineTransform escalado = new AffineTransform();
+        AffineTransform translacion = new AffineTransform();
+
+        double escalaX;
+        double escalaY;
+
+        escalaX = imageSize.width / extent.getWidth();
+        escalaY = imageSize.height / extent.getHeight();
+
+        double xCenter = extent.getCenterX();
+        double yCenter = extent.getCenterY();
+        double newHeight;
+        double newWidth;
+
+        adjustedExtent = new Rectangle2D.Double();
+
+        if (adjustableExtent) {
+            if (escalaX < escalaY) {
+                scale = escalaX;
+                newHeight = imageSize.height / scale;
+                adjustedExtent.setRect(xCenter - (extent.getWidth() / 2.0),
+                    yCenter - (newHeight / 2.0),
+                    extent.getWidth(),
+                    newHeight);
+            } else {
+                scale = escalaY;
+                newWidth = imageSize.width / scale;
+                adjustedExtent.setRect(xCenter - (newWidth / 2.0), yCenter
+                    - (extent.getHeight() / 2.0), newWidth, extent.getHeight());
+            }
+            escalado.setToScale(scale, -scale);
+        } else { // adjusted is same as extent
+            scale = escalaX;
+            adjustedExtent.setFrame(extent);
+            escalado.setToScale(escalaX, -escalaY);
+        }
+        Envelope env = getAdjustedExtent();
+        if (env == null) {
+            return;
+        }
+        translacion.setToTranslation(-env.getMinimum(0), -env.getMinimum(1)
+            - getAdjustedExtent().getLength(1));
+
+        AffineTransform offsetTrans = new AffineTransform();
+        offsetTrans.setToTranslation(offset.getX(), offset.getY());
+
+        trans.setToIdentity();
+        trans.concatenate(offsetTrans);
+        trans.concatenate(escalado);
+
+        trans.concatenate(translacion);
+
+        // Calculamos las distancias de 1 pixel y 3 pixel con esa
+        // transformaci�n
+        // de coordenadas, de forma que est�n precalculadas para cuando las
+        // necesitemos
+        AffineTransform at;
+
+        try {
+            at = trans.createInverse();
+
+            Point2D pPixel = new Point2D.Float(1, 1);
+
+            Point2D.Float pProv = new Point2D.Float();
+            at.deltaTransform(pPixel, pProv);
+
+            dist1pixel = pProv.x;
+            dist3pixel = 3 * pProv.x;
+        } catch (NoninvertibleTransformException e) {
+            System.err.println("transformada afin = " + trans.toString());
+            System.err.println("extent = " + extent.toString() + " imageSize= "
+                + imageSize.toString());
+            throw new RuntimeException("Non invertible transform Exception", e);
+        }
+    }
+
+    /**
+     * <p>
+     * Sets the offset.
+     * </p>
+     * <p>
+     * The offset is the position where start drawing the map.
+     * </p>
+     * 
+     * @param p
+     *            2D point that represents the offset in pixels
+     * 
+     * @see #getOffset()
+     */
+    public void setOffset(Point2D p) {
+        if (!offset.equals(p)) {
+            this.updateDrawVersion();
+            offset = p;
+        }
+    }
+
+    /**
+     * <p>
+     * Gets the offset.
+     * </p>
+     * <p>
+     * The offset is the position where start drawing the map.
+     * </p>
+     * 
+     * @return 2D point that represents the offset in pixels
+     * 
+     * @see #setOffset(Point2D)
+     */
+    public Point2D getOffset() {
+        return offset;
+    }
+
+    /**
+     * <p>
+     * Sets the background color.
+     * </p>
+     * 
+     * @param c
+     *            the new background color
+     * 
+     * @see #getBackColor()
+     */
+    public void setBackColor(Color c) {
+        if (!c.equals(this.backColor)) {
+            this.updateDrawVersion();
+            backColor = c;
+            callColorChanged(backColor);
+        }
+    }
+
+    /**
+     * <p>
+     * Gets the background color.
+     * </p>
+     * 
+     * @return the background color of the view
+     * 
+     * @see #setBackColor(Color)
+     */
+    public Color getBackColor() {
+        return backColor;
+    }
+
+    /**
+     * <p>
+     * Returns the extent currently covered by the view adjusted (scaled) to the
+     * image size aspect.
+     * </p>
+     * 
+     * @return extent of the view adjusted to the image size aspect
+     * 
+     * @see #setAdjustable(boolean)
+     * @deprecated use {@link ViewPort#getAdjustedEnvelope()} instead
+     */
+    public Envelope getAdjustedExtent() {
+        return getAdjustedEnvelope();
+    }
+
+    /**
+     * <p>
+     * Returns the envelope currently covered by the view adjusted (scaled) to
+     * the image size aspect.
+     * </p>
+     * 
+     * @return envelope of the view adjusted to the image size aspect
+     * 
+     * @see #setAdjustable(boolean)
+     */
+    public Envelope getAdjustedEnvelope() {
+        if (cliprect != null) {
+            Rectangle2D r = adjustedExtent.createIntersection(cliprect);
+            try {
+                return geomManager.createEnvelope(r.getX(),
+                    r.getY(),
+                    r.getMaxX(),
+                    r.getMaxY(),
+                    SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                e.printStackTrace();
+                logger.error("Error adjusting the extent", e);
+            }
+        }
+        if (adjustedExtent != null) {
+            try {
+                return geomManager.createEnvelope(adjustedExtent.getX(),
+                    adjustedExtent.getY(),
+                    adjustedExtent.getMaxX(),
+                    adjustedExtent.getMaxY(),
+                    SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                e.printStackTrace();
+                logger.error("Error adjusting the extent", e);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * <p>
+     * Returns the measurement unit of this view port used for measuring
+     * distances and displaying information.
+     * </p>
+     * 
+     * @return the measurement unit of this view used for measuring distances
+     *         and displaying information
+     * 
+     * @see #setDistanceUnits(int)
+     */
+    public int getDistanceUnits() {
+        return distanceUnits;
+    }
+
+    /**
+     * <p>
+     * Returns the measurement unit of this view port used for measuring areas
+     * and displaying information.
+     * </p>
+     * 
+     * @return the measurement unit of this view used for measuring areas and
+     *         displaying information
+     * 
+     * @see #setDistanceUnits(int)
+     */
+    public int getDistanceArea() {
+        return distanceArea;
+    }
+
+    /**
+     * <p>
+     * Sets the measurement unit of this view port used for measuring distances
+     * and displaying information.
+     * </p>
+     * 
+     * @param distanceUnits
+     *            the measurement unit of this view used for measuring distances
+     *            and displaying information
+     * 
+     * @see #getDistanceUnits()
+     */
+    public void setDistanceUnits(int distanceUnits) {
+        this.distanceUnits = distanceUnits;
+    }
+
+    /**
+     * <p>
+     * Sets the measurement unit of this view port used for measuring areas and
+     * displaying information.
+     * </p>
+     * 
+     * @param distanceUnits
+     *            the measurement unit of this view used for measuring areas and
+     *            displaying information
+     * 
+     * @see #getDistanceUnits()
+     */
+    public void setDistanceArea(int distanceArea) {
+        this.distanceArea = distanceArea;
+    }
+
+    /**
+     * <p>
+     * Gets the measurement unit used by this view port for the map.
+     * </p>
+     * 
+     * @return Returns the current map measure unit
+     * 
+     * @see #setMapUnits(int)
+     */
+    public int getMapUnits() {
+        return mapUnits;
+    }
+
+    /**
+     * <p>
+     * Sets the measurement unit used by this view port for the map.
+     * </p>
+     * 
+     * @param mapUnits
+     *            the new map measure unit
+     * 
+     * @see #getMapUnits()
+     */
+    public void setMapUnits(int mapUnits) {
+        this.mapUnits = mapUnits;
+    }
+
+    /**
+     * <p>
+     * Gets the width in <i>screen coordinates</i> of the rectangle where the
+     * image is displayed.
+     * </p>
+     * <p>
+     * Used by {@linkplain #calculateAffineTransform()} to calculate:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustableExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getImageHeight()
+     * @see #getImageSize()
+     * @see #setImageSize(Dimension)
+     */
+    public int getImageWidth() {
+        return imageSize.width;
+    }
+
+    /**
+     * <p>
+     * Gets the height in <i>screen coordinates</i> of the rectangle where the
+     * image is displayed.
+     * </p>
+     * <p>
+     * Used by {@linkplain #calculateAffineTransform()} to calculate:<br>
+     * 
+     * <ul>
+     * <li>The new {@link #scale scale} .
+     * <li>The new {@link #adjustedExtent adjustableExtent} .
+     * <li>The new {@link #trans trans} .
+     * <li>The new real world coordinates equivalent to 1 pixel (
+     * {@link #dist1pixel dist1pixel}) .
+     * <li>The new real world coordinates equivalent to 3 pixels (
+     * {@link #dist3pixel dist3pixel}) .
+     * </ul>
+     * </p>
+     * 
+     * @see #getImageWidth()
+     * @see #getImageSize()
+     * @see #setImageSize(Dimension)
+     */
+    public int getImageHeight() {
+        return imageSize.height;
+    }
+
+    /**
+     * <p>
+     * Gets the distance in <i>world coordinates</i> equivalent to 1 pixel in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @return the distance
+     * 
+     * @see #setDist1pixel(double)
+     */
+    public double getDist1pixel() {
+        return dist1pixel;
+    }
+
+    /**
+     * <p>
+     * Sets the distance in <i>world coordinates</i> equivalent to 1 pixel in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @param dist1pixel
+     *            the distance
+     * 
+     * @see #getDist1pixel()
+     */
+    public void setDist1pixel(double dist1pixel) {
+        if (dist1pixel == this.dist1pixel) {
+            return;
+        }
+        this.updateDrawVersion();
+        this.dist1pixel = dist1pixel;
+    }
+
+    /**
+     * <p>
+     * Gets the distance in <i>world coordinates</i> equivalent to 3 pixels in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @return the distance
+     * 
+     * @see #setDist3pixel(double)
+     */
+    public double getDist3pixel() {
+        return dist3pixel;
+    }
+
+    /**
+     * <p>
+     * Sets the distance in <i>world coordinates</i> equivalent to 3 pixels in
+     * the view with the current extent.
+     * </p>
+     * 
+     * @param dist3pixel
+     *            the distance
+     * 
+     * @see #getDist3pixel()
+     */
+    public void setDist3pixel(double dist3pixel) {
+        if (this.dist3pixel == dist3pixel) {
+            return;
+        }
+        this.updateDrawVersion();
+        this.dist3pixel = dist3pixel;
+    }
+
+    /**
+     * <p>
+     * Returns the last previous extents of this view port.
+     * </p>
+     * 
+     * @return the last previous extents of this view port
+     * 
+     * @see #setPreviousExtent()
+     * @deprecated use {@link ViewPort#getEnvelopes()}
+     */
+    public ExtentHistory getExtents() {
+        return getEnvelopes();
+    }
+
+    /**
+     * <p>
+     * Returns the last previous extents of this view port.
+     * </p>
+     * 
+     * @return the last previous extents of this view port
+     * 
+     * @see #setPreviousExtent()
+     */
+    public ExtentHistory getEnvelopes() {
+        return extents;
+    }
+
+    /**
+     * <p>
+     * Gets the projection used in this view port.
+     * </p>
+     * 
+     * @return projection used in this view port
+     * 
+     * @see #setProjection(IProjection)
+     */
+    public IProjection getProjection() {
+        return proj;
+    }
+
+    /**
+     * <p>
+     * Sets the projection to this view port.
+     * </p>
+     * 
+     * @param proj
+     *            the new projection
+     * 
+     * @see #getProjection()
+     */
+    public void setProjection(IProjection proj) {
+        if (this.proj == null || !this.proj.getAbrev().equals(proj.getAbrev())) {
+            this.updateDrawVersion();
+            this.proj = proj;
+            callProjectionChanged(proj);
+        }
+    }
+
+    // -----------------------------------------------------------------------------------------------------------
+    // NOTA PARA DESARROLLADORES SOBRE EL M�TODO
+    // "public void setAffineTransform(AffineTransform at)"
+    // ==============================================================================================
+    // Only used for print, should be removed, redefining the {@link
+    // RasterAdapter RasterAdapter} interface,
+    // allowing it to receive a {@link ViewPortData ViewPortData} .
+    // -----------------------------------------------------------------------------------------------------------
+
+    /**
+     * <p>
+     * Sets only the affine transform to this view port, without updating
+     * dependent attributes.
+     * </p>
+     * <p>
+     * <b><i>This method could be problematic!</i></b>
+     * </p>
+     * 
+     * @param at
+     *            the affine transform to set
+     * 
+     * @see #getAffineTransform()
+     * @see #calculateAffineTransform()
+     */
+    public void setAffineTransform(AffineTransform at) {
+        this.trans = at;
+    }
+
+    /**
+     * <p>
+     * Returns an XML entity that represents this view port instance:<br>
+     * <ul>
+     * <li>Properties:
+     * <ul>
+     * <li><i>className</i>: name of this class.
+     * <li>If defined, the adjusted extent:
+     * <ul>
+     * <li><i>adjustedExtentX</i>: X coordinate of the adjusted extent.
+     * <li><i>adjustedExtentY</i>: Y coordinate of the adjusted extent.
+     * <li><i>adjustedExtentW</i>: width of the adjusted extent.
+     * <li><i>adjustedExtentH</i>: height of the adjusted extent.
+     * </ul>
+     * <li>If defined, the background color:
+     * <ul>
+     * <li><i>backColor</i>: background color.
+     * </ul>
+     * <li>If defined, the clip:
+     * <ul>
+     * <li><i>clipX</i>: X coordinate of the clip.
+     * <li><i>clipY</i>: Y coordinate of clip.
+     * <li><i>clipW</i>: width of the clip.
+     * <li><i>clipH</i>: height of the clip.
+     * </ul>
+     * <li><i>dist1pixel</i>: the distance in world coordinates equivalent to 1
+     * pixel in the view.
+     * <li><i>dist3pixel</i>: the distance in world coordinates equivalent to 3
+     * pixels in the view.
+     * <li><i>distanceUnits</i>: the distance measurement unit.
+     * <li>If defined, the extent:
+     * <ul>
+     * <li><i>extentX</i>: X coordinate of the extent.
+     * <li><i>extentY</i>: Y coordinate of the extent.
+     * <li><i>extentW</i>: width of the extent.
+     * <li><i>extentH</i>: height of the extent.
+     * </ul>
+     * <li><i>mapUnits</i>: the map measurement unit.
+     * <li><i>offsetX</i>: X coordinate of the offset.
+     * <li><i>offsetY</i>: Y coordinate of the offset.
+     * <li>If defined, the projection:
+     * <ul>
+     * <li>If its defined, the projection:
+     * <ul>
+     * <li><i>proj</i>: the projection.</li>
+     * </ul>
+     * </ul>
+     * <li><i>scale</i>: ratio between the size of <code>imageSize</code> and
+     * <code>extent</code>.
+     * </ul>
+     * <li>Child branches:
+     * <ul>
+     * <li>XML entity of the internal {@link ExtentHistory ExtentHistory} .
+     * </ul>
+     * </ul>
+     * 
+     * @return the XML entity
+     * 
+     * @see #createFromXML(XMLEntity)
+     */
+    public void saveToState(PersistentState state) throws PersistenceException {
+
+        state.set(FIELD_ADJUSTED_EXTENT, adjustedExtent);
+        state.set(FIELD_BACK_COLOR, backColor);
+        state.set(FIELD_CLIP, cliprect);
+        state.set(FIELD_DIST1PIXEL, dist1pixel);
+        state.set(FIELD_DIST3PIXEL, dist3pixel);
+        state.set(FIELD_DISTANCE_UNITS, distanceUnits);
+        state.set(FIELD_DISTANCE_AREA, distanceArea);
+
+        state.set(FIELD_EXTENT, extent);
+        state.set(FIELD_EXTENTS, extents);
+
+        state.set(FIELD_MAP_UNITS, mapUnits);
+        state.set(FIELD_OFFSET, offset);
+
+        state.set(FIELD_PROJ, proj);
+
+        state.set(FIELD_IMAGE_SIZE, imageSize);
+    }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+
+        adjustedExtent = (Rectangle2D) state.get(FIELD_ADJUSTED_EXTENT);
+        backColor = (Color) state.get(FIELD_BACK_COLOR);
+        cliprect = (Rectangle2D) state.get(FIELD_CLIP);
+        dist1pixel = state.getDouble(FIELD_DIST1PIXEL);
+        dist3pixel = state.getDouble(FIELD_DIST3PIXEL);
+        distanceUnits = state.getInt(FIELD_DISTANCE_UNITS);
+        extents = (ExtentHistory) state.get(FIELD_EXTENTS);
+        extent = (Rectangle2D) state.get(FIELD_EXTENT);
+        mapUnits = state.getInt(FIELD_MAP_UNITS);
+        offset = (Point2D) state.get(FIELD_OFFSET);
+        proj = (IProjection) state.get(FIELD_PROJ);
+        imageSize = (Dimension) state.get(FIELD_IMAGE_SIZE);
+        distanceArea = state.getInt(FIELD_DISTANCE_AREA);
+
+        refreshExtent();
+    }
+
+	public static class RegisterPersistence implements Callable {
+
+		public Object call() throws Exception {
+			PersistenceManager manager = ToolsLocator.getPersistenceManager();
+			if( manager.getDefinition("ViewPort")==null ) {
+		        DynStruct definition =
+		            manager.addDefinition(ViewPort.class,
+		                "ViewPort",
+		                "ViewPort Persistence definition",
+		                null,
+		                null);
+
+		        definition.addDynFieldObject(FIELD_ADJUSTED_EXTENT)
+		            .setClassOfValue(Rectangle2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_BACK_COLOR)
+		            .setClassOfValue(Color.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_CLIP)
+		            .setClassOfValue(Rectangle2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldDouble(FIELD_DIST1PIXEL).setMandatory(true);
+
+		        definition.addDynFieldDouble(FIELD_DIST3PIXEL).setMandatory(true);
+
+		        definition.addDynFieldInt(FIELD_DISTANCE_UNITS).setMandatory(true);
+
+		        definition.addDynFieldInt(FIELD_DISTANCE_AREA).setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_EXTENT)
+		            .setClassOfValue(Rectangle2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_EXTENTS)
+		            .setClassOfValue(ExtentHistory.class)
+		            .setMandatory(true);
+
+		        definition.addDynFieldInt(FIELD_MAP_UNITS).setMandatory(true);
+
+		        definition.addDynFieldObject(FIELD_OFFSET)
+		            .setClassOfValue(Point2D.class)
+		            .setMandatory(false);
+
+		        definition.addDynFieldObject(FIELD_PROJ)
+		            .setClassOfValue(IProjection.class)
+		            .setMandatory(true);
+
+		        definition.addDynFieldObject(FIELD_IMAGE_SIZE)
+		            .setClassOfValue(Dimension.class)
+		            .setMandatory(false);
+			}
+			return Boolean.TRUE;
+		}
+		
+	}
+
+	/**
+     * Clone the view port without clone the listeners nor the extent history.
+     * 
+     * @return the cloned view port
+     */
+    public Object clone() throws CloneNotSupportedException {
+
+        ViewPort clonedViewPort = (ViewPort) super.clone();
+        clonedViewPort.listeners = new ArrayList();
+        clonedViewPort.extents = new ExtentHistory();
+
+        if (this.adjustedExtent!=null){
+            clonedViewPort.adjustedExtent =
+                (Rectangle2D) this.adjustedExtent.clone();
+        }
+
+        if (this.cliprect!=null){
+            clonedViewPort.cliprect = (Rectangle2D) this.cliprect.clone();
+        }
+        
+        if (this.extent!=null) {
+            clonedViewPort.extent = (Rectangle2D) this.extent.clone();
+        }
+        if (this.imageSize!=null){
+            clonedViewPort.imageSize = (Dimension) this.imageSize.clone();
+        }
+        
+        if (this.offset!=null){
+            clonedViewPort.offset = (Point2D) this.offset.clone();
+        }
+        if (proj!=null){
+            clonedViewPort.proj = (IProjection) this.proj.clone();
+        }
+        
+        clonedViewPort.trans = (AffineTransform) this.trans.clone();
+
+        return clonedViewPort;
+    }
+
+    /**
+     * <p>
+     * Returns a <code>String</code> representation of the main values of this
+     * view port: <code>{@linkplain #extent}</code>,
+     * <code>{@linkplain #adjustedExtent}</code>,
+     * <code>{@linkplain #imageSize}</code>, <code>{@linkplain #scale}</code>,
+     * and <code>{@linkplain #trans}</code>.
+     * </p>
+     * 
+     * @return a <code>string</code> representation of the main values of this
+     *         view port
+     */
+    public String toString() {
+
+        String str;
+        str =
+            "Datos del viewPort:\nExtent=" + extent + "\nadjustedExtent="
+                + adjustedExtent + "\nimageSize=" + imageSize + "\nescale="
+                + scale + "\ntrans=" + trans;
+
+        return str;
+    }
+
+    /**
+     * <p>
+     * Sets the position and size of the clipping rectangle.
+     * </p>
+     * 
+     * @param rectView
+     *            the clipping rectangle to set
+     */
+    public void setClipRect(Rectangle2D rectView) {
+        this.updateDrawVersion();
+        cliprect = rectView;
+    }
+
+    /**
+     * <p>
+     * Converts and returns the {@link Rectangle2D Rectangle2D}, that is in
+     * <i>map coordinates</i> to <i>screen coordinates</i> (pixels) using an
+     * <i>inverse transform</i> with the transformation affine information in
+     * the {@link #trans #trans} attribute.
+     * </p>
+     * 
+     * @param r
+     *            the 2D rectangle in <i>map coordinates</i>
+     * @return 2D rectangle equivalent in <i>screen coordinates</i> (pixels)
+     * 
+     * @see #toMapRectangle(Rectangle2D)
+     * @see #fromMapDistance(double)
+     * @see #fromMapPoint(Point2D)
+     */
+    public Rectangle2D fromMapRectangle(Rectangle2D r) {
+        Rectangle2D rect = new Rectangle2D.Double();
+        Point2D p1 = fromMapPoint((int) r.getX(), (int) r.getY());
+        Point2D p2 = fromMapPoint((int) r.getMaxX(), (int) r.getMaxY());
+        rect.setFrameFromDiagonal(p1, p2);
+        return rect;
+    }
+
+    /**
+     * <p>
+     * Recalculates the current <code>{@linkplain #extent}</code> using an
+     * scale. It's necessary execute {@linkplain #refreshExtent()} after.
+     * </p>
+     * 
+     * @param s
+     *            the scale to set
+     * 
+     * @deprecated since 07/09/07, use
+     *             {@linkplain MapContext#setScaleView(long)}
+     */
+    public void setScale(long s) {
+        double x = extent.getX();
+        double y = extent.getY();
+        double escalaX = imageSize.width / extent.getWidth();
+        // double w = imageSize.width / s;
+        // double h = imageSize.height / s;
+        double difw = escalaX / s;
+
+        double x1 = (-x * difw) - x + extent.getWidth() / 2;
+        double y1 = (-y * difw) - y + extent.getHeight() / 2;
+        double w1 = extent.getWidth() * difw;
+        double h1 = extent.getHeight() * difw;
+        extent.setRect(-x1, -y1, w1, h1);
+    }
+
+    public long getDrawVersion() {
+        return this.drawVersion;
+    }
+
+    protected void updateDrawVersion() {
+        this.drawVersion++;
+    }
+
+    public Time getTime() {
+        return time;
+    }
+    
+    public void setTime(Time time) {
+        this.time = time;
+        this.updateDrawVersion();
+        callTimeChanged(time);
+    }
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OutGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OutGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OutGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Out;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class OutGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public OutGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addFieldValue(geomName);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Out.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "out of geometry";
+	}
+
+	public String getSQL() {
+		return " not contains(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/TouchesGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/TouchesGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/TouchesGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Touches;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class TouchesGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public TouchesGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Touches.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "touches with geometry";
+	}
+
+	public String getSQL() {
+		return " touches(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossEnvelopeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossEnvelopeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossEnvelopeEvaluator.java	(revision 36112)
@@ -0,0 +1,107 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class CrossEnvelopeEvaluator extends AbstractEvaluator {
+
+	private Envelope envelope;
+	private String geomName;
+	private Envelope envelopeTrans;
+	private boolean isDefault;
+	private String srs;
+	private String envelopeWKT;
+
+	public CrossEnvelopeEvaluator(Envelope envelope,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.envelope = envelope;
+		// this.srs = envelopeProjection.getAbrev();
+		// this.projection=CRSFactory.getCRS(fad.getSRS());
+		// this.envelopeProjection=envelopeProjection;
+//		ICoordTrans ct = null;
+//		if (!this.srs.equals(fad.getSRS())) { // FIXME comparaci�n
+//			ct = envelopeProjection.getCT(fad.getSRS());
+//		}
+//		if (ct != null) {
+//			this.envelopeTrans = envelope.convert(ct);
+//		} else {
+			this.envelopeTrans = envelope;
+//		}
+		this.geomName = geomName;
+		this.srs = envelopeProjection.getAbrev();
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, envelopeTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		if (isDefault) {
+			Feature feature = (Feature) data.getContextValue("feature");
+			//			return new Boolean(envelopeTrans.contains(feature
+			//					.getDefaultEnvelope())
+			//					|| envelopeTrans.intersects(feature.getDefaultEnvelope()));
+//			System.out.println("== Filter[" + envelopeTrans.getLowerCorner()[0]
+//					+ "," + envelopeTrans.getLowerCorner()[1] + "] ["
+//					+ envelopeTrans.getUpperCorner()[0] + ","
+//					+ envelopeTrans.getUpperCorner()[1] + "]");
+
+			Envelope featureEnvelope = feature.getDefaultEnvelope();
+//			System.out.println("== Geom ["
+//					+ featureEnvelope.getLowerCorner()[0]
+//					+ "," + featureEnvelope.getLowerCorner()[1] + "] ["
+//					+ featureEnvelope.getUpperCorner()[0] + ","
+//					+ featureEnvelope.getUpperCorner()[1] + "]");
+			Boolean r = new Boolean(envelopeTrans.intersects(featureEnvelope));
+//			System.out.println("==3 "+r);
+			return r;
+
+		} else {
+			Geometry geom = (Geometry) data.getDataValue(geomName);
+			//			return new Boolean(envelopeTrans.contains(geom.getEnvelope())
+			//					|| envelopeTrans.intersects(geom.getEnvelope()));
+
+			return new Boolean(envelopeTrans.intersects(geom.getEnvelope()));
+
+		}
+	}
+
+	public String getName() {
+		return "contains in envelope";
+	}
+
+	public String getSQL() {
+		if (envelopeWKT == null) {
+			try {
+				envelopeWKT = (String) envelope.getGeometry().invokeOperation(
+						ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " intersects(GeomFromText('" + envelopeWKT + "', '" + srs
+				+ "'), envelope(" + geomName + ")) ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/GraphicLayer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/GraphicLayer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/GraphicLayer.java	(revision 36112)
@@ -0,0 +1,169 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * 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 2
+ * 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.
+ *
+ * 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.
+ *
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol;
+
+/**
+ * Utility layer to be able to draw graphics in a {@link MapContext}. Those
+ * graphics won't be stored and will be rendered on top of all the other
+ * MapContext's layers.
+ * 
+ * @author gvSIG team
+ * @version $Id$
+ */
+public interface GraphicLayer extends VectorLayer {
+
+	public static final int DEFAULT_PRIORITY = 100;
+
+	public static final String FEATURE_ATTR_FEATUREID = "featureId";
+	public static final String FEATURE_ATTR_GROUPID = "groupId";
+	public static final String FEATURE_ATTR_GEOMETRY = "geom";
+	public static final String FEATURE_ATTR_IDSYMBOL = "idsym";
+	public static final String FEATURE_ATTR_LABEL = "label";
+	public static final String FEATURE_ATTR_TAG = "tag";
+	public static final String FEATURE_ATTR_PRIORITY = "priority";
+
+	/**
+	 * Adds a new {@link ISymbol} to the layer to be used to render the
+	 * {@link Geometry} objects. The symbol will be added to the legend of the
+	 * layer.
+	 * 
+	 * @param newSymbol
+	 *            the {@link ISymbol} to add
+	 * @return an identifier of the symbol to be used when adding geometries
+	 */
+	public int addSymbol(ISymbol newSymbol);
+
+	/**
+	 * Returns the {@link ISymbol} of the layer with the given identifier.
+	 * 
+	 * @param symbolId
+	 *            the symbol identifier
+	 * @return the symbol with the given id or null if there is not any symbol
+	 *         registered with that id
+	 */
+	public ISymbol getSymbol(int symbolId);
+
+	/**
+	 * Returns the identifier of the symbol into the layer.
+	 * 
+	 * @param symbol
+	 *            the symbol to look for
+	 * @return the symbol identifier or -1 if it is not registered into the
+	 *         layer
+	 */
+	public int getSymbolId(ISymbol symbol);
+
+	/**
+	 * Adds a new {@link Geometry} to be rendered into the layer.
+	 * 
+	 * @param groupId
+	 *            group identifier. Allows to identify a group of
+	 *            {@link Geometry} added to the layer
+	 * @param geom
+	 *            the {@link Geometry} to add
+	 * @param idsym
+	 *            the {@link ISymbol} identifier to apply to render the
+	 *            {@link Geometry}
+	 */
+	public void addGraphic(String groupId, Geometry geom, int idsym);
+
+	/**
+	 * @deprecated @see
+	 *             {@link #addGraphic(String, Geometry, int, String, Object, int)
+
+	 */
+	public void addGraphic(Geometry geom, int idsym);
+
+	/**
+	 * @deprecated @see
+	 *             {@link #addGraphic(String, Geometry, int, String, Object, int)
+
+	 */
+	public void addGraphic(Geometry geom, int idsym, String label);
+
+	/**
+	 * Adds a new {@link Geometry} to be rendered into the layer.
+	 * 
+	 * @param groupId
+	 *            group identifier. Allows to identify a group of
+	 *            {@link Geometry} added to the layer
+	 * @param geom
+	 *            the {@link Geometry} to add
+	 * @param idsym
+	 *            the {@link ISymbol} identifier to apply to render the
+	 *            {@link Geometry}
+	 * @param label
+	 *            the text to show if the {@link ISymbol} is a
+	 *            {@link ITextSymbol}. Set null otherwise.
+	 */
+	public void addGraphic(String groupId, Geometry geom, int idsym,
+			String label);
+
+	/**
+	 * Adds a new {@link Geometry} to be rendered into the layer.
+	 * 
+	 * @param groupId
+	 *            group identifier. Allows to identify a group of
+	 *            {@link Geometry} added to the layer
+	 * @param geom
+	 *            the {@link Geometry} to add
+	 * @param idsym
+	 *            the {@link ISymbol} identifier to apply to render the
+	 *            {@link Geometry}
+	 * @param label
+	 *            the text to show if the {@link ISymbol} is a
+	 *            {@link ITextSymbol}. Set null otherwise.
+	 * @param tag
+	 *            an object to classify, identify or add related information to
+	 *            the {@link Geometry}
+	 * @param priority
+	 *            to apply while rendering the {@link Geometry}. Values with
+	 *            lower priority will be rendered first.
+	 */
+	public void addGraphic(String groupId, Geometry geom, int idsym,
+			String label, Object tag, int priority);
+
+	/**
+	 * Removes all previously registered {@link Geometry} objects from the layer
+	 * with the given groupId.
+	 * 
+	 * @param groupId
+	 *            of the geometries to remove
+	 */
+	public void removeGraphics(String groupId);
+
+	/**
+	 * Removes all registered {@link Geometry} objects.
+	 */
+	public void clearAllGraphics();
+
+	/**
+	 * Removes all registered {@link ISymbol} objects.
+	 */
+	public int clearAllSymbols();
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,92 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.Contains;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class ContainsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+	private String geometryWKT;
+
+	public ContainsGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Contains.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "contains with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " contains(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java	(revision 36112)
@@ -0,0 +1,221 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* 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 2
+* 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.
+*
+* 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.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.AbstractFeatureStoreTransform;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class ReprojectDefaultGeometry extends AbstractFeatureStoreTransform {
+
+	private IProjection targetSRS;
+	private ICoordTrans ct;
+	private IProjection sourceSRS;
+	private FeatureType orgDefFeatureType;
+	private List orgFeatureTypes;
+
+	public ReprojectDefaultGeometry() {
+		
+	}
+	
+	public IProjection getTargetSRS() {
+		return targetSRS;
+	}
+
+	public void setTargetSRS(IProjection targetSRS) {
+		this.targetSRS = targetSRS;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.FeatureStoreTransform#applyTransform(org.gvsig.fmap.dal.feature.Feature, org.gvsig.fmap.dal.feature.EditableFeature)
+	 */
+	public void applyTransform(Feature source, EditableFeature target)
+			throws DataException {
+		FeatureAttributeDescriptor attr;
+		Iterator iter = target.getType().iterator();
+		int defGeomIndex = target.getType().getDefaultGeometryAttributeIndex();
+		while (iter.hasNext()) {
+			attr = (FeatureAttributeDescriptor)iter.next();
+			if (attr.getIndex() == defGeomIndex) {
+				Geometry geom =source.getDefaultGeometry();
+				geom.reProject(ct);
+				target.setDefaultGeometry(geom);
+			} else {
+				target.set(attr.getIndex(), source.get(attr.getName()));
+			}
+
+		}
+
+	}
+
+	public void setFeatureStore(FeatureStore store) {
+		try {
+			orgDefFeatureType = store.getDefaultFeatureType();
+			orgFeatureTypes = store.getFeatureTypes();
+			EditableFeatureType defFType = orgDefFeatureType
+					.getEditable();
+			EditableFeatureAttributeDescriptor attr = (EditableFeatureAttributeDescriptor) defFType
+					.getAttributeDescriptor(defFType
+							.getDefaultGeometryAttributeName());
+			sourceSRS = attr.getSRS();
+			ct = sourceSRS.getCT(targetSRS);
+			attr.setSRS(this.targetSRS);
+			FeatureType defaultType = defFType.getNotEditableCopy();
+			List types = new ArrayList();
+			Iterator iter = orgFeatureTypes.iterator();
+			FeatureType tmp;
+			while (iter.hasNext()) {
+				tmp = (FeatureType) iter.next();
+				if (tmp.getId().equals(defaultType.getId())) {
+					types.add(defaultType);
+				} else {
+					types.add(tmp);
+				}
+			}
+
+			this.setFeatureTypes(types, defaultType);
+		} catch (DataException e) {
+			// FIXME
+			throw new RuntimeException(e);
+		}
+
+		super.setFeatureStore(store);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.FeatureStoreTransform#getSourceFeatureTypeFrom(org.gvsig.fmap.dal.feature.FeatureType)
+	 */
+	public FeatureType getSourceFeatureTypeFrom(FeatureType targetFeatureType) {
+		EditableFeatureType result = null;
+		FeatureType tmp;
+		EditableFeatureAttributeDescriptor attr;
+		Iterator iter = orgFeatureTypes.iterator();
+		Iterator iterAttr;
+		while (iter.hasNext()) {
+			tmp = (FeatureType) iter.next();
+			if (tmp.getId().equals(targetFeatureType.getId())) {
+				result = tmp.getEditable();
+				iterAttr = result.iterator();
+				while (iterAttr.hasNext()) {
+					attr = (EditableFeatureAttributeDescriptor) iterAttr.next();
+					if (targetFeatureType.getIndex(attr.getName()) < 0) {
+						iterAttr.remove();
+					}
+				}
+				break;
+			}
+		}
+		return result.getNotEditableCopy();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.dal.feature.FeatureStoreTransform#isTransformsOriginalValues()
+	 */
+	public boolean isTransformsOriginalValues() {
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.persistence.Persistent#loadState(org.gvsig.tools.persistence.PersistentState)
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException {
+		super.saveToState(state);
+		
+		state.set("source_crs", this.sourceSRS);
+		state.set("source_defaultFeatureType", this.orgDefFeatureType);
+		state.set("source_featureTypes", this.orgFeatureTypes);
+		state.set("target_crs", this.targetSRS);
+		state.set("coordtrans", this.ct);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.tools.persistence.Persistent#loadFromState(org.gvsig.tools.persistence.PersistentState)
+	 */
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		super.loadFromState(state);
+		this.sourceSRS = (IProjection) state.get("source_crs");
+		this.orgDefFeatureType = (FeatureType) state.get("source_defaultFeatureType");
+		this.orgFeatureTypes = new ArrayList( (List) state.get("source_featureTypes"));
+		this.targetSRS = (IProjection) state.get("target_crs");
+		this.ct = (ICoordTrans) state.get("coordtrans");
+	}
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				ReprojectDefaultGeometry.class,
+				"ReprojectDefaultGeometry",
+				"ReprojectDefaultGeometry Persistence definition",
+				null, 
+				null
+		);
+		definition.extend( manager.getDefinition(AbstractFeatureStoreTransform.class));
+		
+		definition.addDynFieldObject("source_crs")
+			.setClassOfValue(IProjection.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("source_defaultFeatureType")
+			.setClassOfValue(FeatureType.class)
+			.setMandatory(true);
+		definition.addDynFieldList("source_featureTypes")
+			.setClassOfItems(FeatureType.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("target_crs")
+			.setClassOfValue(IProjection.class)
+			.setMandatory(true);
+		definition.addDynFieldObject("coordtrans")
+			.setClassOfValue(ICoordTrans.class)
+			.setMandatory(true);
+
+	}
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossesGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossesGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/CrossesGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,92 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.Crosses;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class CrossesGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+	private String geometryWKT;
+
+	public CrossesGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Crosses.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "crosses with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " crosses(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/impl/DefaultGraphicLayer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/impl/DefaultGraphicLayer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/impl/DefaultGraphicLayer.java	(revision 36112)
@@ -0,0 +1,243 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+* 
+* 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 2
+* 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.
+* 
+* 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.
+* 
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 {Iver T.I.}   {Task}
+*/
+package org.gvsig.fmap.mapcontext.layers.vectorial.impl;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.fmap.dal.feature.EditableFeature;
+import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.EditableFeatureType;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.exception.BaseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Default {@link GraphicLayer} implementation. 
+ * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
+ */
+public class DefaultGraphicLayer extends FLyrVect implements GraphicLayer{
+	private static final String DEFAULT = "default";
+	protected static final Logger logger = LoggerFactory.getLogger(DefaultGraphicLayer.class);
+	private static DataManager dataManager = DALLocator.getDataManager();
+	private IVectorialUniqueValueLegend legend = null;
+	
+	private FeatureStore store = null;
+	private long ids = 0;
+
+	private int symbolId = -1;
+
+	public DefaultGraphicLayer() {
+		super();	
+	}
+
+	public void initialize(IProjection projection) throws ValidateDataParametersException, DataException, LoadLayerException { 
+		store = dataManager.createMemoryStore(FEATURE_ATTR_PRIORITY);
+		store.edit();
+
+		EditableFeatureType editableFeatureType = store.getDefaultFeatureType().getEditable();
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_GROUPID, DataTypes.STRING);
+
+		EditableFeatureAttributeDescriptor geometryDescriptor = editableFeatureType.add(GraphicLayer.FEATURE_ATTR_GEOMETRY, DataTypes.GEOMETRY);
+		geometryDescriptor.setGeometryType(TYPES.GEOMETRY);
+		geometryDescriptor.setGeometrySubType(SUBTYPES.GEOM2D);
+		geometryDescriptor.setSRS(projection);
+		editableFeatureType.setDefaultGeometryAttributeName(GraphicLayer.FEATURE_ATTR_GEOMETRY);
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_IDSYMBOL, DataTypes.INT);
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_LABEL, DataTypes.STRING);
+
+		EditableFeatureAttributeDescriptor featureIdDescriptor = 
+			editableFeatureType.add(GraphicLayer.FEATURE_ATTR_FEATUREID, DataTypes.LONG);
+
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_TAG, DataTypes.OBJECT);
+		editableFeatureType.add(GraphicLayer.FEATURE_ATTR_PRIORITY, DataTypes.INT);
+		
+		featureIdDescriptor.setIsPrimaryKey(true);
+		editableFeatureType.setHasOID(true);
+
+		store.update(editableFeatureType);	
+
+		store.finishEditing();		
+
+		this.setDataStore(store);
+	}
+
+	public void addGraphic(String groupId, Geometry geom, int idsym) {
+		addGraphic(groupId, geom, idsym, null, null, DEFAULT_PRIORITY);
+	}
+
+	public void addGraphic(Geometry geom, int idsym) {
+		addGraphic(DEFAULT, geom, idsym, null, null, DEFAULT_PRIORITY);
+	}
+
+	public void addGraphic(Geometry geom, int idsym, String label) {
+		addGraphic(DEFAULT, geom, idsym, label, null, DEFAULT_PRIORITY);
+	}
+
+	public void addGraphic(String groupId, Geometry geom, int idsym, String label) {
+		addGraphic(groupId, geom, idsym, label, null, DEFAULT_PRIORITY);
+	}
+	
+	public void addGraphic(String groupId, Geometry geom, int idsym, String label,
+			Object tag, int priority) {
+
+		try{
+			if (!store.isEditing()){
+				store.edit();
+			}
+			EditableFeature feature = store.createNewFeature().getEditable();
+			feature.setString(GraphicLayer.FEATURE_ATTR_GROUPID, groupId);
+			feature.setGeometry(GraphicLayer.FEATURE_ATTR_GEOMETRY, geom);
+			feature.setInt(GraphicLayer.FEATURE_ATTR_IDSYMBOL, idsym);	
+			feature.setString(GraphicLayer.FEATURE_ATTR_LABEL, label);	
+			feature.setLong(GraphicLayer.FEATURE_ATTR_FEATUREID, ids);
+			feature.set(GraphicLayer.FEATURE_ATTR_TAG, tag);
+			feature.setInt(GraphicLayer.FEATURE_ATTR_PRIORITY, priority);
+
+			ids++;
+
+			store.insert(feature);
+			store.finishEditing();
+		} catch (DataException e) {
+			logger.error("Error adding a geometry to the graphic layer", e);
+		}
+	}	
+
+	public int addSymbol(ISymbol newSymbol) {
+		symbolId++;
+		legend.addSymbol(new Integer(symbolId), newSymbol);
+		return symbolId;
+	}
+
+	public ISymbol getSymbol(int symbolPos) {
+		return legend.getSymbolByValue(new Integer(symbolPos));		
+	}
+
+	public int getSymbolId(ISymbol symbol) {
+		Object key = legend.getSymbolKey(symbol);
+		return key == null ? -1 : ((Number) key).intValue();
+	}
+
+	public void clearAllGraphics() {
+		DisposableIterator iterator = null;
+		FeatureSet featureSet = null;
+		try{
+			if (!store.isEditing()){
+				store.edit();
+			}
+			featureSet = store.getFeatureSet();
+			for (iterator = featureSet.fastIterator(); iterator.hasNext();) {
+				Feature feature = (Feature) iterator.next();
+				featureSet.delete(feature);
+			}
+			store.finishEditing();			
+		} catch (DataException e) {
+			logger.error("Error clearing all the geometry of the graphic layer", e);
+		} finally {
+			if (featureSet != null) {
+				featureSet.dispose();
+			}
+			if (iterator != null) {
+				iterator.dispose();
+			}
+		}
+	}
+
+	public int clearAllSymbols() {
+		legend.clear();
+		symbolId = -1;
+		return symbolId;
+	}
+
+	public void removeGraphics(String groupId) {
+		DisposableIterator iterator = null;
+		FeatureSet featureSet = null;
+		try{
+			if (!store.isEditing()){
+				store.edit();
+			}
+			featureSet = store.getFeatureSet();
+			for (iterator = featureSet.fastIterator(); iterator.hasNext();) {
+				Feature feature = (Feature) iterator.next();
+				if (feature.get(FEATURE_ATTR_GROUPID).equals(groupId)) {
+					featureSet.delete(feature);
+				}
+			}
+			store.finishEditing();
+		} catch (DataException e) {
+			logger.error("Error clearing all the geometry of the graphic layer", e);
+		} finally {
+			if (featureSet != null) {
+				featureSet.dispose();
+			}
+			if (iterator != null) {
+				iterator.dispose();
+			}
+		}
+	}
+
+	protected void doDispose() throws BaseException {
+		super.doDispose();
+		if (store != null) {
+			store.dispose();
+			store = null;
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect#setLegend(org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend)
+	 */
+	public void setLegend(IVectorLegend legend) throws LegendLayerException {
+		if (legend instanceof IVectorialUniqueValueLegend){		
+			super.setLegend(legend);
+			this.legend = (IVectorialUniqueValueLegend)legend;
+			this.legend.setClassifyingFieldNames(new String[]{FEATURE_ATTR_IDSYMBOL});
+		}else{
+			logger.warn("The legend for the graphics layer must be a instance of IVectorialUniqueValueLegend");
+		}
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/DisjointGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/DisjointGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/DisjointGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,92 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Disjoint;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class DisjointGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+	private String geometryWKT;
+
+	public DisjointGeometryEvaluator(Geometry geometry,
+			IProjection projection,
+			FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Disjoint.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "disjoint with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " disjoint(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,87 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Intersects;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class IntersectsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private String geometryWKT = null;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public IntersectsGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Intersects.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "intersects with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " intersects(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java	(revision 36112)
@@ -0,0 +1,60 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * 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 2
+ * 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.
+ *
+ * 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.
+ *
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.timesupport.Time;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+
+/**
+ * @author gvSIG Team
+ * @version $Id$
+ *
+ */
+public class IntersectsTimeEvaluator extends AbstractEvaluator {
+    private Time time;
+    private String timeAttributeName;
+   
+    public IntersectsTimeEvaluator(Time time, String timeAttributeName) {
+        super();  
+        this.time = time;
+        this.timeAttributeName = timeAttributeName;
+        this.getFieldsInfo().addMatchFieldValue(timeAttributeName, time);
+    }
+
+    public Object evaluate(EvaluatorData data) throws EvaluatorException {
+        Feature feature = ((Feature) data.getContextValue("feature"));
+        return new Boolean(time.intersects((Time)feature.get(timeAttributeName)));       
+    }
+
+    public String getName() {       
+        return "intersets with time";
+    }
+
+    public String getSQL() {
+        // TODO add the time filter!!!
+        return super.getSQL();
+    }
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsTimeEvaluator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVectLinkProperties.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVectLinkProperties.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVectLinkProperties.java	(revision 36112)
@@ -0,0 +1,165 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import java.awt.geom.Point2D;
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.layers.AbstractLinkProperties;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.DisposableIterator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+
+
+/**
+ * This class extends AbstractLinkProperties and implements the method to get an array of URI
+ * using a point2D and a tolerance. This class extends AstractLinkProperties to add HyperLink
+ * to Vectorial Layer(FLyrVect)
+ * 
+ * @deprecated this functionality has extracted of the core form gvSIG 2.0 
+ */
+
+public class FLyrVectLinkProperties extends AbstractLinkProperties {
+
+    /**
+     * Default Constructor. Costructs a LinkProperties with the necessary information
+     *
+     */
+    public FLyrVectLinkProperties(){
+        setType(0);
+        setField(null);
+        setExt(null);
+    }
+
+    /**
+     * Constructor. Constructs a LinkProperties with the information that receives
+     * @param tipo
+     * @param fieldName
+     * @param extension
+     */
+    public FLyrVectLinkProperties(int tipo, String fieldName, String extension){
+        setType(tipo);
+        setField(fieldName);
+        setExt(extension);
+    }
+
+    /**
+     * Creates an array of URI. With the point and the tolerance makes a query to the layer
+     * and gets the geometries that contains the point with a certain error (tolerance).
+     * For each one of this geometries creates one URI and adds it to the array
+     * @param layer
+     * @param point
+     * @param tolerance
+     * @return Array of URI
+     * @throws ReadException
+     */
+    public URI[] getLink(FLayer layer, Point2D point, double tolerance) throws ReadException{
+    	//Sacado de la clase LinkListener
+		FLyrVect lyrVect = (FLyrVect) layer;
+		FeatureStore fStore = null;
+		FeatureSet fSet=null;
+		DisposableIterator iter = null;
+
+    	try {
+    		fStore = lyrVect.getFeatureStore();
+    		//URI uri[]=null;
+
+    		//Construimos el BitSet (V�ctor con componentes BOOLEAN) con la consulta que
+    		try {
+    			fSet = lyrVect.queryByPoint(point, tolerance, fStore.getDefaultFeatureType());//fStore.getFeatureSet(featureQuery);
+    		} catch (ReadException e) {
+    			return null;
+    		} catch (DataException e) {
+    			return null;
+			}
+
+    		//Si el bitset creado no est� vac�o creamos el vector de URLS correspondientes
+    		//a la consulta que hemos hecho.
+
+    		ArrayList tmpUris=new ArrayList();
+    		String auxext="";
+    		int idField = fStore.getDefaultFeatureType().getIndex(this.getField());
+
+
+
+
+    		//Consigo el identificador del campo pasandole como par�metro el
+    		//nombre del campo del �nlace
+    		if (idField == -1){
+        		throw new ReadException(lyrVect.getName()+": '"+this.getField()+"' not found",new Exception());
+    		}
+    		//Recorremos el BitSet siguiendo el ejmplo de la clase que se
+    		//proporciona en la API
+    		iter = fSet.iterator();
+    		while (iter.hasNext()){
+    			//TODO
+    			//Sacado de la clase LinkPanel, decidir como pintar la URL le
+    			//corresponde a LinkPanel, aqu� solo creamos el vector de URL�s
+    			if (!super.getExt().equals("")){
+    				auxext="."+this.getExt();
+    			}
+    			//Creamos el fichero con el nombre del campo y la extensi�n.
+    			Feature feature = (Feature) iter.next();
+    			String auxField=feature.getString(idField);
+    			URI tmpUri = null;
+    			if(auxField.startsWith("http:/")){
+    				tmpUri= new URI(auxField);
+    			}else{
+    				File file =new File(feature.getString(idField)+auxext);
+    				tmpUri = file.toURI();
+    			}
+    			tmpUris.add(tmpUri);
+    			System.out.println(tmpUri.toString());
+
+
+    		}
+
+    		if (tmpUris.size()==0){
+    			return null;
+    		}
+
+    		// Creo el vector de URL�s con la misma longitud que el bitset
+
+    		return (URI[]) tmpUris.toArray(new URI[0]);
+
+    	} catch (ReadException e) {
+    		throw new ReadException(lyrVect.getName(),e);
+    	} catch (URISyntaxException e) {
+    		throw new ReadException(lyrVect.getName(),e);
+		} catch (DataException e) {
+			throw new ReadException(lyrVect.getName(),e);
+		}finally{
+			if (iter != null) {
+				iter.dispose();
+			}
+			if (fSet != null) {
+				fSet.dispose();
+			}
+		}
+
+    }
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				FLyrVectLinkProperties.class,
+				"FLyrVectLinkProperties",
+				"FLyrVectLinkProperties Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("typeLink").setMandatory(true);
+		definition.addDynFieldString("fieldName").setMandatory(true);
+		definition.addDynFieldString("extName").setMandatory(true);
+	}
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/EqualsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/EqualsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/EqualsGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,91 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Equals;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class EqualsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private String geometryWKT = null;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public EqualsGeometryEvaluator(Geometry geometry,
+			IProjection projection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = projection.getAbrev();
+		ICoordTrans ct = projection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Equals.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "equals with geometry";
+	}
+
+	public String getSQL() {
+		if (geometryWKT == null) {
+			try {
+				geometryWKT = (String) geometry.invokeOperation(ToWKT.CODE,
+						null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " equals(GeomFromText('" + geometryWKT + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OverlapsGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OverlapsGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/OverlapsGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Overlaps;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class OverlapsGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public OverlapsGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Overlaps.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "overlaps with geometry";
+	}
+
+	public String getSQL() {
+		return " overlaps(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java	(revision 36112)
@@ -0,0 +1,1492 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.cresques.cts.ICoordTrans;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureQuery;
+import org.gvsig.fmap.dal.feature.FeatureSet;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.dal.feature.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Circle;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.geom.type.GeometryType;
+import org.gvsig.fmap.geom.type.GeometryTypeNotSupportedException;
+import org.gvsig.fmap.geom.type.GeometryTypeNotValidException;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReprojectLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StopEditionLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLyrDefault;
+import org.gvsig.fmap.mapcontext.layers.LayerEvent;
+import org.gvsig.fmap.mapcontext.layers.SpatialCache;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.LegendException;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.FeatureDrawnNotification;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingStrategy;
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.locator.LocatorException;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.persistence.exception.PersistenceRuntimeException;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * Capa b�sica Vectorial.
+ * 
+ * @author Fernando Gonz�lez Cort�s
+ */
+
+public class FLyrVect extends FLyrDefault implements VectorLayer,
+LegendContentsChangedListener, Observer {
+
+    final static private org.slf4j.Logger logger =
+        LoggerFactory.getLogger(FLyrVect.class);
+    private final GeometryManager geomManager =
+        GeometryLocator.getGeometryManager();
+
+    /** Leyenda de la capa vectorial */
+    private IVectorLegend legend;
+    private int typeShape = -1;
+    private FeatureStore featureStore = null;
+    private SpatialCache spatialCache = new SpatialCache();
+
+    /**
+     * An implementation of gvSIG spatial index
+     */
+    // protected ISpatialIndex spatialIndex = null;
+    private IVectorLegend loadLegend = null;
+
+    private boolean isLabeled;
+    protected ILabelingStrategy strategy;
+
+    public FLyrVect() {
+        super();
+    }
+
+    /**
+     * Devuelve el VectorialAdapater de la capa.
+     * 
+     * @return VectorialAdapter.
+     */
+    public DataStore getDataStore() {
+        if (!this.isAvailable()) {
+            return null;
+        }
+        return featureStore;
+    }
+
+    /**
+     * If we use a persistent spatial index associated with this layer, and the
+     * index is not intrisic to the layer (for example spatial databases) this
+     * method looks for existent spatial index, and loads it.
+     * 
+     */
+    // private void loadSpatialIndex() {
+    // //FIXME: Al abrir el indice en fichero...
+    // //�C�mo lo liberamos? un metodo Layer.shutdown()
+    //
+    //
+    // ReadableVectorial source = getSource();
+    // //REVISAR QUE PASA CON LOS DRIVERS DXF, DGN, etc.
+    // //PUES SON VECTORIALFILEADAPTER
+    // if (!(source instanceof VectorialFileAdapter)) {
+    // // we are not interested in db adapters
+    // return;
+    // }
+    // VectorialDriver driver = source.getDriver();
+    // if (!(driver instanceof BoundedShapes)) {
+    // // we dont spatially index layers that are not bounded
+    // return;
+    // }
+    // File file = ((VectorialFileAdapter) source).getFile();
+    // String fileName = file.getAbsolutePath();
+    // File sptFile = new File(fileName + ".qix");
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // // before to exit, look for it in temp path
+    // String tempPath = System.getProperty("java.io.tmpdir");
+    // fileName = tempPath + File.separator + sptFile.getName();
+    // sptFile = new File(fileName);
+    // // it doesnt exists, must to create
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // return;
+    // }// if
+    // }// if
+    //
+    // try {
+    // source.start();
+    // spatialIndex = new
+    // QuadtreeGt2(FileUtils.getFileWithoutExtension(sptFile),
+    // "NM", source.getFullExtent(), source.getShapeCount(), false);
+    // source.setSpatialIndex(spatialIndex);
+    // } catch (SpatialIndexException e) {
+    // spatialIndex = null;
+    // e.printStackTrace();
+    // return;
+    // } catch (ReadDriverException e) {
+    // spatialIndex = null;
+    // e.printStackTrace();
+    // return;
+    // }
+    //
+    // }
+
+    /**
+     * Checks if it has associated an external spatial index
+     * (an spatial index file).
+     * 
+     * It looks for it in main file path, or in temp system path.
+     * If main file is rivers.shp, it looks for a file called
+     * rivers.shp.qix.
+     * 
+     * @return
+     */
+    // public boolean isExternallySpatiallyIndexed() {
+    // /*
+    // * FIXME (AZABALA): Independizar del tipo de fichero de �ndice
+    // * con el que se trabaje (ahora mismo considera la extension .qix,
+    // * pero esto depender� del tipo de �ndice)
+    // * */
+    // ReadableVectorial source = getSource();
+    // if (!(source instanceof VectorialFileAdapter)) {
+    // // we are not interested in db adapters.
+    // // think in non spatial dbs, like HSQLDB
+    // return false;
+    // }
+    // File file = ((VectorialFileAdapter) source).getFile();
+    // String fileName = file.getAbsolutePath();
+    // File sptFile = new File(fileName + ".qix");
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // // before to exit, look for it in temp path
+    // // it doesnt exists, must to create
+    // String tempPath = System.getProperty("java.io.tmpdir");
+    // fileName = tempPath + File.separator + sptFile.getName();
+    // sptFile = new File(fileName);
+    // if (!sptFile.exists() || (!(sptFile.length() > 0))) {
+    // return false;
+    // }// if
+    // }// if
+    // return true;
+    // }
+    /**
+     * Inserta el VectorialAdapter a la capa.
+     * 
+     * @param va
+     *            VectorialAdapter.
+     * 
+     * @deprecated esto deber�a se ser protected
+     */
+    public void setDataStore(DataStore dataStore) throws LoadLayerException {
+        if (this.featureStore != null && this.featureStore != dataStore) {
+            this.featureStore.deleteObserver(this);
+        }
+
+        featureStore = (FeatureStore) dataStore;
+
+        IVectorLegend legend =
+            (IVectorLegend) MapContextLocator.getMapContextManager().getLegend(dataStore);
+
+        if (legend == null) {
+            throw new LegendLayerException(this.getName());
+        }
+
+        this.setLegend(legend);
+
+        ILabelingStrategy labeler = null;
+        try {
+            labeler =
+                (ILabelingStrategy) dataStore.invokeDynMethod("getLabeling",
+                    null);
+        } catch (DynMethodNotSupportedException e1) {
+            labeler = null;
+        } catch (DynMethodException e1) {
+            logger.error("Can't load the specific lebeling strategy provided for the layer {}.",
+                this.getName(),
+                e1);
+        }
+
+        if (labeler != null) {
+            labeler.setLayer(this);
+            this.setLabelingStrategy(labeler);
+            this.setIsLabeled(true); // TODO: ac� no s'hauria de detectar si t�
+            // etiquetes?????
+        }
+
+        this.delegate(dataStore);
+
+        dataStore.addObserver(this);
+
+        ToolsLocator.getDisposableManager().bind(dataStore);
+    }
+
+    public Envelope getFullEnvelope() throws ReadException {
+        Envelope rAux;
+        try {
+            rAux = getFeatureStore().getEnvelope();
+        } catch (BaseException e) {
+            throw new ReadException(getName(), e);
+        }
+
+        // Esto es para cuando se crea una capa nueva con el fullExtent de ancho
+        // y alto 0.
+        if (rAux == null || rAux.getMaximum(0) - rAux.getMinimum(0) == 0
+            && rAux.getMaximum(1) - rAux.getMinimum(1) == 0) {
+            try {
+                rAux =
+                    geomManager.createEnvelope(0, 0, 100, 100, SUBTYPES.GEOM2D);
+            } catch (CreateEnvelopeException e) {
+                logger.error("Error creating the envelope", e);
+                e.printStackTrace();
+            }
+        }
+        // Si existe reproyecci�n, reproyectar el extent
+        ICoordTrans ct = getCoordTrans();
+        try {
+            if (ct != null) {
+                Point2D pt1 =
+                    new Point2D.Double(rAux.getMinimum(0), rAux.getMinimum(1));
+                Point2D pt2 =
+                    new Point2D.Double(rAux.getMaximum(0), rAux.getMaximum(1));
+                pt1 = ct.convert(pt1, null);
+                pt2 = ct.convert(pt2, null);
+                try {
+                    rAux =
+                        geomManager.createEnvelope(pt1.getX(),
+                            pt1.getY(),
+                            pt2.getX(),
+                            pt2.getY(),
+                            SUBTYPES.GEOM2D);
+                } catch (CreateEnvelopeException e) {
+                    logger.error("Error creating the envelope", e);
+                    e.printStackTrace();
+                }// new Rectangle2D.Double();
+            }
+        } catch (IllegalStateException e) {
+            this.setAvailable(false);
+            this.addError(new ReprojectLayerException(getName(), e));
+        }
+        return rAux;
+
+    }
+
+    /**
+     * Draws using IFeatureIterator. This method will replace the old draw(...)
+     * one.
+     * 
+     * @autor jaume dominguez faus - jaume.dominguez@iver.es
+     * @param image
+     * @param g
+     * @param viewPort
+     * @param cancel
+     * @param scale
+     * @throws ReadDriverException
+     */
+    public void draw(BufferedImage image,
+        Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale) throws ReadException {
+
+        if (legend == null) {
+            return;
+        }
+
+        if (!this.isWithinScale(scale)) {
+            return;
+        }
+        if (cancel.isCanceled()) {
+            return;
+        }
+
+        if (spatialCache.isEnabled()) {
+            spatialCache.clearAll();
+            legend.addDrawingObserver(this);
+        }
+
+        FeatureQuery featureQuery = null;
+        try {
+            FeatureAttributeDescriptor featureAttributeDescriptor =
+                getFeatureStore().getDefaultFeatureType().getDefaultTimeAttribute();
+
+            if ((viewPort.getTime() != null) && (featureAttributeDescriptor != null)){
+                featureQuery = getFeatureStore().createFeatureQuery();
+                IntersectsTimeEvaluator intersectsTimeEvaluator =
+                    new IntersectsTimeEvaluator(viewPort.getTime(), featureAttributeDescriptor.getName());
+                featureQuery.addFilter(intersectsTimeEvaluator);
+            }
+        } catch (DataException e1) {
+            logger.error("Impossible to get the temporal filter", e1);
+        }
+
+        try {
+            legend.draw(image,
+                g,
+                viewPort,
+                cancel,
+                scale,
+                null,
+                getCoordTrans(),
+                getFeatureStore(),
+                featureQuery);
+
+        } catch (LegendException e) {
+            this.setVisible(false);
+            this.setActive(false);
+            throw new ReadException(getName(), e);
+        } finally {
+            if (spatialCache.isEnabled()) {
+                legend.deleteDrawingObserver(this);
+            }
+        }
+    }
+
+    public void print(Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale,
+        PrintAttributes properties) throws ReadException {
+        if (!this.isWithinScale(scale)) {
+            return;
+        }
+        if (cancel.isCanceled()) {
+            return;
+        }
+
+        try {
+            legend.print(g,
+                viewPort,
+                cancel,
+                scale,
+                null,
+                getCoordTrans(),
+                getFeatureStore(),
+                null,
+                properties);
+
+        } catch (LegendException e) {
+            this.setVisible(false);
+            this.setActive(false);
+            throw new ReadException(getName(), e);
+        }
+    }
+
+    /**
+     * <p>
+     * Creates an spatial index associated to this layer. The spatial index will
+     * used the native projection of the layer, so if the layer is reprojected,
+     * it will be ignored.
+     * </p>
+     * 
+     * @param cancelMonitor
+     *            instance of CancellableMonitorable that allows
+     *            to monitor progress of spatial index creation, and cancel the
+     *            process
+     */
+    // public void createSpatialIndex(CancellableMonitorable cancelMonitor){
+    // // FJP: ESTO HABR� QUE CAMBIARLO. PARA LAS CAPAS SECUENCIALES, TENDREMOS
+    // // QUE ACCEDER CON UN WHILE NEXT. (O mejorar lo de los FeatureVisitor
+    // // para que acepten recorrer sin geometria, solo con rectangulos.
+    //
+    // //If this vectorial layer is based in a spatial database, the spatial
+    // //index is already implicit. We only will index file drivers
+    // ReadableVectorial va = getSource();
+    // //We must think in non spatial databases, like HSQLDB
+    // if(!(va instanceof VectorialFileAdapter)){
+    // return;
+    // }
+    // if (!(va.getDriver() instanceof BoundedShapes)) {
+    // return;
+    // }
+    // File file = ((VectorialFileAdapter) va).getFile();
+    // String fileName = file.getAbsolutePath();
+    // ISpatialIndex localCopy = null;
+    // try {
+    // va.start();
+    // localCopy = new QuadtreeGt2(fileName, "NM", va.getFullExtent(),
+    // va.getShapeCount(), true);
+    //
+    // } catch (SpatialIndexException e1) {
+    // // Probably we dont have writing permissions
+    // String directoryName = System.getProperty("java.io.tmpdir");
+    // File newFile = new File(directoryName +
+    // File.separator +
+    // file.getName());
+    // String newFileName = newFile.getName();
+    // try {
+    // localCopy = new QuadtreeGt2(newFileName, "NM", va.getFullExtent(),
+    // va.getShapeCount(), true);
+    // } catch (SpatialIndexException e) {
+    // // if we cant build a file based spatial index, we'll build
+    // // a pure memory spatial index
+    // localCopy = new QuadtreeJts();
+    // } catch (ReadException e) {
+    // localCopy = new QuadtreeJts();
+    // }
+    //
+    // } catch(Exception e){
+    // e.printStackTrace();
+    // }//try
+    // BoundedShapes shapeBounds = (BoundedShapes) va.getDriver();
+    // try {
+    // for (int i=0; i < va.getShapeCount(); i++)
+    // {
+    // if(cancelMonitor != null){
+    // if(cancelMonitor.isCanceled())
+    // return;
+    // cancelMonitor.reportStep();
+    // }
+    // Rectangle2D r = shapeBounds.getShapeBounds(i);
+    // if(r != null)
+    // localCopy.insert(r, i);
+    // } // for
+    // va.stop();
+    // if(localCopy instanceof IPersistentSpatialIndex)
+    // ((IPersistentSpatialIndex) localCopy).flush();
+    // spatialIndex = localCopy;
+    // //vectorial adapter needs a reference to the spatial index, to solve
+    // //request for feature iteration based in spatial queries
+    // source.setSpatialIndex(spatialIndex);
+    // } catch (ReadException e) {
+    // // TODO Auto-generated catch block
+    // e.printStackTrace();
+    // }
+    // }
+
+    // public void createSpatialIndex() {
+    // createSpatialIndex(null);
+    // }
+
+    public void setLegend(IVectorLegend legend) throws LegendLayerException {
+        if (this.legend == legend) {
+            return;
+        }
+        if (this.legend != null && this.legend.equals(legend)) {
+            return;
+        }
+        IVectorLegend oldLegend = this.legend;
+        this.legend = legend;
+        if (oldLegend != null) {
+            oldLegend.removeLegendListener(this);
+            oldLegend.deleteDrawingObserver(this);
+        }
+        if (legend != null) {
+            this.legend.addDrawingObserver(this);
+            this.legend.addLegendListener(this);
+        }
+        LegendChangedEvent e =
+            LegendChangedEvent.createLegendChangedEvent(oldLegend, this.legend);
+        e.setLayer(this);
+        callLegendChanged(e);
+    }
+
+    /**
+     * Devuelve la Leyenda de la capa.
+     * 
+     * @return Leyenda.
+     */
+    public ILegend getLegend() {
+        return legend;
+    }
+
+    /**
+     * Devuelve el tipo de shape que contiene la capa.
+     * 
+     * @return tipo de shape.
+     * 
+     * @throws ReadException
+     */
+    public int getShapeType() throws ReadException {
+    	if (typeShape == -1) {
+    		FeatureType featureType = null;
+    		try {
+    			if( getDataStore()!=null ){
+    				featureType =
+    					(((FeatureStore) getDataStore()).getDefaultFeatureType());
+    			}
+    		} catch (DataException e) {
+    			throw new ReadException(getName(), e);
+    		}
+    		if( featureType!=null ){
+    			int indexGeom = featureType.getDefaultGeometryAttributeIndex();
+    			typeShape =
+    				featureType.getAttributeDescriptor(indexGeom).getGeometryType();
+    		}
+    	}
+    	return typeShape;
+    }
+
+    public void saveToState(PersistentState state) throws PersistenceException {
+
+        if (!this.isAvailable()) {
+            return;
+        }
+
+        super.saveToState(state);
+
+        if (getLegend() != null) {
+            state.set("legend", getLegend());
+        }
+
+        FeatureStore fst = null;
+        fst = getFeatureStore();
+
+        if (fst != null) {
+            state.set("featureStore", fst);
+        }
+
+        state.set("isLabeled", isLabeled);
+
+        if (strategy != null) {
+            state.set("labelingStrategy", strategy);
+        }
+
+        if (getLinkProperties() != null) {
+            state.set("linkProperties", getLinkProperties());
+        }
+
+        // state.set("bHasJoin", bHasJoin);
+        state.set("typeShape", typeShape);
+    }
+
+    // public XMLEntity getXMLEntity() throws XMLException {
+    //
+    // if (!this.isAvailable() && this.orgXMLEntity != null) {
+    // return this.orgXMLEntity;
+    // }
+    // XMLEntity xml = super.getXMLEntity();
+    // if (getLegend()!=null){
+    // XMLEntity xmlLegend=getLegend().getXMLEntity();
+    // xmlLegend.putProperty("tagName","legend");
+    // xml.addChild(xmlLegend);
+    // }
+    // try {
+    // PersistenceManager manager = ToolsLocator.getPersistenceManager();
+    // PersistentState stateFeatureStore=manager.getState(getFeatureStore());
+    // stateFeatureStore.set("tagName","featureStore");
+    // xml.addChild(((XMLEntityState)stateFeatureStore).getXMLEntity());
+    // } catch (ReadException e) {
+    // throw new XMLLayerException(getName(),e);
+    // } catch (PersistenceException e) {
+    // throw new XMLLayerException(getName(),e);
+    // }
+    // // properties from ILabelable
+    // xml.putProperty("isLabeled", isLabeled);
+    // if (strategy != null) {
+    // XMLEntity strategyXML = strategy.getXMLEntity();
+    // strategyXML.putProperty("tagName", "labelingStrategy");
+    // xml.addChild(strategy.getXMLEntity());
+    // }
+    // xml.addChild(getLinkProperties().getXMLEntity());
+    // return xml;
+    // }
+
+    public void loadFromState(PersistentState state) throws PersistenceException {
+
+        super.loadFromState(state);
+        DataStore store = null;
+        try {
+        	store = (DataStore) state.get("featureStore");
+        } catch (PersistenceRuntimeException e) {
+			this.setAvailable(false);
+			return;
+		}
+        try {
+            this.setDataStore(store);
+        } catch (LoadLayerException e) {
+            throw new PersistenceException("While loading FLyrVect from state.",
+                e);
+        }
+
+        IVectorLegend lgnd = (IVectorLegend) state.get("legend");
+        try {
+            this.setLegend(lgnd);
+        } catch (LegendLayerException e) {
+            throw new PersistenceException("While loading FLyrVect from state.",
+                e);
+        }
+
+        Boolean isLbl = new Boolean(false);
+        ILabelingStrategy lblst = null;
+
+        try {
+            isLbl = (Boolean) state.get("isLabeled");
+            if (isLbl.booleanValue()) {
+                lblst = (ILabelingStrategy) state.get("labelingStrategy");
+            }
+        } catch (Exception ex) {
+            throw new PersistenceException("While loading FLyrVect from state.",
+                ex);
+        }
+
+        /*
+         * String _labelFieldName = null;
+         * String _labelfield = null;
+         */
+
+        if (isLbl.booleanValue()) {
+            this.setIsLabeled(true);
+            this.setLabelingStrategy(lblst);
+        } else {
+            this.setIsLabeled(false);
+            this.setLabelingStrategy(null);
+        }
+
+        // try {
+        // linkProperties = (FLyrVectLinkProperties)
+        // state.get("linkProperties");
+        // } catch (PersistenceException pex) {
+        // // not mandatory
+        // linkProperties = null;
+        // }
+
+        // bHasJoin = state.getBoolean("bHasJoin");
+        typeShape = state.getInt("typeShape");
+
+        // try { _labelFieldName = state.getString("labelFieldName"); } catch
+        // (PersistenceException ex) {
+        // _labelFieldName = null;
+        // }
+        // try { _labelfield = state.getString("labelfield"); } catch
+        // (PersistenceException ex) {
+        // _labelfield = null;
+        // }
+
+        // ILabelingStrategy not implemented
+        // if (_labelFieldName != null) {
+        //
+        // AttrInTableLabelingStrategy labeling = new
+        // AttrInTableLabelingStrategy();
+        // try {
+        // labeling.setLayer(this);
+        // } catch (ReadException e) {
+        // logger.error("While setting layer to AttrInTableLabelingStrategy: " +
+        // e.getMessage());
+        // }
+        // labeling.setUsesFixedSize(true);
+        // labeling.setFixedSize(10);
+        // labeling.setTextField(_labelFieldName);
+        // labeling.setHeightField(state.getString("labelHeightFieldName"));
+        // labeling.setRotationField(state.getString("labelRotationFieldName"));
+        // setLabelingStrategy(labeling);
+        // setIsLabeled(true);
+        //
+        // } else {
+        // if (_labelfield != null) {
+        //
+        // AttrInTableLabelingStrategy labeling = new
+        // AttrInTableLabelingStrategy();
+        // try {
+        // labeling.setLayer(this);
+        // } catch (ReadException e) {
+        // logger.error("While setting layer to AttrInTableLabelingStrategy: " +
+        // e.getMessage());
+        // }
+        // labeling.setUsesFixedSize(true);
+        // labeling.setFixedSize(10);
+        // labeling.setTextField(_labelfield);
+        // labeling.setHeightField(state.getString("labelFieldHeight"));
+        // labeling.setRotationField(state.getString("labelFieldRotation"));
+        // setLabelingStrategy(labeling);
+        // setIsLabeled(true);
+        // }
+        // }
+
+    }
+
+    // public void setXMLEntity(XMLEntity xml) throws XMLException {
+    // try {
+    // super.setXMLEntity(xml);
+    // XMLEntity legendXML = xml.firstChild("tagName","legend");
+    // IVectorLegend leg = LegendFactory.createFromXML(legendXML);
+    //
+    // // PersistentState persistentState=new XMLEntityState(new
+    // XMLEntityManager());
+    // XMLEntity xmlStore=xml.firstChild("tagName","featureStore");
+    // XMLEntityManager xmlManger = new XMLEntityManager();
+    // PersistentState state = xmlManger.createState(xmlStore);
+    // DataStore store = (DataStore)
+    // ToolsLocator.getPersistenceManager().create(state);
+    // // persistentState.createState(xmlStore);
+    //
+    // // DataManager dm=DALLocator.getDataManager();
+    //
+    // this.setDataStore(store);
+    // /* end patch */
+    // try {
+    // setLegend(leg);
+    // } catch (LegendLayerException e) {
+    // throw new XMLLegendException(e);
+    // }
+    // // set properties for ILabelable
+    //
+    // if (xml.contains("isLabeled")
+    // && xml.getBooleanProperty(("isLabeled"))) {
+    // XMLEntity labelingXML = xml.firstChild("tagName", "labelingStrategy");
+    // if (labelingXML != null){
+    //
+    // isLabeled = true;
+    // try {
+    // this.strategy = LabelingFactory.createStrategyFromXML(labelingXML, this);
+    // } catch (NotExistInXMLEntity neXMLEX) {
+    // // no strategy was set, just continue;
+    // logger.warn("Reached what should be unreachable code");
+    // }
+    // } else {
+    // isLabeled = false;
+    // }
+    // } else if (legendXML.contains("labelFieldName")||
+    // legendXML.contains("labelfield")) {
+    // /* (jaume) begin patch;
+    // * for backward compatibility purposes. Since gvSIG v1.1 labeling is
+    // * no longer managed by the Legend but by the ILabelingStrategy. The
+    // * following allows restoring older projects' labelings.
+    // */
+    // String labelTextField = null;
+    // if (legendXML.contains("labelFieldName")){
+    // labelTextField = legendXML.getStringProperty("labelFieldName");
+    // if (labelTextField != null) {
+    // AttrInTableLabelingStrategy labeling = new AttrInTableLabelingStrategy();
+    // labeling.setLayer(this);
+    // labeling.setUsesFixedSize(true);
+    // labeling.setFixedSize(10);
+    // labeling.setTextField(labelTextField);
+    // labeling.setHeightField(legendXML.getStringProperty("labelHeightFieldName"));
+    // labeling.setRotationField(legendXML.getStringProperty("labelRotationFieldName"));
+    // this.setLabelingStrategy(labeling);
+    // this.setIsLabeled(true);
+    // }
+    // }else{
+    // labelTextField = legendXML.getStringProperty("labelfield");
+    // if (labelTextField != null) {
+    // AttrInTableLabelingStrategy labeling = new AttrInTableLabelingStrategy();
+    // labeling.setLayer(this);
+    // labeling.setUsesFixedSize(true);
+    // labeling.setFixedSize(10);
+    // labeling.setTextField(labelTextField);
+    // labeling.setHeightField(legendXML.getStringProperty("labelFieldHeight"));
+    // labeling.setRotationField(legendXML.getStringProperty("labelFieldRotation"));
+    // this.setLabelingStrategy(labeling);
+    // this.setIsLabeled(true);
+    // }
+    // }
+    // }else{
+    // isLabeled = false;
+    // }
+    // XMLEntity xmlLinkProperties=xml.firstChild("typeChild","linkProperties");
+    // if (xmlLinkProperties != null){
+    // getLinkProperties().setXMLEntity(xmlLinkProperties);
+    // }
+    // } catch (Exception e) {
+    // e.printStackTrace();
+    // this.setAvailable(false);
+    // this.orgXMLEntity = xml;
+    //
+    // }
+    // //
+    //
+    // }
+
+    /**
+     * Sobreimplementaci�n del m�todo toString para que las bases de datos
+     * identifiquen la capa.
+     * 
+     * @return DOCUMENT ME!
+     */
+    public String toString() {
+        /*
+         * Se usa internamente para que la parte de datos identifique de forma
+         * un�voca las tablas
+         */
+        String ret = super.toString();
+
+        return "layer" + ret.substring(ret.indexOf('@') + 1);
+    }
+
+    // public boolean isJoined() {
+    // return bHasJoin;
+    // }
+
+    /**
+     * Returns if a layer is spatially indexed
+     * 
+     * @return if this layer has the ability to proces spatial queries without
+     *         secuential scans.
+     * @throws StopEditionLayerException 
+     */
+    // public boolean isSpatiallyIndexed() {
+    // ReadableVectorial source = getSource();
+    // if (source instanceof ISpatialDB)
+    // return true;
+    //
+    // //FIXME azabala
+    // /*
+    // * Esto es muy dudoso, y puede cambiar.
+    // * Estoy diciendo que las que no son fichero o no son
+    // * BoundedShapes estan indexadas. Esto es mentira, pero
+    // * as� quien pregunte no querr� generar el indice.
+    // * Esta por ver si interesa generar el indice para capas
+    // * HSQLDB, WFS, etc.
+    // */
+    // if(!(source instanceof VectorialFileAdapter)){
+    // return true;
+    // }
+    // if (!(source.getDriver() instanceof BoundedShapes)) {
+    // return true;
+    // }
+    //
+    // if (getISpatialIndex() != null)
+    // return true;
+    // return false;
+    // }
+    //
+    // public void setIsJoined(boolean hasJoin) {
+    // bHasJoin = hasJoin;
+    // }
+
+    // /**
+    // * @return Returns the spatialIndex.
+    // */
+    // public ISpatialIndex getISpatialIndex() {
+    // return spatialIndex;
+    // }
+    // /**
+    // * Sets the spatial index. This could be useful if, for some
+    // * reasons, you want to work with a distinct spatial index
+    // * (for example, a spatial index which could makes nearest
+    // * neighbour querys)
+    // * @param spatialIndex
+    // */
+    // public void setISpatialIndex(ISpatialIndex spatialIndex){
+    // this.spatialIndex = spatialIndex;
+    // }
+
+    public void setEditing(boolean b) throws StartEditionLayerException {
+        super.setEditing(b);
+        FeatureStore fs = getFeatureStore();
+        if (b) {
+            try {
+                fs.edit();
+            } catch (ReadException e) {
+                throw new StartEditionLayerException(getName(), e);
+            } catch (DataException e) {
+                throw new StartEditionLayerException(getName(), e);
+            }
+        }
+        setSpatialCacheEnabled(b);
+        callEditionChanged(LayerEvent.createEditionChangedEvent(this, "edition"));
+    }
+
+    /**
+     * @deprecated Use {@link #getSpatialCache()}
+     */
+    public void clearSpatialCache() {
+        spatialCache.clearAll();
+    }
+
+    /**
+     * @deprecated Use {@link #getSpatialCache()}
+     */
+    public boolean isSpatialCacheEnabled() {
+        return spatialCache.isEnabled();
+    }
+
+    /**
+     * @deprecated Use {@link #getSpatialCache()}
+     */
+    public void setSpatialCacheEnabled(boolean spatialCacheEnabled) {
+        spatialCache.setEnabled(spatialCacheEnabled);
+    }
+
+    public SpatialCache getSpatialCache() {
+        return spatialCache;
+    }
+
+    /**
+     * Siempre es un numero mayor de 1000
+     * 
+     * @param maxFeatures
+     */
+    public void setMaxFeaturesInEditionCache(int maxFeatures) {
+        if (maxFeatures > spatialCache.getMaxFeatures()) {
+            spatialCache.setMaxFeatures(maxFeatures);
+        }
+
+    }
+
+    /**
+     * This method returns a boolean that is used by the FPopMenu
+     * to make visible the properties menu or not. It is visible by
+     * default, and if a later don't have to show this menu only
+     * has to override this method.
+     * 
+     * @return
+     *         If the properties menu is visible (or not)
+     */
+    public boolean isPropertiesMenuVisible() {
+        return true;
+    }
+
+    public void reload() throws ReloadLayerException {
+        super.reload();
+        try {
+            getFeatureStore().refresh();
+        } catch (Exception e) {
+            throw new ReloadLayerException(getName(), e);
+        }
+    }
+
+    protected void setLoadSelection(Object xml) {
+        // this.loadSelection = xml;
+    }
+
+    protected void setLoadLegend(IVectorLegend legend) {
+        this.loadLegend = legend;
+    }
+
+    protected void putLoadSelection() {
+        // if (this.loadSelection == null) return;
+        // try {
+        // this.getRecordset().getSelectionSupport().setXMLEntity(this.loadSelection);
+        // } catch (ReadDriverException e) {
+        // throw new XMLException(e);
+        // }
+        // this.loadSelection = null;
+
+    }
+
+    protected void putLoadLegend() throws LegendLayerException {
+        if (this.loadLegend == null) {
+            return;
+        }
+        this.setLegend(this.loadLegend);
+        this.loadLegend = null;
+    }
+
+    protected void cleanLoadOptions() {
+        this.loadLegend = null;
+    }
+
+    public boolean isWritable() {
+        return getFeatureStore().allowWrite();
+    }
+
+    public FLayer cloneLayer() throws Exception {
+        FLyrVect clonedLayer = new FLyrVect();
+        clonedLayer.setDataStore(getDataStore());
+        // if (isJoined()) {
+        // clonedLayer.setIsJoined(true);
+        // }
+        clonedLayer.setVisible(isVisible());
+        // clonedLayer.setISpatialIndex(getISpatialIndex());
+        clonedLayer.setName(getName());
+        clonedLayer.setCoordTrans(getCoordTrans());
+
+        clonedLayer.setLegend((IVectorLegend) getLegend().cloneLegend());
+
+        clonedLayer.setIsLabeled(isLabeled());
+        ILabelingStrategy labelingStrategy = getLabelingStrategy();
+        if (labelingStrategy != null) {
+            clonedLayer.setLabelingStrategy(labelingStrategy);
+        }
+
+        return clonedLayer;
+    }
+
+    protected boolean isOnePoint(AffineTransform graphicsTransform,
+        ViewPort viewPort,
+        double dpi,
+        CartographicSupport csSym,
+        Geometry geom,
+        int[] xyCoords) {
+        return isOnePoint(graphicsTransform, viewPort, geom, xyCoords)
+        && csSym.getCartographicSize(viewPort, dpi, geom) <= 1;
+    }
+
+    private boolean isOnePoint(AffineTransform graphicsTransform,
+        ViewPort viewPort,
+        Geometry geom,
+        int[] xyCoords) {
+        boolean onePoint = false;
+        int type = geom.getType();
+        if (type == Geometry.TYPES.NULL) {
+            return false;
+        }
+        if (type != Geometry.TYPES.POINT && type != Geometry.TYPES.MULTIPOINT) {
+
+            Envelope geomBounds = geom.getEnvelope();
+
+            // ICoordTrans ct = getCoordTrans();
+
+            // Se supone que la geometria ya esta reproyectada
+            // if (ct!=null) {
+            // // geomBounds = ct.getInverted().convert(geomBounds);
+            // geomBounds = geomBounds.convert(ct);
+            // }
+
+            double dist1Pixel = viewPort.getDist1pixel();
+
+            onePoint =
+                (geomBounds.getLength(0) <= dist1Pixel && geomBounds.getLength(1) <= dist1Pixel);
+
+            if (onePoint) {
+                // avoid out of range exceptions
+                org.gvsig.fmap.geom.primitive.Point p;
+                try {
+                    p =
+                        geomManager.createPoint(geomBounds.getMinimum(0),
+                            geomBounds.getMinimum(1),
+                            SUBTYPES.GEOM2D);
+                    p.transform(viewPort.getAffineTransform());
+                    p.transform(graphicsTransform);
+                    xyCoords[0] = (int) p.getX();
+                    xyCoords[1] = (int) p.getY();
+                } catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+                    logger.error("Error creating a point", e);
+                }
+
+            }
+
+        }
+        return onePoint;
+    }
+
+    /*
+     * jaume. Stuff from ILabeled.
+     */
+
+    public boolean isLabeled() {
+        return isLabeled;
+    }
+
+    public void setIsLabeled(boolean isLabeled) {
+        this.isLabeled = isLabeled;
+    }
+
+    public ILabelingStrategy getLabelingStrategy() {
+        return strategy;
+    }
+
+    public void setLabelingStrategy(ILabelingStrategy strategy) {
+        this.strategy = strategy;
+        if (strategy == null) {
+            return;
+        }
+        strategy.setLayer(this);
+    }
+
+    public void drawLabels(BufferedImage image,
+        Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale,
+        double dpi) throws ReadException {
+        if (strategy != null && isWithinScale(scale)) {
+            strategy.draw(image, g, viewPort, cancel, dpi);
+        }
+    }
+
+    public void printLabels(Graphics2D g,
+        ViewPort viewPort,
+        Cancellable cancel,
+        double scale,
+        PrintAttributes properties) throws ReadException {
+        if (strategy != null) {
+            strategy.print(g, viewPort, cancel, properties);
+        }
+    }
+
+    // M�todos para el uso de HyperLinks en capas FLyerVect
+
+    /**
+     * Return true, because a Vectorial Layer supports HyperLink
+     */
+    public boolean allowLinks() {
+        return true;
+    }
+
+    /**
+     * Returns an instance of AbstractLinkProperties that contains the
+     * information
+     * of the HyperLink
+     * 
+     * @return Abstra
+     */
+    // public AbstractLinkProperties getLinkProperties()
+    // {
+    // return linkProperties;
+    // }
+
+    /**
+     * Provides an array with URIs. Returns one URI by geometry that includes
+     * the point
+     * in its own geometry limits with a allowed tolerance.
+     * 
+     * @param layer
+     *            , the layer
+     * @param point
+     *            , the point to check that is contained or not in the
+     *            geometries in the layer
+     * @param tolerance
+     *            , the tolerance allowed. Allowed margin of error to detect if
+     *            the point
+     *            is contained in some geometries of the layer
+     * @return
+     * @throws ReadException
+     * @throws BehaviorException
+     */
+    // public URI[] getLink(Point2D point, double tolerance) throws
+    // ReadException
+    // {
+    // //return linkProperties.getLink(this)
+    // return linkProperties.getLink(this,point,tolerance);
+    // }
+
+    public void load() throws LoadLayerException {
+        super.load();
+    }
+
+    public FeatureStore getFeatureStore() {
+        return (FeatureStore) getDataStore();
+    }
+
+    /**
+     * @deprecated use instead {@link #queryByPoint(org.gvsig.fmap.geom.primitive.Point, double, FeatureType)}
+     */
+    public FeatureSet queryByPoint(Point2D mapPoint,
+        double tol,
+        FeatureType featureType) throws DataException {
+        logger.warn("Deprecated use of queryByPoint.");
+        GeometryManager manager = GeometryLocator.getGeometryManager();
+        org.gvsig.fmap.geom.primitive.Point center;
+        try {
+            center =
+                (org.gvsig.fmap.geom.primitive.Point) manager.create(TYPES.POINT,
+                    SUBTYPES.GEOM2D);
+            center.setX(mapPoint.getX());
+            center.setY(mapPoint.getY());
+            Circle circle =
+                (Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
+            circle.setPoints(center, tol);
+            return queryByGeometry(circle, featureType);
+        } catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+            throw new CreateGeometryException(TYPES.CIRCLE, SUBTYPES.GEOM2D, e);
+        }
+    }
+
+    public FeatureSet queryByPoint(org.gvsig.fmap.geom.primitive.Point point,
+        double tol,
+        FeatureType featureType) throws DataException {
+        GeometryManager manager = GeometryLocator.getGeometryManager();
+        try {
+            Circle circle =
+                (Circle) manager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D);
+            circle.setPoints(point, tol);
+            return queryByGeometry(circle, featureType);
+        } catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
+            throw new CreateGeometryException(TYPES.CIRCLE, SUBTYPES.GEOM2D, e);
+        }
+    }
+
+    public FeatureSet queryByGeometry(Geometry geom, FeatureType featureType) throws DataException {
+        FeatureQuery featureQuery = featureStore.createFeatureQuery();
+        String geomName =
+            featureStore.getDefaultFeatureType()
+            .getDefaultGeometryAttributeName();
+        featureQuery.setFeatureType(featureType);
+        IntersectsGeometryEvaluator iee =
+            new IntersectsGeometryEvaluator(geom,
+                getMapContext().getViewPort().getProjection(),
+                featureStore.getDefaultFeatureType(),
+                geomName);
+        featureQuery.setFilter(iee);
+        return getFeatureStore().getFeatureSet(featureQuery);
+
+    }
+
+    /**
+     * It return the {@link FeatureSet} that intersects with the envelope.
+     * @param envelope
+     *          envelope that defines the area for the query.
+     * @param featureType
+     *          only the features with this feature type are used in
+     *          the query.    
+     * @return
+     *          the set of features that intersect with the envelope.
+     * @throws DataException
+     */
+    public FeatureSet queryByEnvelope(Envelope envelope, FeatureType featureType) throws DataException {
+        return queryByEnvelope(envelope, featureType, null);
+    }
+
+    /**
+     * It return the {@link FeatureSet} that intersects with the envelope.
+     * @param envelope
+     *          envelope that defines the area for the query.
+     * @param featureType
+     *          only the features with this feature type are used in
+     *          the query.
+     * @param names
+     *          the feature attributes that have to be checked.
+     * @return
+     *          the set of features that intersect with the envelope.
+     * @throws DataException
+     */
+    public FeatureSet queryByEnvelope(Envelope envelope,
+        FeatureType featureType,
+        String[] names) throws DataException {
+        FeatureQuery featureQuery = featureStore.createFeatureQuery();
+        if (names == null) {
+            featureQuery.setFeatureType(featureType);
+        } else {
+            featureQuery.setAttributeNames(names);
+            featureQuery.setFeatureTypeId(featureType.getId());
+        }
+        String geomName =
+            featureStore.getDefaultFeatureType()
+            .getDefaultGeometryAttributeName();
+        IntersectsGeometryEvaluator iee =
+            new IntersectsGeometryEvaluator(envelope.getGeometry(),
+                getMapContext().getViewPort().getProjection(),
+                featureStore.getDefaultFeatureType(),
+                geomName);
+        featureQuery.setFilter(iee);
+        return getFeatureStore().getFeatureSet(featureQuery);
+
+    }
+
+    public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel) throws LoadLayerException,
+    DataException {
+
+        return getInfo(p, tolerance, cancel, true);
+    }
+
+    public DynObjectSet getInfo(Point p,
+        double tolerance,
+        Cancellable cancel,
+        boolean fast) throws LoadLayerException, DataException {
+        Point2D infop = new Point2D.Double(p.x, p.y);
+        Point2D pReal = this.getMapContext().getViewPort().toMapPoint(infop);
+        return queryByPoint(pReal,
+            tolerance,
+            getFeatureStore().getDefaultFeatureType()).getDynObjectSet(fast);
+    }
+
+    public DynObjectSet getInfo(org.gvsig.fmap.geom.primitive.Point p,
+        double tolerance) throws LoadLayerException, DataException {
+        return queryByPoint(p,tolerance, getFeatureStore().getDefaultFeatureType()).getDynObjectSet(false);
+    }
+    
+    public void legendCleared(LegendClearEvent event) {
+        // this.updateDrawVersion(); TODO
+        LegendChangedEvent e =
+            LegendChangedEvent.createLegendChangedEvent(legend, legend);
+        this.callLegendChanged(e);
+    }
+
+    public boolean symbolChanged(SymbolLegendEvent e) {
+        LegendChangedEvent ev =
+            LegendChangedEvent.createLegendChangedEvent(legend, legend);
+        this.callLegendChanged(ev);
+        return true;
+    }
+
+    public void update(Observable observable, Object notification) {
+        if (observable.equals(this.featureStore)) {
+            if (notification instanceof FeatureStoreNotification) {
+                FeatureStoreNotification event =
+                    (FeatureStoreNotification) notification;
+                if (event.getType() == FeatureStoreNotification.AFTER_CANCELEDITING
+                    || event.getType() == FeatureStoreNotification.AFTER_DELETE
+                    || event.getType() == FeatureStoreNotification.AFTER_UNDO
+                    || event.getType() == FeatureStoreNotification.AFTER_REDO
+                    || event.getType() == FeatureStoreNotification.AFTER_REFRESH
+                    || event.getType() == FeatureStoreNotification.AFTER_UPDATE
+                    || event.getType() == FeatureStoreNotification.AFTER_UPDATE_TYPE
+                    || event.getType() == FeatureStoreNotification.SELECTION_CHANGE
+                    || event.getType() == FeatureStoreNotification.AFTER_INSERT) {
+                    this.updateDrawVersion();
+
+                } else if (event.getType() == FeatureStoreNotification.TRANSFORM_CHANGE){
+                    //If a transform has to be applied, try to reload the layer.
+                    try {
+                        reload();
+                    } catch (ReloadLayerException e) {
+                        this.setAvailable(false);
+                    }
+                } else if (event.getType() == FeatureStoreNotification.RESOURCE_CHANGED) {
+                    this.setAvailable(false);
+                } else 	if (event.getType() == FeatureStoreNotification.AFTER_FINISHEDITING) {
+                    this.setAvailable(true);
+                }
+            }
+        }
+        // Only if its an event from our own legend
+        else
+            // I comment this line because a legend doesn't implements the
+            // Observable interface.
+            // This code is necessary on edition.
+            // if (observable == getLegend()) {
+            if (notification instanceof FeatureDrawnNotification) {
+                Geometry geometry =
+                    ((FeatureDrawnNotification) notification).getDrawnGeometry();
+                spatialCache.insert(geometry.getEnvelope(), geometry);
+                // }
+            }
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+     */
+    public Set getMetadataChildren() {
+        Set ret = new TreeSet();
+        ret.add(this.featureStore);
+        return ret;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.gvsig.metadata.Metadata#getMetadataID()
+     */
+    public Object getMetadataID() throws MetadataException {
+        return "Layer(" + this.getName() + "):"
+        + this.featureStore.getMetadataID();
+    }
+
+
+
+    public GeometryType getTypeVectorLayer() throws DataException,
+    LocatorException,
+    GeometryTypeNotSupportedException,
+    GeometryTypeNotValidException {
+        // FIXME Esto deberia de pedirse a FType!!!!
+        FeatureStore fs = this.getFeatureStore();
+        FeatureType fType = fs.getDefaultFeatureType();
+        FeatureAttributeDescriptor attr =
+            fType.getAttributeDescriptor(fType.getDefaultGeometryAttributeIndex());
+        GeometryType geomType =
+            GeometryLocator.getGeometryManager()
+            .getGeometryType(attr.getGeometryType(),
+                attr.getGeometrySubType());
+        return geomType;
+    }
+
+    public static void registerPersistent() {
+        PersistenceManager manager = ToolsLocator.getPersistenceManager();
+        if (manager.getDefinition(FLyrDefault.class) == null) {
+            FLyrDefault.registerPersistent();
+        }
+        DynStruct definition =
+            manager.addDefinition(FLyrVect.class,
+                "FLyrVect",
+                "FLyrVect Persistence definition",
+                null,
+                null);
+        definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE,
+        "FLyrDefault");
+
+        definition.addDynFieldObject("legend")
+        .setClassOfValue(IVectorLegend.class)
+        .setMandatory(true);
+        definition.addDynFieldObject("featureStore")
+        .setClassOfValue(FeatureStore.class)
+        .setMandatory(true);
+        definition.addDynFieldBoolean("isLabeled").setMandatory(true);
+        definition.addDynFieldInt("typeShape").setMandatory(true);
+        definition.addDynFieldObject("labelingStrategy")
+        .setClassOfValue(ILabelingStrategy.class)
+        .setMandatory(false);
+
+    }
+
+    protected void doDispose() throws BaseException {
+        dispose(featureStore);
+        spatialCache.clearAll();
+    }
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/VectorLayer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/VectorLayer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/VectorLayer.java	(revision 36112)
@@ -0,0 +1,13 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
+import org.gvsig.fmap.mapcontext.layers.operations.InfoByPoint;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable;
+
+public interface VectorLayer  extends SingleLayer, ILabelable, InfoByPoint,
+ClassifiableVectorial  {
+
+	FeatureStore getFeatureStore();
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsEnvelopeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsEnvelopeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ContainsEnvelopeEvaluator.java	(revision 36112)
@@ -0,0 +1,86 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class ContainsEnvelopeEvaluator extends AbstractEvaluator {
+
+	private Envelope envelope;
+	private String geomName;
+	private Envelope envelopeTrans;
+	private boolean isDefault;
+	private String srs;
+	private String envelopeWKT;
+
+	public ContainsEnvelopeEvaluator(Envelope envelope,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.envelope = envelope;
+		// this.srs = envelopeProjection.getAbrev();
+		// this.projection=CRSFactory.getCRS(fad.getSRS());
+		// this.envelopeProjection=envelopeProjection;
+//		ICoordTrans ct = null;
+//		if (!this.srs.equals(fad.getSRS())) { // FIXME comparaci�n
+//			ct = envelopeProjection.getCT(fad.getSRS());
+//		}
+//		if (ct != null) {
+//			this.envelopeTrans = envelope.convert(ct);
+//		} else {
+			this.envelopeTrans = envelope;
+//		}
+		this.geomName = geomName;
+		this.srs = envelopeProjection.getAbrev();
+		this.getFieldsInfo().addMatchFieldValue(geomName, envelopeTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		Envelope featureEnvelope;
+		if (isDefault) {
+			featureEnvelope = ((Feature) data.getContextValue("feature"))
+					.getDefaultEnvelope();
+
+		} else {
+			featureEnvelope = ((Geometry) data.getDataValue(geomName))
+					.getEnvelope();
+		}
+		return new Boolean(envelopeTrans.contains(featureEnvelope));
+	}
+
+	public String getName() {
+		return "contains in envelope";
+	}
+
+	public String getSQL() {
+		if (envelopeWKT == null) {
+			try {
+				envelopeWKT = (String) envelope.getGeometry().invokeOperation(
+						ToWKT.CODE, null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+		return " contains(GeomFromText('" + envelopeWKT + "', '" + srs
+				+ "'), envelope(" + geomName + ")) ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/WithinGeometryEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/WithinGeometryEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/WithinGeometryEvaluator.java	(revision 36112)
@@ -0,0 +1,76 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.relationship.DefaultRelationshipGeometryOperationContext;
+import org.gvsig.fmap.geom.operation.relationship.Within;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+/**
+ *
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class WithinGeometryEvaluator extends AbstractEvaluator {
+
+	private String geomName;
+	private Geometry geometry;
+	private Geometry geometryTrans;
+	private String srs;
+	private boolean isDefault;
+
+	public WithinGeometryEvaluator(Geometry geometry,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.geometry = geometry;
+		this.geometryTrans = geometry.cloneGeometry();
+		this.srs = envelopeProjection.getAbrev();
+		ICoordTrans ct = envelopeProjection.getCT(fad.getSRS());
+		if (ct != null) {
+			geometryTrans.reProject(ct);
+		}
+		this.geomName = geomName;
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		try {
+			DefaultRelationshipGeometryOperationContext context;
+			if (isDefault) {
+				Feature feature = (Feature) data.getContextValue("feature");
+				context =new DefaultRelationshipGeometryOperationContext(feature
+						.getDefaultGeometry());
+
+			} else {
+				Geometry geom = (Geometry) data.getDataValue(geomName);
+
+				context = new DefaultRelationshipGeometryOperationContext(geom);
+			}
+			return geometryTrans.invokeOperation(Within.CODE, context);
+
+		} catch (Exception e) {
+			throw new EvaluatorException(e);
+		}
+	}
+
+	public String getName() {
+		return "within with geometry";
+	}
+
+	public String getSQL() {
+		return " within(GeomFromText('" + geometry.toString() + "', " + "'"
+				+ srs + "'" + "), " + geomName + ") ";
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java	(revision 36112)
@@ -0,0 +1,90 @@
+package org.gvsig.fmap.mapcontext.layers.vectorial;
+
+import org.cresques.cts.IProjection;
+
+import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.operation.GeometryOperationException;
+import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
+import org.gvsig.fmap.geom.operation.towkt.ToWKT;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.tools.evaluator.AbstractEvaluator;
+import org.gvsig.tools.evaluator.EvaluatorData;
+import org.gvsig.tools.evaluator.EvaluatorException;
+
+public class IntersectsEnvelopeEvaluator extends AbstractEvaluator {
+
+	private Envelope envelope;
+	private String geomName;
+	private String envelopeWKT = null;
+	private Envelope envelopeTrans;
+	private boolean isDefault;
+	private String srs;
+
+	public IntersectsEnvelopeEvaluator(Envelope envelope,
+			IProjection envelopeProjection, FeatureType featureType,
+			String geomName) {
+		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+				.get(geomName);
+
+		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+				geomName);
+		this.envelope = envelope;
+		// this.srs = envelopeProjection.getAbrev();
+		// this.projection=CRSFactory.getCRS(fad.getSRS());
+		// this.envelopeProjection=envelopeProjection;
+//		ICoordTrans ct = null;
+//		if (!this.srs.equals(fad.getSRS())) { // FIXME comparaci�n
+//			ct = envelopeProjection.getCT(fad.getSRS());
+//		}
+//		if (ct != null) {
+//			this.envelopeTrans = envelope.convert(ct);
+//		} else {
+			this.envelopeTrans = envelope;
+//		}
+		this.geomName = geomName;
+
+		this.srs = envelopeProjection.getAbrev();
+
+		this.getFieldsInfo().addMatchFieldValue(geomName, envelopeTrans);
+
+	}
+
+	public Object evaluate(EvaluatorData data) throws EvaluatorException {
+		Envelope featureEnvelope;
+		if (isDefault) {
+			featureEnvelope = ((Feature) data.getContextValue("feature"))
+					.getDefaultEnvelope();
+		} else {
+			featureEnvelope = ((Geometry) data.getDataValue(geomName)).getEnvelope();
+		}
+		return new Boolean(envelopeTrans.intersects(featureEnvelope));
+
+	}
+
+	public String getName() {
+		return "intersets in envelope";
+	}
+
+	public String getSQL() {
+
+
+		if (envelopeWKT == null) {
+			try {
+				envelopeWKT = (String) envelope.getGeometry().invokeOperation(
+						ToWKT.CODE, null);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			} catch (GeometryOperationException e) {
+				throw new DataEvaluatorRuntimeException(e);
+			}
+		}
+
+		return " intersects(GeomFromText('" + envelopeWKT + "', '" + srs
+				+ "'), envelope(" + geomName + ")) ";
+	}
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LinkSelectionListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LinkSelectionListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LinkSelectionListener.java	(revision 36112)
@@ -0,0 +1,130 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+
+/**
+ * Listener que est� pendiente de la selecci�n que se haga sobre la tabla para
+ * poder seleccionar de la tabla linkada los registros oportunos.
+ *
+ * @author Vicente Caballero Navarro
+ * @deprecated TODO Esto tendr�a que estar en appgvSIG en las tablas
+ */
+public class LinkSelectionListener implements SelectionListener {
+//	private SelectableDataSource modelo1;
+//	private SelectableDataSource modelo2;
+	private int index1;
+	private int index2;
+
+	/**
+	 * Crea un nuevo LinkSelectionListener. Donde se pasan como par�metros dos
+	 * SelectableDataSource, el primero de ellos(model1), representa la tabla
+	 * sobre la que al seleccionar alg�n registro buscaremos en el modelo2
+	 * para ver el valor del campo s1 y compararlo con el valor del campo s2 y
+	 * de esta forma seleccionar instantanemente los registros oportunos en la
+	 * tabla al que se representa con el modelo2.
+	 *
+	 * @param model1 SelectableDataSource de la tabla sobre la que se efectua
+	 * 		  el link.
+	 * @param model2 SelectableDataSource de la tabla linkada.
+	 * @param s1 nombre del campo de la tabla donde se efectua el link.
+	 * @param s2 nombre del campo de la tabla linkada.
+	 */
+//	public LinkSelectionListener(SelectableDataSource model1,
+//		SelectableDataSource model2, String s1, String s2) {
+//		modelo1 = model1;
+//		modelo2 = model2;
+//
+//		try {
+//			index1 = modelo1.getFieldIndexByName(s1);
+//			index2 = modelo2.getFieldIndexByName(s2);
+//		} catch (ReadDriverException e) {
+//			e.printStackTrace();
+//		}
+//
+//		//field1 = s1;
+//		//field2 = s2;
+//	}
+
+	/**
+	 * @see com.iver.cit.gvsig.fmap.layers.LegendListener#selectionChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void selectionChanged(SelectionEvent e) {
+//		FBitSet bs1 = modelo1.getSelection();
+//		FBitSet bs2 = new FBitSet(); //(FBitSet)modelo2.getSelection().clone();
+//		HashMap idx = new HashMap(bs1.cardinality());
+//		//int index1 = -1;
+//		//int index2 = -1;
+//
+//		try {
+//			//		Construimos el �ndice
+//			for (int i = bs1.nextSetBit(0); i >= 0;
+//					i = bs1.nextSetBit(i + 1)) {
+//				Value v = modelo1.getFieldValue((long) i, index1);
+//
+//				if (idx.get(v) == null) {
+//					idx.put(v, new Integer(i));
+//				}
+//			}
+//		} catch (ReadDriverException e2) {
+//			e2.printStackTrace();
+//		}
+//
+//		try {
+//			for (int i = 0; i < modelo2.getRowCount(); i++) {
+//				Value v = modelo2.getFieldValue(i, index2);
+//				Integer pi = (Integer) idx.get(v);
+//
+//				if (pi != null) {
+//					bs2.set(i);
+//				}
+//			}
+//		} catch (ReadDriverException e1) {
+//			e1.printStackTrace();
+//		}
+//
+//		// this applies the selection to the linked table
+//		if (modelo1!=modelo2)
+//			modelo2.setSelection(bs2);
+//		//modelo2.fireSelectionEvents();
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayersIterator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayersIterator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayersIterator.java	(revision 36112)
@@ -0,0 +1,87 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
+
+
+/**
+ * Interator for iterate in a Layers tree
+ * <P>
+ * Extend this class to create an expecific layer iterator
+ * and override the method <code>evaluate</code> for check
+ * if a layer will be in the iteration list.
+ * <P> 
+ * @author jmvivo
+ *
+ */
+public class LayersIterator implements Iterator {
+	ArrayList layersList  =new ArrayList();
+	int index = 0;
+	
+	public LayersIterator() {
+		
+	}
+	
+	public LayersIterator(FLayer layer) {
+		this.appendLayer(layer);
+	}
+	
+	protected void appendLayer(FLayer layer) {
+		if (this.evaluate(layer)) {
+			layersList.add(layer);
+		}
+		if (layer instanceof LayerCollection) {
+			appendLayers((LayerCollection)layer);			
+		}
+	}
+	
+	private void appendLayers(LayerCollection layers) {
+		int i;
+		for (i=0;i< layers.getLayersCount();i++) {
+			appendLayer(layers.getLayer(i));
+		}
+	}
+
+	public void remove() {
+		throw new UnsupportedOperationException();		
+	}
+
+	public boolean hasNext() {
+		return  index < layersList.size();
+	}
+
+	public Object next() {		
+		return nextLayer();
+	}
+	
+    /**
+     * Returns the next layer in the iteration.
+     *
+     * @return the next layer in the iteration.
+     * @exception NoSuchElementException iteration has no more elements.
+     * 
+     * @see next()
+     */
+	public FLayer nextLayer() {
+		if (!this.hasNext()) {
+			throw new NoSuchElementException();
+		}
+		FLayer aux = (FLayer)layersList.get(index);
+		index++;
+		return aux;
+	}
+	
+	/**
+	 * Called before add a layer to the iteration
+	 * list.	 
+	 * @param layer the layer to check
+	 * @return true if the layer will be in the iteration list
+	 */
+	public boolean evaluate(FLayer layer) {
+		return true;
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerEvent.java	(revision 36112)
@@ -0,0 +1,189 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+
+
+/**
+ * <p>Event produced when changes the visibility, activation, edition status, or the name of a layer.</p>
+ *
+ * @author Fernando Gonz�lez Cort�s
+ */
+public class LayerEvent extends FMapEvent {
+	/**
+	 * <p>String that identifies the property that has changed.</p>
+	 */
+	private String property;
+
+	/**
+	 * <p>Layer affected by the action.</p>
+	 */
+	private FLayer source;
+
+	/**
+	 * <p>Identifies this event as a action of change of the visibility status of a layer.</p>
+	 */
+	public static final int VISIBILITY_CHANGED = 0;
+
+	/**
+	 * <p>Identifies this event as a action of change of the activation status of a layer.</p>
+	 */
+	public static final int ACTIVATION_CHANGED = 1;
+	
+	/**
+	 * <p>Identifies this event as a action of a change of the name of a layer.</p>
+	 */
+	public static final int NAME_CHANGED = 2;
+	
+	/**
+	 * <p>Identifies this event as a action of change of the edition status of a layer.</p>
+	 */
+	public static final int EDITION_CHANGED = 3;
+
+	/**
+	 * <p>Identifies this event as a action of change of any property that affects to draw of the layer.</p>
+	 */
+	public static final int DRAW_VALUES_CHANGED = 4;
+
+	/**
+	 * <p>Creates a new layer event notifying a "visibility changed" action.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */
+	public static LayerEvent createVisibilityChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, VISIBILITY_CHANGED);
+	}
+
+	/**
+	 * <p>Creates a new layer event notifying an "activation changed" action.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */
+	public static LayerEvent createActivationChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, ACTIVATION_CHANGED);
+	}
+	
+	public static LayerEvent createDrawValuesChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, DRAW_VALUES_CHANGED);
+	}
+
+	/**
+	 * <p>Creates a new layer event notifying an action of "change of the name of a layer".</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */	
+	public static LayerEvent createNameChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, NAME_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new layer event notifying an "edition changed" action.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * 
+	 * @return a new layer event
+	 */
+	public static LayerEvent createEditionChangedEvent(FLyrDefault default1, String property){
+		return new LayerEvent(default1, property, EDITION_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new layer event of the specified type.</p>
+	 * 
+	 * @param default1 layer affected by the action
+	 * @param property property that has changed
+	 * @param eventType type of layer collection event
+	 * 
+	 * @return a new layer collection event
+	 */
+	private LayerEvent(FLayer default1, String property, int eventType) {
+		source = default1;
+		this.property = property;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the layer affected.</p>
+	 *
+	 * @return the layer affected
+	 */
+	public FLayer getSource() {
+		return source;
+	}
+
+	/**
+	 * <p>Sets the layer affected.</p>
+	 *
+	 * @param the layer affected
+	 */
+	public void setSource(FLayer source) {
+		this.source = source;
+	}
+
+	/**
+	 * <p>Gets the property that has changed.</p>
+	 *
+	 * @return the property that has changed
+	 */
+	public String getProperty() {
+		return property;
+	}
+
+	/**
+	 * <p>Sets the property that has changed.</p>
+	 *
+	 * @param the property that has changed
+	 */
+	public void setProperty(String property) {
+		this.property = property;
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerChangeSupport.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerChangeSupport.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerChangeSupport.java	(revision 36112)
@@ -0,0 +1,92 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+
+
+
+/**
+ * <p>Manages all legend listeners of a layer, notifying them any legend change event produced.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class LayerChangeSupport {
+	/**
+	 * <p>The legend listeners of a layer.</p>
+	 */
+	private ArrayList listeners = new ArrayList();
+
+	/**
+	 * <p>Registers a <code>LegendListener</code>.</p>
+	 * 
+	 * @param listener the legend listener
+	 */
+	public void addLayerListener(LegendListener listener) {
+		listeners.add(listener);
+	}
+
+	/**
+	 * <p>Removes a registered <code>LegendListener</code>.</p>
+	 *
+	 * @param listener the legend listener
+	 */
+	public void removeLayerListener(LegendListener listener) {
+		listeners.remove(listener);
+	}
+
+	/**
+	 * <p>Notifies a legend change to all legend listeners registered.</p>
+	 *
+	 * @param e a legend event with the new legend and events that compound this one
+	 */
+	public void callLegendChanged(LegendChangedEvent e) {
+		for (Iterator iter = listeners.iterator(); iter.hasNext();) {
+			LegendListener listener = (LegendListener) iter.next();
+
+			listener.legendChanged(e);
+		}
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SpatialCache.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SpatialCache.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SpatialCache.java	(revision 36112)
@@ -0,0 +1,87 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.List;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.util.Converter;
+
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.index.ItemVisitor;
+import com.vividsolutions.jts.index.quadtree.Quadtree;
+
+public class SpatialCache  {
+	int maxFeatures = 1000; // Por defecto, pero se puede cambiar
+	int fastNumTotalRegs=0;
+	Quadtree quadTree = new Quadtree();
+	
+	private boolean enabled = false;
+
+	public int getMaxFeatures() {
+		return maxFeatures;
+	}
+
+	public void setMaxFeatures(int maxFeatures) {
+		this.maxFeatures = maxFeatures;
+	}
+
+	/**
+	 * M�todo de conveniencia
+	 *
+	 * @param r
+	 * @param igeometry
+	 */
+	public synchronized void insert(org.gvsig.fmap.geom.primitive.Envelope bounds, Geometry geom) {
+		if (isEnabled() && getMaxFeatures() >= size()) {
+			Envelope env = Converter.convertEnvelopeToJTS(bounds);
+			this.insert(env, geom);
+			//fastNumTotalRegs++;
+		}
+	}
+
+	public synchronized void query(Envelope searchEnv, ItemVisitor visitor)
+	{
+		quadTree.query(searchEnv, visitor);
+	}
+	public synchronized List query(Envelope searchEnv)
+	{
+		return quadTree.query(searchEnv);
+	}
+
+	public void insert(Envelope itemEnv, Object item) {
+		if (isEnabled() && getMaxFeatures() >= size()) {
+			quadTree.insert(itemEnv, item);
+			fastNumTotalRegs++;
+		}
+	}
+
+	public boolean remove(Envelope itemEnv, Object item) {
+		boolean resul = quadTree.remove(itemEnv, item);
+		if (resul)
+			fastNumTotalRegs--;
+		return resul;
+	}
+
+	public int size() {
+		return fastNumTotalRegs;
+	}
+
+	public void clearAll() {
+		quadTree = new Quadtree();
+		fastNumTotalRegs = 0;
+	}
+
+	public void remove(org.gvsig.fmap.geom.primitive.Envelope bounds, Geometry geom) {
+		Envelope env = Converter.convertEnvelopeToJTS(bounds);
+		this.remove(env,geom);
+	}
+
+	public boolean isEnabled() {
+		return enabled;
+	}
+
+	public void setEnabled(boolean enabled) {
+		this.enabled = enabled;
+	}
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java	(revision 36112)
@@ -0,0 +1,1037 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Image;
+import java.awt.geom.Point2D;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DataTypes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+import org.gvsig.metadata.MetadataContainer;
+import org.gvsig.metadata.MetadataLocator;
+import org.gvsig.metadata.MetadataManager;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DynClass;
+import org.gvsig.tools.dynobject.DynObject;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.slf4j.LoggerFactory;
+
+
+
+/**
+ * <p>Implementation of the common characteristics of all layers: visibility, activation, name, ...</p>
+ *
+ * <p>Represents the definition of a basic layer, implementing {@link FLayer FLayer}, and new functionality:
+ * <ul>
+ *  <li>Supports transparency.
+ *  <li>Notification of evens produced using this layer.
+ *  <li>Can have internal virtual layers.
+ *  <li>Can have a text layer.
+ *  <li>Supports an strategy for visit its geometries.
+ *  <li>Can have an image in the <i>TOC (table of contents)</i> associated to the state of this layer.
+ * </ul>
+ * </p>
+ *
+ * <p>Each graphical layer will inherit from this class and adapt to its particular logic and model according
+ *  its nature.</p>
+ *
+ * @see FLayer
+ * @see FLayerStatus
+ */
+public abstract class FLyrDefault extends AbstractDisposable implements FLayer,
+		LayerListener {
+	/**
+	 * Useful for debug the problems during the implementation.
+	 */
+	final static private org.slf4j.Logger logger = LoggerFactory.getLogger(FLyrDefault.class);
+
+	private LayerChangeSupport layerChangeSupport = new LayerChangeSupport();
+
+	/**
+	 * Path to the upper layer which this layer belongs.
+	 *
+	 * @see #getParentLayer()
+	 * @see #setParentLayer(FLayers)
+	 */
+	private FLayers parentLayer = null;
+
+	/**
+	 * Transparency level of this layer in the range 0-255. By default 255.
+	 * 0   --> Transparent
+	 * 255 --> Opaque
+	 *
+	 * @see #getTransparency()
+	 * @see #setTransparency(int)
+	 */
+	private int transparency = 255;
+
+	/**
+	 * Coordinate transformation.
+	 *
+	 * @see #getCoordTrans()
+	 * @see #setCoordTrans(ICoordTrans)
+	 */
+	private ICoordTrans ct;
+
+	/**
+	 * Minimum scale, >= 0 or -1 if not defined. By default -1.
+	 *
+	 * @see #getMinScale()
+	 * @see #setMinScale(double)
+	 */
+	private double minScale = -1; // -1 indica que no se usa
+
+	/**
+	 * Maximum scale, >= 0 or -1 if not defined. By default -1.
+	 *
+	 * @see #getMaxScale()
+	 * @see #setMaxScale(double)
+	 */
+	private double maxScale = -1;
+	//	private boolean isInTOC = true;
+
+	/**
+	 * Array list with all listeners registered to this layer.
+	 *
+	 * @see #getLayerListeners()
+	 * @see #removeLayerListener(LayerListener)
+	 * @see #callEditionChanged(LayerEvent)
+	 */
+	protected ArrayList layerListeners = new ArrayList();
+
+
+	/**
+	 * Hash table with the extended properties of this layer.
+	 *
+	 * @see #getProperty(Object)
+	 * @see #setProperty(Object, Object)
+	 * @see #getExtendedProperties()
+	 */
+	private Map properties = new Hashtable();
+
+	//by default, all is active, visible and avalaible
+	/**
+	 * Status of this layer.
+	 *
+	 * @see #getFLayerStatus()
+	 * @see #setFLayerStatus(FLayerStatus)
+	 * @see #isActive()
+	 * @see #setActive(boolean)
+	 * @see #isVisible()
+	 * @see #setVisible(boolean)
+	 * @see #visibleRequired()
+	 * @see #isEditing()
+	 * @see #setEditing(boolean)
+	 * @see #isInTOC()
+	 * @see #isCachingDrawnLayers()
+	 * @see #setCachingDrawnLayers(boolean)
+	 * @see #isDirty()
+	 * @see #setDirty(boolean)
+	 * @see #isAvailable()
+	 * @see #setAvailable(boolean)
+	 * @see #isOk()
+	 * @see #isWritable()
+	 * @see #getNumErrors()
+	 * @see #getError(int)
+	 * @see #getErrors()
+	 * @see #addError(BaseException)
+	 */
+	private FLayerStatus status = new FLayerStatus();
+	/**
+	 * Image drawn shown in the TOC according the status of this layer.
+	 *
+	 * @see #getTocStatusImage()
+	 * @see #setTocStatusImage(Image)
+	 */
+	private Image tocStatusImage;
+
+	protected MetadataContainer metadataContainer;
+
+	/**
+	 * Draw version of the context. It's used for know when de componend has
+	 * changed any visualization property
+	 *
+	 *  @see getDrawVersion
+	 *  @see updateDrawVersion
+	 */
+	private long drawVersion= 0L;
+
+	public FLyrDefault(MetadataContainer metadataContainer) {
+		this.metadataContainer = metadataContainer;
+	}
+
+	public FLyrDefault() {
+		this(MetadataLocator
+			.getMetadataManager()
+				.createMetadataContainer(FLayer.METADATA_DEFINITION_NAME)
+		);
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getProperty(java.lang.Object)
+	 */
+	public Object getProperty(Object key) {
+		return properties.get(key);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setProperty(java.lang.Object, java.lang.Object)
+	 */
+	public void setProperty(Object key, Object val) {
+		properties.put(key, val);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getExtendedProperties()
+	 */
+	public Map getExtendedProperties() {
+		return properties;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setActive(boolean)
+	 */
+	public void setActive(boolean selected) {
+		status.active = selected;
+		callActivationChanged(LayerEvent.createActivationChangedEvent(this,
+		"active"));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isActive()
+	 */
+	public boolean isActive() {
+		return status.active;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setName(java.lang.String)
+	 */
+	public void setName(String name) {
+		this.metadataContainer.setDynValue(METADATA_NAME, name);
+		callNameChanged(LayerEvent.createNameChangedEvent(this, "name"));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getName()
+	 */
+	public String getName() {
+		return (String) this.metadataContainer.getDynValue(METADATA_NAME);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#load()
+	 */
+	public void load() throws LoadLayerException {
+	    MetadataManager manager = MetadataLocator.getMetadataManager();
+	    try {
+            manager.loadMetadata(this);
+        } catch (MetadataException e) {
+            throw new LoadLayerException("Can't load metadata." , e );
+        }
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setVisible(boolean)
+	 */
+	public void setVisible(boolean visibility) {
+		if (status.visible != visibility){
+			status.visible = visibility;
+			this.updateDrawVersion();
+
+			//			if (this.getMapContext() != null){
+			//				this.getMapContext().clearAllCachingImageDrawnLayers();
+			//			}
+			callVisibilityChanged(LayerEvent.createVisibilityChangedEvent(this,
+			"visible"));
+		}
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isVisible()
+	 */
+	public boolean isVisible() {
+		return status.visible && status.available;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getParentLayer()
+	 */
+	public FLayers getParentLayer() {
+		return parentLayer;
+	}
+
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setParentLayer(com.iver.cit.gvsig.fmap.layers.FLayers)
+	 */
+	public void setParentLayer(FLayers root) {
+		if (this.parentLayer != root){
+			this.parentLayer = root;
+			this.updateDrawVersion();
+		}
+	}
+
+	/**
+	 * <p>Inserts the projection to this layer.</p>
+	 *
+	 * @param proj information about the new projection
+	 *
+	 * @see #isReprojectable()
+	 * @see #reProject(MapControl)
+	 */
+	public void setProjection(IProjection proj) {
+		IProjection curProj = this.getProjection();
+		if (curProj == proj) {
+			return;
+		}
+		if (curProj != null && curProj.equals(proj)){
+			return;
+		}
+		this.updateDrawVersion();
+		this.metadataContainer.setDynValue(METADATA_CRS, proj);
+		// Comprobar que la proyecci�n es la misma que la de FMap
+		// Si no lo es, es una capa que est� reproyectada al vuelo
+		if ((proj != null) && (getMapContext() != null)) {
+			if (proj != getMapContext().getProjection()) {
+				ICoordTrans ct = proj.getCT(getMapContext().getProjection());
+				setCoordTrans(ct);
+				logger.debug("Cambio proyecci�n: FMap con "
+						+ getMapContext().getProjection().getAbrev() + " y capa "
+						+ getName() + " con " + proj.getAbrev());
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.cresques.geo.Projected#getProjection()
+	 */
+	public IProjection getProjection() {
+		return (IProjection) this.metadataContainer.getDynValue(METADATA_CRS);
+	}
+
+	/**
+	 * <p>Changes the projection of this layer.</p>
+	 * <p>This method will be overloaded in each kind of layer, according its specific nature.</p>
+	 *
+	 * @param mapC <code>MapControl</code> instance that will reproject this layer
+	 *
+	 * @return <code>true<code> if the layer has been created calling {@link FLayers#addLayer(FLayer) FLayers#addLayer}. But returns <code>false</code>
+	 *  if the load control logic of this layer is in the reprojection method
+	 *
+	 * @see #isReprojectable()
+	 * @see #setProjection(IProjection)
+	 */
+	public void reProject(ICoordTrans arg0) {
+	}
+
+	/**
+	 * Returns the transparency level of this layer, in the range 0-255 .
+	 *
+	 * @return the transparency level
+	 *
+	 * @see #setTransparency(int)
+	 */
+	public int getTransparency() {
+		return transparency;
+	}
+
+	/**
+	 * Inserts the transparency level for this layer, the range allowed is 0-255 .
+	 *
+	 * @param trans the transparency level
+	 *
+	 * @see #getTransparency()
+	 */
+	public void setTransparency(int trans) {
+		if (this.transparency != trans){
+			transparency = trans;
+			this.updateDrawVersion();
+		}
+	}
+	
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMapContext()
+	 */
+	public MapContext getMapContext() {
+		if (getParentLayer() != null) {
+			return getParentLayer().getMapContext();
+		} else {
+			return null;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#addLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
+	 */
+	public boolean addLayerListener(LayerListener o) {
+		if (layerListeners.contains(o)) {
+			return false;
+		}
+		return layerListeners.add(o);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getLayerListeners()
+	 */
+	public LayerListener[] getLayerListeners() {
+		return (LayerListener[])layerListeners.toArray(new LayerListener[0]);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#removeLayerListener(com.iver.cit.gvsig.fmap.layers.LayerListener)
+	 */
+	public boolean removeLayerListener(LayerListener o) {
+		return layerListeners.remove(o);
+	}
+	/**
+	 *
+	 */
+	private void callDrawValueChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.drawValueChanged(e);
+		}
+	}
+	/**
+	 * Called by the method {@linkplain #setName(String)}. Notifies all listeners associated to this layer,
+	 *  that its name has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setName(String)
+	 */
+	private void callNameChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.nameChanged(e);
+		}
+	}
+
+	/**
+	 * Called by the method {@linkplain #setVisible(boolean)}. Notifies all listeners associated to this layer,
+	 *  that its visibility has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setVisible(boolean)
+	 */
+	private void callVisibilityChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.visibilityChanged(e);
+		}
+	}
+
+	/**
+	 * Called by the method {@linkplain #setActive(boolean)}. Notifies all listeners associated to this layer,
+	 *  that its active state has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setActive(boolean)
+	 */
+	private void callActivationChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.activationChanged(e);
+		}
+	}
+
+	/**
+	 * Returns the virtual layers associated to this layer.
+	 *
+	 * @return a node with the layers
+	 *
+	 * @see #setVirtualLayers(FLayers)
+	 */
+	//	public FLayers getVirtualLayers() {
+	//		return virtualLayers;
+	//	}
+
+	/**
+	 * Inserts virtual layers to this layer.
+	 *
+	 * @param virtualLayers a node with the layers
+	 *
+	 * @see #getVirtualLayers()
+	 */
+	//	public void setVirtualLayers(FLayers virtualLayers) {
+	//		this.virtualLayers = virtualLayers;
+	//	}
+
+	/**
+	 * Sets transformation coordinates for this layer.
+	 *
+	 * @param ct an object that implements the <code>ICoordTrans</code> interface, and with the transformation coordinates
+	 *
+	 * @see #getCoordTrans()
+	 */
+	public void setCoordTrans(ICoordTrans ct) {
+		if (this.ct == ct){
+			return;
+		}
+		if (this.ct != null && this.ct.equals(ct)){
+			return;
+		}
+		this.ct = ct;
+		this.updateDrawVersion();
+	}
+
+	/**
+	 * Returns the transformation coordinates of this layer.
+	 *
+	 * @return an object that implements the <code>ICoordTrans</code> interface, and with the transformation coordinates
+	 *
+	 * @see #setCoordTrans(ICoordTrans)
+	 */
+	public ICoordTrans getCoordTrans() {
+		return ct;
+	}
+
+	/**
+	 * <p>Method called by {@link FLayers FLayers} to notify this layer that is going to be added.
+	 *  This previous notification is useful for the layers that need do something before being added. For
+	 *  example, the raster needs reopen a file that could have been closed recently.</p>
+	 */
+	public void wakeUp() throws LoadLayerException {
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMinScale()
+	 */
+	public double getMinScale() {
+		return minScale;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getMaxScale()
+	 */
+	public double getMaxScale() {
+		return maxScale;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setMinScale(double)
+	 */
+	public void setMinScale(double minScale) {
+		if (this.minScale != minScale){
+			this.minScale = minScale;
+			this.updateDrawVersion();
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setMaxScale(double)
+	 */
+	public void setMaxScale(double maxScale) {
+		if (this.maxScale != maxScale){
+			this.maxScale = maxScale;
+			this.updateDrawVersion();
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isWithinScale(double)
+	 */
+	public boolean isWithinScale(double scale) {
+
+		boolean bVisible = true;
+		if (getMinScale() != -1) {
+			if (scale < getMinScale()){
+				bVisible = false;
+			}
+		}
+		if (getMaxScale() != -1) {
+			if (scale > getMaxScale()) {
+				bVisible = false;
+			}
+		}
+
+		return bVisible;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setEditing(boolean)
+	 */
+	public void setEditing(boolean b) throws StartEditionLayerException {
+		status.editing = b;
+	}
+	/**
+	 * Called by some version of the method {@linkplain #setEditing(boolean)} overwritten. Notifies
+	 *  all listeners associated to this layer, that its edition state has changed.
+	 *
+	 * @param e a layer event with the name of the property that has changed
+	 *
+	 * @see #setEditing(boolean)
+	 */
+	protected void callEditionChanged(LayerEvent e) {
+		for (Iterator iter = layerListeners.iterator(); iter.hasNext();) {
+			LayerListener listener = (LayerListener) iter.next();
+
+			listener.editionChanged(e);
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isEditing()
+	 */
+	public boolean isEditing() {
+		return status.editing;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getTocImageIcon()
+	 */
+	public String getTocImageIcon() {
+		return "toc-layer-group";
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isInTOC()
+	 */
+	public boolean isInTOC() {
+		return status.inTOC;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setInTOC(boolean)
+	 */
+	public void setInTOC(boolean b) {
+		status.inTOC=b;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isAvailable()
+	 */
+	public boolean isAvailable() {
+		return status.available;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setAvailable(boolean)
+	 */
+	public void setAvailable(boolean available) {
+		if (status.available != available){
+			status.available = available;
+			this.updateDrawVersion();
+		}
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#reload()
+	 */
+	public void reload() throws ReloadLayerException {
+		this.setAvailable(true);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFLayerStatus()
+	 */
+	public FLayerStatus getFLayerStatus(){
+		return status.cloneStatus();
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setFLayerStatus(com.iver.cit.gvsig.fmap.layers.FLayerStatus)
+	 */
+	public void setFLayerStatus(FLayerStatus status){
+		if (!this.status.equals(status)){
+			this.status = status;
+			this.updateDrawVersion();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isOk()
+	 */
+
+	public boolean isOk(){
+		return status.isOk();
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getNumErrors()
+	 */
+	public int getNumErrors(){
+		return status.getNumErrors();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getError(int)
+	 */
+	public BaseException getError(int i){
+		return status.getError(i);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getErrors()
+	 */
+	public List getErrors(){
+		return status.getErrors();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 *
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#addError(BaseException)
+	 */
+	public void addError(BaseException exception){
+		status.addLayerError(exception);
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#visibleRequired()
+	 */
+	public boolean visibleRequired() {
+		return status.visible;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getInfoString()
+	 */
+	public String getInfoString() {
+		return null;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#isWritable()
+	 */
+	public boolean isWritable() {
+		return status.writable;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#cloneLayer()
+	 */
+	public FLayer cloneLayer() throws Exception {
+		return this;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getTocStatusImage()
+	 */
+	public Image getTocStatusImage() {
+		return tocStatusImage;
+	}
+
+	/**
+	 * Inserts the image icon that will be shown in the TOC next to this layer, according its status.
+	 *
+	 * @param tocStatusImage the image
+	 *
+	 * @see #getTocStatusImage()
+	 */
+	public void setTocStatusImage(Image tocStatusImage) {
+		this.tocStatusImage = tocStatusImage;
+		logger.debug("setTocStatusImage " + tocStatusImage + " sobre capa " + this.getName());
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#newComposedLayer()
+	 */
+	public ComposedLayer newComposedLayer() {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#allowLinks()
+	 */
+	public boolean allowLinks()
+	{
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getLinkProperties()
+	 */
+	public AbstractLinkProperties getLinkProperties()
+	{
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getLink(java.awt.geom.Point2D, double)
+	 */
+	public URI[] getLink(Point2D point, double tolerance) throws ReadException{
+		return null;
+	}
+
+	/**
+	 * @see LayerChangeSupport#addLayerListener(LegendListener)
+	 */
+	public void addLegendListener(LegendListener listener) {
+		layerChangeSupport.addLayerListener(listener);
+	}
+
+	/**
+	 * @see LayerChangeSupport#callLegendChanged(LegendChangedEvent)
+	 */
+	protected void callLegendChanged(LegendChangedEvent e) {
+		layerChangeSupport.callLegendChanged(e);
+		if(parentLayer != null) {
+			parentLayer.callLegendChanged(e);
+		}
+	}
+
+	/**
+	 * @see LayerChangeSupport#removeLayerListener(LegendListener)
+	 */
+	public void removeLegendListener(LegendListener listener) {
+		layerChangeSupport.removeLayerListener(listener);
+	}
+	public String getClassName() {
+		return this.getClass().getName();
+	}
+
+	public void delegate(DynObject dynObject) {
+		this.metadataContainer.delegate(dynObject);
+	}
+
+	public DynClass getDynClass() {
+		return this.metadataContainer.getDynClass();
+	}
+
+	public Object getDynValue(String name) throws DynFieldNotFoundException {
+		return this.metadataContainer.getDynValue(name);
+	}
+
+	public boolean hasDynValue(String name) {
+		return this.metadataContainer.hasDynValue(name);
+	}
+
+	public void implement(DynClass dynClass) {
+		this.metadataContainer.implement(dynClass);
+	}
+
+	public Object invokeDynMethod(int code, DynObject context)
+	throws DynMethodException {
+		return this.metadataContainer.invokeDynMethod(this, code, context);
+	}
+
+	public Object invokeDynMethod(String name, DynObject context)
+	throws DynMethodException {
+		return this.metadataContainer.invokeDynMethod(this, name, context);
+	}
+
+	public void setDynValue(String name, Object value)
+	throws DynFieldNotFoundException {
+		this.metadataContainer.setDynValue(name, value);
+	}
+
+	public long getDrawVersion() {
+		return this.drawVersion;
+	}
+
+	protected void updateDrawVersion(){
+		this.drawVersion++;
+		this.callDrawValueChanged(LayerEvent.createDrawValuesChangedEvent(this, ""));
+		if (this.parentLayer != null){
+			this.parentLayer.updateDrawVersion();
+		}
+	}
+
+	public boolean hasChangedForDrawing(long value){
+		return this.drawVersion > value;
+	}
+
+	public void activationChanged(LayerEvent e) {
+	}
+
+	public void drawValueChanged(LayerEvent e) {
+		this.updateDrawVersion();
+	}
+
+	public void editionChanged(LayerEvent e) {
+
+	}
+
+	public void nameChanged(LayerEvent e) {
+
+	}
+
+	public void visibilityChanged(LayerEvent e) {
+
+	}
+	
+	// ========================================================
+	
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("parentLayer", parentLayer);
+		state.set("status",status);
+		state.set("minScale", minScale);
+		state.set("maxScale", maxScale);
+		state.set("transparency",transparency);
+		state.set("coordTrans",ct);
+		state.set("name", getName());
+		state.set("crs", getProjection());
+		state.set("properties",properties);
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		this.parentLayer = (FLayers) state.get("parentLayer");
+		this.status = (FLayerStatus) state.get("status");
+		this.minScale = state.getDouble("minScale");
+		this.minScale = state.getDouble("maxScale");
+		this.transparency = state.getInt("transparency");
+		this.ct = (ICoordTrans) state.get("coordTrans");
+
+		this.setDynValue(METADATA_NAME, state.getString("name"));
+		this.setDynValue(METADATA_CRS, state.get("crs"));
+		
+		this.properties = new Hashtable((Map)state.get("properties"));
+	}
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				FLyrDefault.class,
+				"FLyrDefault",
+				"FLyrDefault Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldString("name").setMandatory(false);
+		definition.addDynFieldInt("transparency").setMandatory(true);
+		definition.addDynFieldDouble("minScale").setMandatory(true);
+		definition.addDynFieldDouble("maxScale").setMandatory(true);
+		definition.addDynFieldObject("crs").setClassOfValue(IProjection.class).setMandatory(false);
+		definition.addDynFieldObject("parentLayer").setClassOfValue(FLayers.class).setMandatory(false);
+		definition.addDynFieldObject("coordTrans").setClassOfValue(ICoordTrans.class).setMandatory(false);
+		definition.addDynFieldObject("status").setClassOfValue(FLayerStatus.class).setMandatory(true);
+		definition.addDynFieldMap("properties").setClassOfItems(Object.class)
+				.setMandatory(true);
+	}
+
+	
+//	/**
+//	 * Splits string into an array of strings
+//	 * @param input input string
+//	 * @param sep separator string
+//	 * @return an array of strings
+//	 */
+//	public static String[] splitString(String input, String sep) {
+//		return Pattern.compile(sep).split(input, 0);
+//	}
+	
+	public void clear() {
+		if (metadataContainer != null) {
+			metadataContainer.clear();
+		}
+	}
+	
+    public String getMetadataName() throws MetadataException {
+        return FLayer.METADATA_DEFINITION_NAME;
+    }
+    
+	public static void registerMetadata() {
+		MetadataManager metadataManager = MetadataLocator.getMetadataManager();
+
+		
+		DynStruct metadataDefinition = metadataManager.getDefinition(FLayer.METADATA_DEFINITION_NAME);
+		if (metadataDefinition == null) {
+			try {
+				metadataDefinition = metadataManager.addDefinition(
+						FLayer.METADATA_DEFINITION_NAME,
+						FLayer.METADATA_DEFINITION_DESCRIPTION);
+				metadataDefinition.addDynField(FLayer.METADATA_NAME)
+						.setMandatory(true);
+
+				metadataDefinition.addDynFieldObject(FLayer.METADATA_CRS)
+						.setType(DataTypes.CRS).setMandatory(true);
+			} catch (MetadataException e) {
+				logger.warn("Can't create metadata definition for 'Layer'", e);
+			}
+		}
+	}
+	
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrText.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrText.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrText.java	(revision 36112)
@@ -0,0 +1,503 @@
+/*
+ * Created on 28-dic-2004
+ *
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Set;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
+import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * Capa de texto.
+ *
+ * @author FJP
+ * @deprecated
+ */
+public class FLyrText extends FLyrDefault implements ClassifiableVectorial {
+    /**
+     * <code>m_labels</code> es una arrayList de FLabel (string + punto de
+     * inserci�n + rotaci�n + altura de texto
+     */
+    private ArrayList m_labels = new ArrayList();
+
+    private IVectorLegend legend;
+
+    // private Rectangle2D fullExtent;
+    private FLyrVect assocLyrVect = null;
+
+    /**
+     * Crea un nuevo FLyrText.
+     *
+     * @param arrayLabels
+     *            DOCUMENT ME!
+     */
+    public FLyrText() {
+    	super();
+    }
+
+//    /**
+//     * Esto tiene el fallo de que obligas a una etiqueta por
+//     * entidad, para poder evitar esto, una posible soluci�n
+//     * ser�a que un FLabel pudiera ser una colecci�n de FLabel
+//     * (Patr�n Composite)
+//     * @param lyrVect
+    // * @throws ReadDriverException
+//     */
+//    public void createLabels(FLyrVect lyrVect) throws ReadDriverException {
+//
+//        assocLyrVect = lyrVect;
+//        SelectableDataSource ds=null;
+//			ds = lyrVect.getRecordset();
+//
+//        try {
+//           	ReadableVectorial adapter = lyrVect.getSource();
+//            adapter.start();
+//            ds.start();
+//            int sc;
+//            int fieldId = ds.getFieldIndexByName(legend.getLabelField());
+//            IVectorialLegend l = (IVectorialLegend) getLegend();
+//            int idFieldHeightText = -1;
+//            int idFieldRotationText = -1;
+//
+////            FSymbol defaultSym = (FSymbol) l.getDefaultSymbol();
+////
+////            if (l.getLabelHeightField() != null) {
+////                idFieldHeightText = ds.getFieldIndexByName(l
+////                        .getLabelHeightField());
+////                defaultSym.setFontSizeInPixels(false);
+////            }
+////
+////            if (l.getLabelRotationField() != null) {
+////                idFieldRotationText = ds.getFieldIndexByName(l
+////                        .getLabelRotationField());
+////            }
+//
+//            sc = (int) ds.getRowCount();
+//            m_labels = new ArrayList(sc);
+//
+//
+//            DriverAttributes attr = adapter.getDriverAttributes();
+//            boolean bMustClone = false;
+//            if (attr != null) {
+//                if (attr.isLoadedInMemory()) {
+//                    bMustClone = attr.isLoadedInMemory();
+//                }
+//            }
+//            ICoordTrans ct = getCoordTrans();
+//
+//
+//            for (int i = 0; i < sc; i++) {
+//                IGeometry geom = adapter.getShape(i);
+//
+//                if (geom == null) {
+//                    m_labels.add(null);
+//                    continue;
+//                }
+//                if (ct != null) {
+//                    if (bMustClone)
+//                        geom = geom.cloneGeometry();
+//                    geom.reProject(ct);
+//                }
+//
+//                // TODO: El m�todo contenedor (createLabelLayer) debe recoger
+//                // los par�metros de posicionamiento y de allowDuplicates
+//                // if (i >= 328)
+//                // System.out.println("i= " + i + " " + val.toString());
+//                Value val = ds.getFieldValue(i, fieldId);
+//
+//                if ((val instanceof NullValue) || (val == null)) {
+//                    continue;
+//                }
+//
+//                FLabel[] lbls = geom.createLabels(0, true);
+//				for (int j = 0; j < lbls.length; j++) {
+//					if (lbls[j] != null) {
+//						lbls[j].setString(val.toString());
+//
+//						if (idFieldHeightText != -1) {
+//							NumericValue height = (NumericValue) ds.getFieldValue(i,
+//									idFieldHeightText);
+//							lbls[j].setHeight(height.floatValue());
+//						} else {
+//                            // El tama�o del texto va siempre en el simbolo por defecto
+//                            // cuando no hay un campo de altura de texto
+//                            // TODO: Todo esto cambiar� con el nuevo sistema de leyendas...
+//// jaume							if (l.getDefaultSymbol()!=null)
+//// jaume					lbls[j].setHeight(defaultSym.getFontSize());
+//						}
+//
+//						if (idFieldRotationText != -1) {
+//							DoubleValue rotation = (DoubleValue) ds.getFieldValue(i,
+//									idFieldRotationText);
+//							lbls[j].setRotation(rotation.getValue());
+//						}
+//						m_labels.add(lbls[j]);
+//					}
+//
+//
+//				}
+//
+//                /* if (lbls[0] == null)
+//                    m_labels.add(null);
+//                else
+//                    m_labels.add(lbls[0].getOrig()); */
+//            }
+//
+//            ds.stop();
+//            adapter.stop();
+//        } catch (ExpansionFileReadException e) {
+//        	 throw new ReadDriverException(getName(),e);
+//		} catch (InitializeDriverException e) {
+//			 throw new ReadDriverException(getName(),e);
+//		}
+//
+//    }
+
+    /**
+     * Dibuja sobre el graphics los textos.
+     *
+     * @param image
+     * @param g
+     *            Graphics.
+     * @param viewPort
+     *            ViewPort.
+     * @param cancel
+     */
+//    private void drawLabels(BufferedImage image, Graphics2D g,
+//            ViewPort viewPort, Cancellable cancel) {
+//        int numReg;
+//        /*
+//         * refactored... labels will be managed by the LabelingStrategy
+//        Rectangle2D elExtent = viewPort.getAdjustedExtent();
+//
+//        // int anchoMapa;
+//        // int altoMapa;
+//        // double anchoReal;
+//        // double altoReal;
+//        // double escala;
+//        ISymbol theSymbol = null;
+//        System.out.println("Dibujando etiquetas...");
+//
+//        for (numReg = 0; numReg < m_labels.size(); numReg++) {
+//            if (cancel.isCanceled()) {
+//                break;
+//            }
+//
+//            FLabel theLabel = (FLabel) m_labels.get(numReg);
+//            if ((theLabel == null) || (theLabel.getOrig() == null))
+//                continue;
+//
+//            if (elExtent.contains(theLabel.getOrig())) // TODO: Aqui hay que
+//            // ponerle al FLabel un
+//            // getExtent()
+//            {
+//                theSymbol = getLegend().getDefaultSymbol();
+//
+//                FShape shp = new FPoint2D(theLabel.getOrig().getX(), theLabel
+//                        .getOrig().getY());
+//
+//                theLabel.draw(g, viewPort.getAffineTransform(), shp, theSymbol);
+//                // FGraphicUtilities.DrawLabel(g, viewPort.getAffineTransform(),
+//                //         shp, theSymbol, theLabel);
+//            }
+//        }
+//        */
+//    }
+
+//    /**
+//     * @deprecated use drawlabels (compatibility with postgis)
+//     * @param image
+//     * @param g
+//     * @param viewPort
+//     * @param cancel
+    // * @throws ReadDriverException
+//     */
+//    private void drawLabels2(BufferedImage image, Graphics2D g,
+//            ViewPort viewPort, Cancellable cancel) throws ReadDriverException {
+//        int numReg;
+//        Rectangle2D elExtent = viewPort.getAdjustedExtent();
+//
+//        // int anchoMapa;
+//        // int altoMapa;
+//        // double anchoReal;
+//        // double altoReal;
+//        // double escala;
+//        FSymbol theSymbol = null;
+//        System.out.println("Dibujando etiquetas...");
+//        FLabel theLabel = new FLabel();
+//
+//        SelectableDataSource ds=null;
+//			ds = assocLyrVect.getRecordset();
+//	        int fieldId = ds.getFieldIndexByName(legend.getLabelField());
+//            IVectorialLegend l = (IVectorialLegend) getLegend();
+//            int idFieldHeightText = -1;
+//            int idFieldRotationText = -1;
+//            FSymbol defaultSym = (FSymbol) l.getDefaultSymbol();
+//
+//            if (l.getLabelHeightField() != null) {
+//                // l.setBWithHeightText(true);
+//                idFieldHeightText = ds.getFieldIndexByName(l
+//                        .getLabelHeightField());
+//                defaultSym.setFontSizeInPixels(false);
+//            }
+//            /*
+//             * }else{ l.setBWithHeightText(false); }
+//             */
+//
+//            // boolean bWithRotationText = false;
+//            if (l.getLabelRotationField() != null) {
+//                // bWithRotationText = true;
+//                idFieldRotationText = ds.getFieldIndexByName(l
+//                        .getLabelRotationField());
+//            }
+//
+//            for (numReg = 0; numReg < m_labels.size(); numReg++) {
+//                if (cancel.isCanceled()) {
+//                    break;
+//                }
+//
+//                Point2D thePoint = (Point2D) m_labels.get(numReg);
+//
+//
+//
+//                if (thePoint == null)
+//                    continue;
+//                FPoint2D theShape = new FPoint2D(thePoint);
+//                if (getCoordTrans() != null)
+//                    theShape.reProject(this.getCoordTrans());
+//
+//                if (elExtent.contains(theShape.getX(), theShape.getY())) // TODO: Aqui hay que
+//                // ponerle al FLabel un
+//                // getExtent()
+//                {
+//                    Value val = ds.getFieldValue(numReg, fieldId);
+//
+//                    if ((val instanceof NullValue) || (val == null)) {
+//                        continue;
+//                    }
+//
+//                    theSymbol = defaultSym;
+//                    theLabel.setString(val.toString());
+//                    theLabel.setOrig(thePoint);
+//
+//                    if (idFieldHeightText != -1) {
+//                        NumericValue height = (NumericValue) ds
+//                                .getFieldValue(numReg, idFieldHeightText);
+//                        theLabel.setHeight(height.floatValue());
+//                    } else {
+//                        // El tama�o del texto va siempre en el simbolo por
+//                        // defecto
+//                        // cuando no hay un campo de altura de texto
+//                        // TODO: Todo esto cambiar� con el nuevo sistema de
+//                        // leyendas...
+//                        if (defaultSym != null)
+//                            theLabel.setHeight(defaultSym.getFontSize());
+//                    }
+//
+//                    if (idFieldRotationText != -1) {
+//                        DoubleValue rotation = (DoubleValue) ds
+//                                .getFieldValue(numReg, idFieldRotationText);
+//                        theLabel.setRotation(rotation.getValue());
+//                    }
+//                    theLabel.draw(g, viewPort.getAffineTransform(), theShape, theSymbol);
+//                }
+//            }
+//
+//
+//    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent()
+     */
+    public Envelope getFullEnvelope() throws ReadException {
+        return assocLyrVect.getFullEnvelope();
+    }
+
+    /*
+     * (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.cit.gvsig.fmap.operations.Cancellable)
+     */
+    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+            Cancellable cancel, double scale) throws ReadException {
+//        if (isVisible() && isWithinScale(scale)) {
+//            drawLabels(image, g, viewPort, cancel);
+//        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D,
+     *      com.iver.cit.gvsig.fmap.ViewPort,
+     *      com.iver.cit.gvsig.fmap.operations.Cancellable)
+     */
+    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
+            double scale, PrintAttributes properties) throws ReadException {
+//        if (isVisible() && isWithinScale(scale)) {
+//            drawLabels(null, g, viewPort, cancel);
+//        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial#setLegend(com.iver.cit.gvsig.fmap.rendering.VectorialLegend)
+     */
+    public void setLegend(IVectorLegend r) {
+        legend = r;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#addLegendListener(com.iver.cit.gvsig.fmap.layers.LegendListener)
+     */
+    public void addLegendListener(LegendListener listener) {
+        // TODO Auto-generated method stub
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#removeLegendListener(com.iver.cit.gvsig.fmap.layers.LegendListener)
+     */
+    public void removeLegendListener(LegendListener listener) {
+        // TODO Auto-generated method stub
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#getLegend()
+     */
+    public ILegend getLegend() {
+        return legend;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#getShapeType()
+     */
+    public int getShapeType() {
+        return legend.getShapeType();
+    }
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.metadata.Metadata#getMetadataChildren()
+	 */
+	public Set getMetadataChildren() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.metadata.Metadata#getMetadataID()
+	 */
+	public Object getMetadataID() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.gvsig.metadata.Metadata#getMetadataName()
+	 */
+	public String getMetadataName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    /**
+     * Devuelve un ArrayList con los textos de la capa.
+     *
+     * @return Texto de la capa.
+     */
+    /* public ArrayList getLabels() {
+        return m_labels;
+    } */
+
+    /**
+     * Inserta los textos de la capa
+     *
+     * @param m_labels
+     *            ArrayList con los textos de la capa.
+     */
+    /* public void setLabels(ArrayList m_labels) {
+        this.m_labels = m_labels;
+    } */
+	
+	public static void registerPersistent() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	protected void doDispose() throws BaseException {
+		// Nothing to do
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerListener.java	(revision 36112)
@@ -0,0 +1,88 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package org.gvsig.fmap.mapcontext.layers;
+
+
+
+/**
+ * <p><code>LayerListener</code> defines the interface for an object that listens
+ *  to changes in a layer.</p>
+ */
+public interface LayerListener {
+	/**
+	 * <p>Called when the visibility of a layer has changed.</p>
+	 * 
+	 * @param e a visibility changed layer event object
+	 */
+	public void visibilityChanged(LayerEvent e);
+
+	/**
+	 * <p>Called when the activation of a layer has changed.</p>
+	 * 
+	 * @param e an activation changed layer event object
+	 */
+	public void activationChanged(LayerEvent e);
+
+	/**
+	 * <p>Called when the name of a layer has changed.</p>
+	 * 
+	 * @param e a name changed layer event object
+	 */
+	public void nameChanged(LayerEvent e);
+
+	/**
+	 * <p>Called when the edition of a layer has changed.</p>
+	 * 
+	 * @param e an edition changed layer event object
+	 */
+	public void editionChanged(LayerEvent e);
+
+	/**
+	 * <p>
+	 * Called when a draw value of a layer has changed.
+	 * </p>
+	 * 
+	 * @param e
+	 *            an edition changed layer event object
+	 */
+	public void drawValueChanged(LayerEvent e);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayer.java	(revision 36112)
@@ -0,0 +1,643 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.cresques.geo.Projected;
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.ReloadLayerException;
+import org.gvsig.fmap.mapcontext.exceptions.StartEditionLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.metadata.Metadata;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+/**
+ * <p>Definition of the basic functionality that all kind of <i>FMap</i> layers should implement.</p>
+ *
+ * <p>This kind of layers store their data, are drawable, projectable (with a projection), can be a node of a tree of layers, and
+ *  could be editable and have a cache with previous draws. They also can be visible or not, and active or not.</p>
+ *
+ * <p>A layer can also store information about errors produced working with it, and have a name (kind of layer) and
+ *  a brief summary explaining what's for.</p>
+ *
+ * <p>Each particular implementation can add new properties, and limit or expand the functionality.</p>
+ *
+ * @see Projected
+ */
+public interface FLayer extends Projected, Persistent, Metadata, Disposable
+{
+	public final String METADATA_DEFINITION_NAME = "Layer";
+	public final String METADATA_DEFINITION_DESCRIPTION = "Basic layer metadata definition";
+
+	public static final String METADATA_CRS = DataStore.METADATA_CRS;
+	public static final String METADATA_NAME = "name";
+
+
+//	/**
+//	 * <p>Returns an entity that represents this layer.</p>
+//	 *
+//	 * <p>This XML entity has elements that represent and store information about this layer.</p>
+//	 *
+//	 * @return an XML entity with information of this layer
+//	 * @throws XMLException if there is an error obtaining the object.
+//	 *
+//	 * @see #setXMLEntity(XMLEntity)
+//	 * @see #setXMLEntity03(XMLEntity)
+//	 */
+//	XMLEntity getXMLEntity() throws XMLException;
+//
+//	/**
+//	 * <p>Inserts information to this layer from an XML entity.</p>
+//	 *
+//	 * <p>This XML entity has elements that represent and store information about this layer.</p>
+//	 *
+//	 * @param xml an <code>XMLEntity</code> with the information
+//	 *
+//	 * @throws XMLException if there is an error setting the object.
+//	 *
+//	 * @see #getXMLEntity()
+//	 * @see #setXMLEntity03(XMLEntity)
+//	 */
+//	void setXMLEntity(XMLEntity xml) throws XMLException;
+
+	/**
+	 * <p>Changes the status of this layer to active or inactive.</p>
+	 * <p>One layer is active if is selected in TOC.</p>
+	 *
+	 * @param selected the boolean to be set
+	 *
+	 * @see #isActive()
+	 */
+	void setActive(boolean selected);
+
+	/**
+	 * <p>Returns if this layer is active or not in TOC.</p>
+	 * <p>One layer is active if is selected in TOC.</p>
+	 *
+	 * @return <code>true</code> if this layer is active; <code>false</code> otherwise
+	 *
+	 * @see #setActive(boolean)
+	 */
+	boolean isActive();
+
+	/**
+	 * Sets a name to this layer.
+	 *
+	 * @param name the string that is to be this layer's name
+	 *
+	 * @see #getName()
+	 */
+	void setName(String name);
+
+	/**
+	 * Returns the name of this layer.
+	 *
+	 * @return an string with this layer's name
+	 *
+	 * @see #setName(String)
+	 */
+	String getName();
+
+	/**
+	 * <p>Executes the initialization operations of this layer. This method is invoked
+	 * only one time during the life of this layer and just before visualize it.</p>
+	 *
+	 * @throws org.gvsig.fmap.drivers.reading.DriverIOException if fails loading the layer.
+	 *
+	 * @see #reload()
+	 */
+	void load() throws LoadLayerException;
+	/**
+	 * <p>Changes the status of this layer to visible or not.</p>
+	 * <p>One layer is visible if it's check box associated is selected. This means
+	 *  that layer will tried to be painted. If the data associated isn't available,
+	 *  then this property will change to <code>false</code>.</p>
+	 *
+	 * @param visibility the boolean to be set
+	 *
+	 * @see #isVisible()
+	 * @see #visibleRequired()
+	 * @see #isAvailable()
+	 */
+	void setVisible(boolean visibility);
+
+	/**
+	 * <p>Returns if this layer is visible and available.</p>
+	 * <p>One layer is visible if it's check box associated is selected. This means
+	 *  that layer will tried to be painted.</p>
+	 * <p>One layer is available if the source of data is on-line.</p>
+	 * <p>It's probably that one layer selected hadn't available it's data, for example
+	 *  in a remote service.</p>
+	 *
+	 * @return <code>true</code> if this layer is visible and available; <code>false</code> otherwise
+	 *
+	 * @see #isAvailable()
+	 * @see #setAvailable(boolean)
+	 * @see #visibleRequired()
+	 */
+	boolean isVisible();
+
+	/**
+	 * Returns the parent {@link FLayers FLayers} node of this layer.
+	 *
+	 * @return the parent of this layer, or <code>null</code> if hasn't parent
+	 *
+	 * @see #setParentLayer(FLayers)
+	 */
+	public FLayers getParentLayer();
+
+	/**
+	 * <p>Returns a reference to the model of this layer, or null if this layer has no model.</p>
+	 *
+	 * @return the model of this layer
+	 */
+	public MapContext getMapContext();
+
+	/**
+	 * Inserts the parent {@link FLayers FLayers} node of the layer.
+	 *
+	 * @param root a <code>FLayers</code> object
+	 *
+	 * @see #getParentLayer()
+	 */
+	public void setParentLayer(FLayers root);
+	/**
+	 * Returns the full extension of the layer node.
+	 *
+	 * @return location and dimension of this layer node
+	 *
+	 * @throws ReadException if fails the driver used in this method.
+	 */
+	Envelope getFullEnvelope() throws ReadException;
+
+	/**
+	 * Draws the layer using a buffer.
+	 *
+	 * @param image an image used to accelerate the screen draw
+	 * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
+	 * @param viewPort information for drawing this layer
+	 * @param cancel an object thread that implements the <code>Cancellable</code> interface, and will allow to cancel the draw
+	 * @param scale value that represents the scale
+	 *
+	 * @throws ReadException if fails the driver used in this method.
+	 *
+	 * @see #print(Graphics2D, ViewPort, Cancellable, double, PrintAttributes)
+	 */
+	void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale) throws ReadException;
+
+	/**
+	 * Prints this layer according to some properties requested.
+	 *
+	 * @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 an object thread that implements the {@link Cancellable Cancellable} interface, and will allow to cancel the draw
+	 * @param scale the scale of the view. Must be between {@linkplain FLayer#getMinScale()} and {@linkplain FLayer#getMaxScale()}.
+	 * @param properties a set with the settings to be applied to a whole print job and to all the docs in the print job
+	 *
+	 * @throws ReadException if fails the driver used in this method.
+	 *
+	 * @see #draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+	void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintAttributes properties)
+	throws ReadException;
+
+	/**
+	 * Inserts the transformation coordinates.
+	 *
+	 * @param ct transformation coordinates
+	 *
+	 * @see #getCoordTrans()
+	 */
+	void setCoordTrans(ICoordTrans ct);
+
+	/**
+	 * Returns the transformation coordinates.
+	 *
+	 * @return transformation coordinates
+	 *
+	 * @see #setCoordTrans(ICoordTrans)
+	 */
+	ICoordTrans getCoordTrans();
+
+	/**
+	 * Adds a <code>LayerListener</code> to the listener list.
+	 *
+	 * @param o a layer listener
+	 *
+	 * @return <code>true</code> if hasn't been any problem during the insertion of the listener
+	 *
+	 * @see #getLayerListeners()
+	 * @see #removeLayerListener(LayerListener)
+	 */
+	public boolean addLayerListener(LayerListener o);
+	/**
+	 * Returns all <code>LayerListener</code>s of this layer as an array.
+	 *
+	 * @return an array with all layer listeners associated to this layer
+	 *
+	 * @see #addLayerListener(LayerListener)
+	 * @see #removeLayerListener(LayerListener)
+	 */
+	public LayerListener[] getLayerListeners();
+	/**
+	 * Removes the <code>LayerListener</code> argument from this layer.
+	 *
+	 * @param o a layer listener
+	 *
+	 * @return <code>true</code> if hasn't been any problem doing this process
+	 *
+	 * @see #addLayerListener(LayerListener)
+	 * @see #getLayerListeners()
+	 */
+	public boolean removeLayerListener(LayerListener o);
+	/**
+	 * <p>Returns if the value of <code>scale</code> argument
+	 *  is within the maximum and minimum scale of this layer.</p>
+	 *
+	 * @param scale the scale > 0
+	 *
+	 * @return <code>true</code> if the <code>scale</code> argument is within the range of scales of this layer; <code>false</code> otherwise
+	 *
+	 * @see #setMinScale(double)
+	 * @see #setMaxScale(double)
+	 */
+	public boolean isWithinScale(double scale);
+
+
+	/**
+	 * Returns the minimum scale visible. Lower scales won't be drawn.
+	 *
+	 * @return the minimum scale > 0, -1 if not defined
+	 *
+	 * @see #setMinScale(double)
+	 */
+	public double getMinScale();
+
+	/**
+	 * Returns the maximum scale visible. Higher scales won't be drawn.
+	 *
+	 * @return the maximum scale > 0, -1 if not defined
+	 *
+	 * @see #setMaxScale(double)
+	 */
+	public double getMaxScale();
+	/**
+	 * Sets the minimum scale visible. Lower scales won't be drawn.
+	 *
+	 * @param minScale the scale > 0, -1 if not defined
+	 *
+	 * @see #getMinScale()
+	 */
+	public void setMinScale(double minScale);
+	/**
+	 * Sets the maximum scale visible. Higher scales won't be drawn.
+	 *
+	 * @param maxScale the scale > 0, -1 if not defined
+	 *
+	 * @see #getMaxScale()
+	 */
+	public void setMaxScale(double maxScale);
+	/**
+	 * <p>Changes the status of this layer to editable or not.</p>
+	 * <p>One layer is editable if user can modify its information with graphical tools.</p>
+	 *
+	 * @param b the boolean to be set
+	 *
+	 * @throws com.iver.cit.gvsig.fmap.edition.EditionException if fails enabling for edition this kind of layer.
+	 *
+	 * @see #isEditing()
+	 */
+	public void setEditing(boolean b) throws StartEditionLayerException;
+	/**
+	 * <p>Returns if this layer is editable.</p>
+	 * <p>One layer is editable if user can modify its information with graphical tools.</p>
+	 *
+	 * @return <code>true</code> if this layer is editable; <code>false</code> otherwise
+	 *
+	 * @see #setEditing(boolean)
+	 */
+	public boolean isEditing();
+
+	/**
+	 * Returns the image icon that will be shown in the TOC next to this layer.
+	 *
+	 * @return a String reference to the image icon, or <code>null</code> if there isn't any
+	 */
+	public String getTocImageIcon();
+
+	/**
+	 * <p>Returns if this layer appears in the TOC.</p>
+	 * <p>If doesn't appears, remains in the view and in the project.</p>
+	 *
+	 * @return <code>true</code> if this layer appears in the TOC; <code>false</code> otherwise
+	 */
+	boolean isInTOC();
+	/**
+	 * <p>Sets that this layer appears or not in the TOC.</p>
+	 *
+	 * @param b <code>true</code> if appears in the TOC; <code>false</code> otherwise
+	 */
+	void setInTOC(boolean b);
+	/**
+	 * Returns the status of this layer.
+	 *
+	 * @return the status stored in a <code>FLayerStatus</code> object
+	 *
+	 * @see #setFLayerStatus(FLayerStatus)
+	 */
+	public FLayerStatus getFLayerStatus();
+	/**
+	 * Sets the status of this layer.
+	 *
+	 * @param status information of the status for this layer
+	 *
+	 * @see #getFLayerStatus()
+	 */
+	public void setFLayerStatus(FLayerStatus status);
+	/*
+	 * This stuff is to save error's info that causes
+	 * unavailable status.
+	 * */
+	/**
+	 * <p>Returns if this layer hasn't got errors.</p>
+	 *
+	 * @return <code>true</code> if this layer hasn't got errors; <code>false</code> otherwise
+	 */
+	public boolean isOk();
+	/**
+	 * Returns the number of errors which causes this layer to be in unavailable status.
+	 *
+	 * @return number of errors >= 0
+	 *
+	 * @see #getError(int)
+	 * @see #getErrors()
+	 */
+	public int getNumErrors();
+
+	/**
+	 * Returns the specified error.
+	 *
+	 * @param i index of the error >= 0 && < <code>getNumErrors</code>
+	 *
+	 * @return a singular error
+	 *
+	 * @see #getNumErrors()
+	 * @see #getErrors()
+	 */
+	public BaseException getError(int i);
+
+    /**
+     * Adds an error reason that describes this layer's wrong status.
+     * 
+     * @param error
+     *            a <code>BaseException</code> with the information of the error
+     * 
+     * @see #getNumErrors()
+     * @see #getError(int)
+     * @see #getErrors()
+     */
+	public void addError(BaseException exception);
+
+	/**
+	 * Returns a list with all layer errors.
+	 *
+	 * @return an <code>ArrayList</code> with the errors
+	 *
+	 * @see #getError(int)
+	 * @see #getNumErrors()
+	 */
+	public List getErrors();
+	/**
+	 * <p>Changes the status of availability of this layer.</p>
+	 * <p>One layer is available if the source of data is on-line.</p>
+	 *
+	 * @param the boolean to be set
+	 *
+	 * @see #isAvailable()
+	 */
+	public void setAvailable(boolean available);
+	/**
+	 * <p>Returns the status of availability of this layer.</p>
+	 * <p>One layer is available if the source of data is on-line.</p>
+	 *
+	 * @return <code>true</code> if the source of data is on-line; <code>false</code> otherwise
+	 *
+	 * @see #setAvailable(boolean)
+	 * @see #isVisible()
+	 */
+	public boolean isAvailable();
+
+    /**
+     * <p>
+     * Tries recover a layer of a possible error.
+     * </p>
+     * <p>
+     * If it has any problem during the load, marks the availability to false
+     * and throws an exception.
+     * </p>
+     * 
+     * @throws ReloadLayerException
+     *             if it's thrown a <code>ReadException</code> or an
+     *             <code>IOException</code> during the load of this layer.
+     * 
+     * @see #load()
+     */
+	public void reload() throws ReloadLayerException;
+
+	/**
+	 * Returns <code>true</code> if this layer has the visible status enabled.
+	 *
+	 * @return <code>true</code> if visible this layer has the visible status enabled, otherwise <code>false</code>
+	 *
+	 * @see #isVisible()
+	 * @see #setVisible(boolean)
+	 */
+	boolean visibleRequired();
+	/**
+	 * Returns an string with the information of this layer.
+	 *
+	 * @return the string that is to be this component's information
+	 */
+	public String getInfoString();
+	/**
+	 * <p>Returns the writing status of this layer.</p>
+	 * <p>One layer is writable if there is a writing driver for this layer.</p>
+	 *
+	 * @return <code>true</code> if there is a writing driver for this layer; <code>false</code> otherwise
+	 */
+	public boolean isWritable();
+
+	/**
+	 * <p>This method can be used to have a fast cloned layer.</p>
+	 * <p>The implementations should take care of not recreate this layer. Instead of this,
+	 *  is better to use the same source (driver) and <i>deepclone</i> the legend. Exception:
+	 *   the labels aren't <i>deepcloned</i> to avoid memory consumption.</p>
+	 * <p><i>Note</i>: Labels are memory consuming to speed up layers like PostGIS and so on.</p>
+	 *
+	 * @return a layer that is a clonation of this layer
+	 *
+	 * @throws java.lang.Exception any exception produced during the cloning of this layer.
+	 */
+	public FLayer cloneLayer() throws Exception;
+
+
+
+	/**
+	 * <p>Returns a reference to an object (property) associated to this layer.</p>
+	 *
+	 * <p>For example, you can attach a network definition to key "network" and check
+	 *  if a layer has a network loaded using <i>getAssociatedObject("network")</i> and
+	 *  that it's not null.</p>
+	 *
+	 * @param key the key associated to the property
+	 *
+	 * @return <code>null</code> if key is not found
+	 *
+	 * @see #getExtendedProperties()
+	 * @see #setProperty(Object, Object)
+	 */
+	public Object getProperty(Object key);
+
+	/**
+	 * Insets an object as a property to this layer.
+	 *
+	 * @param key the key associated to the property
+	 * @param obj the property
+	 *
+	 * @see #getProperty(Object)
+	 * @see #getExtendedProperties()
+	 */
+	public void setProperty(Object key, Object obj);
+	/**
+	 * Returns a hash map with all new properties associated to this layer.
+	 *
+	 * @return hash table with the added properties
+	 *
+	 * @see #getProperty(Object)
+	 * @see #setProperty(Object, Object)
+	 */
+	public Map getExtendedProperties();
+
+	/**
+	 * <p>Returns a new instance of {@link ComposedLayer ComposedLayer}.</p>
+	 *
+	 * <p>This allows make a single draw for a group
+	 * of layers with the same source.</p>
+	 *
+	 * <p>If this operation isn't applicable for this
+	 * kind of layer, this method returns null.</p>
+	 *
+	 * <p>By default this operation is not supported.</p>
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer
+	 *
+	 * @return a new composed layer or <code>null</code> if not supported
+	 */
+	public ComposedLayer  newComposedLayer();
+
+	/**
+	 * Returns the image icon that will be shown in the TOC next to this layer, according its status.
+	 *
+	 * @return the image
+	 */
+	Image getTocStatusImage();
+
+//	M�todos para la utilizaci�n de HyperLinks
+
+	/**
+	 * Returns information about if the layer allows HyperLink or not
+	 * @return boolean true if allows Link, false if not
+	 */
+	public boolean allowLinks();
+
+	/**
+	 * Returns an instance of AbstractLinkProperties that contains the information
+	 * of the HyperLink
+	 * @return Abstra
+	 */
+	public AbstractLinkProperties getLinkProperties();
+
+	/**
+	 * Provides an array with URIs. Returns one URI by geometry that includes the point
+	 * in its own geometry limits with a allowed tolerance.
+	 * @param layer, the layer
+	 * @param point, the point to check that is contained or not in the geometries in the layer
+	 * @param tolerance, the tolerance allowed. Allowed margin of error to detect if the  point
+	 * 		is contained in some geometries of the layer
+	 * @return
+	 * @throws ReadException
+	 * @throws BehaviorException
+	 */
+	public URI[] getLink(Point2D point, double tolerance) throws ReadException;
+
+
+	/**
+	 * <p>Inserts the projection to this layer.</p>
+	 *
+	 * @param proj information about the new projection
+	 *
+	 */
+	public void setProjection(IProjection proj);
+	
+	public long getDrawVersion();
+	
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/VectorialSecuencial.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/VectorialSecuencial.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/VectorialSecuencial.java	(revision 36112)
@@ -0,0 +1,55 @@
+/*
+ * Created on 13-may-2005
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.fmap.dal.feature.FeatureSet;
+
+public interface VectorialSecuencial {
+
+    // public int getRowIndexByFID(IFeature FID);
+    public FeatureSet getFeatureIterator(Rectangle2D r, String strEPSG);
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/Tiling.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/Tiling.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/Tiling.java	(revision 36112)
@@ -0,0 +1,350 @@
+/*
+ * Created on 16-feb-2005
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Dimension;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * C�lculo de Partes (Tiles) en las que se divide un raster grande.
+ * Se usa para imprimir rasters y capas raste remotas (WMS).
+ *
+ * Para no pedir imagenes demasiado grandes, vamos
+ * a hacer lo mismo que hace EcwFile: chunkear.
+ * Llamamos a drawView con cuadraditos m�s peque�os
+ * del BufferedImage ni caso, cuando se imprime viene con null
+ * c�digo original de Fran Pe�arrubia
+ * @author Luis W. Sevilla (sevilla_lui@gva.es)
+ */
+
+public class Tiling {	
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	private static final Logger logger = LoggerFactory.getLogger(Tiling.class);
+	private static final int		MIN_SIZE = 50; //Tama�o m�nimo en pixeles del tile
+	private boolean 				debug = true;
+	private int 					tileMaxWidth, tileMaxHeight;
+	private int 					numRows, numCols;
+	private double[][] 				srcPts;
+	private Rectangle2D[] 			tile;
+	private double 					width = 500, height = 500;
+	private AffineTransform 		mat;
+	private ViewPort 				vp;
+
+	public Tiling(){}
+
+	public Tiling(int tileW, int tileH, Rectangle2D r) {
+		int[] size = this.calcMaxTileSize(tileW, tileH, r);
+		tileMaxWidth = size[0];
+		tileMaxHeight = size[1];
+
+        int stepX, stepY;
+        int xProv, yProv;
+        int altoAux, anchoAux;
+
+        //Vamos a hacerlo en trozos de AxH
+        numCols = 1+(int) (r.getWidth()) / tileMaxWidth;
+        numRows = 1+(int) (r.getHeight()) / tileMaxHeight;
+
+        srcPts = new double[numCols*numRows][8];
+        tile = new Rectangle2D[numCols*numRows];
+
+    	yProv = (int) r.getY();
+        for (stepY=0; stepY < numRows; stepY++) {
+    		if ((yProv + tileMaxHeight) > r.getMaxY())
+    			altoAux = (int) r.getMaxY() - yProv;
+    		else
+    			altoAux = tileMaxHeight;
+
+    		xProv = (int) r.getX();
+        	for (stepX=0; stepX < numCols; stepX++) {
+	    		if ((xProv + tileMaxWidth) > r.getMaxX())
+	    			anchoAux = (int) r.getMaxX() - xProv;
+	    		else
+	    			anchoAux = tileMaxWidth;
+
+        		//Rectangle newRect = new Rectangle(xProv, yProv, anchoAux, altoAux);
+        		int tileCnt = stepY*numCols+stepX;
+        		// Parte que dibuja
+        		srcPts[tileCnt][0] = xProv;
+        		srcPts[tileCnt][1] = yProv;
+        		srcPts[tileCnt][2] = xProv + anchoAux+1;
+        		srcPts[tileCnt][3] = yProv;
+        		srcPts[tileCnt][4] = xProv + anchoAux+1;
+        		srcPts[tileCnt][5] = yProv + altoAux+1;
+        		srcPts[tileCnt][6] = xProv;
+        		srcPts[tileCnt][7] = yProv + altoAux+1;
+
+        		tile[tileCnt] = new Rectangle2D.Float(xProv, yProv, anchoAux+1, altoAux+1);
+
+				xProv += tileMaxWidth;
+        	}
+        	yProv += tileMaxHeight;
+        }
+	}
+
+	/**
+	 * Calcula el tama�o m�ximo de tile controlando que ning�n tile tenga menos de MIN_SIZE
+	 * pixeles
+	 * @param tileW Ancho del tile
+	 * @param tileH	Alto del tile
+	 * @param r Rectangulo que define el area de la imagen
+	 */
+	public int[] calcMaxTileSize(int tileW, int tileH, Rectangle2D r){
+		
+		if(r.getWidth() < tileW || r.getHeight() < tileH){
+			int[] sizeTiles = {tileW, tileH};
+			return sizeTiles;
+		}
+
+        int wLastCol = 0;
+        tileW += MIN_SIZE;
+		do{
+			tileW -= MIN_SIZE;
+	        int numCols = (int) (r.getWidth() / tileW);
+	        int w = 0;
+	        for(int i = 0; i < numCols; i++)
+	        	w += tileW;
+	        wLastCol = ((int) r.getWidth()) - w;
+		}while(wLastCol < MIN_SIZE && tileW > (MIN_SIZE * 2));
+
+		int hLastRow = 0;
+        tileH += MIN_SIZE;
+		do{
+			tileH -= MIN_SIZE;
+	        int numRows = (int) (r.getHeight() / tileH);
+	        int h = 0;
+	        for(int i = 0; i < numRows; i++)
+	        	h += tileH;
+	        hLastRow = ((int) r.getHeight()) - h;
+		}while(hLastRow < MIN_SIZE && tileH > (MIN_SIZE * 2));
+
+		tileMaxWidth = tileW;
+		tileMaxHeight = tileH;
+		int[] sizeTiles = {tileMaxWidth, tileMaxHeight};
+		return sizeTiles;
+	}
+
+	public double [] getTilePts(int colNr, int rowNr) {
+		return srcPts[rowNr*numCols+colNr];
+	}
+
+	public double [] getTilePts(int num) {
+		return srcPts[num];
+	}
+
+	public Rectangle2D getTileSz(int colNr, int rowNr) {
+		return tile[rowNr*numCols+colNr];
+	}
+
+	public Rectangle2D getTile(int num) {
+		return tile[num];
+	}
+
+	/**
+	 * @return Returns the numCols.
+	 */
+	public int getNumCols() {
+		return numCols;
+	}
+	/**
+	 * @return Returns the numRows.
+	 */
+	public int getNumRows() {
+		return numRows;
+	}
+
+	public int getNumTiles() { return numRows*numCols; }
+	/**
+	 * @return Returns the tileHeight.
+	 */
+	public int getMaxTileHeight() {
+		return tileMaxHeight;
+	}
+	/**
+	 * @return Returns the tileWidth.
+	 */
+	public int getMaxTileWidth() {
+		return tileMaxWidth;
+	}
+
+	ViewPort[] viewPortList = null;
+	private void calcViewPort(ViewPort viewPort)throws NoninvertibleTransformException{
+		viewPortList = new ViewPort[numCols*numRows];
+
+		/*if(viewPort.getImageWidth() < width && viewPort.getImageHeight() < height){
+			viewPortList[0] = viewPort;
+			return;
+		}*/
+
+	    int vpCnt = 0;
+
+	    double imgPxX = viewPort.getImageWidth();
+	    double dWcX = viewPort.getAdjustedExtent().getLength(0);
+	    double tileWcW = (getTile(vpCnt).getWidth() * dWcX) / imgPxX;
+
+	    double imgPxY = viewPort.getImageHeight();
+	    double dWcY = viewPort.getAdjustedExtent().getLength(1);
+	    double tileWcH = (getTile(vpCnt).getHeight() * dWcY) / imgPxY;
+
+	    try {
+            viewPortList[0] = (ViewPort) viewPort.clone();
+        } catch (CloneNotSupportedException e) {
+            logger.error("Error clonning the viewport", e);
+            e.printStackTrace();
+        }
+	    
+	    int auxw = (int) getTile(vpCnt).getWidth();
+	    int auxh = (int) getTile(vpCnt).getHeight();
+	    Dimension auxdim = new Dimension(auxw, auxh);
+	    
+	    viewPortList[0].setImageSize(auxdim);
+	    Envelope r=viewPort.getAdjustedExtent();
+	    try {
+			viewPortList[0].setEnvelope(geomManager.createEnvelope(r.getMinimum(0), r.getMaximum(1) - tileWcH,r.getMinimum(0)+tileWcW, r.getMaximum(1), SUBTYPES.GEOM2D));
+		} catch (CreateEnvelopeException e) {
+			logger.error("Error setting the envelope", e);
+			e.printStackTrace();
+		}
+	    viewPortList[0].setAffineTransform(mat);
+
+	    double wt = tileWcW;
+	    double ht = tileWcH;
+	    double xt = viewPort.getAdjustedExtent().getMinimum(0);
+	    double yt = viewPort.getAdjustedExtent().getMaximum(1) - tileWcH;
+
+	    for (int stepY=0; stepY < numRows; stepY++) {
+	    	wt = tileWcW;
+	    	xt = viewPort.getAdjustedExtent().getMinimum(0);
+	    	for (int stepX=0; stepX < numCols; stepX++) {
+	    		vpCnt = stepY*numCols+stepX;
+	    		if(vpCnt > 0){
+	    			if(stepX > 0)
+	    				xt += wt;
+	    			if((xt + wt) > viewPort.getAdjustedExtent().getMaximum(0))
+	    				wt = Math.abs(viewPort.getAdjustedExtent().getMaximum(0) - xt);
+
+	    			try {
+                        viewPortList[vpCnt] = (ViewPort) viewPort.clone();
+                    } catch (CloneNotSupportedException e) {
+                        logger.error("Error clonning the viewport", e);
+                        e.printStackTrace();
+                    }
+	    			
+	    		    auxw = (int) getTile(vpCnt).getWidth();
+	    		    auxh = (int) getTile(vpCnt).getHeight();
+	    		    auxdim = new Dimension(auxw, auxh);
+
+	    			viewPortList[vpCnt].setImageSize(auxdim);
+	    			
+	    			try {
+						viewPortList[vpCnt].setEnvelope(geomManager.createEnvelope(xt, yt,xt + wt, yt + ht, SUBTYPES.GEOM2D));
+					} catch (CreateEnvelopeException e) {
+						logger.error("Error setting the envelope", e);
+						e.printStackTrace();
+					}
+	    			viewPortList[vpCnt].setAffineTransform(mat);
+
+	    		}
+	    		//System.out.println("ViewPort: "+vpCnt+" "+viewPortList[vpCnt].getAdjustedExtent()+" "+getTile(vpCnt).getSize());
+	    	}
+	    	if((yt - ht) < viewPort.getAdjustedExtent().getMinimum(1)){
+	    		ht = Math.abs(yt - viewPort.getAdjustedExtent().getMinimum(1));
+	    		yt = viewPort.getAdjustedExtent().getMinimum(1);
+	    	}else
+	    		yt -= ht;
+	    }
+	}
+
+	public ViewPort getTileViewPort(ViewPort viewPort, int tileNr) throws NoninvertibleTransformException {
+		/*if(viewPortList == null)
+			this.calcViewPort(viewPort);
+		return viewPortList[tileNr];*/
+
+		if(tile.length == 1)
+			return viewPort;
+
+		double [] dstPts = new double[8];
+		double [] srcPts = getTilePts(tileNr);
+		Rectangle2D tile = getTile(tileNr);
+		//Rectangle newRect = new Rectangle((int)srcPts[0], (int)srcPts[1], tileSz[0], tileSz[1]);
+
+		mat.inverseTransform(srcPts, 0, dstPts, 0, 4);
+		double x = dstPts[0], w = dstPts[2] - dstPts[0];
+		double y = dstPts[1], h = dstPts[5] - dstPts[3];
+		if (w < 0) { x = dstPts[2]; w = dstPts[0] - dstPts[2]; }
+		if (h < 0) { y = dstPts[5]; h = dstPts[3] - dstPts[5]; }
+		Envelope rectCuadricula = null;
+		try {
+			rectCuadricula = geomManager.createEnvelope(x, y,x+ w,y+ h, SUBTYPES.GEOM2D);
+		} catch (CreateEnvelopeException e) {
+			logger.error("Error setting the envelope", e);
+			e.printStackTrace();
+		}
+		//Extent extent = new Extent(rectCuadricula);
+
+		ViewPort vp = null;
+		try {
+		    vp = (ViewPort) viewPort.clone();
+
+
+		    int auxw = (int) tile.getWidth();
+		    int auxh = (int) tile.getHeight();
+		    Dimension auxdim = new Dimension(auxw, auxh);
+
+		    vp.setImageSize(auxdim);
+		    //vp.setOffset(tile.getLocation());
+		    vp.setEnvelope(rectCuadricula);
+		    vp.setAffineTransform(mat);
+
+		    if (debug)
+		        System.out.println("Tiling.print(): tile "+tileNr+" de "
+		            + getNumTiles() +
+		            "\n, Extent = "+vp.getAdjustedExtent() + " tile: "
+		            + tile);
+
+		} catch (CloneNotSupportedException e) {
+            logger.error("Error clonning the viewport", e);
+            e.printStackTrace();
+        }
+        return vp;
+	}
+	/**
+	 * @return Returns the mat.
+	 */
+	public AffineTransform getAffineTransform() {
+		return mat;
+	}
+	/**
+	 * @param mat The mat to set.
+	 */
+	public void setAffineTransform(AffineTransform mat) {
+		this.mat = mat;
+	}
+	/**
+	 * @return Returns the debug.
+	 */
+	public boolean isDebug() {
+		return debug;
+	}
+	/**
+	 * @param debug The debug to set.
+	 */
+	public void setDebug(boolean debug) {
+		this.debug = debug;
+	}
+}
+
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/MappingAnnotation.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/MappingAnnotation.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/MappingAnnotation.java	(revision 36112)
@@ -0,0 +1,116 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * 
+ * @deprecated
+ *
+ */
+public class MappingAnnotation implements Persistent {
+
+	private int columnText = -1;
+	private int columnRotate = -1;
+	private int columnColor = -1;
+	private int columnHeight = -1;
+	private int columnTypeFont = -1;
+	private int columnStyleFont = -1;
+
+	public MappingAnnotation() {
+		
+	}
+	
+	public int getColumnColor() {
+		return columnColor;
+	}
+
+	public void setColumnColor(int columnColor) {
+		this.columnColor = columnColor;
+	}
+
+	public int getColumnHeight() {
+		return columnHeight;
+	}
+
+	public void setColumnHeight(int columnHeight) {
+		this.columnHeight = columnHeight;
+	}
+
+	public int getColumnRotate() {
+		return columnRotate;
+	}
+
+	public void setColumnRotate(int columnRotate) {
+		this.columnRotate = columnRotate;
+	}
+
+	public int getColumnStyleFont() {
+		return columnStyleFont;
+	}
+
+	public void setColumnStyleFont(int columnStyleFont) {
+		this.columnStyleFont = columnStyleFont;
+	}
+
+	public int getColumnText() {
+		return columnText;
+	}
+
+	public void setColumnText(int columnText) {
+		this.columnText = columnText;
+	}
+
+	public int getColumnTypeFont() {
+		return columnTypeFont;
+	}
+
+	public void setColumnTypeFont(int columnTypeFont) {
+		this.columnTypeFont = columnTypeFont;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+
+		columnText = state.getInt("columnText");
+		columnRotate = state.getInt("columnRotate");
+		columnColor = state.getInt("columnColor");
+		columnHeight = state.getInt("columnHeight");
+		columnTypeFont = state.getInt("columnTypeFont");
+		columnStyleFont = state.getInt("columnStyleFont");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+
+		state.set("columnText", columnText);
+		state.set("columnRotate", columnRotate);
+		state.set("columnColor", columnColor);
+		state.set("columnHeight", columnHeight);
+		state.set("columnTypeFont", columnTypeFont);
+		state.set("columnStyleFont", columnStyleFont);
+
+	}
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				MappingAnnotation.class,
+				"MappingAnnotation",
+				"MappingAnnotation Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldInt("columnText").setMandatory(true);
+		definition.addDynFieldInt("columnRotate").setMandatory(true);
+		definition.addDynFieldInt("columnColor").setMandatory(true);
+		definition.addDynFieldInt("columnHeight").setMandatory(true);
+		definition.addDynFieldInt("columnTypeFont").setMandatory(true);
+		definition.addDynFieldInt("columnStyleFont").setMandatory(true);
+	}
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayerStatus.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayerStatus.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayerStatus.java	(revision 36112)
@@ -0,0 +1,340 @@
+/*
+ * Created on 01-sep-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id: FLayerStatus.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.2  2007-03-06 17:08:55  caballero
+* Exceptions
+*
+* Revision 1.1  2006/09/21 17:23:39  azabala
+* First version in cvs
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+/**
+ * <p>All layers in <i>libFMap</i> can be in a set of <i>states</i>, that their combination represent the <i>status</i> of a layer.</p>
+ * 
+ * <p><code>FLayerStatus</code> class supports the common status for all kind of {@link FLyrDefault FLyrDefault} layers.</p>
+ * 
+ * <p>This means that not necessarily all layers can stay in all possible status, it depends on its particular
+ * nature.</p>
+ * 
+ * <p>Layer status states defined in <code>FLayerStatus</code> are:
+ *  <ul>
+ *  <li><i><b>Available</b></i>: the layer is available if the source of its data is on-line.</li>
+ *  <li><i><b>Visible</b></i>: one layer is visible if it's selected its <i>check box</i> associated in TOC. This implies that 
+ *  layer will be called to be painted unless the necessary data would be unavailable; this situation is more frequent with layers of
+ *  remote services.</li>
+ *  <li><i><b>Active</b></i>: is active if it's selected at the TOC.</li>
+ *  <li><i><b>Dirty</b></i>: is dirty if needs to be refreshed.</li>
+ *  <li><i><b>In TOC</b></i>: if it's being listed in a TOC GUI.</li>
+ *  <li><i><b>Editing</b></i>: if the layer it's being edited now.</li>
+ *  <li><i><b>Writable</b></i>: if can be modified and saved the changes.</li>
+ *  <li><i><b>Cache drawn layers</b></i>: if stores previous draws. This is useful to accelerate the draw of the layer.</li>
+ *  <li><i><b>Driver loaded</b></i>: if driver for managing the layer has been loaded successfully.</li>
+ *  </ul>
+ * </p>
+ * 
+ * @see IFLayerStatus
+ * 
+ * @author azabala
+ */
+public class FLayerStatus implements IFLayerStatus {
+	/**
+	 * <p>Layer's availability: the layer is available if the source of its data is on-line.</p>
+	 */
+	public boolean available;
+	
+	/**
+	 * <p>Layer's visibility: the layer is visible if it's selected its <i>check box</i> associated in TOC. This implies that 
+	 *  layer will tried to be painted unless the necessary data would be unavailable; this situation is more frequent with layers of
+	 *  remote services.</p>
+	 */
+	public boolean visible;
+	
+	/**
+	 * <p>The layer is active if it's selected at the TOC.</p>
+	 */
+	public boolean active;
+	
+	/**
+	 * <p>One layer is dirty if needs to be refreshed.</p>
+	 */
+	public boolean dirty;
+	
+	/**
+	 * <p>The layer is in TOC if it's being listed in a TOC GUI.</p>
+	 */
+	public boolean inTOC;
+	
+	/**
+	 * <p>This parameter reports if the layer it's being edited now.</p>
+	 */
+	public boolean editing;
+	
+	/**
+	 * <p>This parameter reports if the layer can be modified and saved the changes.</p>
+	 */
+	public boolean writable;
+	
+	/**
+	 * <p>This state reports if the layer stores previous draws. That's useful to accelerate the draw of the layer.</p>
+	 */
+	public boolean cacheDrawnLayers;
+
+	
+	/**
+	 * <p>List with the information of the driver errors produced working this layer.</p>
+	 */
+	private ArrayList layerErrors;
+		
+	/**
+	 * <p>This state reports if the driver for managing the layer has been loaded successfully.</p>
+	 */
+	private boolean driverLoaded=true;
+
+	/**
+	 * <p>Creates an instance with the default status of a <code>FLyrDefault</code> layer:
+	 * <br>
+	 *  <ul>
+	 *  <li><b><i>Visible</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Active</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>In TOC</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Editing</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>Cache drawn layers</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>Dirty</i></b>: <code>false</code> .</li>
+	 *  <li><b><i>Available</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Driver loaded</i></b>: <code>true</code> .</li>
+	 *  <li><b><i>Writable</i></b>: <code>false</code> .</li>
+	 *  <li>Without driver errors.</li>
+	 *  </ul>
+	 * </p>
+	 */
+	public FLayerStatus(){
+		this.layerErrors = new ArrayList();
+		visible = true;
+		active = false;
+		inTOC = true;
+		editing = false;
+		cacheDrawnLayers = false;
+		dirty = false;
+		available = true;
+
+		writable = false;
+
+	}
+
+	/**
+	 * <p>Stores information of an exception produced working with a driver of the layer.</p>
+	 * 
+	 * @param error the driver exception
+	 */
+	public void addLayerError(BaseException error){
+		layerErrors.add(error);
+	}
+
+	public FLayerStatus cloneStatus(){
+		FLayerStatus newStatus = new FLayerStatus();
+		newStatus.layerErrors.addAll(this.layerErrors);
+		newStatus.visible = this.visible;
+		newStatus.active = this.active;
+		newStatus.inTOC = this.inTOC;
+		newStatus.editing = this.editing;
+		newStatus.cacheDrawnLayers = this.cacheDrawnLayers;
+		newStatus.dirty = this.dirty;
+		newStatus.available = this.available;
+		newStatus.driverLoaded = this.driverLoaded;	
+		newStatus.writable = this.writable;
+	
+		return newStatus;
+	}
+	
+	
+
+	public boolean equals(Object obj) {
+		FLayerStatus other;
+		if (obj instanceof FLayerStatus) {
+			other = (FLayerStatus) obj;
+		} else{
+			return false;
+		}
+
+		if (other.visible != this.visible 
+				|| other.active != this.active
+				|| other.inTOC != this.inTOC || other.editing != this.editing
+				|| other.cacheDrawnLayers != this.cacheDrawnLayers
+				|| other.dirty != this.dirty
+				|| other.available != this.available
+				|| other.driverLoaded != this.driverLoaded
+				|| other.writable != this.writable) {
+			return false;
+		}
+		
+
+		
+		if ((!other.layerErrors.containsAll(this.layerErrors)) || other.layerErrors.size() != this.layerErrors.size()){
+			return false;
+		}
+		return super.equals(obj);
+	}
+
+	/**
+	 * <p>Gets the number of driver exceptions produced working with the layer.</p>
+	 * 
+	 * @return number of driver exceptions produced
+	 */
+	public int getNumErrors(){
+		return layerErrors.size();
+	}
+
+	/**
+	 * <p>Gets the information of the <i>nth</i> layer driver exception registered in the status.</p>
+	 * 
+	 * @param i ith layer exception registered
+	 * 
+	 * @return the <i>nth</i> layer driver exception registered
+	 */
+	public BaseException getError(int i){
+		return (BaseException) layerErrors.get(i);
+	}
+
+	/**
+	 * <p>Returns if there have been driver errors working with the layer.</p>
+	 * 
+	 * @return <code>true</code> if there have driver errors working with the layer; otherwise <code>false</code>
+	 */
+	public boolean isOk(){
+		return layerErrors.size() == 0;
+	}
+
+	/**
+	 * <p>Returns a list of errors produced in a layer working with its driver.</p>
+	 * 
+	 * @return list errors produced in a layer working with its driver
+	 */
+	public List getErrors() {
+		return layerErrors;
+	}
+
+	/**
+	 * <p>Returns if has been loaded successfully the driver for managing the layer.</p>
+	 * 
+	 * @return <code>true</code> if has been loaded successfully the driver for managing the layer; otherwise <code>false</code>
+	 */
+	public boolean isDriverLoaded() {
+		return driverLoaded;
+	}
+
+	/**
+	 * <p>Sets if has been loaded successfully the driver for managing the layer.</p>
+	 * 
+	 * @param driverLoaded <code>true</code> if has been loaded successfully the driver for managing the layer; otherwise <code>false</code>
+	 */
+	public void setDriverLoaded(boolean driverLoaded) {
+		this.driverLoaded = driverLoaded;
+	}
+
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+
+		visible = state.getBoolean("visible");
+		active = state.getBoolean("active");
+		inTOC = state.getBoolean("inTOC");
+		editing = state.getBoolean("editing");
+		cacheDrawnLayers = state.getBoolean("cacheDrawnLayers");
+		dirty = state.getBoolean("dirty");
+		available = state.getBoolean("available");
+		writable = state.getBoolean("writable");
+		driverLoaded = state.getBoolean("driverLoaded");
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		
+		state.set("visible", visible);
+		state.set("active", active);
+		state.set("inTOC", inTOC);
+		state.set("editing", editing);
+		state.set("cacheDrawnLayers", cacheDrawnLayers);
+		state.set("dirty", dirty);
+		state.set("available", available);
+		state.set("writable", writable);
+		state.set("driverLoaded", driverLoaded);
+	}
+	
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				FLayerStatus.class,
+				"FLayerStatus",
+				"FLayerStatus Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldBoolean("visible").setMandatory(true);
+		definition.addDynFieldBoolean("active").setMandatory(true);
+		definition.addDynFieldBoolean("inTOC").setMandatory(true);
+		definition.addDynFieldBoolean("editing").setMandatory(true);
+		definition.addDynFieldBoolean("cacheDrawnLayers").setMandatory(true);
+		definition.addDynFieldBoolean("dirty").setMandatory(true);
+		definition.addDynFieldBoolean("available").setMandatory(true);
+		definition.addDynFieldBoolean("writable").setMandatory(true);
+		definition.addDynFieldBoolean("driverLoaded").setMandatory(true);
+		//definition.addDynFieldBoolean("locked").setMandatory(true);
+	}
+}
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionEvent.java	(revision 36112)
@@ -0,0 +1,52 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+
+
+/**
+ * <p>Event associated to a selection on a vector layer.</p>
+ * 
+ * @see FMapEvent
+ */
+public class SelectionEvent extends FMapEvent {
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SingleLayerIterator.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SingleLayerIterator.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SingleLayerIterator.java	(revision 36112)
@@ -0,0 +1,96 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.ArrayList;
+
+
+/**
+ * @author fjp
+ *
+ * Class to iterate for all layers in FLayers, but assuring not FLayers is returned.
+ * The layer you receive in next method is a "leaf" layer, not grouped. 
+ */
+public class SingleLayerIterator {
+
+	ArrayList singleLayers  =new ArrayList();
+	int i = 0;
+	int subIndex = 0;	
+	public SingleLayerIterator(FLayers layers)
+	{
+		addSubLayer(layers);
+		
+	}
+
+	public boolean hasNext() {
+		return (i < singleLayers.size());
+	}
+
+	public FLayer next() {
+		FLayer aux = (FLayer) singleLayers.get(i); 
+		i++;
+		return aux;
+	}
+	
+	private void addSubLayer(FLayer lyr) {
+		FLayers layers;
+		if (lyr instanceof FLayers)
+		{
+			layers = (FLayers)lyr;
+			for (int i=0; i < layers.getLayersCount(); i++)
+			{
+				addSubLayer(layers.getLayer(i));
+			}			
+		}
+		else
+		{
+			singleLayers.add(lyr);
+		}		
+	}
+	
+	public void rewind()
+	{
+		i=0;
+	}
+
+}
+
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionEvent.java	(revision 36112)
@@ -0,0 +1,190 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+
+
+/**
+ * <p>Event produced when a layer is been added or removed, or has been added or
+ *  removed, or its visibility or activation state has changed from a collection of layers.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class LayerCollectionEvent extends FMapEvent {
+	/**
+	 * <p>Identifies this event as a action on a layer that has been added.</p>
+	 */
+	private final static int LAYER_ADDED = 0;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that has been removed.</p>
+	 */
+	private final static int LAYER_REMOVED = 2;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that is being added.</p>
+	 */
+	private final static int LAYER_ADDING = 3;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that is being removed.</p>
+	 */
+	private final static int LAYER_REMOVING = 5;
+	
+	/**
+	 * <p>Identifies this event as a action of change of the activation status of a layer.</p>
+	 */
+	private final static int LAYER_ACTIVATION_CHANGED = 6;
+	
+	/**
+	 * <p>Identifies this event as a action of change of the visibility status of a layer.</p>
+	 */
+	private final static int LAYER_VISIBILITY_CHANGED = 7;
+
+	/**
+	 * <p>Reference to the collection of layers.</p>
+	 */
+	private FLayers layers;
+
+	/**
+	 * <p>Reference to the layer which this layer notifies.</p>
+	 */
+	private FLayer affected;
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer added" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerAddedEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_ADDED);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer removed" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerRemovedEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_REMOVED);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer adding" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerAddingEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_ADDING);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer removing" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerRemovingEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_REMOVING);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer activation changed" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerActivationEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_ACTIVATION_CHANGED);
+	}
+
+	/**
+	 * <p>Creates a new layer collection event notifying a "layer visibility changed" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * 
+	 * @return a new layer collection event
+	 */
+	public static LayerCollectionEvent createLayerVisibilityEvent(FLayer lyr){
+		return new LayerCollectionEvent(lyr, LAYER_VISIBILITY_CHANGED);
+	}
+	
+	/**
+	 * <p>Creates a new layer collection event of the specified type.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param eventType type of layer collection event
+	 * 
+	 * @return a new layer collection event
+	 */
+	protected LayerCollectionEvent(FLayer lyr, int eventType) {
+		layers = lyr.getParentLayer();
+		affected = lyr;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the collection of layers which the layer affected belongs.</p>
+	 *
+	 * @return the collection of layers affected
+	 */
+	public FLayers getLayers() {
+		return layers;
+	}
+
+	/**
+	 * <p>Gets the layer that this event references.</p>
+	 *
+	 * @return the layer that this event references
+	 */
+	public FLayer getAffectedLayer() {
+		return affected;
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/DifferentVersionException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/DifferentVersionException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/DifferentVersionException.java	(revision 36112)
@@ -0,0 +1,83 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+/**
+ * Excepci�n que se lanzara cunado exista un problema de versi�n.
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class DifferentVersionException extends Exception {
+	/**
+	 * Crea una nueva DifferentVersionException
+	 */
+	public DifferentVersionException() {
+		super();
+	}
+
+	/**
+	 * Crea una nueva DifferentVersionException
+	 *
+	 * @param arg0
+	 */
+	public DifferentVersionException(String arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Crea una nueva DifferentVersionException
+	 *
+	 * @param arg0
+	 * @param arg1
+	 */
+	public DifferentVersionException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+	/**
+	 * Crea una nueva DifferentVersionException
+	 *
+	 * @param arg0
+	 */
+	public DifferentVersionException(Throwable arg0) {
+		super(arg0);
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/SelectionListener.java	(revision 36112)
@@ -0,0 +1,58 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+/**
+ * <p>The interface <code>SelectionListener</code> defines the interface for an object that listens
+ *  to changes in a vector layer.</p>
+ */
+public interface SelectionListener {
+	/**
+	 * <p>Called when the selection in a vector layer has changed.</p>
+	 * 
+	 * <p>The <code>SelectionEvent</code> event must be launched invoking
+	 *  the <code>fireSelectionEvents</code> method of the layer.</p>
+	 *
+	 * @param e a selection event on a vector layer
+	 */
+	void selectionChanged(SelectionEvent e);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawEvent.java	(revision 36112)
@@ -0,0 +1,97 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.events.FMapEvent;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+
+
+/**
+ * <p>The <code>LayerDrawEvent</code> class represents an event produced on a layer about a drawing change.</p>
+ * <p>This event can be a notification before or after a {@link FLayer FLayer}, {@link FLayers FLayers}, or
+ *  {@link GraphicLayer GraphicLayer} is drawn.</p>
+ */
+public class LayerDrawEvent extends FMapEvent {
+	/**
+	 * <p>The view port the information for drawing the layer in which this event has been produced.</p>
+	 */
+	ViewPort vp;
+	
+	/**
+	 * <p>Reference to an object for rendering 2D on the Java(tm) platform.</p>
+	 */
+	Graphics2D g;
+	
+	/**
+	 * <p>Reference to the layer where this event has been produced.</p>
+	 */
+	FLayer lyr;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  before drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
+	 */
+	public static final int LAYER_BEFORE_DRAW = 101;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  after drawing on a {@link FLayer FLayer} or {@link FLayers FLayers}.
+	 */
+	public static final int LAYER_AFTER_DRAW = 102;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  before drawing on a {@link GraphicLayer GraphicLayer}.
+	 */
+	public static final int GRAPHICLAYER_BEFORE_DRAW = 103;
+	
+	/**
+	 * Public constant that identifies the kind of <code>LayerDrawEvent</code> as an event produced
+	 *  after drawing on a {@link GraphicLayer GraphicLayer}.
+	 */
+	public static final int GRAPHICLAYER_AFTER_DRAW = 104;
+
+	/**
+	 * <p>Creates a new layer draw event with all necessary information.</p>
+	 * 
+	 * @param lyr layer in which the event has been produced
+	 * @param g object for rendering 2D on the Java(tm) platform
+	 * @param vp object with information for drawing the layer in which this event has been produced
+	 * @param eventType identifies the kind of this event: {@linkplain #LAYER_BEFORE_DRAW}, {@linkplain #LAYER_AFTER_DRAW},
+	 *  {@linkplain #GRAPHICLAYER_BEFORE_DRAW} or {@linkplain #GRAPHICLAYER_AFTER_DRAW}.
+	 */
+	public LayerDrawEvent(FLayer lyr, Graphics2D g, ViewPort vp, int eventType) {
+		this.lyr = lyr;
+		this.g = g;
+		this.vp = vp;
+		setEventType(eventType);
+	}
+	
+	/**
+	 * <p>Returns an object for rendering 2-dimensional shapes, text and images on the Java(tm) platform.</p>
+	 * 
+	 * @return object for rendering 2D on the Java(tm) platform
+	 */
+	public Graphics2D getGraphics() {
+		return g;
+	}
+	
+	/**
+	 * <p>Returns the view port the information for drawing the layer in which this event has been produced.</p>
+	 * 
+	 * @return object with information for drawing the layer in which this event has been produced
+	 */
+	public ViewPort getViewPort() {
+		return vp;
+	}
+
+	/**
+	 * <p>Returns a reference to the layer where this event has been produced.</p> 
+	 * 
+	 * @return layer in which this event has been produced
+	 */
+	public FLayer getLayer() {
+		return lyr;
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawingListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawingListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerDrawingListener.java	(revision 36112)
@@ -0,0 +1,58 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+
+
+/**
+ * <p><code>LayerDrawingListener</code> defines listeners
+ *  to catch and handle drawing events from layers.</p>
+ */
+public interface LayerDrawingListener {
+    /**
+ 	 * <p>Called before a layer of type {@link FLayer FLayer} or {@link FLayers FLayers} is drawn.</p>
+ 	 * 
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void beforeLayerDraw(LayerDrawEvent e) throws CancelationException;
+    
+    /**
+     * <p>Process to execute after a layer had been drawn.</p>
+     * 
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void afterLayerDraw(LayerDrawEvent e) throws CancelationException;
+    
+    /**
+     * <p>Process to execute before a {@link GraphicLayer GraphicLayer} had been drawn.</p>
+     *
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void beforeGraphicLayerDraw(LayerDrawEvent e) throws CancelationException;
+
+    /**
+     * <p>Process to execute after a {@link GraphicLayer GraphicLayer} had been drawn.</p>
+     * 
+     * @param e a layer event object
+     * 
+     * @throws CancelationException if cancels the operation, this exception will have the message
+     *  that user will see.
+     * 
+     * @see LayerDrawEvent
+     */
+    void afterLayerGraphicDraw(LayerDrawEvent e) throws CancelationException;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerCollectionListener.java	(revision 36112)
@@ -0,0 +1,122 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+/**
+ * <p><code>LayerCollectionListener</code> defines listeners for events that can be produced in a
+ *  collection of layers.</p>
+ */
+public interface LayerCollectionListener {
+    /**
+ 	 * <p>Called when a layer has been added or replaced in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     */
+    void layerAdded(LayerCollectionEvent e);
+
+    /**
+ 	 * <p>Called when a layer has been moved in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     */
+    void layerMoved(LayerPositionEvent e);
+
+    /**
+  	 * <p>Called when a layer has been removed from the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     */
+    void layerRemoved(LayerCollectionEvent e);
+
+    /**
+ 	 * <p>Called when a layer is just going to be added or replaced in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the adding operation, this exception will have the message
+     *  that user will see.
+     */
+    void layerAdding(LayerCollectionEvent e) throws CancelationException;
+
+    /**
+ 	 * <p>Called when a layer is just going to be moved in the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the moving operation, this exception will have the message
+     *  that user will see.
+     */
+    void layerMoving(LayerPositionEvent e) throws CancelationException;
+
+    /**
+ 	 * <p>Called when a layer is just going to be removed from the internal list of layers.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the removing operation, this exception will have the message
+     *  that user will see.
+     */
+    void layerRemoving(LayerCollectionEvent e) throws CancelationException;
+
+
+    ///**
+    // * <p>Called when the activation state of the collection of layers has changed.</p>
+    // *
+    // * @param e a layer collection event object
+    // *
+    // * @throws CancelationException Si se quiere cancelar la operaci�n. El
+    // *         mensaje de la excepci�n es el que se mostrar� al usuario en su
+    // *         caso
+    // */
+    //  useless. Please, use LayerListener interface instead
+    // void activationChanged(LayerCollectionEvent e) throws CancelationException;
+
+    /**
+ 	 * <p>Called when the visibility of the collection of layers has changed.</p>
+     *
+     * @param e a layer collection event object
+     *
+     * @throws CancelationException if cancels the operation of change visibility, this exception will have the
+     *  message that user will see.
+     */
+    void visibilityChanged(LayerCollectionEvent e) throws CancelationException;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/AbstractLinkProperties.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/AbstractLinkProperties.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/AbstractLinkProperties.java	(revision 36112)
@@ -0,0 +1,151 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.geom.Point2D;
+import java.net.URI;
+
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+
+
+/**
+ * This is an abstract class to keep the properties of the HyperLink. One layer may have
+ * one or zero LinkProperties. The properties of a Link are:
+ * - fieldName, the field�s name of the selected column of the table associated to the
+ * 	layer
+ * - extName, the name of the extension that the usser indicates
+ * - typeLink, the type of the Link
+ * The class implements  'IPersistance' interface to provide persistance to the properties
+ * of HyperLink
+ * 
+ * @deprecated this functionality has extracted of the core in gvSIG 2.0 
+ */
+public abstract class AbstractLinkProperties implements Persistent {
+	private String fieldName;
+	private String extName;
+	private int typeLink;
+
+
+	/**
+	 * Default constructor
+	 */
+	public AbstractLinkProperties(){
+		fieldName=null;
+		extName=null;
+		typeLink=-1;
+	}
+
+	/**
+	 * Provides an array with URIs. Returns one URI by geometry that includes the point
+	 * in its own geometry limits with a allowed tolerance.
+	 * @param layer, the layer
+	 * @param point, the point to check that is contained or not in the geometries in the layer
+	 * @param tolerance, the tolerance allowed. Allowed margin of error to detect if the  point
+	 * 		is contained in some geometries of the layer
+	 * @return
+	 * @throws ReadException
+	 * @throws BehaviorException
+	 */
+	public abstract URI[] getLink(FLayer layer, Point2D point, double tolerance) throws ReadException;
+
+	/**
+	 * Gets the field�s name of the table that the user has selected
+	 * @return this name of the field
+	 */
+	public String getField(){
+		return this.fieldName;
+	}
+
+	/**
+	 * Sets the field�s name
+	 * @param campo, the field�s name
+	 */
+	public void setField(String campo){
+		this.fieldName=campo;
+	}
+
+	/**
+	 * Gets the type of the HyperLink
+	 * @return the type
+	 */
+	public int getType(){
+		return this.typeLink;
+	}
+
+	/**
+	 * Sets the type of the HyperLink
+	 * @param tipo
+	 */
+	public void setType(int tipo){
+		this.typeLink=tipo;
+	}
+
+	/**
+	 * Gets the extension of the files that the user has indicated like properties of the
+	 * HyperLink, this extension is added to the content of the field selected in the table
+	 *
+	 * @return the extension
+	 */
+	public String getExt(){
+		return this.extName;
+	}
+
+	/**
+	 * Sets the extension
+	 * @param extension, the extension of the files
+	 */
+	public void setExt(String extension){
+		this.extName=extension;
+	}
+
+//	/**
+//	 * Provides persistance to the properties of the HyperLink.
+//	 * @return XMLEntity with the information of the HyperLink
+//	 */
+//	public XMLEntity getXMLEntity() {
+//		XMLEntity xml=new XMLEntity();
+//		xml.putProperty("typeChild","linkProperties");
+//		xml.putProperty("extName",extName);
+//		xml.putProperty("fieldName",fieldName);
+//		xml.putProperty("typeLink",typeLink);
+//		return xml;
+//	}
+//
+//	/**
+//	 * Sets the properties of the HyperLink using a XMLEntity that contains the information
+//	 * @param XMLEntity
+//	 */
+//	public void setXMLEntity(XMLEntity xml) {
+//		extName=xml.getStringProperty("extName");
+//		fieldName=xml.getStringProperty("fieldName");
+//		typeLink=xml.getIntProperty("typeLink");
+//	}
+	
+	/**
+	 * Saves the internal state of the object on the provided
+	 * PersistentState object.
+	 * 
+	 * @param state
+	 */
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("extName",extName);
+		state.set("fieldName",fieldName);
+		state.set("typeLink",typeLink);
+	}
+
+	/**
+	 * Set the state of the object from the state passed as parameter.
+	 *
+	 * @param state
+	 */
+	public void loadFromState(PersistentState state) throws PersistenceException {
+		
+		extName = state.getString("extName");
+		fieldName = state.getString("fieldName");
+		typeLink = state.getInt("typeLink");
+	}
+	
+	
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/IFLayerStatus.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/IFLayerStatus.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/IFLayerStatus.java	(revision 36112)
@@ -0,0 +1,68 @@
+/*
+ * Created on 01-sep-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id: IFLayerStatus.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.1  2006-09-21 17:23:39  azabala
+* First version in cvs
+*
+*
+*/
+package org.gvsig.fmap.mapcontext.layers;
+
+import org.gvsig.tools.persistence.Persistent;
+
+/**
+ * <p>According to the particular constitution of a layer, it can be in a set of states,
+ *  some of them simultaneously, that altogether represent its <i>status</i>.</p>
+ *   
+ * <p><code>IFLayerStatus</code> is a "marked" interface (we don't define any methods), that represents
+ *  the common status of all kind of layers.</p>
+ * 
+ * @author azabala
+ */
+public interface IFLayerStatus extends Persistent {
+}
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/CancelationException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/CancelationException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/CancelationException.java	(revision 36112)
@@ -0,0 +1,91 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+/**
+ * <p>There are classes and event handlers that allow cancel some of their operations when they are running. 
+ * If fails that cancellation, a <code>CancelationException</code> exception is thrown.</p>
+ * 
+ * @see RuntimeException
+ */
+public class CancelationException extends RuntimeException {
+	/**
+	 * <p>Constructs a new cancelation exception with <code>null</code> as its detail message.
+	 *  The cause is not initialized, and may subsequently be initialized by a call to <code>initCause</code>.</p>
+	 */
+	public CancelationException() {
+		super();
+	}
+
+	/**
+	 * <p>Constructs a new cancelation exception with the specified detail message. The cause is not
+	 *  initialized, and may subsequently be initialized by a call to <code>initCause</code>.
+	 * 
+	 * @param message the detail message. The detail message is saved for later retrieval by the <code>getMessage()</code> method.
+	 */
+	public CancelationException(String message) {
+		super(message);
+	}
+
+	/**
+	 * <p>Constructs a new cancelation exception with the specified detail message and cause.</p>
+	 * <p>Note that the detail message associated with cause is not automatically incorporated in this
+	 *  exception's detail message.</p>
+	 *  
+	 * @param message the detail message (which is saved for later retrieval by the <code>getMessage()</code> method).
+	 * @param cause the cause (which is saved for later retrieval by the <code>getCause()</code> method). (A <code>null</code>
+	 *  value is permitted, and indicates that the cause is nonexistent or unknown).
+	 */
+	public CancelationException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * <p>Constructs a cancelation exception with the specified <code>cause</code> and a detail message of <code>(cause==null ?
+	 *  null : cause.toString())</code> (which typically contains the class and detailed information about cause).
+	 *  
+	 * @param cause the cause (which is saved for later retrieval by the <code>getCause()</code> method). (A <code>null</code>
+	 *  value is permitted, and indicates that the cause is nonexistent or unknown).
+	 */
+	public CancelationException(Throwable cause) {
+		super(cause);
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerPositionEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerPositionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerPositionEvent.java	(revision 36112)
@@ -0,0 +1,130 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+
+/**
+ * <p>Event produced when a layer has been or is being moved from a collection of layers.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class LayerPositionEvent extends LayerCollectionEvent {
+	/**
+	 * <p>If this event is a <i>LAYER_MOVED</i> type, stores the previous index of the affected layer in the layer
+	 *  collection; otherwise its value will be the same as the <code>newPos</code> one.</p>
+	 */
+	private int oldPos;
+
+	/**
+	 * <p>The new index in the layer collection of the layer affected.</p>
+	 */
+	private int newPos;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that is being moved.</p>
+	 */
+	private final static int LAYER_MOVING = 4;
+
+	/**
+	 * <p>Identifies this event as a action on a layer that has been moved.</p>
+	 */
+	private final static int LAYER_MOVED = 1;
+
+	/**
+	 * <p>Creates a new layer position event notifying a "layer moved" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param oldp previous index of the affected layer in the layer collection
+	 * @param newp new index of the affected layer in the layer collection
+	 * 
+	 * @return a new layer position event
+	 */
+	public static LayerPositionEvent createLayerMovedEvent(FLayer lyr, int oldp, int newp){
+		return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVED);
+	}
+
+	/**
+	 * <p>Creates a new layer position event notifying a "layer moving" action.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param oldp previous index of the affected layer in the layer collection
+	 * @param newp new index of the affected layer in the layer collection
+	 * 
+	 * @return a new layer position event
+	 */
+	public static LayerPositionEvent createLayerMovingEvent(FLayer lyr, int oldp, int newp){
+		return new LayerPositionEvent(lyr, oldp, newp, LAYER_MOVING);
+	}
+
+	/**
+	 * <p>Creates a new layer position event of the specified type.</p>
+	 * 
+	 * @param lyr layer affected by the action
+	 * @param oldp previous index of the affected layer in the layer collection
+	 * @param newp new index of the affected layer in the layer collection
+	 * @param eventType type of layer collection event
+	 * 
+	 * @return a new layer position event
+	 */
+	private LayerPositionEvent(FLayer lyr, int oldp, int newp, int eventType) {
+		super(lyr, eventType);
+		oldPos = oldp;
+		newPos = newp;
+	}
+
+	/**
+	 * <p>Gets the previous index of the affected layer in the layer collection.</p>
+	 *
+	 * @return the previous index
+	 */
+	public int getOldPos() {
+		return oldPos;
+	}
+
+	/**
+	 * <p>Gets the new index of the affected layer in the layer collection.</p>
+	 *
+	 * @return the new index
+	 */
+	public int getNewPos() {
+		return newPos;
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java	(revision 36112)
@@ -0,0 +1,37 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* 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 2
+* 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.
+*
+* 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.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.visitor.Visitor;
+
+public interface LayersVisitor extends Visitor {
+	public void visit(FLayer layer) throws BaseException;
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/InfoByPoint.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/InfoByPoint.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/InfoByPoint.java	(revision 36112)
@@ -0,0 +1,147 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.geom.primitive.Point;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.task.Cancellable;
+
+
+/**
+ * <p>Interface that must be implemented by layers which support the operation "<i>information by point</i>".</p>
+ *
+ * <p>That operation allows get meta-information from a point and an area around, of a layer.</p>
+ */
+public interface InfoByPoint {
+
+    /**
+     * <p>
+     * Executes a consultation about information of a point on the layer.
+     * </p>
+     * 
+     * <p>
+     * There is an area around the point where will got the information.
+     * </p>
+     * 
+     * @param p
+     *            point where is the consultation
+     * @param tolerance
+     *            permissible margin around the coordinates of the point where
+     *            the method will got the information. Each
+     *            singular implementation of this method would use it in a
+     *            different way. The coordinates also depend on the
+     *            implementation.
+     * @param cancel
+     *            shared object that determines if this layer can continue being
+     *            drawn
+     * 
+     * @return a DynObjectSet. If the InfoByPoint Object is a vector layer it
+     *         should return a FeatureSet.
+     * @throws DataException
+     *             TODO
+     * @throws LoadLayerException
+     *             any exception produced using the driver.
+     *             
+     * @deprecated use instead {@link #getInfo(Point, double)}
+     */
+    public DynObjectSet getInfo(java.awt.Point p, double tolerance, Cancellable cancel)
+        throws LoadLayerException, DataException;
+
+    /**
+     * <p>
+     * Executes a consultation about information of a point on the layer.
+     * </p>
+     * 
+     * <p>
+     * There is an area around the point where will got the information.
+     * </p>
+     * 
+     * @param p
+     *            point where is the consultation
+     * @param tolerance
+     *            permissible margin around the coordinates of the point where
+     *            the method will got the information. Each
+     *            singular implementation of this method would use it in a
+     *            different way. The coordinates also depend on the
+     *            implementation.
+     * @param cancel
+     *            shared object that determines if this layer can continue being
+     *            drawn
+     * 
+     * @param fast
+     *            if true try to reuse objects as much as possible to make the
+     *            object iteration faster. If true, DynObjects got through the
+     *            returned set must not be stored unless cloned.
+     * 
+     * @return a DynObjectSet. If the InfoByPoint Object is a vector layer it
+     *         should return a FeatureSet.
+     * @throws DataException
+     *             TODO
+     * @throws LoadLayerException
+     *             any exception produced using the driver.
+     *             
+     * @deprecated use instead {@link #getInfo(Point, double)}
+     */
+    public DynObjectSet getInfo(java.awt.Point p, double tolerance, Cancellable cancel,
+        boolean fast) throws LoadLayerException, DataException;
+
+    /**
+     * <p>
+     * Executes a consultation about information of a point on the layer.
+     * </p>
+     * 
+     * <p>
+     * There is an area around the point where will got the information.
+     * </p>
+     * 
+     * @param p
+     *            point in map coordinates where is the consultation
+     * @param tolerance
+     *            permissible margin around the coordinates of the point where
+     *            the method will got the information. Each
+     *            singular implementation of this method would use it in a
+     *            different way. The unit are in map coordinates.
+     */            
+    public DynObjectSet getInfo(Point p, double tolerance) throws LoadLayerException, DataException;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/Classifiable.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/Classifiable.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/Classifiable.java	(revision 36112)
@@ -0,0 +1,97 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+
+/**
+ * <p>Interface that all layers that can be classifiable, must implement.</p>
+ * <p>The interface <code>Classifiable</code> allows classify a layer in <i>raster</i> or <i>vector</i>,
+ *  and then, generates a legend.</p>
+ */
+public interface Classifiable {
+	/**
+	 * Adds the specified legend listener to receive legend events from the inner legend.
+	 *  If the parameter is null, no exception is thrown and no action is performed.
+	 *
+	 * @param listener the legend listener
+	 *
+	 * @see #removeLegendListener(LegendListener)
+	 */
+	void addLegendListener(LegendListener listener);
+
+	/**
+	 * Removes the specified legend listener so that it no longer receives legend events from the inner
+	 *  legend. This method performs no function, nor does it throw an exception, if the listener specified
+	 *  by the argument was not previously added to the legend. If the parameter is null, no exception is
+	 *  thrown and no action is performed.
+	 *
+	 * @param listener the legend listener
+	 *
+	 * @see #addLegendListener(LegendListener)
+	 */
+	void removeLegendListener(LegendListener listener);
+
+	/**
+	 * Returns the inner legend.
+	 *
+	 * @return Legend.
+	 */
+	public ILegend getLegend();
+
+	/**
+	 * <p>Returns the type of the shape.</p>
+	 * <p>All geometry types are defined in <code>Geometry.TYPES</code>.
+	 *  For getting the equivalent shape of a geometry type, you must use a method like
+	 *  <code>{@linkplain SHPFileWrite#getShapeType()}</code>.</p>
+	 *
+	 * @return the type of this shape.
+	 * @throws ReadException
+	 *
+	 * @see Geometry
+	 * @see Constant
+	 *
+	 * @throws ReadDriverException if the driver fails reading the data.
+	 */
+	public int getShapeType() throws ReadException;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableRaster.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableRaster.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableRaster.java	(revision 36112)
@@ -0,0 +1,72 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.mapcontext.rendering.legend.IRasterLegend;
+
+
+/**
+ * <p>Interface that all raster layers that can be classifiable and can have associated a legend,
+ *  must implement.</p>
+ *
+ * @see Classifiable
+ */
+public interface ClassifiableRaster extends Classifiable {
+	/**
+	 * <p>Sets the layer's legend as a raster legend.</p>
+	 *
+	 * @param r the legend with raster data
+	 *
+	 * @throws DriverException if fails the driver used in this method.
+	 */
+	void setLegend(IRasterLegend r);
+
+	/**
+	 * <p>Returns the type of this shape.</p>
+	 * <p>All geometry types are defined in <code>Geometry.TYPES</code>, and their shape equivalent in <code>FConstant</code>.</p>
+	 *
+	 * @return the type of this shape
+	 *
+	 * @see Geometry
+	 * @see Constant
+	 */
+	int getShapeType();
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java	(revision 36112)
@@ -0,0 +1,36 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* 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 2
+* 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.
+*
+* 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.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2008 IVER T.I. S.A.   {{Task}}
+*/
+
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.visitor.Visitable;
+
+public interface LayersVisitable extends Visitable {
+	public void accept(LayersVisitor visitor) throws BaseException;
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayersVisitable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ComposedLayer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ComposedLayer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ComposedLayer.java	(revision 36112)
@@ -0,0 +1,142 @@
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.LayerDrawEvent;
+import org.gvsig.tools.task.Cancellable;
+
+/**
+ * Abstract class for the classes that make able
+ * a single draw for a layers group
+ *
+ * @see  org.gvsig.fmap.mapcontext.layers.FLayer#newComposedLayer()
+ */
+public abstract class ComposedLayer {
+
+	ArrayList pendingLayersEvents= new ArrayList();
+	MapContext mapContext = null;
+
+	public ComposedLayer(){
+
+	}
+
+	public void setMapContext(MapContext mapContext) {
+		this.mapContext = mapContext;
+	}
+
+	/**
+	 * Checks if the layer can be added to this group
+	 *
+	 * @param layer
+	 * @return layer can be added or not
+	 */
+	public abstract boolean canAdd(FLayer layer);
+
+	/**
+	 * Adds the layer to the draw group.
+	 * You have to implements the doAdd(FLayer) method.
+	 *
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#canAdd(FLayer)
+	 *
+	 * @param layer
+	 * @throws Exception
+	 */
+	public final void add(FLayer layer) throws Exception {
+		if (this.mapContext == null){
+			this.mapContext =layer.getMapContext();
+		}
+        doAdd(layer);
+    	pendingLayersEvents.add(layer);
+	}
+
+	/**
+	 * Draws all the group in one pass
+	 * You have to implements the doDraw method.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+    public final void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale) throws ReadException {
+    	doDraw(image, g, viewPort, cancel, scale);
+    	fireLayerDrawingEvents(g,viewPort);
+		pendingLayersEvents.clear();
+    }
+
+	/**
+	 * Prints all the group in one pass
+	 * You have to implements the doDraw method.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+    public final void print(Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale,PrintAttributes properties) throws ReadException {
+    	doPrint(g, viewPort, cancel, scale,properties);
+		pendingLayersEvents.clear();
+    }
+
+	/**
+	 * Fires the event LayerDrawEvent.LAYER_AFTER_DRAW for every
+	 * layers of the group.
+	 *
+	 *
+	 *  @see org.gvsig.fmap.mapcontext.layers.LayerDrawEvent
+	 *
+	 */
+	private void fireLayerDrawingEvents(Graphics2D g, ViewPort viewPort) {
+		Iterator iter = pendingLayersEvents.iterator();
+		LayerDrawEvent afterEvent;
+		FLayer layer = null ;
+		while (iter.hasNext()) {
+			layer =(FLayer)iter.next();
+			afterEvent = new LayerDrawEvent(layer, g, viewPort, LayerDrawEvent.LAYER_AFTER_DRAW);
+			// System.out.println("+++ evento " + afterEvent.getLayer().getName());
+			mapContext.fireLayerDrawingEvent(afterEvent);
+		}
+	}
+
+
+	/**
+	 * Adds the layer to the draw group.
+	 * Specific implementation.
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#add(FLayer)
+	 *
+	 * @see org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#canAdd(FLayer)
+	 *
+	 * @param layer
+	 * @throws Exception
+	 */
+	protected abstract void doAdd(FLayer layer) throws Exception ;
+
+	/**
+	 * Draws all the group in one pass.
+	 * Specific implementation.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+	protected abstract void doDraw(BufferedImage image, Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale) throws ReadException ;
+
+	/**
+	 * Prints all the group in one pass.
+	 * Specific implementation.
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer#print(Graphics2D, ViewPort, Cancellable, double)
+	 *
+	 * @see  org.gvsig.fmap.mapcontext.layers.FLayer#print(Graphics2D, ViewPort, Cancellable, double)
+	 */
+	protected abstract void doPrint(Graphics2D g, ViewPort viewPort,
+			Cancellable cancel,double scale,PrintAttributes properties) throws ReadException ;
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/IHasImageLegend.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/IHasImageLegend.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/IHasImageLegend.java	(revision 36112)
@@ -0,0 +1,52 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import java.awt.Image;
+
+public interface IHasImageLegend {
+
+	Image getImageLegend();
+	String getPathImage();
+
+}
+
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerCollection.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerCollection.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerCollection.java	(revision 36112)
@@ -0,0 +1,278 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import java.awt.Graphics2D;
+
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.CancelationException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener;
+
+
+
+/**
+ * <p>Interface with methods for a collection of layers.</p>
+ */
+public interface LayerCollection extends LayersVisitable {
+
+	/**
+	 * Value used to specify the insertion at the beginning.
+	 */
+	public final static int BEGIN = 0;
+	/**
+	 * Value used to specify the insertion at the end.
+	 */
+	public final static int END = 1;
+	/**
+	 * Value used to specify the insertion before an element.
+	 */
+	public final static int BEFORE = 2;
+	/**
+	 * Value used to specify the insertion after an element.
+	 */
+	public final static int AFTER = 3;
+
+	/**
+	 * <p>Adds a listener of events produced on a collection of layers.</p>
+	 *
+	 * @param listener a <code>LayerCollectionListener</code>
+	 *
+	 * @see #removeLayerCollectionListener(LayerCollectionListener)
+	 */
+	public void addLayerCollectionListener(LayerCollectionListener listener);
+
+	/**
+	 * <p>Removes a listener of events produced on a collection of layers.</p>
+	 *
+	 * @param listener a <code>LayerCollectionListener</code>
+	 *
+	 * @see #addLayerCollectionListener(LayerCollectionListener)
+	 */
+	public void removeLayerCollectionListener(LayerCollectionListener listener);
+
+	/**
+	 * <p>Adds a new layer to this collection.</p>
+	 *
+	 * @param layer the new layer
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 * @throws LoadLayerException any exception produced loading the layer.
+	 *
+	 * @see #removeLayer(FLayer)
+	 * @see #removeLayer(int)
+	 * @see #removeLayer(String)
+	 */
+	public void addLayer(FLayer layer) throws CancelationException, LoadLayerException;
+
+	/**
+	 * <p>Adds a new layer to this collection before or after an element if supplied, 
+	 * and if not at the beginning or end of the collection.</p>.</p>
+	 *
+	 * @param layer a FLayer to move
+	 * @param group a LayerCollection in which the layer has to be moved
+	 * @param where the position parameter. The valid values are:<br>
+	 * 	0 = BEGIN (first position)<br>
+	 * 	1 = END (last position)<br>
+	 * 	2 = BEFORE (before target layer)<br>
+	 * 	3 = AFTER (after target layer)<br>
+	 * 
+	 * @param adjoiningLayer a FLayer a layer adjacent to where to insert the layer.
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 * @throws LoadLayerException any exception produced loading the layer.
+	 *
+	 * @see #moveTo(FLayer, LayerCollection, int, FLayer)
+	 */
+	public void addLayer(FLayer layer, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException ;
+
+	/**
+	 * <p>Moves a layer of the collection to another position in internal list. It doesn't consider sub-nodes of layers.</p>
+	 *
+	 * @param from origin position
+	 * @param to destination position
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 */
+	public void moveTo(int from, int to) throws CancelationException;
+
+	/**
+	 * <p>Removes a layer from this collection.</p>
+	 *
+	 * @param lyr a layer
+	 *
+	 * @throws CancelationException any exception produced during the cancellation of the driver.
+	 *
+	 * @see #removeLayer(int)
+	 * @see #removeLayer(String)
+	 * @see #addLayer(FLayer)
+	 */
+	public void removeLayer(FLayer lyr) throws CancelationException;
+
+	/**
+	 * <p>Removes a layer using its identifier.</p>
+	 *
+	 * @param idLayer layer identifier
+	 *
+	 * @see #removeLayer(FLayer)
+	 * @see #removeLayer(String)
+	 * @see #addLayer(FLayer)
+	 */
+	public void removeLayer(int idLayer);
+
+	/**
+	 * <p>Removes a layer using its name.</p>
+	 *
+	 * @param layerName the name of the layer
+	 *
+	 * @see #removeLayer(FLayer)
+	 * @see #removeLayer(int)
+	 * @see #addLayer(FLayer)
+	 */
+	public void removeLayer(String layerName);
+
+	/**
+	 * <p>Returns an array with all visible layers in this collection.</p>
+	 *
+	 * @return array with first-level visible layer nodes, or <code>null</code> if no there is no layer visible
+	 *
+	 * @see #setAllVisibles(boolean)
+	 */
+	public FLayer[] getVisibles();
+
+	/**
+	 * <p>Returns an array with all active layers in this collection.</p>
+	 *
+	 * @return array with first-level active layer nodes, or <code>null</code> if no there is no layer actived
+	 *
+	 * @see #setAllActives(boolean)
+	 */
+	public FLayer[] getActives();
+
+	/**
+	 * <p>Returns the ith-output directed son (from bottom up) of this collection.</p>
+	 *
+	 * @param index index of the ith-output layer in this collection.
+	 *
+	 * @return a layer
+	 *
+	 * @see #getLayer(String)
+	 */
+	public FLayer getLayer(int index);
+
+	/**
+	 * <p>Returns a first-level layer of this collection, using its name.</p>
+	 *
+	 * @param layerName name of a layer of this collection
+	 *
+	 * @return a layer
+	 *
+	 * @see #getLayer(int)
+	 */
+	public FLayer getLayer(String layerName);
+
+	/**
+	 * <p>Returns the number of layers that are at the first level inside this one.</p>
+	 *
+	 * <p>Doesn't counts the sublayers (of <code>FLayers</code> subnodes).</p>
+	 *
+	 * @return number >= 0 with layers that are at the same first-level
+	 *
+	 * @see #getLayer(int)
+	 * @see #getLayer(String)
+	 */
+	public int getLayersCount();
+
+	/**
+	 * <p>Changes the status of all layers to active or inactive.</p>
+	 *
+	 * @param active a boolean value
+	 *
+	 * @see #getActives()
+	 */
+	public void setAllActives(boolean active);
+
+	/**
+	 * <p>Changes the status of all layers to visible or invisible.</p>
+	 *
+	 * @param visible a boolean value
+	 *
+	 * @see #getVisibles()
+	 */
+	public void setAllVisibles(boolean visible);
+
+
+	public void beginDraw(Graphics2D g, ViewPort viewPort);
+	public void endDraw(Graphics2D g, ViewPort viewPort);
+	
+	/**
+	 * <p>Moves a layer from this collection to another collection 
+	 * before or after an element if supplied, 
+	 * and if not at the beginning or end of the collection.</p>
+	 *
+	 * @param layer a FLayer to move
+	 * @param group a LayerCollection in which the layer has to be moved
+	 * @param where the position parameter. The valid values are:<br>
+	 * 	0 = BEGIN (first position)<br>
+	 * 	1 = END (last position)<br>
+	 * 	2 = BEFORE (before target layer)<br>
+	 * 	3 = AFTER (after target layer)<br>
+	 * 
+	 * @param adjoiningLayer a FLayer a layer adjacent to where to insert the layer.
+	 * @throws LayerNotFoundInCollectionException 
+	 * 
+	 * @see #addLayer(FLayer, int, FLayer)
+	 */
+	public void move(FLayer layer, LayerCollection group, int where, FLayer adjoiningLayer) throws LayerNotFoundInCollectionException;
+
+	/**
+	 * <p>Moves a layer from this collection to the end of another collection.</p>
+	 *
+	 * @param layer a FLayer to move
+	 * @param group a LayerCollection in which the layer has to be moved
+	 * @throws LayerNotFoundInCollectionException 
+	 *
+	 */
+	public void move(FLayer layer, LayerCollection group);
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableVectorial.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableVectorial.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/ClassifiableVectorial.java	(revision 36112)
@@ -0,0 +1,61 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+
+/**
+ * <p>All vector layers that can be classifiable and can have associated a legend, must implement
+ *  <code>ClassifiableVectorial</code>.</p>
+ *
+ * @see Classifiable
+ */
+public interface ClassifiableVectorial extends Classifiable{
+	/**
+	 * <p>Sets the layer's legend as a vector legend.</p>
+	 *
+	 * @param r the legend with vector data
+	 *
+	 * @throws LegendLayerException if fails setting the legend to this layer.
+	 */
+	void setLegend(IVectorLegend r) throws LegendLayerException;
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java	(revision 36112)
@@ -0,0 +1,21 @@
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.tools.exception.BaseException;
+
+public class LayerNotFoundInCollectionException extends BaseException {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1936414534310013616L;
+    private final static String MESSAGE_FORMAT = "Layer '%(layer)' not found in collection '%(collection)'.";
+    private final static String MESSAGE_KEY = "_LayerNotFoundInCollectionException";
+    
+    public LayerNotFoundInCollectionException(FLayer layer, LayerCollection collection){
+        super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
+        setValue("layer", layer.getName());
+        setValue("collection", collection.toString());
+    }
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/LayerNotFoundInCollectionException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/SingleLayer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/SingleLayer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/operations/SingleLayer.java	(revision 36112)
@@ -0,0 +1,78 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers.operations;
+
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+
+/**
+ * DOCUMENT ME!
+ *
+ */
+public interface SingleLayer extends FLayer {
+	/**
+	 * M�todo que devuelve el DataStore del que saca los datos la capa.
+	 *
+	 * @return DataStore de la capa.
+	 */
+	public DataStore getDataStore();
+
+	/**
+	 * M�todo que devuelve el DataStore del que saca los datos la capa.
+	 *
+	 * @param dataStore
+	 *            a insertar.
+	 *
+	 * @throws LoadLayerException
+	 * @throws {@link UnsupportedOperationException}
+	 *
+	 * @deprecated ???? creo que ya no deber�a estar en inteface
+	 */
+	public void setDataStore(DataStore dataStore) throws LoadLayerException;
+
+    /**
+     * By default null
+     * @return
+     */
+//    public Strategy getStrategy();
+//    public void setStrategy(Strategy s);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerFactory.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerFactory.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/LayerFactory.java	(revision 36112)
@@ -0,0 +1,190 @@
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.DALLocator;
+import org.gvsig.fmap.dal.DataManager;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.InitializeException;
+import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.mapcontext.MapContextManager;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+
+/**
+ * Crea un adaptador del driver que se le pasa como par�metro en los m�todos
+ * createLayer. Si hay memoria suficiente se crea un FLyrMemory que pasa todas
+ * las features del driver a memoria
+ */
+public class LayerFactory {
+//	final static private Logger logger = LoggerFactory.getLogger(LayerFactory.class);
+
+	private static LayerFactory instance = null;
+
+
+
+	public static LayerFactory getInstance() {
+		if (instance == null) {
+			instance = new LayerFactory();
+		}
+		return instance;
+	}
+
+	/**
+	 * Guarda registro de que clase de capa debe usar para un determinado Store
+	 *
+	 * como clave usamos el nombre de registro del dataStore
+	 */
+	private Map layersToUseForStore = new HashMap();
+
+	/**
+	 * Registra que clase tiene que usar para un {@link DataStore} determinado. <br>
+	 * Por defecto, si el
+	 *
+	 *
+	 * @param dataStoreName
+	 *            Nombre de registro del {@link DataStore} dentro del
+	 *            {@link DataManager}
+	 * @param layerClassToUse
+	 *            clase que implementa {@link SingleLayer}
+	 * @return
+	 */
+
+	public boolean registerLayerToUseForStore(String dataStoreName,
+			Class layerClassToUse) {
+
+		DataManager dm = DALLocator.getDataManager();
+		DataStoreParameters dsparams;
+		try {
+			dsparams = dm.createStoreParameters(dataStoreName);
+		} catch (InitializeException e) {
+			e.printStackTrace();
+			return false;
+		} catch (ProviderNotRegisteredException e) {
+			e.printStackTrace();
+			return false;
+		}
+		if (!layerClassToUse.isAssignableFrom(SingleLayer.class)) {
+			return false;
+		}
+		this.layersToUseForStore.put(dsparams.getDataStoreName(),
+				layerClassToUse);
+
+		return true;
+	}
+
+	public boolean registerLayerToUseForStore(Class storeClass,
+			Class layerClassToUse) {
+
+//		DataManager dm = DALLocator.getDataManager();
+		if (!DataStore.class.isAssignableFrom(storeClass)) {
+			return false;
+		}
+
+		if (!SingleLayer.class.isAssignableFrom(layerClassToUse)
+				|| !FLayer.class.isAssignableFrom(layerClassToUse)) {
+			return false;
+		}
+		this.layersToUseForStore.put(storeClass,
+				layerClassToUse);
+
+		return true;
+	}
+
+	private Class getLayerClassFor(DataStore store) {
+		Class result = (Class) this.layersToUseForStore.get(store.getName());
+		if (result == null) {
+			Iterator iter = this.layersToUseForStore.entrySet().iterator();
+			Map.Entry entry;
+			Class key;
+			while (iter.hasNext()) {
+				entry = (Entry) iter.next();
+				if (entry.getKey() instanceof Class) {
+					key = (Class) entry.getKey();
+					if (key.isAssignableFrom(store.getClass())) {
+						result = (Class) entry.getValue();
+						break;
+					}
+				}
+			}
+		}
+		return result;
+
+	}
+
+
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1
+	 * @see {@link MapContextManager}.
+	 */
+	public FLayer createLayer(String layerName,
+			DataStoreParameters storeParameters) throws LoadLayerException {
+		// Se obtiene el driver que lee
+		try{
+			DataManager dataManager=DALLocator.getDataManager();
+			DataStore dataStore=dataManager.createStore(storeParameters);
+			return createLayer(layerName, dataStore);
+		}catch (Exception e) {
+			throw new LoadLayerException(layerName,e);
+		}
+	}
+
+	/**
+	 * @deprecated to be removed in gvSIG 2.1
+	 * @see {@link MapContextManager}.
+	 */
+	public FLayer createLayer(String layerName, DataStore dataStore) throws LoadLayerException{
+		try{	
+			Class layerClass = this.getLayerClassFor(dataStore);
+			if (layerClass == null) {
+				throw new CantRetrieveLayerByStoreException(layerName,dataStore.getName());
+			}
+			FLayer layer;
+			try {
+				layer = (FLayer) layerClass.newInstance();
+			} catch (InstantiationException e) {
+				throw new LoadLayerException(layerName, e);
+			} catch (IllegalAccessException e) {
+				throw new LoadLayerException(layerName, e);
+			}
+
+			layer.setName(layerName);
+			((SingleLayer) layer).setDataStore(dataStore);
+			IProjection proj = (IProjection)dataStore.getDynValue(FeatureStore.METADATA_CRS);
+			if (proj != null) {
+				layer.setProjection(proj);
+			}
+			layer.load();
+			return layer;
+		} catch (Exception e) {
+			throw new LoadLayerException(layerName,e);
+		}
+	}
+	
+	private class CantRetrieveLayerByStoreException extends LoadLayerException {
+
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 1442450896900126712L;
+
+		CantRetrieveLayerByStoreException(String layerName, String storeName) {
+			super(
+				"Can't retrieve the class leyer of %(layer) to use for store %(store).",
+				null,
+				"_Cant_retrieve_the_class_leyer_of_XlayerX_to_use_for_store_XstoreX",
+				serialVersionUID
+			);
+			setValue("layer", layerName);
+			setValue("store", storeName);
+		}
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java	(revision 36112)
@@ -0,0 +1,1395 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.Messages;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.InfoByPoint;
+import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
+import org.gvsig.fmap.mapcontext.layers.operations.LayerNotFoundInCollectionException;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitable;
+import org.gvsig.fmap.mapcontext.layers.operations.LayersVisitor;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable;
+import org.gvsig.metadata.exceptions.MetadataException;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.Disposable;
+import org.gvsig.tools.dynobject.DynObjectSet;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.dynobject.impl.MultiDynObjectSet;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+import org.gvsig.tools.visitor.NotSupportedOperationException;
+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>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 {
+
+	
+	/**
+	 * 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;
+
+	/**
+	 * 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);
+
+	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);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#setAllVisibles(boolean)
+	 */
+	public void setAllVisibles(boolean visible) {
+		FLayer lyr;
+
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+			lyr.setVisible(visible);
+
+			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();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.layerOperations.LayerCollection#addLayer(com.iver.cit.gvsig.fmap.layers.FLayer)
+	 */
+	public void addLayer(FLayer layer) {
+		addLayer(layers.size(),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();
+			}
+
+			if (layer instanceof FLayers){
+				FLayers layers=(FLayers)layer;
+				fmap.addAsCollectionListener(layers);
+			}
+			callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer));
+
+			doAddLayer(pos,layer);
+
+			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#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));
+	}
+
+	/**
+	 * 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));
+	}
+
+	/*
+	 * (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));
+
+			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
+				removeLayer(i);
+
+				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
+	 */
+	public void replaceLayer(String layerName, FLayer layer) throws LoadLayerException
+	{
+		FLayer lyr;
+		FLayer parent;
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+
+			if (lyr.getName().compareToIgnoreCase(layerName) == 0) {
+				parent = lyr.getParentLayer();
+				removeLayer(i);
+				if (parent != null) {
+					//Notificamos a la capa que va a ser a�adida
+					if (layer instanceof FLyrDefault) {
+						((FLyrDefault)layer).wakeUp();
+					}
+				}
+
+				if (layer instanceof FLayers){
+					FLayers layers=(FLayers)layer;
+					fmap.addAsCollectionListener(layers);
+				}
+				callLayerAdding(LayerCollectionEvent.createLayerAddingEvent(layer));
+
+//				layers.add(i,layer);
+//				layer.setParentLayer(this);
+				this.doAddLayer(i, layer);
+				
+				callLayerAdded(LayerCollectionEvent.createLayerAddedEvent(layer));
+				break;
+			}
+		}
+	}
+
+	/*
+	 * (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());
+		}
+
+		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(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));
+
+			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;
+				}
+			}
+		}
+
+		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);
+		}
+	}
+
+	/*
+	 * (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#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);
+	}
+
+	/**
+	 * <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;
+		}
+
+		// TODO: A la hora de imprimir, isWithinScale falla, porque est�
+		// 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;
+			}
+
+			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);
+
+							// 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;
+
+								lLayer.drawLabels(null, g, viewPort, cancel, scale, dpi);
+							}
+						}
+					} else {
+						// add the layer to the group
+						group.setMapContext(fmap);
+						group.add(lyr);
+
+					}
+				}
+				///// CHEMA ComposedLayer
+
+			} 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 (getVirtualLayers() != null) {
+		//			getVirtualLayers().print( g, viewPort, cancel, scale, properties);
+		//		}
+
+		///// 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;
+
+
+		for (Iterator iter = layers.iterator(); iter.hasNext();) {
+			FLayer capa = (FLayer) iter.next();
+			try{
+				if (first) {
+					rAux = capa.getFullEnvelope();
+					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;
+	}
+
+	/**
+	 * 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 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 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 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 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 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);
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		
+		super.saveToState(state);
+		
+		state.set("mapContext", fmap);
+		state.set("layers", layers);
+	}
+
+	public void loadFromState(PersistentState state) throws PersistenceException {
+
+		super.loadFromState(state);
+
+		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;
+	}
+	/*
+	 * (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.layers.FLyrDefault#setCoordTrans(org.cresques.cts.ICoordTrans)
+	 */
+	public void setCoordTrans(ICoordTrans ct) {
+		super.setCoordTrans(ct);
+
+		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;
+
+		for (int i = 0; i < layers.size(); i++) {
+			lyr = ((FLayer) layers.get(i));
+			lyr.setActive(active);
+
+			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) {
+
+			public boolean evaluate(FLayer layer) {
+				return layer.isActive();
+			}
+
+		};
+
+		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);
+    }
+
+    public DynObjectSet getInfo(Point p, double tolerance, Cancellable cancel,
+        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 {
+        int i;
+        FLayer layer;
+        List res = new ArrayList();
+        for (i = 0; i < this.layers.size(); i++) {
+            layer = (FLayer) layers.get(i);
+            if (layer instanceof InfoByPoint) {
+                InfoByPoint queryable_layer = (InfoByPoint) layer;
+                res.add(queryable_layer.getInfo(p, tolerance));
+            }
+        }
+        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 "toc-layer-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);
+	//
+	//	}
+
+//	/**
+//	 * <p>Adds the layer with the information in an XML entity and the specified name, to this collection of layers.</p>
+//	 *
+//	 * <p>This method really executes the addition, considering the kind of layer (<code>FLyrVect</code>,
+//	 *  <code>FLyrAnnotation</code>, <code>FLyrRaster</code>, a collection of layers (<code>FLayers</code>),
+//	 *  or another kind of layer (<code>FLayer</code>)), and the driver in the layer.</p>
+//	 *
+//	 * @param xml tree-node structure with information about layers
+//	 * @param name name of the layer to add
+//	 *
+//	 * @throws LoadLayerException if fails loading this layer.
+//	 */
+//	private void addLayerFromXML(XMLEntity xml, String name) throws LoadLayerException {
+//		FLayer layer = null;
+//
+//		try {
+//			if (name == null) {
+//				name = xml.getName();
+//			}
+//
+//
+//			String className = xml.getStringProperty("className");
+//			Class clase = Class.forName(className);
+//			layer = (FLayer) clase.newInstance();
+//			if (FLayers.class.isAssignableFrom(clase)) {
+//				((FLayers)layer).setMapContext(getMapContext());
+//				((FLayers)layer).setParentLayer(this);
+//				//			layer = new FLayers(getMapContext(),this);
+//				layer.setXMLEntity(xml);
+//			} else {
+//				// Capas Nuevas (externas)
+//				layer.setName(name);
+//				layer.setXMLEntity(xml);
+//				layer.load();
+//			}
+//
+//			//		//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,
+//			//		//ya que los drivers de una FLyrAnnotation no sabemos cual es puede ser cualquier Driver Vectorial.
+//			//		if (className.equals(FLyrVect.class.getName())){// || className.equals(FLyrAnnotation.class.getName())) {
+//			//			String type = xml.getStringProperty("type");
+//			//			if ("vectorial".equals(type)){
+//			//				//String recordsetName = xml.getChild(i).getStringProperty("recordset-name");
+//			//				IProjection proj = null;
+//			//				if (xml.contains("proj")) {
+//			//					proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
+//			//				}
+//			//				else
+//			//				{
+//			//					proj = this.getMapContext().getViewPort().getProjection();
+//			//				}
+//			//				if (xml.contains("file")) {
+//			//					Driver d;
+//			//					try {
+//			//						d = LayerFactory.getDM().getDriver(xml.getStringProperty("driverName"));
+//			//					} catch (DriverLoadException e1) {
+//			//						throw new DriverLayerException(name,e1);
+//			//					}
+//			//					layer = LayerFactory.createLayer(name, (VectorialFileDriver) d,
+//			//							new File(xml.getStringProperty("file")),
+//			//							proj);
+//			//
+//			//
+//			//				}
+//			//				if (xml.contains("db")) {
+//			//
+//			//					String driverName = xml.getStringProperty("db");
+//			//					IVectorialDatabaseDriver driver;
+//			//					try {
+//			//						driver = (IVectorialDatabaseDriver) LayerFactory.getDM().getDriver(driverName);
+//			//						//Hay que separar la carga de los datos del XMLEntity del load.
+//			//						driver.setXMLEntity(xml.getChild(2));
+//			//
+//			//						boolean loadOk = false;
+//			//						((DefaultJDBCDriver)driver).load();
+//			//						if (((DefaultJDBCDriver)driver).getConnection() != null) {
+//			//							loadOk = true;
+//			//						}
+//			//						layer = LayerFactory.createDBLayer(driver, name, proj);
+//			//						if (!loadOk) {
+//			//							layer.setAvailable(false);
+//			//						}
+//			//
+//			//					} catch (DriverLoadException e) {
+//			//						throw new DriverLayerException(name,e);
+//			//					} catch (XMLException e) {
+//			//						throw new DriverLayerException(name,e);
+//			//					} catch (ReadException e) {
+//			//						throw new DriverLayerException(name,e);
+//			//					}
+//			//
+//			//				}
+//			//				// Clases con algun driver gen�rico creado por otro
+//			//				// programador
+//			//				if (xml.contains("other")) {
+//			//
+//			//					String driverName = xml.getStringProperty("other");
+//			//					VectorialDriver driver = null;
+//			//					try {
+//			//						driver = (VectorialDriver) LayerFactory.getDM().getDriver(driverName);
+//			//					} catch (DriverLoadException e) {
+//			//						// Si no existe ese driver, no pasa nada.
+//			//						// Puede que el desarrollador no quiera que
+//			//						// aparezca en el cuadro de di�logo y ha metido
+//			//						// el jar con sus clases en nuestro directorio lib.
+//			//						// Intentamos cargar esa clase "a pelo".
+//			//						if (xml.getChild(2).contains("className"))
+//			//						{
+//			//							String className2 = xml.getChild(2).getStringProperty("className");
+//			//							try {
+//			//								driver = (VectorialDriver) Class.forName(className2).newInstance();
+//			//							} catch (Exception e1) {
+//			//								throw new DriverLayerException(name,e);
+//			//							}
+//			//						}
+//			//					} catch (NullPointerException npe) {
+//			//						// Si no existe ese driver, no pasa nada.
+//			//						// Puede que el desarrollador no quiera que
+//			//						// aparezca en el cuadro de di�logo y ha metido
+//			//						// el jar con sus clases en nuestro directorio lib.
+//			//						// Intentamos cargar esa clase "a pelo".
+//			//						if (xml.getChild(2).contains("className"))
+//			//						{
+//			//							String className2 = xml.getChild(2).getStringProperty("className");
+//			//							try {
+//			//								driver = (VectorialDriver) Class.forName(className2).newInstance();
+//			//							} catch (Exception e1) {
+//			//								throw new DriverLayerException(name,e1);
+//			//							}
+//			//						}
+//			//					}
+//			//					if (driver instanceof IPersistence)
+//			//					{
+//			//						IPersistence persist = (IPersistence) driver;
+//			//						persist.setXMLEntity(xml.getChild(2));
+//			//					}
+//			//					layer = LayerFactory.createLayer(name, driver, proj);
+//			//				}
+//			//
+//			//			}
+//			//
+//			//			//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,
+//			//			//ya que los drivers de una FLyrAnnotation no sabemos cual es puede ser cualquier Driver Vectorial.
+//			//			if (className.equals(FLyrAnnotation.class.getName())){
+//			//				layer=FLyrAnnotation.createLayerFromVect((FLyrVect)layer);
+//			//			}
+//			//
+//			//
+//			//			layer.setXMLEntity(xml);
+//			//
+//			//		} else {
+//			//			Class clase = LayerFactory.getLayerClassForLayerClassName(className);
+//			//			layer = (FLayer) clase.newInstance();
+//			//			if (clase.isAssignableFrom(FLayers.class)) {
+//			//				((FLayers)layer).setMapContext(getMapContext());
+//			//				((FLayers)layer).setParentLayer(this);
+//			////				layer = new FLayers(getMapContext(),this);
+//			//				layer.setXMLEntity(xml);
+//			//			} else {
+//			//				// Capas Nuevas (externas)
+//			//				layer.setName(name);
+//			//				layer.setXMLEntity(xml);
+//			//				layer.load();
+//			//			}
+//			//		}
+//			this.addLayer(layer);
+//			logger.debug("layer: "+ layer.getName() +" loaded");
+//			// Comprobar que la proyecci�n es la misma que la de FMap
+//			// Si no lo es, es una capa que est� reproyectada al vuelo
+//			IProjection proj = layer.getProjection();
+//			if ((proj != null)) {
+//				if (!proj.getFullCode().equals(getMapContext().getProjection().getFullCode()))
+//				{
+//					ICoordTrans ct = proj.getCT(getMapContext().getProjection());
+//					// TODO: REVISAR CON LUIS
+//					// Se lo fijamos a todas, luego cada una que se reproyecte
+//					// si puede, o que no haga nada
+//
+//					layer.setCoordTrans(ct);
+//				}
+//			}
+//		} catch (XMLException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (ClassNotFoundException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (InstantiationException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (IllegalAccessException e) {
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			throw new LoadLayerException(name,e);
+//		} catch (LoadLayerException e){
+//			fmap.addLayerError(xml.getStringProperty("name"));
+//			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>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,
+//	 *  inserts the transformation coordinates to the layer.</p>
+//	 *
+//	 * <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>
+//	 *
+//	 * @param xml tree-node structure with information about layers
+//	 * @param name name of the layer to add
+//	 */
+//	private void addLayerFromXMLNew(XMLEntity xml, String name) {
+//		//		FLayer layer = null;
+//		//
+//		//
+//		//		try {
+//		//			String className = xml.getStringProperty("className");
+//		//			Class clazz = Class.forName(className);
+//		//			if (clazz.isAssignableFrom(FLayers.class)) {
+//		//				layer = (FLayer) clazz.newInstance();
+//		//				((FLayers)layer).setMapContext(getMapContext());
+//		//				((FLayers)layer).setParentLayer(this);
+//		//	//		if (className.equals((FLayers.class.getName()))){
+//		//	//			layer = new FLayers(getMapContext(),this);
+//		//			} else {
+//		//	//			Por compatibilidad
+//		//				if (className.equals(FLyrVect.class.getName())) {
+//		//					if (xml.contains("file")) {
+//		//						layer = new FLayerFileVectorial();
+//		//					} else if (xml.contains("db")) {
+//		//						try {
+//		//							layer = (FLayer)((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create("com.iver.cit.gvsig.fmap.layers.FLayerJDBCVectorial");
+//		//						} catch (Exception e) {
+//		//							throw new XMLException(new Exception("No se tiene registrada la capa de tipo JDBC"));
+//		//						}
+//		//						//className = FLayerJDBCVectorial.class.getName();
+//		//					} else if (xml.contains("other")){
+//		//						layer = new FLayerGenericVectorial();
+//		//					} else {
+//		//						throw new XMLException(new Exception("Capa vectorial de tipo no reconocido"));
+//		//					}
+//		//	//				Fin por compatibilidad
+//		//				} else {
+//		//					try {
+//		//						layer = (FLayer)(((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create(className));
+//		//					} catch (Exception e) {
+//		//						//puende que no este registrada como punto de extension
+//		//						Class clase = Class.forName(className);
+//		//						layer = (FLayer) clase.newInstance();
+//		//						// FIXME: Hacemos algo aqui o dejamos que suba el error?
+//		//					}
+//		//				}
+//		//
+//		//			}
+//		//			layer.setXMLEntity(xml);
+//		//			if (name != null) layer.setName(name);
+//		//			layer.load();
+//		//
+//		//			this.addLayer(layer);
+//		//			logger.debug("layer: "+ layer.getName() +" loaded");
+//		//			// Comprobar que la proyecci�n es la misma que la de FMap
+//		//			// Si no lo es, es una capa que est� reproyectada al vuelo
+//		//			IProjection proj = layer.getProjection();
+//		//			if ((proj != null))
+//		//				if (proj != getMapContext().getProjection())
+//		//				{
+//		//					ICoordTrans ct = proj.getCT(getMapContext().getProjection());
+//		//					// TODO: REVISAR CON LUIS
+//		//					// Se lo fijamos a todas, luego cada una que se reproyecte
+//		//					// si puede, o que no haga nada
+//		//					layer.setCoordTrans(ct);
+//		//
+//		//				}
+//		//		}catch (Exception e) {
+//		//			fmap.addLayerError(xml.getStringProperty("name"));
+//		//			logger.debug(Messages.getString("could_not_load_layer")+": "+xml.getStringProperty("name") + ".\n"
+//		//					+Messages.getString("reason")+":", e);
+//		//		}
+//	}
+
+	public void accept(Visitor visitor) throws BaseException {
+		throw new NotSupportedOperationException(visitor, this);
+	}
+
+	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#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();
+	}
+
+
+	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 static void registerPersistent() {
+		
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		if( manager.getDefinition(FLyrDefault.class) == null ) {
+			FLyrDefault.registerPersistent();
+		}
+		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);
+	}
+
+	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));
+
+	}
+
+	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;
+		}
+
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/OperationNotSupportedException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/OperationNotSupportedException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/OperationNotSupportedException.java	(revision 36112)
@@ -0,0 +1,89 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.layers;
+
+/**
+ * Lanzada cuando se intenta realizar una operaci�n generalmente sobre una
+ * clase abstracta o interfaz y la implementaci�n de dicha clase abstracta o
+ * interfaz no soporta dicha  operaci�n. Ver la descripci�n del m�todo que la
+ * origin�
+ */
+public class OperationNotSupportedException extends Exception {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1057162354181561395L;
+
+	/**
+	 * Crea una nueva OperationNotSupportedException.
+	 */
+	public OperationNotSupportedException() {
+		super();
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param message
+	 */
+	public OperationNotSupportedException(String message) {
+		super(message);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param message
+	 * @param cause
+	 */
+	public OperationNotSupportedException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * DOCUMENT ME!
+	 *
+	 * @param cause
+	 */
+	public OperationNotSupportedException(Throwable cause) {
+		super(cause);
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java	(revision 36112)
@@ -0,0 +1,90 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Rectangle2D} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class Rectangle2DPersistenceFactory extends
+		AbstractSinglePersistenceFactory {
+
+	private static final String DYNCLASS_NAME = "AwtRectangle2D";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Rectangle2D";
+
+	public static final String FIELD_X = "x";
+	public static final String FIELD_Y = "y";
+	public static final String FIELD_WIDTH = "width";
+	public static final String FIELD_HEIGHT = "height";
+
+	/**
+	 * Creates a new {@link Rectangle2DPersistenceFactory} with the
+	 * {@link DynStruct} definition for the {@link Rectangle2D} objects.
+	 */
+	public Rectangle2DPersistenceFactory() {
+		super(Rectangle2D.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null,
+				null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldDouble(FIELD_X).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_Y).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_WIDTH).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_HEIGHT).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+
+		double x = state.getDouble(FIELD_X);
+		double y = state.getDouble(FIELD_Y);
+		double width = state.getDouble(FIELD_WIDTH);
+		double height = state.getDouble(FIELD_HEIGHT);
+
+		return new Rectangle2D.Double(x, y, width, height);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Rectangle2D rec = (Rectangle2D) obj;
+
+		state.set(FIELD_X, rec.getX());
+		state.set(FIELD_Y, rec.getY());
+		state.set(FIELD_WIDTH, rec.getWidth());
+		state.set(FIELD_HEIGHT, rec.getHeight());
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Rectangle2DPersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/ColorPersistenceFactory.java	(revision 36112)
@@ -0,0 +1,87 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Color;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Color} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class ColorPersistenceFactory extends AbstractSinglePersistenceFactory {
+
+	static final String FIELD_RED = "red";
+	static final String FIELD_GREEN = "green";
+	static final String FIELD_BLUE = "blue";
+	static final String FIELD_ALPHA = "alpha";
+
+	private static final String DYNCLASS_NAME = "AwtColor";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Color";
+
+	/**
+	 * Creates a new {@link ColorPersistenceFactory} with the {@link DynStruct}
+	 * definition for the {@link Color} objects.
+	 */
+	public ColorPersistenceFactory() {
+		super(Color.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null, null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldInt(FIELD_RED).setMandatory(true);
+		definition.addDynFieldInt(FIELD_GREEN).setMandatory(true);
+		definition.addDynFieldInt(FIELD_BLUE).setMandatory(true);
+		definition.addDynFieldInt(FIELD_ALPHA).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		int red = state.getInt(FIELD_RED);
+		int green = state.getInt(FIELD_GREEN);
+		int blue = state.getInt(FIELD_BLUE);
+		int alpha = state.getInt(FIELD_ALPHA);
+
+		return new Color(red, green, blue, alpha);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Color color = (Color) obj;
+		state.set(FIELD_RED, color.getRed());
+		state.set(FIELD_GREEN, color.getGreen());
+		state.set(FIELD_BLUE, color.getBlue());
+		state.set(FIELD_ALPHA, color.getAlpha());
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/Point2DPersistenceFactory.java	(revision 36112)
@@ -0,0 +1,78 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.geom.Point2D;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Point2D} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class Point2DPersistenceFactory extends AbstractSinglePersistenceFactory {
+
+	static final String FIELD_X = "x";
+	static final String FIELD_Y = "y";
+
+	private static final String DYNCLASS_NAME = "AwtPoint2D";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Point2D";
+
+	/**
+	 * Creates a new {@link Point2DPersistenceFactory} with the
+	 * {@link DynStruct} definition for the {@link Point2D} objects.
+	 */
+	public Point2DPersistenceFactory() {
+		super(Point2D.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null, null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldDouble(FIELD_X).setMandatory(true);
+		definition.addDynFieldDouble(FIELD_Y).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		double x = state.getDouble(FIELD_X);
+		double y = state.getDouble(FIELD_Y);
+
+		return new Point2D.Double(x, y);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Point2D point = (Point2D) obj;
+		state.set(FIELD_X, point.getX());
+		state.set(FIELD_Y, point.getY());
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java	(revision 36112)
@@ -0,0 +1,82 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Dimension;
+import java.awt.geom.Rectangle2D;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Rectangle2D} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class DimensionPersistenceFactory extends
+		AbstractSinglePersistenceFactory {
+
+	private static final String DYNCLASS_NAME = "AwtDimension";
+	private static final String DYNCLASS_DESCRIPTION = "Dimension in AWT";
+
+	public static final String FIELD_HEIGHT = "height";
+	public static final String FIELD_WIDTH = "width";
+
+	/**
+	 * Creates a new {@link DimensionPersistenceFactory} with the
+	 * {@link DynStruct} definition for the {@link Dimension} objects.
+	 */
+	public DimensionPersistenceFactory() {
+		super(Dimension.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null,
+				null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldInt(FIELD_WIDTH).setMandatory(true);
+		definition.addDynFieldInt(FIELD_HEIGHT).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		Dimension dimension = new Dimension();
+		dimension.width = state.getInt(FIELD_WIDTH);
+		dimension.height = state.getInt(FIELD_HEIGHT); 
+		return dimension;
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Dimension dim = (Dimension) obj;
+
+		state.set(FIELD_HEIGHT, dim.height);
+		state.set(FIELD_WIDTH, dim.width);
+	}
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/DimensionPersistenceFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactory.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactory.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/tools/persistence/FontPersistenceFactory.java	(revision 36112)
@@ -0,0 +1,82 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Gobernment (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.tools.persistence;
+
+import java.awt.Font;
+
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.persistence.AbstractSinglePersistenceFactory;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+
+/**
+ * Factory to manage the persistence of {@link Font} objects.
+ * 
+ * @author 2009- <a href="cordinyana@gvsig.org">C�sar Ordi�ana</a> - gvSIG team
+ * @author 2010- <a href="jjdelcerro@gvsig.org">Joaquin Jose del Cerro</a> -
+ *         gvSIG team
+ */
+public class FontPersistenceFactory extends AbstractSinglePersistenceFactory {
+
+	static final String FIELD_NAME = "name";
+	static final String FIELD_STYLE = "style";
+	static final String FIELD_SIZE = "size";
+
+	private static final String DYNCLASS_NAME = "AwtFont";
+	private static final String DYNCLASS_DESCRIPTION = "Awt Font";
+
+	/**
+	 * Creates a new {@link FontPersistenceFactory} with the {@link DynStruct}
+	 * definition for the {@link Font} objects.
+	 */
+	public FontPersistenceFactory() {
+		super(Font.class, DYNCLASS_NAME, DYNCLASS_DESCRIPTION, null, null);
+
+		DynStruct definition = this.getDefinition();
+
+		definition.addDynFieldString(FIELD_NAME).setMandatory(true);
+		definition.addDynFieldInt(FIELD_STYLE).setMandatory(true);
+		definition.addDynFieldInt(FIELD_SIZE).setMandatory(true);
+	}
+
+	public Object createFromState(PersistentState state)
+			throws PersistenceException {
+		String name = state.getString(FIELD_NAME);
+		int style = state.getInt(FIELD_STYLE);
+		int size = state.getInt(FIELD_SIZE);
+
+		return new Font(name, style, size);
+	}
+
+	public void saveToState(PersistentState state, Object obj)
+			throws PersistenceException {
+		Font font = (Font) obj;
+		state.set(FIELD_NAME, font.getName());
+		state.set(FIELD_STYLE, font.getStyle());
+		state.set(FIELD_SIZE, font.getSize());
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java	(revision 36112)
@@ -0,0 +1,609 @@
+package org.gvsig.fmap.mapcontext.impl;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.gvsig.compat.CompatLocator;
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.MapContextDrawer;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.LayersIterator;
+import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer;
+import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection;
+import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelable;
+import org.gvsig.tools.task.Cancellable;
+
+
+
+public class DefaultMapContextDrawer implements MapContextDrawer {
+	private MapContext mapContext=null;
+	private ViewPort viewPort=null;
+	private CachedImage cachedImage=null;
+	private DrawList previousDrawList = null;
+
+	public DefaultMapContextDrawer(){
+
+	}
+
+	protected void checkIntilalized(){
+		if (mapContext == null || viewPort == null){
+			throw new IllegalStateException("MapContext and ViewPort must be set");
+		}
+	}
+
+	protected boolean isLayerCacheable(FLayer layer){
+		return layer.isActive();
+	}
+
+	public void draw(FLayers root, BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException {
+
+		this.checkIntilalized();
+
+		boolean needToPaintAll = false;
+
+		DrawList drawList = this.createDrawList(root, cancel,scale);
+		if (cancel.isCanceled()){
+			return;
+		}
+
+		if (cachedImage == null){
+			needToPaintAll=true;
+		} else if (!cachedImage.isValid(mapContext, viewPort, drawList.getFirstLayerToDraw())){
+			needToPaintAll=true;
+		}
+
+
+		int firstLayer= 0;
+		if (!needToPaintAll){
+			firstLayer = cachedImage.getListPosition()+1;
+//			System.out.println("=======Pintando a partir de la pos "+ firstLayer+"============");
+			g.drawImage(cachedImage.getImage(), 0, 0, null);
+//			System.out.println("=======Pintando imagen ============");
+
+		} else{
+			this.cachedImage = null;
+//			System.out.println("=======Pintando todo============");
+		}
+
+
+		boolean cached=false;
+		ComposedLayer composed = null;
+		int pos;
+		int layerPos= -1;
+		FLayer layer;
+		Object obj;
+		LayersGroupEvent event;
+		for (pos=0; pos < drawList.size(); pos++){
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			obj = drawList.get(pos);
+
+			// *** Gestion de eventos de pintado de grupos ***
+			if (obj instanceof LayersGroupEvent){
+				event = (LayersGroupEvent) obj;
+				if (event.type == LayersGroupEvent.IN_Event){
+//					System.out.println("=======Empiza a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+					event.group.beginDraw(g, viewPort);
+				} else{
+					event.group.endDraw(g, viewPort);
+//					System.out.println("=======Fin a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+
+				}
+				continue;
+			}
+			layerPos++;
+			if (layerPos < firstLayer){
+				continue;
+			}
+
+			layer = (FLayer) obj;
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			// *** Gestion de cache ***
+			if ((!cached) && this.isLayerCacheable(layer)){
+				if (layerPos > 0){ //La primera capa es la activa, no cacheamos
+					if (cachedImage==null || cachedImage.getListPosition() < layerPos-1){
+
+						if (composed != null){
+							//si tenemos una composicion de capas, necesitamos pintarlas
+							//antes de guardarnos la imagen
+//							System.out.println("=======Pintando composicion de pintado "+ (layerPos-1)+" (antes de cache)============");
+							this.draw(composed, image, g, cancel, scale);
+//							composed.draw(image, g, viewPort, cancel, scale);
+							composed = null;
+
+						}
+						CachedImage  newCached = new CachedImage();
+						newCached.setImage(image, mapContext, viewPort, layerPos-1);
+						this.cachedImage = newCached;
+//						System.out.println("=======Guardando imagen de la pos "+ (layerPos-1)+" ("+ newCached.getListPosition() +")============");
+					}
+				}
+				cached = true;
+			}
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			if (composed == null){
+				composed = layer.newComposedLayer();
+				if (composed != null){
+					try {
+//						System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+						composed.add(layer);
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefalutMapContexDrawer exception",e);
+					}
+				}
+			}else{
+				if (composed.canAdd(layer)){
+					try {
+//						System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+						composed.add(layer);
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefalutMapContexDrawer exception",e);
+					}
+				} else {
+//					System.out.println("=======Pintando composicion de pintado "+ (layerPos-1)+" (cambio composicion)============");
+					this.draw(composed, image, g, cancel, scale);
+//					composed.draw(image, g, viewPort, cancel, scale);
+					composed = layer.newComposedLayer();
+					if (composed != null){
+						try {
+//							System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+							composed.add(layer);
+							continue;
+						} catch (Exception e) {
+							throw new ReadException("DefalutMapContexDrawer exception",e);
+						}					}
+				}
+			}
+//			System.out.println("=== pintando "+ layerPos+ " "+layer.getName());
+			this.draw(layer, image, g, cancel, scale);
+//			layer.draw(image, g, viewPort, cancel, scale);
+
+		}
+		if (composed != null){
+			// si la composicion no se ha pintado la pintamos
+//			System.out.println("=======Pintando composicion de pintado "+ (layerPos-1)+" (ultimo)============");
+			this.draw(composed, image, g, cancel, scale);
+//			composed.draw(image, g, viewPort, cancel, scale);
+		}
+		if (cancel.isCanceled()){
+			return;
+		}
+
+		this.previousDrawList = drawList;
+
+	}
+
+	private void draw(Object layerOrComposed,BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException{
+		ILabelable labelable= null;
+		ILabelable tmp= null;
+		if (layerOrComposed instanceof ILabelable){
+
+			tmp =(ILabelable) layerOrComposed;
+
+			if (tmp.isLabeled()
+				&& tmp.getLabelingStrategy() != null
+				&& tmp.getLabelingStrategy().shouldDrawLabels(scale)) {
+				labelable =tmp;
+			}
+		}
+		if (layerOrComposed instanceof FLayer){
+			FLayer layer = (FLayer) layerOrComposed;
+			layer.draw(image, g, viewPort, cancel, scale);
+		} else{
+			ComposedLayer composed = (ComposedLayer) layerOrComposed;
+			composed.draw(image, g, viewPort, cancel, scale);
+		}
+		if (labelable != null){
+			labelable.drawLabels(image, g, viewPort, cancel, scale, MapContext.getScreenDPI());
+		}
+
+	}
+
+	private void print(Object layerOrComposed,Graphics2D g, Cancellable cancel,
+			double scale, PrintAttributes properties) throws ReadException{
+		ILabelable labelable= null;
+		ILabelable tmp= null;
+		if (layerOrComposed instanceof ILabelable){
+
+			tmp =(ILabelable) layerOrComposed;
+
+			if (tmp.isLabeled()
+				&& tmp.getLabelingStrategy() != null
+				&& tmp.getLabelingStrategy().shouldDrawLabels(scale)) {
+				labelable =tmp;
+			}
+		}
+
+		if (layerOrComposed instanceof FLayer){
+			FLayer layer = (FLayer) layerOrComposed;
+			layer.print(g, viewPort, cancel, scale, properties);
+		} else{
+			ComposedLayer composed = (ComposedLayer) layerOrComposed;
+			composed.print(g, viewPort, cancel, scale, properties);
+		}
+		if (labelable != null){
+			labelable.printLabels(g, viewPort, cancel, scale, properties);
+		}
+
+	}
+
+	public void setMapContext(MapContext mapContext) {
+		if (this.mapContext == mapContext){
+			return;
+		}
+		this.clean();
+		this.mapContext = mapContext;
+
+	}
+
+	public void setViewPort(ViewPort viewPort) {
+		if (this.viewPort == viewPort){
+			return;
+		}
+		this.clean();
+		this.viewPort = viewPort;
+
+	}
+
+	protected void clean(){
+		this.cachedImage = null;
+	}
+
+	public class CachedImage{
+		private BufferedImage image;
+		private long mapContextVersion;
+		private long viewPortVersion;
+		private int listPosition;
+
+		public void setImage(BufferedImage img,MapContext mapContext, ViewPort viewPort,int pos) {
+
+			image = CompatLocator.getGraphicsUtils().copyBufferedImage(img);
+			this.mapContextVersion = mapContext.getDrawVersion();
+			this.viewPortVersion = viewPort.getDrawVersion();
+			this.listPosition = pos;
+		}
+
+		public BufferedImage getImage() {
+			return image;
+		}
+
+		public long getMapContextVersion() {
+			return mapContextVersion;
+		}
+
+		public long getViewPortVersion() {
+			return viewPortVersion;
+		}
+
+		public int getListPosition(){
+			return this.listPosition;
+		}
+
+		public boolean isValid(MapContext context,ViewPort viewPort,int firstLayerToDraw){
+			if (viewPort.getDrawVersion() > this.viewPortVersion){
+				return false;
+			}
+			if (firstLayerToDraw <= this.listPosition){
+				return false;
+			}
+			return true;
+		}
+	}
+
+	public class DrawList{
+		private List layers = new ArrayList();
+		private List all = new ArrayList();
+		private List versions = new ArrayList();
+		private DrawList previosList = null;
+		private int firstLayerToDraw =-1;
+
+		public DrawList(){
+		}
+
+		public DrawList(DrawList previousList){
+			if (previousList != null){
+				this.firstLayerToDraw =previousList.getLayerCount();
+				this.previosList=previousList;
+			}
+		}
+
+		public int getLayerCount(){
+			return this.layers.size();
+		}
+
+		private boolean hasChanged(FLayer layer, int pos){
+			FLayer previous =(FLayer) this.previosList.layers.get(pos);
+//			String previousName = previous.getName();
+//			String layerName = layer.getName();
+			if (previous != layer){
+				return true;
+			}
+			long previousVersion = ((Long) this.previosList.versions.get(pos)).longValue();
+			long layerVersion = layer.getDrawVersion();
+
+			return previousVersion != layerVersion;
+		}
+
+		public void add(Object obj){
+			if (obj instanceof FLayer){
+				FLayer layer = (FLayer) obj;
+				int curIndex = this.layers.size();
+				if (this.firstLayerToDraw >= curIndex){
+					if (this.previosList.getLayerCount() > curIndex){
+						if (this.hasChanged(layer, curIndex)){
+							this.firstLayerToDraw = curIndex;
+						}
+					} else if (this.previosList.getLayerCount() == curIndex){
+						this.firstLayerToDraw = curIndex;
+					}
+				}
+				this.layers.add(layer);
+				this.versions.add(new Long(layer.getDrawVersion()));
+			} else if (!(obj instanceof LayersGroupEvent)){
+				throw new UnsupportedOperationException();
+			}
+
+			this.all.add(obj);
+		}
+
+		public int size(){
+			return this.all.size();
+		}
+
+		public int getFirstLayerToDraw(){
+			if (this.firstLayerToDraw > this.layers.size()){
+				this.firstLayerToDraw = this.layers.size();
+			}
+			return this.firstLayerToDraw;
+		}
+
+		public FLayer getLayer(int pos){
+			return (FLayer) this.layers.get(pos);
+		}
+
+		public Object get(int pos){
+			return this.all.get(pos);
+		}
+
+	}
+
+	private class SimpleLayerIterator extends LayersIterator{
+
+		public SimpleLayerIterator(FLayer layer) {
+			this.appendLayer(layer);
+		}
+
+		public boolean evaluate(FLayer layer) {
+			if (layer instanceof FLayers) {
+				return false;
+			}
+			return layer.isAvailable() && layer.isVisible();
+		}
+
+	}
+
+	public void dispose() {
+		this.mapContext=null;
+		this.viewPort=null;
+		this.cachedImage=null;
+		this.previousDrawList = null;
+	}
+
+
+	public void print(FLayers root, Graphics2D g, Cancellable cancel,
+			double scale, PrintAttributes properties)
+			throws ReadException {
+		this.checkIntilalized();
+
+		List printList = this.createPrintList(root, cancel);
+		if (cancel.isCanceled()){
+			return;
+		}
+
+
+		ComposedLayer composed = null;
+		int pos;
+		FLayer layer;
+		int layerPos= -1;
+		Object obj;
+		LayersGroupEvent event;
+		for (pos=0; pos < printList.size(); pos++){
+			if (cancel.isCanceled()){
+				return;
+			}
+
+			obj = printList.get(pos);
+			if (obj instanceof LayersGroupEvent){
+				event = (LayersGroupEvent) obj;
+				if (event.type == LayersGroupEvent.IN_Event){
+//					System.out.println("=======Empiza a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+					event.group.beginDraw(g, viewPort);
+				} else{
+					event.group.endDraw(g, viewPort);
+//					System.out.println("=======Fin a pintar grupo de capas "+ ((FLayers)event.group).getName() +"============");
+
+				}
+				continue;
+			}
+			layerPos++;
+
+			layer = (FLayer) obj;
+
+
+			// *** Pintado de capa/composicion de capa ***
+			if (composed == null){
+				composed = layer.newComposedLayer();
+				if (composed != null){
+					try {
+						composed.add(layer);
+//						System.out.println("=======Imprimiendo composicion de pintado "+ (layerPos-1)+" ============");
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefaultMapContexDrawer exception",e);
+					}
+				}
+			}else{
+				if (composed.canAdd(layer)){
+					try {
+						composed.add(layer);
+//						System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+						continue;
+					} catch (Exception e) {
+						throw new ReadException("DefaultMapContexDrawer exception",e);
+					}
+				} else {
+//					System.out.println("=======Imprimiendo composicion de pintado "+ (layerPos-1)+" ============");
+					this.print(composed, g, cancel, scale, properties);
+//					composed.print( g, viewPort, cancel, scale,properties);
+					composed = layer.newComposedLayer();
+					if (composed != null){
+						try {
+							composed.add(layer);
+//							System.out.println("=== a�adiendo a composicion de pintado "+ layerPos+ " "+layer.getName());
+							continue;
+						} catch (Exception e) {
+							throw new ReadException("DefaultMapContexDrawer exception",e);
+						}
+					}
+				}
+			}
+//			System.out.println("=== imprimiendo "+ layerPos+ " "+layer.getName());
+			this.print(layer, g, cancel, scale, properties);
+//			layer.print(g, viewPort, cancel, scale,properties);
+			// *** Pintado de capa/composicion de capa ***
+			if (composed != null){
+				// si la composicion no se ha pintado la pintamos
+//				System.out.println("=======Imprimiendo composicion de pintado "+ (layerPos-1)+" (ultimo) ============");
+				this.print(composed, g, cancel, scale, properties);
+//				composed.print(g, viewPort, cancel, scale, properties);
+				composed = null;
+			}
+		}
+
+
+	}
+
+	private DrawList createDrawList(FLayers root,Cancellable cancel,double scale){
+		DrawList result = new DrawList(this.previousDrawList);
+		Iterator iter = new MyLayerIterator((FLayer)root,scale);
+		while (iter.hasNext()){
+			if (cancel.isCanceled()){
+				return null;
+			}
+			result.add(iter.next());
+
+		}
+
+		return result;
+	}
+
+	private List createPrintList(FLayers root,Cancellable cancel){
+		List result = new ArrayList();
+		Iterator iter = new SimpleLayerIterator((FLayer)root);
+		while (iter.hasNext()){
+			if (cancel.isCanceled()){
+				return null;
+			}
+			result.add(iter.next());
+		}
+		return result;
+	}
+
+	private class MyLayerIterator implements Iterator{
+		ArrayList layersList  =new ArrayList();
+		int index = 0;
+		double scale=0;
+
+
+		public MyLayerIterator(FLayer layer, double scale) {
+			this.scale=scale;
+			this.appendLayer(layer);
+		}
+
+		protected void appendLayer(FLayer layer) {
+			if (this.evaluate(layer)) {
+				layersList.add(layer);
+			}
+			if (layer instanceof LayerCollection) {
+				appendLayers((LayerCollection)layer);
+			}
+		}
+
+		private void appendLayers(LayerCollection layers) {
+			int i;
+			layersList.add(new LayersGroupEvent(layers,LayersGroupEvent.IN_Event));
+			for (i=0;i< layers.getLayersCount();i++) {
+				appendLayer(layers.getLayer(i));
+			}
+			layersList.add(new LayersGroupEvent(layers,LayersGroupEvent.OUT_Event));
+		}
+
+		public void remove() {
+			throw new UnsupportedOperationException();
+		}
+
+		public boolean hasNext() {
+			return  index < layersList.size();
+		}
+
+		public Object next() {
+			if (!this.hasNext()) {
+				throw new NoSuchElementException();
+			}
+			Object aux = layersList.get(index);
+			index++;
+			return aux;
+		}
+
+		public boolean evaluate(FLayer layer) {
+			if (layer instanceof FLayers) {
+				return false;
+			}
+			return layer.isAvailable() && layer.isVisible() && layer.isWithinScale(this.scale);
+		}
+
+	}
+
+	private class LayersGroupEvent {
+		public static final String IN_Event = "in";
+		public static final String OUT_Event = "Out";
+
+		private LayerCollection group=null;
+		private String type = IN_Event;
+
+		public LayersGroupEvent(LayerCollection group,String type){
+			this.group =group;
+			this.type =type;
+		}
+
+
+		public String getType() {
+			return type;
+		}
+
+		public LayerCollection getGroup() {
+			return group;
+		}
+	}
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextDrawer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java	(revision 36112)
@@ -0,0 +1,535 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * 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 2
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {Create Manager to register MapContextDrawer implementation}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.cresques.cts.IProjection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.fmap.dal.DataServerExplorer;
+import org.gvsig.fmap.dal.DataStore;
+import org.gvsig.fmap.dal.DataStoreParameters;
+import org.gvsig.fmap.dal.exception.DataException;
+import org.gvsig.fmap.dal.feature.FeatureStore;
+import org.gvsig.fmap.dal.feature.FeatureType;
+import org.gvsig.fmap.mapcontext.MapContextDrawer;
+import org.gvsig.fmap.mapcontext.MapContextException;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.MapContextManager;
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.LayerFactory;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.layers.vectorial.impl.DefaultGraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.IVectorialUniqueValueLegend;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader;
+import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolException;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager;
+import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dynobject.exception.DynMethodException;
+import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.PersistentState;
+
+/**
+ * Default implementation of the {@link MapContextManager}.
+ *
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class DefaultMapContextManager implements MapContextManager {
+
+    private static final Logger LOG = LoggerFactory
+        .getLogger(DefaultMapContextManager.class);
+
+	private Class drawerClazz = DefaultMapContextDrawer.class;
+
+	private Map legends = Collections.synchronizedMap(new HashMap());
+
+	private Map legendReaders = Collections.synchronizedMap(new HashMap());
+
+	private Map legendWriters = Collections.synchronizedMap(new HashMap());
+
+	private String defaultVectorLegend;
+
+	public SymbolManager getSymbolManager() {
+		return MapContextLocator.getSymbolManager();
+	}
+
+	private SymbolPreferences getSymbolPreferences() {
+		return getSymbolManager().getSymbolPreferences();
+	}
+
+	public String getSymbolLibraryPath() {
+		return getSymbolPreferences().getSymbolLibraryPath();
+	}
+
+	public void setSymbolLibraryPath(String symbolLibraryPath) {
+		getSymbolPreferences().setSymbolLibraryPath(symbolLibraryPath);
+	}
+
+	public void resetSymbolLibraryPath() {
+		getSymbolPreferences().resetSymbolLibraryPath();
+	}
+
+	public Color getDefaultSymbolColor() {
+		return getSymbolPreferences().getDefaultSymbolColor();
+	}
+
+	public Color getDefaultSymbolFillColor() {
+		return getSymbolPreferences().getDefaultSymbolFillColor();
+	}
+
+	public Font getDefaultSymbolFont() {
+		return getSymbolPreferences().getDefaultSymbolFont();
+	}
+
+	public String getSymbolFileExtension() {
+		return getSymbolPreferences().getSymbolFileExtension();
+	}
+
+	public boolean isDefaultSymbolFillColorAleatory() {
+		return getSymbolPreferences().isDefaultSymbolFillColorAleatory();
+	}
+
+	public void resetDefaultSymbolColor() {
+		getSymbolPreferences().resetDefaultSymbolColor();
+	}
+
+	public void resetDefaultSymbolFillColor() {
+		getSymbolPreferences().resetDefaultSymbolFillColor();
+	}
+
+	public void resetDefaultSymbolFillColorAleatory() {
+		getSymbolPreferences().resetDefaultSymbolFillColorAleatory();
+	}
+
+	public void resetDefaultSymbolFont() {
+		getSymbolPreferences().resetDefaultSymbolFont();
+	}
+
+	public void setDefaultSymbolColor(Color defaultSymbolColor) {
+		getSymbolPreferences().setDefaultSymbolColor(defaultSymbolColor);
+	}
+
+	public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) {
+		getSymbolPreferences().setDefaultSymbolFillColor(defaultSymbolFillColor);
+	}
+
+	public void setDefaultSymbolFillColorAleatory(
+			boolean defaultSymbolFillColorAleatory) {
+		getSymbolPreferences().setDefaultSymbolFillColorAleatory(
+				defaultSymbolFillColorAleatory);
+	}
+
+	public void setDefaultSymbolFont(Font defaultSymbolFont) {
+		getSymbolPreferences().setDefaultSymbolFont(defaultSymbolFont);
+	}
+
+	public void setSymbolFileExtension(String extension) {
+		getSymbolPreferences().setSymbolFileExtension(extension);
+	}
+
+	public int getDefaultCartographicSupportMeasureUnit() {
+		return getSymbolPreferences().getDefaultCartographicSupportMeasureUnit();
+	}
+
+	public void setDefaultCartographicSupportMeasureUnit(
+			int defaultCartographicSupportMeasureUnit) {
+		getSymbolPreferences().setDefaultCartographicSupportMeasureUnit(
+				defaultCartographicSupportMeasureUnit);
+	}
+
+	public int getDefaultCartographicSupportReferenceSystem() {
+		return getSymbolPreferences().getDefaultCartographicSupportReferenceSystem();
+	}
+
+	public void setDefaultCartographicSupportReferenceSystem(
+			int defaultCartographicSupportReferenceSystem) {
+		getSymbolPreferences().setDefaultCartographicSupportReferenceSystem(
+				defaultCartographicSupportReferenceSystem);
+	}
+
+	public MapContextDrawer createMapContextDrawerInstance(Class drawerClazz)
+	throws MapContextException {
+		return createMapContextDrawerInstance(drawerClazz, "NONE");
+	}
+
+	public MapContextDrawer createDefaultMapContextDrawerInstance()
+	throws MapContextException {
+
+		return createMapContextDrawerInstance(drawerClazz, "default");
+	}
+
+	private MapContextDrawer createMapContextDrawerInstance(Class drawerClazz,
+			String name) throws RegisteredClassInstantiationException {
+		try {
+			return (MapContextDrawer) drawerClazz.newInstance();
+		} catch (Exception ex) {
+			throw new RegisteredClassInstantiationException(
+					MapContextDrawer.class, drawerClazz, name, ex);
+		}
+	}
+
+	public void setDefaultMapContextDrawer(Class drawerClazz)
+	throws MapContextException {
+
+		validateMapContextDrawer(drawerClazz);
+		this.drawerClazz = drawerClazz;
+	}
+
+	public void validateMapContextDrawer(Class drawerClazz)
+	throws MapContextException {
+		if (!MapContextDrawer.class.isAssignableFrom(drawerClazz)) {
+			throw new InvalidRegisteredClassException(MapContextDrawer.class,
+					drawerClazz, "UNKNOWN");
+		}
+	}
+
+	public GraphicLayer createGraphicsLayer(IProjection projection) {
+		DefaultGraphicLayer layer = new DefaultGraphicLayer();
+		try {
+			layer.initialize(projection);	
+			layer.setLegend((IVectorLegend)createLegend(IVectorialUniqueValueLegend.LEGEND_NAME));
+		} catch (Exception e) {
+			LOG.error("Error initializing the graphics layer", e);
+		}
+		return layer;
+	}
+
+	public String getDefaultVectorLegend() {
+		return defaultVectorLegend;
+	}
+
+	public void setDefaultVectorLegend(String defaultVectorLegend) {
+		this.defaultVectorLegend = defaultVectorLegend;
+	}
+
+	public void registerLegend(String legendName, Class legendClass)
+	throws MapContextRuntimeException {
+
+		if (legendClass == null || !ILegend.class.isAssignableFrom(legendClass)) {
+			throw new InvalidRegisteredClassException(ILegend.class,
+					legendClass, legendName);
+		}
+
+		legends.put(legendName, legendClass);
+	}
+
+	public ILegend createLegend(String legendName)
+	throws MapContextRuntimeException {
+		Class legendClass = (Class) legends.get(legendName);
+
+		if (legendClass != null) {
+			try {
+				return (ILegend) legendClass.newInstance();
+			} catch (InstantiationException e) {
+				throw new RegisteredClassInstantiationException(ILegend.class,
+						legendClass, legendName, e);
+			} catch (IllegalAccessException e) {
+				throw new RegisteredClassInstantiationException(ILegend.class,
+						legendClass, legendName, e);
+			}
+		}
+		return null;
+	}
+
+	public IVectorLegend createDefaultVectorLegend(int shapeType)
+	throws MapContextRuntimeException {
+		try {
+			Random rand = new Random();
+
+			int numreg = rand.nextInt(255 / 2);
+			double div = (1 - rand.nextDouble() * 0.66) * 0.9;
+			Color randomColor = new Color(((int) (255 * div + (numreg * rand
+					.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
+							.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
+									.nextDouble()))) % 255);
+			IVectorLegend legend = (IVectorLegend) createLegend(getDefaultVectorLegend());
+			if( legend == null ) {
+				return null;
+			}
+			ISymbol defaultSymbol =
+				getSymbolManager().createSymbol(shapeType, randomColor);
+			legend.setDefaultSymbol(defaultSymbol);
+			legend.setShapeType(shapeType);
+			return legend;
+		} catch(Exception e) {
+			throw new MapContextRuntimeException(e);
+		}
+	}
+
+	public void registerLegendReader(String format, Class readerClass)
+	throws MapContextRuntimeException {
+		if (readerClass == null
+				|| !ILegendReader.class.isAssignableFrom(readerClass)) {
+			throw new InvalidRegisteredClassException(ILegendReader.class,
+					readerClass, format);
+		}
+
+		legendReaders.put(format, readerClass);
+	}
+
+	public ILegendReader createLegendReader(String format)
+	throws MapContextRuntimeException {
+		Class legendReaderClazz = (Class) legendReaders.get(format);
+
+		if (legendReaderClazz != null) {
+			try {
+				return (ILegendReader) legendReaderClazz.newInstance();
+			} catch (InstantiationException e) {
+				throw new RegisteredClassInstantiationException(
+						ILegendReader.class, legendReaderClazz, format, e);
+			} catch (IllegalAccessException e) {
+				throw new RegisteredClassInstantiationException(
+						ILegendReader.class, legendReaderClazz, format, e);
+			}
+		}
+		return null;
+	}
+
+	public void registerLegendWriter(String legendName, String format,
+			Class writerClass) throws MapContextRuntimeException {
+		if (writerClass == null
+				|| !ILegendWriter.class.isAssignableFrom(writerClass)) {
+			throw new InvalidRegisteredClassException(ILegendWriter.class,
+					writerClass, format.concat("-").concat(legendName));
+		}
+
+		Map legendFormatWriters = (Map) legendWriters.get(format);
+
+		synchronized (legendWriters) {
+			if (legendFormatWriters == null) {
+				legendFormatWriters = Collections
+				.synchronizedMap(new HashMap());
+				legendWriters.put(format, legendFormatWriters);
+			}
+		}
+
+		legendFormatWriters.put(legendName, writerClass);
+	}
+
+	public ILegendWriter createLegendWriter(String legendName, String format)
+	throws MapContextRuntimeException {
+		Map legendFormatWriters = getLegendWritersForFormat(format);
+
+		if (legendFormatWriters != null) {
+			Class legendWriterClazz = (Class) legendFormatWriters
+			.get(legendName);
+
+			if (legendWriterClazz != null) {
+				try {
+					return (ILegendWriter) legendWriterClazz.newInstance();
+				} catch (InstantiationException e) {
+					throw new RegisteredClassInstantiationException(
+							ILegendWriter.class, legendWriterClazz, format
+							.concat("-").concat(legendName), e);
+				} catch (IllegalAccessException e) {
+					throw new RegisteredClassInstantiationException(
+							ILegendWriter.class, legendWriterClazz, format
+							.concat("-").concat(legendName), e);
+				}
+			}
+		}
+		return null;
+	}
+
+	private Map getLegendWritersForFormat(String format) {
+		return (Map) legendWriters.get(format);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(int shapeType)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createMultiLayerSymbol(shapeType);
+	}
+
+	public IMultiLayerSymbol createMultiLayerSymbol(String symbolName)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createMultiLayerSymbol(symbolName);
+	}
+
+	public ISymbol createSymbol(int shapeType, Color color)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(shapeType, color);
+	}
+
+	public ISymbol createSymbol(int shapeType)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(shapeType);
+	}
+
+	public ISymbol createSymbol(String symbolName, Color color)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(symbolName, color);
+	}
+
+	public ISymbol createSymbol(String symbolName)
+	throws MapContextRuntimeException {
+		return getSymbolManager().createSymbol(symbolName);
+	}
+
+	public IWarningSymbol getWarningSymbol(String message, String symbolDesc,
+			int symbolDrawExceptionType) throws MapContextRuntimeException {
+		return getSymbolManager().getWarningSymbol(message, symbolDesc,
+				symbolDrawExceptionType);
+	}
+
+	public ISymbol[] loadSymbols(File folder, FileFilter filter)
+	throws SymbolException {
+		return getSymbolManager().loadSymbols(folder, filter);
+	}
+
+	public ISymbol[] loadSymbols(File folder) throws SymbolException {
+		return getSymbolManager().loadSymbols(folder);
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, Class symbolClass)
+	throws MapContextRuntimeException {
+		getSymbolManager().registerMultiLayerSymbol(symbolName, symbolClass);
+	}
+
+	public void registerMultiLayerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextRuntimeException {
+		getSymbolManager().registerMultiLayerSymbol(symbolName, shapeTypes,
+				symbolClass);
+	}
+
+	public void registerSymbol(String symbolName, Class symbolClass)
+	throws MapContextRuntimeException {
+		getSymbolManager().registerSymbol(symbolName, symbolClass);
+	}
+
+	public void registerSymbol(String symbolName, int[] shapeTypes,
+			Class symbolClass) throws MapContextException {
+		getSymbolManager().registerSymbol(symbolName, shapeTypes, symbolClass);
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder,
+			boolean overwrite) throws SymbolException {
+		getSymbolManager().saveSymbol(symbol, fileName, folder, overwrite);
+	}
+
+	public void saveSymbol(ISymbol symbol, String fileName, File folder)
+	throws SymbolException {
+		getSymbolManager().saveSymbol(symbol, fileName, folder);
+	}
+
+	public FLayer createLayer(String layerName, DataStoreParameters parameters)
+	throws LoadLayerException {
+		return LayerFactory.getInstance().createLayer(layerName, parameters);
+	}
+
+	public FLayer createLayer(String layerName, DataStore store)
+	throws LoadLayerException {
+		return LayerFactory.getInstance().createLayer(layerName, store);
+	}
+
+	public ILegend getLegend(DataStore dataStore) {
+		ILegend legend = null;
+
+		//Loading the legend from a store based on file
+		try {
+//			This access by reflection is done because the libFMap_dalfile project
+//			has to be divided in several projects. The commented code is the fine
+//			code whereas the used code has to be deleted.		
+//			
+//			if (dataStore.getExplorer() instanceof FilesystemServerExplorer){
+//				File file = ((FilesystemServerExplorer)dataStore.getExplorer()).getResourcePath(dataStore, "gvl");
+//				if ((file != null) && (file.exists())){
+//					PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
+//					PersistentState persistentState = persistenceManager.loadState(new FileInputStream(file));
+//					legend = (ILegend)persistenceManager.create(persistentState);
+//				}
+//			}
+			DataServerExplorer dataServerExplorer = dataStore.getExplorer();
+			Class[] args = new Class[2];
+			args[0] = DataStore.class;
+			args[1] = String.class;
+			Method method = dataStore.getExplorer().getClass().getMethod("getResourcePath", args);
+			if (method != null){
+				Object[] params = new Object[2];
+				params[0] = dataStore;
+				params[1] = "gvl";
+				File file = (File)method.invoke(dataServerExplorer, params);
+				if ((file != null) && (file.exists())){
+					PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
+					PersistentState persistentState = persistenceManager.loadState(new FileInputStream(file));
+					legend = (ILegend)persistenceManager.create(persistentState);
+				}
+			}	
+
+		} catch (Exception e) {
+			LOG.info("Can't load the specific legend provided by the explorer.", e);
+		} 
+
+		//If the legend is null, next option is to check if the store has the getLegend method
+		if (legend == null){
+			try {
+				legend = (IVectorLegend) dataStore.invokeDynMethod(
+						"getLegend", null);
+			} catch (DynMethodNotSupportedException e) {
+	            LOG.info("This store {} can not provide a legend.", dataStore.getName(), e);
+			} catch (DynMethodException e) {
+				LOG.error("Can't load the specific legend provided for the store {}.", dataStore.getName(), e);
+			}
+		}
+
+		//If legend is null, last step is just try to create the legend by default
+		if( legend == null ) {
+			FeatureType featureType;
+			try {
+				featureType = (((FeatureStore)dataStore).getDefaultFeatureType());
+				int indexGeom = featureType.getDefaultGeometryAttributeIndex();
+				int typeShape = featureType.getAttributeDescriptor(indexGeom).getGeometryType();
+				legend = MapContextLocator.getMapContextManager().createDefaultVectorLegend(typeShape);
+			} catch (DataException e) {
+				LOG.error("Error getting the default feature type", e);
+			}			
+		}
+
+		return legend;
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/RegisteredClassInstantiationException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/RegisteredClassInstantiationException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/RegisteredClassInstantiationException.java	(revision 36112)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+
+/**
+ * Exception thrown when a class instance could not be created.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class RegisteredClassInstantiationException extends
+		MapContextRuntimeException {
+
+	private static final long serialVersionUID = -2797661681885864660L;
+
+	private static final String KEY = "registered_class_instantiation_exception";
+
+	private static final String MESSAGE = "Unable to create an object instance"
+			+ "of the type %(typeToImplement) from the class %(registeredClass)"
+			+ ", registered with the name %(registeredName)";
+
+	public RegisteredClassInstantiationException(Class typeToImplement,
+			Class registeredClass, String registeredName, Throwable cause) {
+		super(MESSAGE, cause, KEY, serialVersionUID);
+		setValue("typeToImplement", typeToImplement);
+		setValue("registeredClass", registeredClass);
+		setValue("registeredName", registeredName);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/InvalidRegisteredClassException.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/InvalidRegisteredClassException.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/InvalidRegisteredClassException.java	(revision 36112)
@@ -0,0 +1,54 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {gvSIG}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import org.gvsig.fmap.mapcontext.MapContextRuntimeException;
+
+/**
+ * Exception thrown when a null class or an implementation class which does
+ * not implements the required type, is registered.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class InvalidRegisteredClassException extends MapContextRuntimeException {
+
+	private static final long serialVersionUID = -2797661681885864660L;
+
+	private static final String KEY = "invalid_registered_class_exception";
+
+	private static final String MESSAGE = "The provided class %(registeredClass), "
+			+ "registered with the name %(registeredName), is null or does not "
+			+ "implements the %(typeToImplement) type";
+
+	public InvalidRegisteredClassException(Class typeToImplement,
+			Class registeredClass, String registeredName) {
+		super(MESSAGE, KEY, serialVersionUID);
+		setValue("typeToImplement", typeToImplement);
+		setValue("registeredName", registeredName);
+		setValue("registeredClass", registeredClass);
+	}
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/MapContextImplLibrary.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/MapContextImplLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/MapContextImplLibrary.java	(revision 36112)
@@ -0,0 +1,55 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ * 
+ * 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 2
+ * 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.
+ * 
+ * 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.
+ * 
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 {DiSiD Technologies}  {{Task}}
+ */
+package org.gvsig.fmap.mapcontext.impl;
+
+import org.gvsig.fmap.mapcontext.MapContextLibrary;
+import org.gvsig.fmap.mapcontext.MapContextLocator;
+import org.gvsig.fmap.mapcontext.rendering.symbols.impl.DefaultSymbolManager;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * Library for the default implementation of the MapContext library.
+ * 
+ * @author <a href="mailto:cordinyana@gvsig.org">C�sar Ordi�ana</a>
+ */
+public class MapContextImplLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsImplementationOf(MapContextLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+		MapContextLocator
+				.registerMapContextManager(DefaultMapContextManager.class);
+		MapContextLocator.registerSymbolManager(DefaultSymbolManager.class);
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+	}
+
+}
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java	(revision 36112)
@@ -0,0 +1,1650 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.cresques.cts.ICoordTrans;
+import org.cresques.cts.IProjection;
+import org.cresques.geo.Projected;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.gvsig.compat.CompatLocator;
+import org.gvsig.compat.print.PrintAttributes;
+import org.gvsig.fmap.dal.exception.ReadException;
+import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.fmap.mapcontext.events.ErrorEvent;
+import org.gvsig.fmap.mapcontext.events.listeners.AtomicEventListener;
+import org.gvsig.fmap.mapcontext.events.listeners.ErrorListener;
+import org.gvsig.fmap.mapcontext.events.listeners.EventBuffer;
+import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
+import org.gvsig.fmap.mapcontext.layers.CancelationException;
+import org.gvsig.fmap.mapcontext.layers.FLayer;
+import org.gvsig.fmap.mapcontext.layers.FLayers;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener;
+import org.gvsig.fmap.mapcontext.layers.LayerDrawEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerDrawingListener;
+import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent;
+import org.gvsig.fmap.mapcontext.layers.operations.Classifiable;
+import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
+import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+import org.gvsig.fmap.mapcontext.rendering.strategies.SelectedZoomVisitor;
+import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dispose.impl.AbstractDisposable;
+import org.gvsig.tools.dynobject.DynStruct;
+import org.gvsig.tools.exception.BaseException;
+import org.gvsig.tools.observer.Observable;
+import org.gvsig.tools.observer.Observer;
+import org.gvsig.tools.persistence.PersistenceManager;
+import org.gvsig.tools.persistence.Persistent;
+import org.gvsig.tools.persistence.PersistentState;
+import org.gvsig.tools.persistence.exception.PersistenceException;
+import org.gvsig.tools.task.Cancellable;
+import org.gvsig.tools.visitor.Visitor;
+
+
+/**
+ * <p>The <code>MapContext</code> class represents the model and a part of the control and view around graphical layers
+ * used by {@link MapControl MapControl}.</p>
+ *
+ * <p>An instance of <code>MapContext</code> is made up with:
+ * <ul>
+ * <li>a hierarchy of {@link FLayers FLayers} nodes
+ * <li>a {@link GraphicLayer GraphicLayer} layer
+ * <li>a {@link ViewPort ViewPort}
+ * <li>an {@link EventBuffer EventButter}
+ * <li>some {@link com.iver.cit.gvsig.fmap.layers.LegendListener LegendListener}s
+ * <li>some {@link LayerDrawingListener LayerDrawingListener}s
+ * <li>some {@link ErrorListener ErrorListener}s
+ * </ul>
+ * </p>
+ *
+ * @author Fernando Gonz�lez Cort�s
+ */
+public class MapContext extends AbstractDisposable implements Projected,
+		Persistent, Observer {
+	/**
+	 * <p>Defines the value which a unit of a distance measurement must be divided to obtain its equivalent <b>in meters</b>.</p>
+	 *
+	 * <p><b><i>Conversion values of distance measurements:</i></b>
+	 * <ul>
+	 *  <li><code>MapContext.CHANGEM[0]</code>: kilometer
+	 *  <li><code>MapContext.CHANGEM[1]</code>: meter
+	 *  <li><code>MapContext.CHANGEM[2]</code>: centimeter
+	 *  <li><code>MapContext.CHANGEM[3]</code>: millimeter
+	 *  <li><code>MapContext.CHANGEM[4]</code>: international statute mile
+	 *  <li><code>MapContext.CHANGEM[5]</code>: yard
+	 *  <li><code>MapContext.CHANGEM[6]</code>: foot
+	 *  <li><code>MapContext.CHANGEM[7]</code>: inch
+	 *  <li><code>MapContext.CHANGEM[8]</code>: grade
+	 * </ul>
+	 *
+	 * <p><h3>Examples:</h3>
+	 * <pre>1 international statute mile / MapContext.CHANGEM[4] = X meters</pre>
+	 * <pre>1 kilometer / MapContext.CHANGEM[0] = X meters</pre>
+	 * <pre>1 grade / MapContext.CHANGEM[8] = X meters</pre>
+	 * </p>
+	 *
+	 * <p><h3>Grade conversion value: <code>MapContext.CHANGEM[8]</code></h3>
+	 * The value of <code>MapContext.CHANGEM[8]</code> represents the meters of a straight line between two
+	 *  points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using
+	 *  a radius approximated of R<sub>Earth</sub>=6.37846082678100774672e6 meters, according these equations:
+	 * <pre>D = 2 * (sin (1)) * R<sub>Earth</sub></pre>
+	 * <pre>MapContext.CHANGEM[8] = 1 / D</pre>
+	 * <h4>Explanation:</h4>
+	 * We get an isosceles triangle with the center of the Earth and the 2 points on the surface. This triangle can be divided into
+	 * two rectangle triangles. We know two values, the angle of 1 grade, that will be 0.50 grades in each triangle, and the Earth radius that
+	 * is the hypotenuse. Then we apply trigonometry and get the distance <i>D</i> between both points on the Earth surface.</p>
+	 * <p>Now we only must invert that value to obtain <code>MapContext.CHANGEM[8]</code>.</p>
+	 *@deprecated use getDistanceTrans2Meter()
+	 */
+	public static final double[] CHANGEM = { 1000, 1, 0.01, 0.001, 1609.344,
+			0.9144, 0.3048, 0.0254, 1/8.983152841195214E-6 };
+
+
+	public static ArrayList AREANAMES=new ArrayList();
+	public static ArrayList AREAABBR=new ArrayList();
+	public static ArrayList AREATRANS2METER=new ArrayList();
+
+	public static ArrayList DISTANCENAMES=new ArrayList();
+	public static ArrayList DISTANCEABBR=new ArrayList();
+	public static ArrayList DISTANCETRANS2METER=new ArrayList();
+
+	static{
+		MapContext.addDistanceUnit("Kilometros","Km",1000);
+    	MapContext.addDistanceUnit("Metros","m",1);
+    	MapContext.addDistanceUnit("Centimetros","cm",0.01);
+    	MapContext.addDistanceUnit("Milimetros","mm",0.001);
+    	MapContext.addDistanceUnit("Millas","mi",1609.344);
+    	MapContext.addDistanceUnit("Yardas","Ya",0.9144);
+    	MapContext.addDistanceUnit("Pies","ft",0.3048);
+    	MapContext.addDistanceUnit("Pulgadas","inche",0.0254);
+    	MapContext.addDistanceUnit("Grados","�",1/8.983152841195214E-6);
+
+    	MapContext.addAreaUnit("Kilometros","Km",true,1000);
+    	MapContext.addAreaUnit("Metros","m",true,1);
+    	MapContext.addAreaUnit("Centimetros","cm",true,0.01);
+    	MapContext.addAreaUnit("Milimetros","mm",true,0.001);
+    	MapContext.addAreaUnit("Millas","mi",true,1609.344);
+    	MapContext.addAreaUnit("Yardas","Ya",true,0.9144);
+    	MapContext.addAreaUnit("Pies","ft",true,0.3048);
+    	MapContext.addAreaUnit("Pulgadas","inche",true,0.0254);
+    	MapContext.addAreaUnit("Grados","�",true,1/8.983152841195214E-6);
+
+
+    }
+	
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	
+	private static final MapContextManager mapContextManager = MapContextLocator
+            .getMapContextManager(); 
+	
+	private static final Logger logger = LoggerFactory.getLogger(MapContext.class);
+
+	/**
+	 * <p>Determines the number of frames.</p>
+	 *
+	 * <p>Number of updates per second that the timer will invoke repaint this component.</p>
+	 */
+    private static int drawFrameRate = 3;
+    /**
+	 * <p>Returns the draw frame rate.</p>
+	 *
+	 * <p>Draw frame rate is the number of repaints of this <code>MapControl</code> instance that timer invokes per second.</p>
+	 *
+	 * @return number of repaints of this <code>MapControl</code> instance that timer invokes per second
+	 *
+	 * @see #applyFrameRate()
+	 * @see #setDrawFrameRate(int)
+	 */
+	public static int getDrawFrameRate() {
+		return drawFrameRate;
+	}
+
+	/**
+	 * <p>Sets the draw frame rate.</p>
+	 *
+	 * <p>Draw frame rate is the number of repaints of this <code>MapControl</code> instance that timer invokes per second.</p>
+	 *
+	 * @param drawFrameRate number of repaints of this <code>MapControl</code> instance that timer invokes per second
+	 *
+	 * @see #applyFrameRate()
+	 * @see #getDrawFrameRate()
+	 */
+	public static void setDrawFrameRate(int dFR) {
+		drawFrameRate = dFR;
+	}
+	public static void addAreaUnit(String name, String abbr,boolean isLinear,double trans2meter){
+		if (!AREANAMES.contains(name)){
+			AREANAMES.add(name);
+			String pow="";
+			if (isLinear) {
+				pow=String.valueOf((char)178);
+			}
+			AREAABBR.add(abbr+pow);
+			AREATRANS2METER.add(new Double(trans2meter));
+		}
+	}
+	public static String[] getAreaNames(){
+		return (String[])AREANAMES.toArray(new String[0]);
+	}
+	public static String[] getAreaAbbr(){
+		return (String[])AREAABBR.toArray(new String[0]);
+	}
+	public static double[] getAreaTrans2Meter(){
+		int size=AREATRANS2METER.size();
+		double[] trans2meters=new double[size];
+		for (int i = 0; i < size; i++) {
+			trans2meters[i]=((Double)AREATRANS2METER.get(i)).doubleValue();
+		}
+		return trans2meters;
+	}
+	public static String getOfLinear(int i) {
+		if (((String)AREAABBR.get(i)).toLowerCase().endsWith(String.valueOf((char)178))){
+			return String.valueOf((char)178);
+		}
+		return "";
+	}
+	public static void addDistanceUnit(String name, String abbr,double trans2meter){
+		if (!DISTANCENAMES.contains(name)){
+			DISTANCENAMES.add(name);
+			DISTANCEABBR.add(abbr);
+			DISTANCETRANS2METER.add(new Double(trans2meter));
+		}
+	}
+	public static String[] getDistanceNames(){
+		return (String[])DISTANCENAMES.toArray(new String[0]);
+	}
+	
+	public String getDistanceName() {
+		return (String) DISTANCENAMES.get( this.getViewPort().getDistanceUnits() );
+	}
+	
+	public static String[] getDistanceAbbr(){
+		return (String[])DISTANCEABBR.toArray(new String[0]);
+	}
+	public static double[] getDistanceTrans2Meter(){
+		int size=DISTANCETRANS2METER.size();
+		double[] trans2meters=new double[size];
+		for (int i = 0; i < size; i++) {
+			trans2meters[i]=((Double)DISTANCETRANS2METER.get(i)).doubleValue();
+		}
+		return trans2meters;
+	}
+	public static int getDistancePosition(String s){
+		for (int i = 0; i < DISTANCENAMES.size(); i++) {
+			if (DISTANCENAMES.get(i).equals(s)){
+				return i;
+			}
+		}
+		return 0;
+	}
+
+	/**
+	 * <p>Defines the value which a unit of a distance measurement must be divided to obtain its equivalent <b>in centimeters</b>.</p>
+	 *
+	 * <p><b><i>Conversion values of distance measurements:</i></b>
+	 * <ul>
+	 *  <li><code>MapContext.CHANGE[0]</code>: kilometer
+	 *  <li><code>MapContext.CHANGE[1]</code>: meter
+	 *  <li><code>MapContext.CHANGE[2]</code>: centimeter
+	 *  <li><code>MapContext.CHANGE[3]</code>: millimeter
+	 *  <li><code>MapContext.CHANGE[4]</code>: international statute mile
+	 *  <li><code>MapContext.CHANGE[5]</code>: yard
+	 *  <li><code>MapContext.CHANGE[6]</code>: foot
+	 *  <li><code>MapContext.CHANGE[7]</code>: inch
+	 *  <li><code>MapContext.CHANGE[8]</code>: grade
+	 * </ul>
+	 *
+	 * <p><h3>Examples:</h3>
+	 * <pre>1 international statute mile / MapContext.CHANGE[4] = X centimeters</pre>
+	 * <pre>1 kilometer / MapContext.CHANGE[0] = X centimeters</pre>
+	 * <pre>1 grade / MapContext.CHANGE[8] = X centimeters</pre>
+	 * </p>
+	 *
+	 * <p><h3>Grade conversion value: <code>MapContext.CHANGE[8]</code></h3>
+	 * The value of <code>MapContext.CHANGE[8]</code> represents the centimeters of a straight line between two
+	 *  points on the Earth surface that are 1 grade far each other of the center of the Earth. This value has been calculated using
+	 *  a radius approximated of R<sub>Earth</sub>=6.37846082678100774672e6 meters, according these equations:
+	 * <pre>D = 2 * (sin (1)) * R<sub>Earth</sub></pre>
+	 * <pre>MapContext.CHANGE[8] = 1 / D</pre>
+	 * <h4>Explanation:</h4>
+	 * We get an isosceles triangle with the center of the Earth and the 2 points on the surface. This triangle can be divided into
+	 * two rectangle triangles. We know two values, the angle of 1 grade, that will be 0.50 grades in each triangle, and the Earth radius that
+	 * is the hypotenuse. Then we apply trigonometry and get the distance <i>D</i> between both points on the Earth surface.</p>
+	 * <p>Now we only must invert that value to obtain <code>MapContext.CHANGE[8]</code>.</p>
+	 * @deprecated use getDistanceTrans2Meter() * 100
+	 */
+	public static final double[] CHANGE = { 100000, 100, 1, 0.1, 160934.4,
+			91.44, 30.48, 2.54, 1/8.983152841195214E-4 };
+
+	/* Do not alter the order and the values of this array, if you need append values.*/
+	/**
+	 * <p>Gets the name of all distance measurements supported by <code>MapContext</code>.</p>
+	 */
+//	public static final String[] NAMES= {
+//		Messages.getString("Kilometros"),
+//		Messages.getString("Metros"),
+//		Messages.getString("Centimetros"),
+//		Messages.getString("Milimetros"),
+//		Messages.getString("Millas"),
+//		Messages.getString("Yardas"),
+//		Messages.getString("Pies"),
+//		Messages.getString("Pulgadas"),
+//		Messages.getString("Grados"),
+//	};
+
+	public static final int EQUALS = 0;
+
+	public static final int DISJOINT = 1;
+
+	public static final int INTERSECTS = 2;
+
+	public static final int TOUCHES = 3;
+
+	public static final int CROSSES = 4;
+
+	public static final int WITHIN = 5;
+
+	public static final int CONTAINS = 6;
+
+	public static final int OVERLAPS = 7;
+
+	/**
+	 * A hierarchy of {@link FLayers FLayers} nodes.
+	 *
+	 * @see #getLayers()
+	 * @see #print(Graphics2D, double, PrintAttributes)
+	 */
+	protected FLayers layers;
+
+	/**
+	 * A layer with graphical items: geometries and symbols.
+	 *
+	 * @see #getGraphicsLayer()
+	 * @see #setGraphicsLayer(GraphicLayer)
+	 * @see #print(Graphics2D, double, PrintAttributes)
+	 */
+	private GraphicLayer tracLayer = null;
+		//MapContextLocator.getMapContextManager().createGraphicsLayer(getProjection());
+
+	/**
+	 * Information for draw layers in a view.
+	 *
+	 * @see #getViewPort()
+	 * @see #setViewPort(ViewPort)
+	 */
+	private ViewPort viewPort;
+
+	// private ArrayList invalidationListeners = new ArrayList();
+
+	/**
+	 * Array list with all {@link LegendListener LegendListener} registered to this map.
+	 *
+	 * @see #addLayerListener(LegendListener)
+	 * @see #removeLayerListener(LegendListener)
+	 * @see #callLegendChanged()
+	 */
+	private ArrayList legendListeners = new ArrayList();
+
+	/**
+	 * Array list with all {@link LayerDrawingListener LayerDrawingListener} registered to this map.
+	 *
+	 * @see #addLayerDrawingListener(LayerDrawingListener)
+	 * @see #removeLayerDrawListener(LayerDrawingListener)
+	 * @see #fireLayerDrawingEvent(LayerDrawEvent)
+	 */
+	private ArrayList layerDrawingListeners = new ArrayList();
+
+	/**
+	 * <p>Buffer that is used to store and eject events produced on this map:
+	 * <ul>
+	 *  <li>Layer collection events.
+	 *  <li>View port events.
+	 *  <li>Atomic events.
+	 *  <li>Layer events.
+	 *  <li>Legend events on a {@link Classificable Classificable} layer.
+	 *  <li>Selection events on an {@link AlphanumericData AlphanumericData} data layer.
+	 * </ul>
+	 * </p>
+	 *
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 * @see #beginAtomicEvent()
+	 * @see #endAtomicEvent()
+	 */
+	private EventBuffer eventBuffer = new EventBuffer();
+
+	/**
+	 * Event listener for the collection of layers of this map.
+	 */
+	private LayerEventListener layerEventListener = null;
+
+	/**
+	 * List with information of all errors produced on all layers.
+	 *
+	 * @see #addLayerError(String)
+	 * @see #getLayersError()
+	 * @see #clearErrors()
+	 */
+	private ArrayList layersError = new ArrayList();
+
+	/**
+	 * Array list with all {@link ErrorListener ErrorListener} registered to this map.
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #removeErrorListener(LegendListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	private ArrayList errorListeners = new ArrayList();
+
+
+
+	// public static ResourceBundle myResourceBundle =
+	// ResourceBundle.getBundle("FMap");
+
+	/**
+	 * <p>Default <i>zoom in</i> factor.</p>
+	 * <p>Doing a <i>zoom in</i> operation, decreases the focal distance and increases the eyesight angle to the surface. This allows view an smaller
+	 * area but with the items bigger.</p>
+	 */
+	public static double ZOOMINFACTOR=2;
+
+	/**
+	 * <p>Default <i>zoom out</i> factor.</p>
+	 * <p>Doing a <i>zoom out</i> operation, increases the focal distance and decreases the eyesight angle to the surface. This allows view a bigger
+	 * area but with the items smaller.</p>
+	 */
+	public static double ZOOMOUTFACTOR=0.5;
+
+	/**
+	 * 	 * Draw version of the context. It's used for know when de componend has
+	 * changed any visualization property
+	 *
+	 *  @see getDrawVersion
+	 *  @see updateDrawVersion
+	 */
+	private long drawVersion= 0L;
+
+	/**
+	 * Object to Manage Draw of MapContext
+	 */
+	private MapContextDrawer mapContextDrawer= null;
+
+	/**
+	 * Object to Manage Draw of MapContext
+	 */
+	private Class mapContextDrawerClass = null;
+
+	/**
+	 * <p>Color used to represent the selections.</p>
+	 */
+	private static Color selectionColor = Color.YELLOW;
+	private ArrayList layersToSnap = new ArrayList();
+
+
+	/**
+	 * <p>Gets the color used to represent the selections.</p>
+	 *
+	 * @return color used to represent the selections
+	 */
+	public static Color getSelectionColor() {
+		return selectionColor;
+	}
+
+	/**
+	 * <p>Sets the color used to represent the selections.</p>
+	 *
+	 * @param selectionColor color used to represent the selections
+	 */
+	public static void setSelectionColor(Color selectionColor) {
+		MapContext.selectionColor = selectionColor;
+	}
+
+	/**
+	 * <p>Creates a new map context with the drawing information defined in the view port argument, and
+	 *  without layers.</p>
+	 *
+	 * @param vp information for drawing the layers of this map in the available rectangular area according a projection
+	 */
+	public MapContext(ViewPort vp) {
+        this(new FLayers(), vp);
+	}
+
+	public MapContext() { }
+
+	/**
+	 * <p>Creates a new map context with the layers and the drawing information defined in the view port arguments.</p>
+	 *
+	 * @param fLayers the initial hierarchy of nodes of layers that this map will have
+	 * @param vp information for drawing the layers of this map in the available rectangular area according a projection
+	 */
+	public MapContext(FLayers fLayers, ViewPort vp) {
+		this.layers = fLayers;
+		
+		layerEventListener = new LayerEventListener();
+
+		if (layers != null) {
+			layers.setMapContext(this);
+			layers.addLayerCollectionListener(layerEventListener);
+			layers.addLayerCollectionListener(eventBuffer);
+		}
+
+		setViewPort(vp);
+	}
+
+	/**
+	 * <p>Reports to all driver error listeners registered of a bundle of driver exceptions caused in the same map atomic transaction.</p>
+	 *
+	 * @param introductoryText introductory text specified by developer. If <code>null</code>, use ""
+	 * @param driverExceptions list with a bundle of driver exceptions caught during an atomic event
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #removeErrorListener(LegendListener)
+	 */
+	public synchronized void reportDriverExceptions(String introductoryText,
+													List driverExceptions){
+		for (int i = 0; i < errorListeners.size(); i++) {
+			((ErrorListener) errorListeners.get(i)).
+				reportDriverExceptions(introductoryText, driverExceptions);
+		}
+	}
+
+	/**
+	 * <p>Adds the specified legend listener (if didn't exist) to receive legend events from this map.</p>
+	 *
+	 * @param listener the legend listener
+	 *
+	 * @see #removeLayerListener(LegendListener)
+	 * @see #callLegendChanged()
+	 */
+	public void addLayerListener(LegendListener listener) {
+		if (!legendListeners.contains(listener)){
+			legendListeners.add(listener);
+		}
+	}
+	// SUGERENCIA DE PABLO
+	//	public void addLegendListener(LegendListener listener) {
+	//		if (!legendListeners.contains(listener))
+	//			legendListeners.add(listener);
+	//	}
+
+	/**
+	 * <p>Adds the specified layer drawing listener to catch and handle drawing events from layers of this map.</p>
+	 *
+	 * @param listener the listener to add
+	 *
+	 * @see #removeLayerDrawListener(LayerDrawingListener)
+	 * @see #fireLayerDrawingEvent(LayerDrawEvent)
+	 */
+	public void addLayerDrawingListener(LayerDrawingListener listener) {
+		layerDrawingListeners.add(listener);
+	}
+
+	/**
+	 * <p>Removes the specified layer drawing listener from this map.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+	 * @see #addLayerDrawingListener(LayerDrawingListener)
+	 * @see #fireLayerDrawingEvent(LayerDrawEvent)
+	 */
+	public void removeLayerDrawListener(LayerDrawingListener listener) {
+		layerDrawingListeners.remove(listener);
+	}
+
+	/**
+	 * <p>Adds the specified error listener to receive error events from this map.</p>
+	 *
+	 * @param listener the listener to add
+	 *
+	 * @see #removeErrorListener(LegendListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	public void addErrorListener(ErrorListener listener) {
+		errorListeners.add(listener);
+	}
+
+	/**
+	 * <p>Removes the specified error listener from this map.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	public void removeErrorListener(LegendListener listener) {
+		legendListeners.remove(listener);
+	}
+
+	// SUGERENCIA DE PABLO:
+	//public void removeErrorListener(ErrorListener listener) {
+	//	errorListeners.remove(listener);
+	//}
+
+	/**
+	 * <p>Notifies to all legend listeners registered, that one legend has changed.</p>
+	 * <p>This method must be called only if it's wanted to reflect a legend change.</p>
+	 *
+	 * @see #addLayerListener(LegendListener)
+	 * @see #removeLayerListener(LegendListener)
+	 */
+	public synchronized void callLegendChanged() {
+		for (int i = 0; i < legendListeners.size(); i++) {
+			((LegendListener) legendListeners.get(i)).legendChanged(null);
+		}
+		// getLayers().moveTo(0,0);
+	}
+
+	/**
+	 * <p>Fires a layer drawing event to all {@link LayerDrawingListener LayerDrawingListener} listeners registered,
+	 *  distinguishing the kind of event.</p>
+	 *
+	 * @param e the event
+	 *
+	 * @see #addLayerDrawingListener(LayerDrawingListener)
+	 * @see #removeLayerDrawListener(LayerDrawingListener)
+	 */
+	public synchronized void fireLayerDrawingEvent(LayerDrawEvent e) {
+		for (int i = 0; i < layerDrawingListeners.size(); i++)
+		{
+			LayerDrawingListener listener = (LayerDrawingListener) layerDrawingListeners.get(i);
+			switch (e.getEventType())
+			{
+				case LayerDrawEvent.LAYER_BEFORE_DRAW:
+					listener.beforeLayerDraw(e);
+					break;
+				case LayerDrawEvent.LAYER_AFTER_DRAW:
+					listener.afterLayerDraw(e);
+					break;
+				case LayerDrawEvent.GRAPHICLAYER_BEFORE_DRAW:
+					listener.beforeGraphicLayerDraw(e);
+					break;
+				case LayerDrawEvent.GRAPHICLAYER_AFTER_DRAW:
+					listener.afterLayerGraphicDraw(e);
+					break;
+			}
+		}
+		// getLayers().moveTo(0,0);
+	}
+
+	/**
+	 * <p>Notifies to all error listeners registered, that one error has been produced.</p>
+	 *
+	 * @param e the event with information of the error
+	 *
+	 * @see #addErrorListener(ErrorListener)
+	 * @see #removeErrorListener(LegendListener)
+	 * @see #reportDriverExceptions(String, List)
+	 */
+	public synchronized void callNewErrorEvent(ErrorEvent e) {
+		for (int i = 0; i < errorListeners.size(); i++) {
+			((ErrorListener) errorListeners.get(i)).errorThrown(e);
+		}
+		errorListeners.clear();
+		// getLayers().moveTo(0,0);
+	}
+
+	/**
+	 * <p>Removes the specified layer listener from this map.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+	 * @see #addLayerListener(LegendListener)
+	 * @see #callLegendChanged()
+	 */
+	public void removeLayerListener(LegendListener listener) {
+		legendListeners.remove(listener);
+	}
+
+	// SUGERENCIA DE PABLO:
+	// public void removeLegendListener(LegendListener listener) {
+	// 	legendListeners.remove(listener);
+	// }
+
+	/**
+	 * <p>Returns the hierarchy of {@link FLayers FLayers} nodes stored in this map.</p>
+	 *
+	 * @return the hierarchy of nodes of layers stored in this map
+	 */
+	public FLayers getLayers() {
+		return layers;
+	}
+
+	/**
+	 * <p>Draws the visible layers of this map according its view port, on the image parameter.</p>
+	 *
+	 * @param b image with an accessible buffer of image data
+	 */
+	public void drawLabels(BufferedImage b) {
+	}
+
+	/**
+	 * @see #redraw()
+	 */
+	public void invalidate() {
+		if (getLayers().getLayersCount() > 0) {
+			getLayers().moveTo(0, 0);
+		}
+	}
+
+    /**
+     * <p>
+     * Prints the layers of this map using the {@link Graphics2D Graphics2D}
+     * argument, that usually is the {@link Graphics Graphics} of the printer.
+     * </p>
+     * 
+     * @param g
+     *            for rendering 2-dimensional shapes, text and images on the
+     *            Java(tm) platform
+     * @param scale
+     *            the scale of the view. Must be between
+     *            {@linkplain FLayer#getMinScale()} and
+     *            {@linkplain FLayer#getMaxScale()}.
+     * @param properties
+     *            a set with the settings to be applied to a whole print job and
+     *            to all the documents in the print job
+     * @throws MapContextException
+     *             if there is an error getting the instance of MapContextDrawer
+     * 
+     * @throws ReadDriverException
+     *             if fails reading with driver.
+     * 
+     * @see GraphicLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable,
+     *      double)
+     */
+	public void print(Graphics2D g, double scale,
+			PrintAttributes properties) throws ReadException,
+            MapContextException {
+		
+		CompatLocator.getGraphicsUtils().setRenderingHintsForPrinting(g);
+
+		Cancellable cancel = new Cancellable() {
+			public boolean isCanceled() {
+				return false;
+			}
+
+			public void setCanceled(boolean canceled) {
+				// No queremos que se pueda cancelar la impresi�n.
+
+			}
+		};
+		this.getMapContextDrawer().print(this.layers, g, cancel, scale,properties);
+		if (tracLayer != null) {
+			tracLayer.draw(null, g, viewPort, cancel, scale);
+		}
+	}
+
+	/**
+	 * <p>Returns a new <code>MapContext</code> instance with the information of the <code>vp</code> argument, and the layers of this map.</p>
+	 *
+	 * @param vp information for drawing the layers of this map in the available rectangular area according a projection
+	 *
+	 * @return a new <code>MapContext</code> instance projected by <code>vp</code>
+	 */
+	public MapContext createNewFMap(ViewPort vp) {
+		MapContext ret = new MapContext(vp);
+		ret.layers = this.layers;
+
+		return ret;
+	}
+
+	/**
+	 * <p>Creates a new independent <code>MapContext</code> instance, that has a clone of the layers and the view port of this one.</p>
+	 * <p>The new map will have the same data source drivers to avoid waste memory, and work faster.</p>
+	 *
+	 * @return the new <code>MapContext</code> instance
+	 *
+	 * @throws XMLException if fails cloning the view port or a layer
+	 *
+	 * @see FLayer#cloneLayer()
+	 * @see ViewPort#cloneViewPort()
+	 */
+	public MapContext cloneFMap() {
+		ViewPort vp;
+        try {
+            vp = (ViewPort) getViewPort().clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
+		FLayers antLayers = getLayers();
+		MapContext ret = new MapContext(vp);
+		FLayers aux = new FLayers();//(ret,null);
+		aux.setMapContext(ret);
+		for (int i=0; i < antLayers.getLayersCount(); i++)
+		{
+			FLayer lyr = antLayers.getLayer(i);
+			try {
+				FLayer auxLayer = lyr.cloneLayer();
+				aux.addLayer(auxLayer);
+				auxLayer.dispose();
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		}
+		ret.layers = aux;
+		return ret;
+
+
+	}
+
+	/**
+	 * Like {@linkplain #cloneFMap()}, but now doesn't clone the layers, rather copies them.
+	 *
+	 * @return the new map
+	 */
+	public MapContext cloneToDraw() {
+		ViewPort vp;
+        try {
+            vp = (ViewPort) getViewPort().clone();
+            MapContext mapContext=new MapContext(getLayers(),vp);
+            return mapContext;
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
+	}
+
+
+	/**
+	 * <p>Adds a layer to the group of layers that are at a upper level in the tree.</p>
+	 *
+	 * @param vectorial the layer to add
+	 */
+	public void addToTrackLayer(FLayer vectorial) {
+	}
+
+	/**
+	 * <p>Returns the scale of the view in the screen.</p>
+	 *
+	 * @return one of this values:
+	 * <ul>
+	 * <li>the scale of the adjusted extent scale of the view in the screen
+	 * <li><code>-1</code> if there is no image
+	 * <li><code>0</code> if there is no extent defined for the image
+	 * </ul>
+	 *
+	 * @see #setScaleView(long)
+	 * @see ViewPort#getAdjustedExtent()
+	 * @see IProjection#getScale(double, double, double, double)
+	 */
+	public long getScaleView() {
+		double dpi = getScreenDPI();
+		IProjection proj = viewPort.getProjection();
+
+		if (viewPort.getImageSize() == null) {
+			return -1;
+		}
+
+		if (viewPort.getAdjustedExtent() == null) {
+			return 0;
+		}
+		double[] trans2Meter=getDistanceTrans2Meter();
+		if (proj == null) {
+			double w = ((viewPort.getImageSize().width / dpi) * 2.54);
+			return (long) (viewPort.getAdjustedExtent().getLength(0) / w * trans2Meter[getViewPort()
+					.getMapUnits()]);
+		}
+
+		return Math.round(proj.getScale((viewPort.getAdjustedExtent().getMinimum(0)*trans2Meter[getViewPort().getMapUnits()]),
+				(viewPort.getAdjustedExtent().getMaximum(0)*trans2Meter[getViewPort().getMapUnits()]),
+				viewPort.getImageSize().width, dpi));
+
+	}
+
+	/**
+	 * <p>Sets the new extent of the view, calculated using the scale argument.</p>
+	 * <p>Doesn't updates the scale if there isn't information about the dimension of the image or the
+	 *  adjusted extent.</p>
+	 *
+	 * @param scale the new scale for the view
+	 *
+	 * @see ViewPort#setProjection(IProjection)
+	 * @see #getScaleView()
+	 */
+	public void setScaleView(long scale) {
+		double dpi = getScreenDPI();
+		if (viewPort.getImageSize() == null) {
+			return;
+		}
+		IProjection proj = viewPort.getProjection();
+		if (viewPort.getAdjustedExtent() == null) {
+			return;
+		}
+		double[] trans2Meter=getDistanceTrans2Meter();
+		Envelope env=viewPort.getAdjustedExtent();
+		Rectangle2D r=new Rectangle2D.Double(env.getMinimum(0),env.getMinimum(1),env.getLength(0),env.getLength(1));
+		Rectangle2D rec=proj.getExtent(r,scale,viewPort.getImageWidth(),viewPort.getImageHeight(),100*getDistanceTrans2Meter()[getViewPort().getMapUnits()],trans2Meter[getViewPort().getDistanceUnits()],dpi);
+		try {
+			getViewPort().setEnvelope(geomManager.createEnvelope(rec.getX(),rec.getY(),rec.getMaxX(),rec.getMaxY(), SUBTYPES.GEOM2D));
+		} catch (CreateEnvelopeException e) {
+			logger.error("Error seting the bounding box");
+		}
+	}
+
+	/**
+	 * <p>Returns the screen resolution (Dots Per Inch) as it was defined by the user's preference, or
+	 * by default as it is defined in the default Toolkit.</p>
+	 *
+	 * @return double with the screen's dpi
+	 */
+	public static double getScreenDPI() {
+		return CompatLocator.getGraphicsUtils().getScreenDPI();
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#setVectorial(com.iver.cit.gvsig.fmap.VectorialAdapter)
+	 */
+//	public void setVectorial(VectorialAdapter v) {
+//	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#process(com.iver.cit.gvsig.fmap.FeatureSelectorVisitor)
+	 */
+	public void process(Visitor visitor) {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#processSelected(com.iver.cit.gvsig.fmap.FeatureVisitor)
+	 */
+	public void processSelected(Visitor visitor) {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#select(com.iver.cit.gvsig.fmap.FeatureSelectorVisitor,
+	 *      VectorialSubSet)
+	 */
+	public void select(Visitor visitor) {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#selectFromSelection()
+	 */
+	public void selectFromSelection() {
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#createIndex()
+	 */
+	public void createIndex() {
+	}
+
+	/**
+	 * @see org.cresques.geo.Projected#getProjection()
+	 *
+	 * @see ViewPort#getProjection()
+	 * @see #setProjection(IProjection)
+	 * @see #reProject(ICoordTrans)
+	 */
+	public IProjection getProjection() {
+		return getViewPort().getProjection();
+	}
+
+	/**
+	 * <p>Sets the new projection.</p>
+	 *
+	 * @param proj the new projection
+	 *
+	 * @see #getProjection()
+	 * @see ViewPort#setProjection(IProjection)
+	 * @see #reProject(ICoordTrans)
+	 */
+	public void setProjection(IProjection proj) {
+		if (getViewPort() != null) {
+			getViewPort().setProjection(proj);
+		}
+	}
+
+	/**
+	 * @see org.cresques.geo.Projected#reProject(org.cresques.cts.ICoordTrans)
+	 */
+	public void reProject(ICoordTrans arg0) {
+		// TODO implementar reprojecci�n (lo que sea eso)
+	}
+
+	/**
+	 * @see org.gvsig.fmap.mapcontext.rendering.strategies.Strategy#getSelectionBounds()
+	 *
+	 * @see SelectedZoomVisitor#getSelectBound()
+	 */
+	public Envelope getSelectionBounds() throws BaseException {
+		SelectedZoomVisitor visitor = new SelectedZoomVisitor();
+
+		layers.accept(visitor);
+
+		return visitor.getSelectBound();
+	}
+
+    /**
+     * <p>
+     * Draws this map if its {@link ViewPort ViewPort} has an extent defined:<br>
+     * <ol>
+     * <li>Selects only the layers that have to be drawn:
+     * {@linkplain #prepareDrawing(BufferedImage, Graphics2D, double)}.
+     * <li>Sets quality: antialiasing by text and images, and quality rendering.
+     * <li>Draws the layers.
+     * <li>Fires a <code>LayerDrawEvent.GRAPHICLAYER_BEFORE_DRAW</code>.
+     * <li>Draws the graphic layer.
+     * <li>Fires a <code>LayerDrawEvent.GRAPHICLAYER_AFTER_DRAW</code>.
+     * <li>Invokes the garbage collector and memory clean.
+     * </ol>
+     * </p>
+     * 
+     * @param image
+     *            buffer used sometimes instead <code>g</code> to accelerate the
+     *            draw. For example, if two points are as closed that can't be
+     *            distinguished, draws only one.
+     * @param g
+     *            for rendering 2-dimensional shapes, text and images on the
+     *            Java(tm) platform
+     * @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()}.
+     * @throws MapContextException
+     *             if there is an error getting the instance of MapContextDrawer
+     * @throws ReadDriverException
+     *             if fails reading with the driver.
+     */
+	public void draw(BufferedImage image, Graphics2D g, Cancellable cancel,
+			double scale) throws ReadException, MapContextException {
+		if (viewPort.getEnvelope() == null) {
+			return;
+		}
+
+		CompatLocator.getGraphicsUtils().setRenderingHintsForDrawing(g);
+
+		this.getMapContextDrawer().draw(this.layers, image, g, cancel, scale);
+
+		if (tracLayer != null) {
+			LayerDrawEvent beforeTracLayerEvent =
+					new LayerDrawEvent(tracLayer, g, viewPort,
+							LayerDrawEvent.GRAPHICLAYER_BEFORE_DRAW);
+			fireLayerDrawingEvent(beforeTracLayerEvent);
+			tracLayer.draw(image, g, viewPort, cancel, scale);
+			LayerDrawEvent afterTracLayerEvent =
+					new LayerDrawEvent(tracLayer, g, viewPort,
+							LayerDrawEvent.GRAPHICLAYER_AFTER_DRAW);
+			fireLayerDrawingEvent(afterTracLayerEvent);
+		}
+
+		System.gc();
+	}
+
+	/**
+	 * <p>Draws only the internal graphic layer using the information of the {@link ViewPort ViewPort} of this map.</p>
+	 *
+	 * @param image image used to accelerate the screen draw
+	 * @param g for rendering 2-dimensional shapes, text and images on the Java(tm) platform
+	 * @param cancel shared object that determines if this layer can continue being drawn
+	 * @param scale value that represents the scale
+	 * @throws ReadDriverException if fails reading with the driver.
+	 *
+	 * @see GraphicLayer#draw(BufferedImage, Graphics2D, ViewPort, Cancellable, double)
+	 */
+	public void drawGraphics(BufferedImage image, Graphics2D g,
+			Cancellable cancel, double scale) throws ReadException {
+		if (viewPort == null) {
+			return;
+		}
+		if (tracLayer != null) {
+			tracLayer.draw(image, g, viewPort, cancel, scale);
+		}
+	}
+
+    /**
+     * <p>
+     * Like
+     * {@linkplain MapContext#draw(BufferedImage, Graphics2D, Cancellable, double)}
+     * , but creating the task as cancellable.
+     * </p>
+     * 
+     * @param image
+     *            buffer used sometimes instead <code>g</code> to accelerate the
+     *            draw. For example, if two points are as closed that can't be
+     *            distinguished, draws only one.
+     * @param g
+     *            for rendering 2-dimensional shapes, text and images on the
+     *            Java(tm) platform
+     * @param scale
+     *            the scale of the view. Must be between
+     *            {@linkplain FLayer#getMinScale()} and
+     *            {@linkplain FLayer#getMaxScale()}.
+     * @throws MapContextException
+     *             if there is an error getting the instance of MapContextDrawer
+     * 
+     * @throws ReadDriverException
+     *             if the driver fails reading.
+     * 
+     * @see #draw(BufferedImage, Graphics2D, Cancellable, double)
+     */
+	public void draw(BufferedImage image, Graphics2D g, double scale)
+			throws ReadException, MapContextException {
+		draw(image, g, new Cancellable() {
+			/**
+			 * @see org.gvsig.utils.swing.threads.Cancellable#isCanceled()
+			 */
+			public boolean isCanceled() {
+				return false;
+			}
+
+			public void setCanceled(boolean canceled) {
+				// Do nothing
+			}
+		}, scale);
+	}
+
+	/**
+	 * <p>Gets the {@link ViewPort ViewPort} associated to this map.</p>
+	 *
+	 * @return the view port
+	 *
+	 * @see #setViewPort(ViewPort)
+	 */
+	public ViewPort getViewPort() {
+		return viewPort;
+	}
+
+	/**
+	 * <p>Sets a {@link ViewPort ViewPort} with the drawing information
+	 *  of this map.</p>
+	 * <p>If there was a previous view port, removes its {@link EventBuffer EventBuffer} and
+	 *  adds the new one.</p>
+	 *
+	 * @param viewPort the viewPort
+	 *
+	 * @see #getViewPort()
+	 */
+	public void setViewPort(ViewPort viewPort) {
+		if (this.viewPort != null) {
+			this.viewPort.removeViewPortListener(eventBuffer);
+		}
+
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.setViewPort(viewPort);
+		}
+
+		this.viewPort = viewPort;
+		if (viewPort != null) {
+			viewPort.addViewPortListener(eventBuffer);
+		}
+	}
+
+	/**
+	 * <p>Sets the given extent to the {@link ViewPort ViewPort} and updates the view with the new zoom.</p>
+	 *
+	 * @param extent the extent of the new zoom
+	 */
+	public void zoomToEnvelope(Envelope extent) {
+		if (extent!=null) {
+			getViewPort().setEnvelope(extent);
+		}
+	}
+
+	/**
+	 * <p>Returns the union of all extents of all layers of this map.</p>
+	 *
+	 * @return full extent of layers of this map
+	 * @throws ReadDriverException if the driver fails reading.
+	 *
+	 * @see FLayers#getFullEnvelope()
+	 */
+	public Envelope getFullEnvelope() throws ReadException {
+		return layers.getFullEnvelope();
+	}
+
+
+
+	/**
+	 * <p>Adds a listener of atomic events to the internal {@link EventBuffer EventBuffer}.</p>
+	 *
+	 * @param listener the new listener
+	 *
+	 * @return <code>true</code> if has added the listener successfully
+	 *
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 * @see EventBuffer#addAtomicEventListener(AtomicEventListener)
+	 */
+	public boolean addAtomicEventListener(AtomicEventListener listener) {
+		return eventBuffer.addAtomicEventListener(listener);
+	}
+
+	/**
+	 * <p>Removes a listener of atomic events from the internal {@link EventBuffer EventBuffer}.</p>
+	 *
+	 * @param listener the listener to remove
+	 *
+     * @return <tt>true</tt> if the list contained the specified element
+	 *
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see EventBuffer#removeAtomicEventListener(AtomicEventListener)
+	 */
+	public boolean removeAtomicEventListener(AtomicEventListener listener) {
+		return eventBuffer.removeAtomicEventListener(listener);
+	}
+
+	/**
+	 * @see EventBuffer#beginAtomicEvent()
+	 *
+	 * @see #endAtomicEvent()
+	 */
+	public void beginAtomicEvent() {
+		eventBuffer.beginAtomicEvent();
+	}
+
+	/**
+	 * @see EventBuffer#endAtomicEvent()
+	 *
+	 * @see #beginAtomicEvent()
+	 */
+	public void endAtomicEvent() {
+		eventBuffer.endAtomicEvent();
+	}
+
+	/**
+	 * <p>The class <code>LayerEventListener</code> implements the methods of {@link LayerCollectionListener LayerCollectionListener}
+	 *  that handles the "layer added" or "layer removed" events in a map.</p>
+	 * <p>Is designed as a listener for all layers in a {@link MapContext MapContext}.</p>
+	 *
+	 * @author Fernando Gonz�lez Cort�s
+	 */
+	public class LayerEventListener implements LayerCollectionListener {
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdded(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerAdded(LayerCollectionEvent e) {
+			// Si es la primera capa, fijamos su extent al ViewPort
+			// if (getLayers().getLayersCount() == 1) {
+			if (getViewPort().getEnvelope() == null) {
+				FLayer lyr = e.getAffectedLayer();
+				if (lyr.isAvailable()) {
+					try {
+						getViewPort().setEnvelope(lyr.getFullEnvelope());
+					} catch (ReadException ex) {
+					    logger.error(
+					        MessageFormat.format(
+					                "Can't set envelope to view port from layer {0}",
+					                new Object[] {lyr.getName() }
+					            ),
+					        ex
+					    );
+					}
+				}
+			}
+
+			// Registramos al FMap como listener del legend de las capas
+			FLayer lyr = e.getAffectedLayer();
+			selectionListener(lyr);
+			if (lyr instanceof SingleLayer){
+				if (((SingleLayer) lyr).getDataStore() != null) {
+					((SingleLayer) lyr).getDataStore().addObserver(
+							MapContext.this);
+				}
+			}
+		}
+
+		/**
+		 * <p>Registers an event buffer as a listener for all layers as argument.</p>
+		 *
+		 * <p>Each {@link FLayer FLayer} of this map must have an event buffer for all kind
+		 * of specific listeners of that layer. This method distinguish between {@link Classifiable Classifiable},
+		 * {@link AlphanumericData AlphanumericData}, and {@link FLayers FLayers} layers, and for each one,
+		 * registers, for their specific listeners, the <code>eventBuffer</code> as a listener.</p>
+		 *
+		 * @param the layer or layers
+		 */
+		private void selectionListener(FLayer lyr){
+			lyr.addLayerListener(eventBuffer);
+
+			if (lyr instanceof Classifiable) {
+				Classifiable c = (Classifiable) lyr;
+				c.addLegendListener(eventBuffer);
+			}
+
+			if (lyr instanceof FLayers){
+				FLayers lyrs=(FLayers)lyr;
+				for(int i=0;i<lyrs.getLayersCount();i++){
+					selectionListener(lyrs.getLayer(i));
+				}
+			}
+
+		}
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoved(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+		 */
+		public void layerMoved(LayerPositionEvent e) {
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoved(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerRemoved(LayerCollectionEvent e) {
+			FLayer lyr = e.getAffectedLayer();
+
+			lyr.removeLayerListener(eventBuffer);
+
+			if (lyr instanceof Classifiable) {
+				Classifiable c = (Classifiable) lyr;
+				c.removeLegendListener(eventBuffer);
+			}
+
+			if (lyr instanceof SingleLayer && ((SingleLayer) lyr).getDataStore()!=null) {
+				((SingleLayer) lyr).getDataStore().deleteObserver(
+						MapContext.this);
+			}
+
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdding(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerAdding(LayerCollectionEvent e)
+				throws CancelationException {
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoving(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+		 */
+		public void layerMoving(LayerPositionEvent e)
+				throws CancelationException {
+		}
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoving(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void layerRemoving(LayerCollectionEvent e)
+				throws CancelationException {
+		}
+
+
+		/*
+		 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#visibilityChanged(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+		 */
+		public void visibilityChanged(LayerCollectionEvent e)
+				throws CancelationException {
+		}
+	}
+
+	/**
+	 * <p>Adds the {@link LayerEventListener LayerEventListener} of this map to the
+	 *  collection of layers argument.</p>
+	 *
+	 * @param a collection of layers
+	 */
+	public void addAsCollectionListener(FLayers layers2) {
+		layers2.addLayerCollectionListener(layerEventListener);
+	}
+
+	/**
+	 * <p>Returns the internal {@link GraphicLayer GraphicLayer}.</p>
+	 *
+	 * @return the graphic layer of this map
+	 *
+	 * @see #setGraphicsLayer(GraphicLayer)
+	 */
+	public GraphicLayer getGraphicsLayer() {
+		if (tracLayer == null) {
+			if (getViewPort() != null) {
+				this.tracLayer =
+						MapContextLocator.getMapContextManager()
+								.createGraphicsLayer(
+										getViewPort().getProjection());
+			} else {
+				this.tracLayer =
+						MapContextLocator.getMapContextManager()
+								.createGraphicsLayer(null);
+			}
+		}
+		return tracLayer;
+	}
+
+	/**
+	 * <p>Sets a new {@link GraphicLayer GraphicLayer} to this map.</p>
+	 *
+	 * @param graphicLayer the new graphic layer
+	 *
+	 * @see #getGraphicsLayer()
+	 */
+	public void setGraphicsLayer(GraphicLayer graphicLayer) {
+		tracLayer = graphicLayer;
+	}
+
+	/**
+	 * <p>Indicates whether some other object is "equal to" this map.</p>
+	 * <p>Returns <code>true</code> if success one of this options:
+	 * <ul>
+	 * <li>Both objects are equal according to {@linkplain Object#equals(Object)}.
+	 * <li>Both maps have the same layers.
+	 * <li>Both maps have the same number of layers and with the same name.
+	 * </ul>
+	 * </p>
+	 *
+	 * @param obj the reference object with which to compare.
+     * @return <code>true</code> if this object is the same as the <code>arg0</code> argument;  otherwise <code>false</code>.
+	 *
+	 * @see Object#equals(Object)
+	 */
+	public boolean equals(Object arg0) {
+		if (!(arg0 instanceof MapContext)) {
+			return false;
+		}
+		MapContext map = (MapContext) arg0;
+		if (super.equals(arg0)) {
+			return true;
+		}
+		if (getLayers() == map.getLayers()) {
+			return true;
+		}
+		boolean isEqual = true;
+		if (map.getLayers().getLayersCount() == getLayers().getLayersCount()) {
+			for (int i = 0; i < getLayers().getLayersCount(); i++) {
+
+				if (!getLayers().getLayer(i).getName().equals(
+						map.getLayers().getLayer(i).getName())) {
+					isEqual = false;
+				}
+
+			}
+		} else {
+			isEqual = false;
+		}
+		return isEqual;
+	}
+
+	/**
+	 * <p>Registers the message of an error associated to this map.</p>
+	 *
+	 * @param stringProperty the error message
+	 *
+	 * @see #getLayersError()
+	 * @see #clearErrors()
+	 */
+	public void addLayerError(String stringProperty) {
+		layersError.add(stringProperty);
+	}
+
+	/**
+	 * <p>Gets the list with all error messages registered to this map.</p>
+	 *
+	 * @return the list of errors registered to this map
+	 *
+	 * @see #addLayerError(String)
+	 * @see #clearErrors()
+	 */
+	public ArrayList getLayersError() {
+		return layersError;
+	}
+
+	/**
+	 * <p>Removes all error messages associated to this map.</p>
+	 *
+	 * @see #addLayerError(String)
+	 * @see #getLayersError()
+	 */
+	public void clearErrors() {
+		layersError.clear();
+	}
+
+	/**
+	 * <p>Creates and returns a new group of layers that belongs to this <code>MapContext</code>.</p>
+	 *
+	 * @param parent layer node in this <code>MapContexte</code> that will be the parent of the new node
+	 * @return the new layer node
+	 */
+	public FLayers getNewGroupLayer(FLayers parent) {
+		FLayers group1 = new FLayers();//(this,parent);
+		group1.setMapContext(this);
+		group1.setParentLayer(parent);
+	    return group1;
+	}
+
+	public String getClassName() {
+		return null;
+	}
+
+	public ArrayList getLayersToSnap() {
+		return layersToSnap;
+	}
+
+	public void setLayersToSnap(ArrayList layersToSnap) {
+		this.layersToSnap = layersToSnap;
+
+	}
+
+	public void update(Observable observable, Object notification) {
+		// TODO REVISAR ESTO!!!
+		String ntype=null;
+		if (notification instanceof FeatureStoreNotification) {
+			FeatureStoreNotification fsNotification = (FeatureStoreNotification) notification;
+			ntype =fsNotification.getType();
+			if (
+					ntype.equals(FeatureStoreNotification.LOAD_FINISHED)||
+					ntype.equals(FeatureStoreNotification.SELECTION_CHANGE)
+			) {
+				getLayers().moveTo(0, 0);
+			}
+		}
+	}
+
+	public long getDrawVersion() {
+		return this.drawVersion;
+	}
+
+	protected void updateDrawVersion(){
+		this.drawVersion++;
+	}
+
+	public MapContextDrawer getMapContextDrawer() throws ReadException,
+            MapContextException {
+		if (this.mapContextDrawer == null){
+		    if (mapContextDrawerClass == null) {
+                this.mapContextDrawer = mapContextManager
+                        .createDefaultMapContextDrawerInstance();
+            } else {
+                this.mapContextDrawer = mapContextManager
+                        .createMapContextDrawerInstance(mapContextDrawerClass);
+            }
+		    this.mapContextDrawer.setMapContext(this);
+            this.mapContextDrawer.setViewPort(viewPort);
+		}
+
+		return this.mapContextDrawer;
+	}
+	
+	public void setMapContextDrawerClass(Class mapContextDrawerClass)
+            throws MapContextException {
+		mapContextManager.validateMapContextDrawer(mapContextDrawerClass);
+		this.mapContextDrawerClass = mapContextDrawerClass;
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.dispose();
+			this.mapContextDrawer = null;
+		}
+	}
+
+	public void setMapContextDrawer(MapContextDrawer drawer){
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.dispose();
+			this.mapContextDrawer = null;
+		}
+		this.mapContextDrawer = drawer;
+		if (this.mapContextDrawer != null){
+			this.mapContextDrawer.setMapContext(this);
+			this.mapContextDrawer.setViewPort(viewPort);
+		}
+	}
+	
+	public void loadFromState(PersistentState state)
+			throws PersistenceException {
+		
+		ViewPort vp = (ViewPort) state.get("ViewPort");
+		setViewPort(vp);
+		
+		layers = (FLayers) state.get("layers");
+		layers.setName("root layer");
+		loadLayers(layers);
+		layers.setMapContext(this);
+		
+		layerEventListener = new LayerEventListener();
+		layers.addLayerCollectionListener(layerEventListener);
+		
+		layers.addLayerCollectionListener(eventBuffer);
+		layers.setProjection(vp.getProjection());
+		
+		
+	}
+
+	private void loadLayers(FLayers lyrs) {
+		
+		int sz = lyrs.getLayersCount();
+		for (int i=0; i<sz; i++) {
+			try {
+				lyrs.getLayer(i).load();
+			} catch (LoadLayerException e) {
+				logger.error("While loading layer: " + lyrs.getLayer(i).getName());
+			}
+		}
+	}
+
+	public void saveToState(PersistentState state) throws PersistenceException {
+		state.set("ViewPort", viewPort);
+		state.set("layers", layers);
+	}
+
+	public static void registerPersistent() {
+		PersistenceManager manager = ToolsLocator.getPersistenceManager();
+		DynStruct definition = manager.addDefinition(
+				MapContext.class,
+				"MapContext",
+				"MapContext Persistence definition",
+				null, 
+				null
+		);
+		definition.addDynFieldObject("ViewPort")
+			.setClassOfValue(ViewPort.class)
+			.setMandatory(true);
+	
+		definition.addDynFieldObject("layers")
+			.setClassOfValue(FLayers.class)
+			.setMandatory(true);
+	}
+
+	protected void doDispose() throws BaseException {
+		dispose(layers);
+		dispose(tracLayer);
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/FMapEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/FMapEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/FMapEvent.java	(revision 36112)
@@ -0,0 +1,71 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+/**
+ * <p>All events produced on a layer must be of a particular type.</p>
+ *
+ * <p><code>FMapEvent</code> defines the least information that can have an event
+ *  produced on a layer, its <i>type</i>.</p>
+ */
+public class FMapEvent {
+	/**
+	 * Kind of event type.
+	 */
+	private int eventType;
+	/**
+	 * <p>Gets the type of this event.</p>
+	 * 
+	 * @return the type of this event
+	 */
+	public int getEventType() {
+		return eventType;
+	}
+	/**
+	 * <p>Sets the type of the event.</p>
+	 * 
+	 * @param eventType the number that identifies this event's type
+	 */
+	public void setEventType(int eventType) {
+		this.eventType = eventType;
+	}
+}
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ProgressListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ProgressListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ProgressListener.java	(revision 36112)
@@ -0,0 +1,8 @@
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+/**
+ * @author Fernando Gonz�lez Cort�s
+ */
+public interface ProgressListener {
+    public void progress(int n);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/EventBuffer.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/EventBuffer.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/EventBuffer.java	(revision 36112)
@@ -0,0 +1,394 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.mapcontext.events.AtomicEvent;
+import org.gvsig.fmap.mapcontext.events.ColorEvent;
+import org.gvsig.fmap.mapcontext.events.ExtentEvent;
+import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
+import org.gvsig.fmap.mapcontext.layers.CancelationException;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionListener;
+import org.gvsig.fmap.mapcontext.layers.LayerEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerListener;
+import org.gvsig.fmap.mapcontext.layers.LayerPositionEvent;
+import org.gvsig.fmap.mapcontext.layers.SelectionEvent;
+import org.gvsig.fmap.mapcontext.layers.SelectionListener;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
+
+
+
+
+/**
+ * <p><code>EventBuffer</code> represents a buffer of events that allows store listeners of events produced in layers
+ *  of a <code>MapContext</code> instance, and configure its dispatching mode.</p>
+ * 
+ * <p>The <i>dispatching mode</i>:
+ * <ul>
+ *  <li><code>true</code> : dispatches each new event received.</li>
+ *  <li><code>false</code> : accumulates all new events received in a internal buffer, and only will dispatch them
+ *   (according to the order they were received) when changes the mode.</li>
+ * </ul>
+ * </p>
+ *
+ * @see LegendListener
+ * @see LayerCollectionListener
+ * @see SelectionListener
+ * @see ViewPortListener
+ * @see LegendListener
+ *
+ * @author Fernando Gonz�lez Cort�s
+ */
+public class EventBuffer implements LegendListener, LayerCollectionListener,
+SelectionListener, ViewPortListener, LayerListener {
+
+	/**
+	 * List with all events received and don't dispatched.
+	 * 
+	 * @see #endAtomicEvent()
+	 * @see #legendChanged(LegendChangedEvent)
+	 * @see #layerAdded(LayerCollectionEvent)
+	 * @see #layerMoved(LayerPositionEvent)
+	 * @see #layerRemoved(LayerCollectionEvent)
+	 * @see #layerAdding(LayerCollectionEvent)
+	 * @see #layerMoving(LayerPositionEvent)
+	 * @see #layerRemoving(LayerCollectionEvent)
+	 * @see #visibilityChanged(LayerCollectionEvent)
+	 * @see #visibilityChanged(LayerEvent)
+	 * @see #selectionChanged(SelectionEvent)
+	 * @see #extentChanged(ExtentEvent)
+	 * @see #activationChanged(LayerEvent)
+	 * @see #nameChanged(LayerEvent)
+	 * @see #backColorChanged(ColorEvent)
+	 * @see #editionChanged(LayerEvent)
+	 * @see #projectionChanged(ProjectionEvent)
+	 * @see #fireAtomicEventListener
+	 */
+	private ArrayList events = new ArrayList();
+
+	/**
+	 * List with all listeners registered.
+	 * 
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 */ 
+	private ArrayList listeners = new ArrayList();
+
+	/**
+	 * Allows enable or disable the <i>dispatching mode</i>.
+	 * 
+	 * @see #beginAtomicEvent()
+	 * @see #endAtomicEvent()
+	 */
+	private boolean dispatching = true;
+
+	/**
+	 * <p>Enables buffer in <i>accumulation event</i> mode.<p>
+	 * 
+	 * <p>All new events received, will be accumulated and won't notified to their respective listeners,
+	 *  until this buffer would received a call to {@link #endAtomicEvent() endAtomicEvent}.</p>
+	 * 
+	 * @see #endAtomicEvent()
+	 */
+	public void beginAtomicEvent() {
+		dispatching = false;
+	}
+
+	/**
+	 * <p>Disables buffer in <i>accumulation event</i> mode.</p>
+	 * 
+	 * <p>All events accumulated will be notify to their respective
+	 *  listeners, in the same order as they arrived.</p>
+	 *  
+	 * @see #beginAtomicEvent()
+	 */
+	public void endAtomicEvent() {
+		fireAtomicEventListener();
+		events.clear();
+		dispatching = true;
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LegendListener#legendChanged(com.iver.cit.gvsig.fmap.rendering.LegendChangedEvent)
+	 */
+	public void legendChanged(LegendChangedEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdded(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerAdded(LayerCollectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoved(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+	 */
+	public void layerMoved(LayerPositionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoved(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerRemoved(LayerCollectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerAdding(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerAdding(LayerCollectionEvent e) throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoving(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent)
+	 */
+	public void layerMoving(LayerPositionEvent e) throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerRemoving(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void layerRemoving(LayerCollectionEvent e)
+	throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#visibilityChanged(com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent)
+	 */
+	public void visibilityChanged(LayerCollectionEvent e)
+	throws CancelationException {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.SelectionListener#selectionChanged(com.iver.cit.gvsig.fmap.layers.SelectionEvent)
+	 */
+	public void selectionChanged(SelectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.ViewPortListener#extentChanged(com.iver.cit.gvsig.fmap.ExtentEvent)
+	 */
+	public void extentChanged(ExtentEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/**
+	 * Appends, if wasn't, the specified listener to the end of the internal list of atomic event listeners.
+	 *
+	 * @param listener an object that implements the atomic event listener
+	 *
+	 * @return <code>true</code> if has added the listener successfully; otherwise <code>false</code>
+	 * 
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 * @see #fireAtomicEventListener()
+	 */
+	public boolean addAtomicEventListener(AtomicEventListener listener) {
+		boolean bFound = false;
+		for (int i=0; i < listeners.size(); i++)
+			if (listeners.get(i) == listener)
+				bFound = true;
+		if (!bFound)
+			listeners.add(listener);
+		return true; 
+	}
+
+	/**
+	 * <p>Removes a single instance of the {@link AtomicEventListener AtomicEventListener} from the
+     * internal list, if it is present (optional operation). Returns <tt>true</tt>
+     * if the list contained the specified element (or equivalently, if the list changed as a
+     * result of the call).<p>
+     *
+     * @param o element to be removed from this list, if present
+     * @return <tt>true</tt> if the list contained the specified element
+     * 
+     * @see #addAtomicEventListener(AtomicEventListener)
+     * @see #fireAtomicEventListener()
+	 */
+	public boolean removeAtomicEventListener(AtomicEventListener listener) {
+		return listeners.remove(listener);
+	}
+
+	/**
+	 * Executes the {@linkplain AtomicEventListener#atomicEvent(AtomicEvent)} method of all listeners registered.
+	 * 
+	 * @see #addAtomicEventListener(AtomicEventListener)
+	 * @see #removeAtomicEventListener(AtomicEventListener)
+	 */
+	private void fireAtomicEventListener() {
+		if (events.size() == 0)
+			return; // No hay eventos que lanzar.
+		for (Iterator i = listeners.iterator(); i.hasNext();) {
+			AtomicEventListener listener = (AtomicEventListener) i.next();
+			AtomicEvent e = new AtomicEvent(events);
+			listener.atomicEvent(e);
+		}
+
+		events.clear();
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#visibilityChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void visibilityChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#activationChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void activationChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#nameChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void nameChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.ViewPortListener#backColorChanged(com.iver.cit.gvsig.fmap.ColorEvent)
+	 */
+	public void backColorChanged(ColorEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.layers.LayerListener#editionChanged(com.iver.cit.gvsig.fmap.layers.LayerEvent)
+	 */
+	public void editionChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+
+	}
+
+	/*
+	 * @see com.iver.cit.gvsig.fmap.ViewPortListener#projectionChanged(com.iver.cit.gvsig.fmap.ProjectionEvent)
+	 */
+	public void projectionChanged(ProjectionEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+
+	
+	public void drawValueChanged(LayerEvent e) {
+		events.add(e);
+
+		if (dispatching) {
+			fireAtomicEventListener();
+		}
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ErrorListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ErrorListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ErrorListener.java	(revision 36112)
@@ -0,0 +1,84 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id: ErrorListener.java 20989 2008-05-28 11:05:57Z jmvivo $
+* $Log$
+* Revision 1.2  2006-09-21 17:20:50  azabala
+* added method to report many driver exceptions
+*
+* Revision 1.1  2005/12/20 10:56:34  jaume
+* Added an error event to fmap
+*
+*
+*/
+/**
+ * 
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import java.util.List;
+
+import org.gvsig.fmap.mapcontext.events.ErrorEvent;
+
+
+/**
+ * @author jaume
+ *
+ */
+public interface ErrorListener {
+    /**
+     * Listen for error events
+     * (usually caused by driverExceptions)
+     * @param e
+     */
+	void errorThrown(ErrorEvent e);
+
+	/**
+	 * Report a bundle of driver exceptions caused in the same
+	 * fmap atomic transaction
+	 * @param introductoryText introductory text specified by developer. It null, used ""
+	 * @param driverExceptions list with a bundle of driver exceptions catched during
+	 * an atomic event
+	 */
+	void reportDriverExceptions(String introductoryText, List driverExceptions);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/AtomicEventListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/AtomicEventListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/AtomicEventListener.java	(revision 36112)
@@ -0,0 +1,59 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import org.gvsig.fmap.mapcontext.events.AtomicEvent;
+
+/**
+ * <p>Listener of {@link AtomicEvent AtomicEvent}.</p>
+ * 
+ * <p>An <code>AtomicEvent</p> represents a group of events that will be attended without any interruption.</p>
+ */
+public interface AtomicEventListener {
+	/**
+	 * <p>Called when is produced an <code>AtomicEvent</code> in the buffer of <code>MapControl</code>.</p>
+	 * 
+	 * @param e an atomic event
+	 * 
+	 * @see EventBuffer
+	 */
+	public void atomicEvent(AtomicEvent e);
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ViewPortListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ViewPortListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/ViewPortListener.java	(revision 36112)
@@ -0,0 +1,73 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+import org.gvsig.fmap.mapcontext.events.ColorEvent;
+import org.gvsig.fmap.mapcontext.events.ExtentEvent;
+import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
+
+
+/**
+ * <p>Defines the interface for an object that listens to changes in a view port.</p>
+ */
+public interface ViewPortListener {
+	/**
+ 	 * <p>Called when the <i>extent</i> of the view port has changed.</p>
+	 *
+	 * @param e an extend event object
+	 */
+	void extentChanged(ExtentEvent e);
+
+	/**
+	 * <p>Called when the background color of the view port has changed.</p>
+	 * 
+	 * @param e a color event object
+	 */
+	void backColorChanged(ColorEvent e);
+
+	/**
+	 * <p>Called when the projection of the view port has changed.</p>
+	 *
+	 * @param e a projection event object
+	 */
+	void projectionChanged(ProjectionEvent e);
+}
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/InvalidationListener.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/InvalidationListener.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/listeners/InvalidationListener.java	(revision 36112)
@@ -0,0 +1,54 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events.listeners;
+
+/**
+ * Interfaz que recibe el evento invalid. Deber�n implementar los elementos de
+ * la interfaz que se quieran actualizar cuando se produzca un cambio en el
+ * FMap
+ */
+public interface InvalidationListener {
+	/**
+	 * M�todo invocado cuando se produce un cambio en FMap que  afecta a la
+	 * representaci�n del mapa
+	 */
+	public void invalid();
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ExtentEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ExtentEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ExtentEvent.java	(revision 36112)
@@ -0,0 +1,137 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+
+import org.gvsig.fmap.geom.primitive.Envelope;
+import org.gvsig.timesupport.Time;
+
+
+
+/**
+ * <p>Event produced when the adjusted extent or the time
+ * of the view port have changed.</p>
+ * <p>
+ * TODO: This class has to be renamed to ViewPortEvent.
+ * </p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class ExtentEvent extends FMapEvent {
+	/**
+	 * <p>Reference to the new adjusted extent.</p>
+	 */
+	private Envelope newExtent;
+	
+	/**
+	 * <p>Reference to the new time.</p>
+	 */
+	private Time newTime;
+
+	/**
+	 * <p>Identifier of this kind of event.</p>
+	 */
+	private static final int EXTENT_EVENT = 0;
+	private static final int TIME_EVENT = 1;
+
+	/**
+	 * <p>Returns a new extent event.</p>
+	 *
+	 * @param c the new adjusted extent
+	 *
+	 * @return a new extent event
+	 * @deprecated
+	 *         use the constructor 
+	 */
+	public static ExtentEvent createExtentEvent(Envelope r){
+		return new ExtentEvent(r, EXTENT_EVENT);
+	}
+
+	/**
+	 * <p>Creates a new extent event.</p>
+	 *
+	 * @param c the new adjusted extent
+	 * @param eventType identifier of this kind of event
+	 */
+	private ExtentEvent(Envelope r, int eventType) {
+		setEventType(eventType);
+		newExtent = r;
+	}
+	
+	/**
+     * <p>Creates a new extent event.</p>
+     *
+     * @param c the new adjusted extent
+     */
+    public ExtentEvent(Envelope envelope) {
+        this(envelope, EXTENT_EVENT);       
+    }
+    
+    /**
+     * <p>Creates a new time event.</p>
+     * @param time
+     *          the new time
+     */
+    public ExtentEvent(Time time) {
+        setEventType(TIME_EVENT);
+        newTime = time;
+    }
+
+	/**
+	 * <p>Gets the new adjusted event.</p>
+	 *
+	 * @return the new adjusted extent
+	 */
+	public Envelope getNewExtent() {
+		return newExtent;
+	}
+	
+	/**
+     * <p>Gets the new time event.</p>
+     *
+     * @return the new time extent
+     */
+    public Time getNewTime() {
+        return newTime;
+    }
+}
+
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ErrorEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ErrorEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ErrorEvent.java	(revision 36112)
@@ -0,0 +1,119 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id: ErrorEvent.java 20989 2008-05-28 11:05:57Z jmvivo $
+ * $Log$
+ * Revision 1.2  2005-12-20 11:23:43  jaume
+ * Added ErrorEvent to any Fmap, and error handling to FLayers
+ *
+ * Revision 1.1  2005/12/20 10:56:34  jaume
+ * Added an error event to fmap
+ *
+ *
+ */
+/**
+ * 
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+
+/**
+ * <p><code>ErrorEvent</code> stores all necessary information of an error produced on a layer.</p>
+ * 
+ * @see FMapEvent
+ * 
+ * 
+ * @author jaume
+ */
+/* 
+ * jjdc
+ *  
+ * FIXME: No esta claro que no se use.
+ *               Si se deja deprecated habria que documentar por que hay que sustituirla. 
+ * @deprecated As of release 1.0.2, don't used
+ */
+public class ErrorEvent extends FMapEvent {
+	/**
+	 * <p>Extra information about the error, like which layer was produced.</p>
+	 * 
+	 * @see #getMessage()
+	 */
+	private String message;
+    
+    /**
+     * <p>Exception associated to the error produced.</p>
+     * 
+     * @see #getException()
+     */
+	private Exception exception;
+
+    /**
+     * <p>Constructs an <code>ErrorEvent</code> with the specified, detailed message as extra information, and the exception thrown.</p>
+     * 
+     * @param message detailed error information
+     * @param e the exception thrown when the error was produced
+     */
+	public ErrorEvent(String message, Exception e){
+		this.message = message;
+		this.exception = e;
+	}
+
+    /**
+     * <p>Gets the <code>Exception</code> associated to the error produced.</p>
+     * 
+     * @return the exception thrown when the error was produced
+     */
+	public Exception getException() {
+		return exception;
+	}
+
+    /**
+     * <p>Gets detailed message with extra information.</p>
+     * 
+     * @return the detail message with extra information
+     */
+	public String getMessage() {
+		return message;
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/AtomicEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/AtomicEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/AtomicEvent.java	(revision 36112)
@@ -0,0 +1,227 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.gvsig.fmap.mapcontext.MapContext;
+import org.gvsig.fmap.mapcontext.layers.LayerCollectionEvent;
+import org.gvsig.fmap.mapcontext.layers.LayerEvent;
+import org.gvsig.fmap.mapcontext.layers.SelectionEvent;
+import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendEvent;
+
+
+
+
+/**
+ * <p>An atomic event represents a group of events that will be attended without any interruption.</p>
+ * 
+ * <p>This kind of events are created by the buffer of events of the {@link MapContext MapContext}.</p>
+ */
+public class AtomicEvent extends FMapEvent {
+	/**
+	 * <p>Events that constitute this one.</p>
+	 */
+	private ArrayList events;
+
+	/**
+	 * <p>Creates a new instance of this kind of event.</p>
+	 *
+	 * @param fmapEvents events that will constitute this one
+	 */
+	public AtomicEvent(ArrayList fmapEvents) {
+		this.events = (ArrayList) fmapEvents.clone();
+	}
+
+	/**
+	 * <p>Returns the event at the specified position in the internal list.</p>
+	 *
+	 * @param index index of event to return
+	 *
+	 * @return event at the specified position in this list
+	 */
+	public FMapEvent getEvent(int index) {
+		return (FMapEvent) events.get(index);
+	}
+
+	/**
+	 * <p>Returns the number of events that constitute this one.</p>
+	 *
+	 * @return number of events that constitute this one
+	 */
+	public int getEventCount() {
+		return events.size();
+	}
+
+	/**
+	 * <p>Returns all legend events that constitute this one.</p>
+	 *
+	 * @return an array with all legend events that constitute this one
+	 */
+	public LegendEvent[] getLegendEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof LegendEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (LegendEvent[]) ret.toArray(new LegendEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all layer collection events that constitute this one.</p>
+	 *
+	 * @return an array with all layer collection events that constitute this one
+	 */
+	public LayerCollectionEvent[] getLayerCollectionEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof LayerCollectionEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (LayerCollectionEvent[]) ret.toArray(new LayerCollectionEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all vector layer selection events that constitute this one.</p>
+	 *
+	 * @return an array with all vector layer selection events that constitute this one
+	 */
+	public SelectionEvent[] getSelectionEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof SelectionEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (SelectionEvent[]) ret.toArray(new SelectionEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all extent events that constitute this one.</p>
+	 *
+	 * @return an array with all extent events that constitute this one
+	 */
+	public ExtentEvent[] getExtentEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof ExtentEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (ExtentEvent[]) ret.toArray(new ExtentEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all layer events that constitute this one.</p>
+	 *
+	 * @return an array with all layer events that constitute this one
+	 */
+	public LayerEvent[] getLayerEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof LayerEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (LayerEvent[]) ret.toArray(new LayerEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all color events that constitute this one.</p>
+	 *
+	 * @return an array with all color events that constitute this one
+	 */
+	public ColorEvent[] getColorEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof ColorEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (ColorEvent[]) ret.toArray(new ColorEvent[0]);
+	}
+
+	/**
+	 * <p>Returns all projection events that constitute this one.</p>
+	 *
+	 * @return an array with all projection events that constitute this one
+	 */
+	public ProjectionEvent[] getProjectionEvents() {
+		ArrayList ret = new ArrayList();
+
+		for (Iterator iter = events.iterator(); iter.hasNext();) {
+			FMapEvent event = (FMapEvent) iter.next();
+
+			if (event instanceof ProjectionEvent) {
+				ret.add(event);
+			}
+		}
+
+		return (ProjectionEvent[]) ret.toArray(new ProjectionEvent[0]);
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ProjectionEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ProjectionEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ProjectionEvent.java	(revision 36112)
@@ -0,0 +1,49 @@
+package org.gvsig.fmap.mapcontext.events;
+
+import org.cresques.cts.IProjection;
+
+/**
+ * <p>Event produced when the projection of the view port has changed.</p>
+ */
+public class ProjectionEvent extends FMapEvent {
+	/**
+	 * <p>The new projection.</p>
+	 */
+	private IProjection newProyection;
+
+	/**
+	 * <p>Identifies this object as an event related with the projection.</p>
+	 */
+	private static final int PROJECTION_EVENT = 0;
+
+	/**
+	 * <p>Creates a new projection event.</p>
+	 * 
+	 * @param proj the new projection
+	 * 
+	 * @return a new projection event
+	 */
+	public static ProjectionEvent createProjectionEvent(IProjection proj){
+		return new ProjectionEvent(proj, PROJECTION_EVENT);
+	}
+
+	/**
+	 * <p>Creates a new projection event of the specified type.</p>
+	 *
+	 * @param proj the new projection
+	 * @param eventType identifier of this kind of event
+	 */
+	private ProjectionEvent(IProjection proj, int eventType) {
+		setEventType(eventType);
+		newProyection = proj;
+	}
+
+	/**
+	 * <p>Gets the new projection.</p>
+	 *
+	 * @return the new projection
+	 */
+	public IProjection getNewProjection() {
+		return newProyection;
+	}
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ColorEvent.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ColorEvent.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/events/ColorEvent.java	(revision 36112)
@@ -0,0 +1,93 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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 2
+ * 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.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package org.gvsig.fmap.mapcontext.events;
+
+import java.awt.Color;
+
+
+/**
+ * <p>Event produced when changes the background color of the <i>view port</i>.</p>
+ *
+ * @author Vicente Caballero Navarro
+ */
+public class ColorEvent extends FMapEvent {
+	/**
+	 * <p>Identifier of this kind of event.</p>
+	 */
+	private static final int COLOR_EVENT = 0;
+	
+	/**
+	 * <p>Reference to the new color</p> 
+	 */
+	private Color color;
+
+	/**
+	 * <p>Returns a new color event.</p>
+	 * 
+	 * @param c the new color
+	 *
+	 * @return a new color event
+	 */
+	public static ColorEvent createColorEvent(Color c){
+		return new ColorEvent(c, COLOR_EVENT);
+	}
+	
+	/**
+	 * <p>Creates a new color event.</p>
+	 *
+	 * @param c the new color
+	 * @param eventType identifier of this kind of event
+	 */
+	private ColorEvent(Color c, int eventType) {
+		color = c;
+		setEventType(eventType);
+	}
+
+	/**
+	 * <p>Gets the new color.</p>
+	 *
+	 * @return the new color
+	 */
+	public Color getNewColor() {
+		return color;
+	}
+}
+
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java	(revision 36112)
@@ -0,0 +1,96 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* 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 2
+* 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.
+*
+* 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.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.geom.operation;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.aggregate.Aggregate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class AggregateDrawInts extends GeometryOperation {
+	public static final String NAME = "drawInts";
+	public static int CODE = Integer.MIN_VALUE;
+
+	
+	final static private Logger logger = LoggerFactory
+			.getLogger(DrawInts.class);
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#getOperationIndex()
+	 */
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.geom.operation.GeometryOperationContext)
+	 */
+	public Object invoke(Geometry geom, GeometryOperationContext ctx)
+			throws GeometryOperationException {
+
+		Aggregate aggregate = (Aggregate) geom;
+		for (int i=0;i<aggregate.getPrimitivesNumber();i++){
+			Geometry prim = aggregate.getPrimitiveAt(i);
+			try {
+				prim.invokeOperation(CODE, ctx);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new GeometryOperationException(e);
+			}
+		}
+		return null;
+	}
+
+	public static void register() {
+		GeometryManager geoMan = GeometryLocator.getGeometryManager();
+
+		CODE = geoMan.getGeometryOperationCode(NAME);
+		
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.AGGREGATE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTIPOINT);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTICURVE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTISURFACE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDrawInts(),
+				TYPES.MULTISOLID);
+
+	}
+
+}

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDrawInts.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawOperationContext.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawOperationContext.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawOperationContext.java	(revision 36112)
@@ -0,0 +1,75 @@
+package org.gvsig.fmap.geom.operation;
+
+import java.awt.Graphics2D;
+
+import org.gvsig.fmap.dal.feature.Feature;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.task.Cancellable;
+
+
+public class DrawOperationContext extends GeometryOperationContext{
+	private ISymbol symbol=null;
+	private Graphics2D graphics=null;
+	private Cancellable cancellable;
+	private double dpi;
+	private double scale;
+	private boolean hasDPI=false;
+	private ViewPort viewPort;
+	private Feature feature;
+	
+	public ViewPort getViewPort() {
+		return viewPort;
+	}
+	public void setViewPort(ViewPort viewPort) {
+		this.viewPort = viewPort;
+	}
+	public Graphics2D getGraphics() {
+		return graphics;
+	}
+	public void setGraphics(Graphics2D graphics) {
+		this.graphics = graphics;
+	}
+	public ISymbol getSymbol() {
+		return symbol;
+	}
+	public void setSymbol(ISymbol symbol) {
+		this.symbol = symbol;
+	}
+	public void setCancellable(Cancellable cancel) {
+		this.cancellable=cancel;
+
+	}
+	public Cancellable getCancellable() {
+		return cancellable;
+	}
+	public void setDPI(double dpi) {
+		this.hasDPI=true;
+		this.dpi=dpi;
+	}
+	public double getDPI(){
+		return dpi;
+	}
+	public boolean hasDPI() {
+		return hasDPI;
+	}
+	/**
+	 * @param scale the scale to set
+	 */
+	public void setScale(double scale) {
+		this.scale = scale;
+	}
+	/**
+	 * @return the scale
+	 */
+	public double getScale() {
+		return scale;
+	}
+	public Feature getFeature() {
+		return feature;
+	}
+	public void setFeature(Feature feature) {
+		this.feature = feature;
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java	(revision 36112)
@@ -0,0 +1,58 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+*
+* Copyright (C) 2007-2008 Infrastructures and Transports Department
+* of the Valencian Government (CIT)
+*
+* 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 2
+* 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.
+*
+* 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.
+*
+*/
+
+/*
+* AUTHORS (In addition to CIT):
+* 2009 IVER T.I   {{Task}}
+*/
+
+/**
+ *
+ */
+package org.gvsig.fmap.geom.operation;
+
+import org.gvsig.fmap.mapcontext.MapContextLibrary;
+import org.gvsig.tools.library.AbstractLibrary;
+import org.gvsig.tools.library.LibraryException;
+
+/**
+ * @author jmvivo
+ *
+ */
+public class MapContextGeomOperationsLibrary extends AbstractLibrary {
+
+    public void doRegistration() {
+        registerAsServiceOf(MapContextLibrary.class);
+    }
+
+	protected void doInitialize() throws LibraryException {
+	}
+
+	protected void doPostInitialize() throws LibraryException {
+		// Register Draw Operations
+		Draw.register();
+		DrawInts.register();
+		AggregateDrawInts.register();
+		AggregateDraw.register();
+	}
+
+}
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/MapContextGeomOperationsLibrary.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDraw.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDraw.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/AggregateDraw.java	(revision 36112)
@@ -0,0 +1,96 @@
+/* gvSIG. Geographic Information System of the Valencian Government
+ *
+ * Copyright (C) 2007-2008 Infrastructures and Transports Department
+ * of the Valencian Government (CIT)
+ *
+ * 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 2
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * AUTHORS (In addition to CIT):
+ * 2009 IVER T.I   {{Task}}
+ */
+
+/**
+ *
+ */
+package org.gvsig.fmap.geom.operation;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.TYPES;
+import org.gvsig.fmap.geom.aggregate.Aggregate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Vicente Caballero Navarro
+ *
+ */
+public class AggregateDraw extends GeometryOperation {
+	
+	public static final String NAME = "draw";
+	public static int CODE = Integer.MIN_VALUE;
+
+	final static private Logger logger = LoggerFactory
+	.getLogger(AggregateDraw.class);
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#getOperationIndex()
+	 */
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.gvsig.fmap.geom.operation.GeometryOperation#invoke(org.gvsig.fmap.geom.Geometry, org.gvsig.fmap.geom.operation.GeometryOperationContext)
+	 */
+	public Object invoke(Geometry geom, GeometryOperationContext ctx)
+	throws GeometryOperationException {
+
+		Aggregate aggregate = (Aggregate) geom;
+		for (int i=0;i<aggregate.getPrimitivesNumber();i++){
+			Geometry prim = aggregate.getPrimitiveAt(i);
+			try {
+				prim.invokeOperation(CODE, ctx);
+			} catch (GeometryOperationNotSupportedException e) {
+				throw new GeometryOperationException(e);
+			}
+		}
+		return null;
+	}
+
+	public static void register() {
+		GeometryManager geoMan = GeometryLocator.getGeometryManager();
+		
+		CODE = geoMan.getGeometryOperationCode(NAME);
+
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.AGGREGATE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTIPOINT);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTICURVE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTISURFACE);
+		geoMan.registerGeometryOperation(NAME, new AggregateDraw(),
+				TYPES.MULTISOLID);
+
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawInts.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawInts.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/DrawInts.java	(revision 36112)
@@ -0,0 +1,161 @@
+package org.gvsig.fmap.geom.operation;
+
+import java.awt.Graphics2D;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.PathIterator;
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryLocator;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.Geometry.SUBTYPES;
+import org.gvsig.fmap.geom.exception.CreateGeometryException;
+import org.gvsig.fmap.geom.primitive.GeneralPathX;
+import org.gvsig.fmap.mapcontext.ViewPort;
+import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
+import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
+import org.gvsig.tools.task.Cancellable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DrawInts extends GeometryOperation {
+	private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
+	public static final String NAME = "drawInts";
+	public static int CODE = Integer.MIN_VALUE;
+
+	final static private Logger logger = LoggerFactory.getLogger(DrawInts.class);
+
+	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException{
+		DrawOperationContext doc=(DrawOperationContext)ctx;
+		ViewPort viewPort = doc.getViewPort();
+		ISymbol symbol = doc.getSymbol();
+		Graphics2D g=doc.getGraphics();
+		Cancellable cancel=doc.getCancellable();
+		//		 make the symbol to resize itself with the current rendering context
+		try {
+			if (doc.hasDPI()){
+				double previousSize = ((CartographicSupport)symbol).
+				toCartographicSize(viewPort, doc.getDPI(), geom);
+				// draw it as normally
+				Geometry decimatedShape = transformToInts(geom, viewPort.getAffineTransform());
+				symbol.draw(g, viewPort.getAffineTransform(), decimatedShape,
+						doc.getFeature(), cancel);
+				// restore previous size
+				((CartographicSupport)symbol).setCartographicSize(previousSize, geom);
+			}else{
+				Geometry decimatedShape = transformToInts(geom, viewPort.getAffineTransform());
+				symbol.draw(g, viewPort.getAffineTransform(), decimatedShape,
+						doc.getFeature(), cancel);
+			}
+		} catch (CreateGeometryException e) {
+			e.printStackTrace();
+			throw new GeometryOperationException(e);
+		}
+
+		return null;
+	}
+
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	private Geometry transformToInts(Geometry gp, AffineTransform at) throws CreateGeometryException {
+		GeneralPathX newGp = new GeneralPathX();
+		double[] theData = new double[6];
+		double[] aux = new double[6];
+
+		// newGp.reset();
+		PathIterator theIterator;
+		int theType;
+		int numParts = 0;
+
+		java.awt.geom.Point2D ptDst = new java.awt.geom.Point2D.Double();
+		java.awt.geom.Point2D ptSrc = new java.awt.geom.Point2D.Double();
+		boolean bFirst = true;
+		int xInt, yInt, antX = -1, antY = -1;
+
+
+		theIterator = gp.getPathIterator(null); //, flatness);
+		int numSegmentsAdded = 0;
+		while (!theIterator.isDone()) {
+			theType = theIterator.currentSegment(theData);
+
+			switch (theType) {
+			case PathIterator.SEG_MOVETO:
+				numParts++;
+				ptSrc.setLocation(theData[0], theData[1]);
+				at.transform(ptSrc, ptDst);
+				antX = (int) ptDst.getX();
+				antY = (int) ptDst.getY();
+				newGp.moveTo(antX, antY);
+				numSegmentsAdded++;
+				bFirst = true;
+				break;
+
+			case PathIterator.SEG_LINETO:
+				ptSrc.setLocation(theData[0], theData[1]);
+				at.transform(ptSrc, ptDst);
+				xInt = (int) ptDst.getX();
+				yInt = (int) ptDst.getY();
+				if ((bFirst) || ((xInt != antX) || (yInt != antY)))
+				{
+					newGp.lineTo(xInt, yInt);
+					antX = xInt;
+					antY = yInt;
+					bFirst = false;
+					numSegmentsAdded++;
+				}
+				break;
+
+			case PathIterator.SEG_QUADTO:
+				at.transform(theData,0,aux,0,2);
+				newGp.quadTo(aux[0], aux[1], aux[2], aux[3]);
+				numSegmentsAdded++;
+				break;
+
+			case PathIterator.SEG_CUBICTO:
+				at.transform(theData,0,aux,0,3);
+				newGp.curveTo(aux[0], aux[1], aux[2], aux[3], aux[4], aux[5]);
+				numSegmentsAdded++;
+				break;
+
+			case PathIterator.SEG_CLOSE:
+				if (numSegmentsAdded < 3) {
+					newGp.lineTo(antX, antY);
+				}
+				newGp.closePath();
+
+				break;
+			} //end switch
+
+			theIterator.next();
+		} //end while loop
+
+		Geometry geom = null;
+		switch (gp.getType()) {
+		case Geometry.TYPES.POINT:
+			geom = geomManager.createPoint(ptDst.getX(), ptDst.getY(), SUBTYPES.GEOM2D);
+			break;
+		case Geometry.TYPES.CURVE:
+		case Geometry.TYPES.ARC:
+			geom = geomManager.createCurve(newGp, SUBTYPES.GEOM2D);
+			break;
+
+		case Geometry.TYPES.SURFACE:
+		case Geometry.TYPES.CIRCLE:
+		case Geometry.TYPES.ELLIPSE:
+
+			geom = geomManager.createSurface(newGp, SUBTYPES.GEOM2D);
+			break;
+		}
+		return geom;
+	}
+
+	public static void register() {
+		
+		GeometryManager gm = GeometryLocator.getGeometryManager();
+		CODE = gm.getGeometryOperationCode(NAME);
+		geomManager.registerGeometryOperation(NAME, new DrawInts());
+	}
+
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/Draw.java
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/Draw.java	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/src/org/gvsig/fmap/geom/operation/Draw.java	(revision 36112)
@@ -0,0 +1,33 @@
+package org.gvsig.fmap.geom.operation;
+
+import java.awt.geom.AffineTransform;
+
+
+import org.gvsig.fmap.geom.Geometry;
+import org.gvsig.fmap.geom.GeometryManager;
+import org.gvsig.fmap.geom.GeometryLocator;
+
+public class Draw extends GeometryOperation{
+	public static final String NAME = "draw";
+	public static int CODE = Integer.MIN_VALUE;
+
+	public Object invoke(Geometry geom, GeometryOperationContext ctx) throws GeometryOperationException {
+		DrawOperationContext doc = (DrawOperationContext)ctx;
+		AffineTransform at = doc.getViewPort().getAffineTransform();		
+		doc.getSymbol().draw(doc.getGraphics(), at, geom, doc.getFeature(),
+				doc.getCancellable());
+		return null;
+	}
+
+	public int getOperationIndex() {
+		return CODE;
+	}
+
+	public static void register() {
+		
+		GeometryManager geoMan = GeometryLocator.getGeometryManager();
+		CODE = geoMan.getGeometryOperationCode(NAME);
+		geoMan.registerGeometryOperation(NAME, new Draw());
+	}
+
+}
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/pom.xml
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/pom.xml	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/pom.xml	(revision 36112)
@@ -0,0 +1,482 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                      http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.gvsig</groupId>
+	<artifactId>org.gvsig.fmap.mapcontext</artifactId>
+	<packaging>jar</packaging>
+	<version>2.0-SNAPSHOT</version>
+	<name>libFMap_mapcontext</name>
+	<url>http://gvsig.org</url>
+	<parent>
+		<groupId>org.gvsig</groupId>
+		<artifactId>gvsig-base-library-pom</artifactId>
+		<version>2.0-SNAPSHOT</version>
+	</parent>	
+	<distributionManagement>
+		<site>
+			<id>gvsig-repository</id>
+			<url>${site-repository}/</url>
+		</site>
+	</distributionManagement>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.tools.lib</artifactId>
+			<type>test-jar</type>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.compat</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.projection</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.geometry</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.geometry</artifactId>
+			<classifier>operation</classifier>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.gvsig</groupId>
+			<artifactId>org.gvsig.fmap.dal</artifactId>
+            <scope>compile</scope>
+		</dependency>
+        <dependency>
+            <groupId>org.gvsig</groupId>
+            <artifactId>org.gvsig.metadata.lib.basic.api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+		<dependency>
+			<groupId>com.vividsolutions</groupId>
+			<artifactId>jts</artifactId>
+            <scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>easymock</groupId>
+			<artifactId>easymock</artifactId>
+			<version>1.2_Java1.3</version>
+			<scope>test</scope>
+		</dependency>
+        <dependency>
+            <groupId>javax.media</groupId>
+            <artifactId>jai_core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.media</groupId>
+            <artifactId>jai_codec</artifactId>
+            <scope>test</scope>
+        </dependency>		
+	</dependencies>
+	<properties>
+		<build-dir>${basedir}/../build</build-dir>
+        <eclipse.project.name>libFMap_mapcontext</eclipse.project.name>
+	</properties>
+	<build>
+		<sourceDirectory>src</sourceDirectory>
+		<testSourceDirectory>src-test</testSourceDirectory>
+		<resources>
+			<resource>
+				<directory>src</directory>
+				<includes>
+					<include>**/*.gif</include>
+					<include>**/*.png</include>
+					<include>**/*.PNG</include>
+					<include> **/*.bmp</include>
+					<include> **/*.jpg</include>
+					<include> **/*.jpeg</include>
+				</includes>
+			</resource>
+		</resources>
+		<testResources>
+			<testResource>
+				<directory>resources-test</directory>
+			</testResource>
+		</testResources>
+		<plugins>
+			<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<skipTests>true</skipTests>
+				</configuration>
+			</plugin>		
+		</plugins>	
+	</build>
+	<profiles>
+		<profile>
+			<id>se</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+			<dependencies>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.tools.lib</artifactId>
+					<type>test-jar</type>
+					<scope>test</scope>
+				</dependency>
+
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.compat</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>se</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.projection</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>cresques-impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.geometry</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>spi</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.geotools</groupId>
+					<artifactId>gt2-main</artifactId>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.geotools</groupId>
+					<artifactId>gt2-legacy</artifactId>
+				</dependency>
+				<dependency>
+					<groupId>org.opengis</groupId>
+				    <artifactId>geoapi</artifactId>
+					<scope>test</scope>
+				</dependency>
+							
+			</dependencies>
+			<build>
+
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-compiler-plugin</artifactId>
+						<configuration>
+							<source>1.4</source>
+							<target>1.4</target>
+							<!-- put your configurations here -->
+							<encoding>ISO-8859-1</encoding>
+						</configuration>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-jar-plugin</artifactId>
+						<!--
+							Generates a jar file only with the mapcontext API
+							TODO: make a good configuration of excludes and 
+							includes, when the api and implementation of
+							the mapcontext library would be performed. 
+						-->
+						<configuration>
+						  <excludes>
+							<exclude>org/gvsig/fmap/geom/**</exclude>
+						  </excludes>
+						</configuration>		
+						<executions>
+							<!--
+								Generates a jar file only with the mapcontext implementation
+							-->
+							<execution>
+								<id>impl</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>impl</classifier>
+									<excludes>
+										<exclude>**/**</exclude>
+									</excludes>
+								</configuration>
+							</execution>
+							<!--
+								Generates a jar file only with the mapcontext geometries operations
+							-->
+							<execution>
+								<id>operation</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>operation</classifier>
+									<excludes>
+										<exclude>NONE</exclude>
+									</excludes>
+									<includes>
+										<include>org/gvsig/fmap/geom/**</include>
+									</includes>
+								</configuration>
+							</execution>
+							<execution>
+								<goals>
+									<goal>test-jar</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>services</id>
+								<phase>package</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+								<configuration>
+									<tasks>
+										<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/api" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/impl" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-operation.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/operation" />
+										</jar>
+									</tasks>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<configuration>
+							<additionalClasspathElements>
+								<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/operation</additionalClasspathElement>
+							</additionalClasspathElements>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+
+		</profile>
+		<profile>
+			<id>cdc</id>
+			<activation>
+				<activeByDefault>false</activeByDefault>
+			</activation>
+			
+			<dependencies>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.tools.lib</artifactId>
+					<type>test-jar</type>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+				  <groupId>org.gvsig.mobile</groupId>
+				  <artifactId>org.gvsig.mobile.compat</artifactId>
+				  <version>2.0-SNAPSHOT</version>
+				  <scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig.mobile</groupId>
+					<artifactId>org.gvsig.mobile.libProjection</artifactId>
+					<version>0.0.1-SNAPSHOT</version>
+					<scope>test</scope>
+				</dependency>
+                <dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.geometry</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>spi</classifier>
+					<scope>test</scope>
+				</dependency>
+				<dependency>
+					<groupId>org.gvsig</groupId>
+					<artifactId>org.gvsig.fmap.dal</artifactId>
+					<version>2.0-SNAPSHOT</version>
+					<classifier>impl</classifier>
+					<scope>test</scope>
+				</dependency>
+				
+			</dependencies>
+
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-compiler-plugin</artifactId>
+						<configuration>
+							<source>1.4</source>
+							<target>1.4</target>
+							<!-- put your configurations here -->
+							<encoding>ISO-8859-1</encoding>
+						</configuration>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-jar-plugin</artifactId>
+						<!--
+							Generates a jar file only with the mapcontext API
+							TODO: make a good configuration of excludes and 
+							includes, when the api and implementation of
+							the mapcontext library would be performed. 
+						-->
+						<configuration>
+						  <excludes>
+							<exclude>org/gvsig/fmap/geom/**</exclude>
+						  </excludes>
+						</configuration>		
+						<executions>
+							<!--
+								Generates a jar file only with the mapcontext implementation
+							-->
+							<execution>
+								<id>impl</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>impl</classifier>
+									<excludes>
+										<exclude>**/**</exclude>
+									</excludes>
+								</configuration>
+							</execution>
+							<!--
+								Generates a jar file only with the mapcontext geometries operations
+							-->
+							<execution>
+								<id>operation</id>
+								<phase>package</phase>
+								<goals>
+									<goal>jar</goal>
+								</goals>
+								<configuration>
+									<classifier>operation</classifier>
+									<excludes>
+										<exclude>NONE</exclude>
+									</excludes>
+									<includes>
+										<include>org/gvsig/fmap/geom/**</include>
+									</includes>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<executions>
+							<execution>
+								<id>services</id>
+								<phase>package</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+								<configuration>
+									<tasks>
+										<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/api" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-impl.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/impl" />
+										</jar>
+										<jar destfile="${project.build.directory}/${project.build.finalName}-operation.jar"
+											update="true">
+											<fileset dir="${basedir}/resources/operation" />
+										</jar>
+									</tasks>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<configuration>
+							<additionalClasspathElements>
+								<additionalClasspathElement>${basedir}/resources/api</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/impl</additionalClasspathElement>
+								<additionalClasspathElement>${basedir}/resources/operation</additionalClasspathElement>
+							</additionalClasspathElements>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+
+		</profile>
+		<profile>
+			<id>eclipse-project</id>
+			<build>
+				<defaultGoal>antrun:run</defaultGoal>
+				<plugins>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<configuration>
+							<tasks>
+								<ant antfile="${build-dir}/ant-tasks/eclipse-tasks.xml"
+									target="eclipse.all"/>
+							</tasks>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>				
+		</profile>		
+	</profiles>
+</project>
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources/operation/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources/operation/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources/operation/META-INF/services/org.gvsig.tools.library.Library	(revision 36112)
@@ -0,0 +1 @@
+org.gvsig.fmap.geom.operation.MapContextGeomOperationsLibrary
\ No newline at end of file
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources/impl/META-INF/services/org.gvsig.tools.library.Library
===================================================================
Index: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources/api/META-INF/services/org.gvsig.tools.library.Library
===================================================================
--- tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 0)
+++ tags/dal_time_support_Build_1/libraries/libFMap_mapcontext/resources/api/META-INF/services/org.gvsig.tools.library.Library	(revision 36112)
@@ -0,0 +1,2 @@
+org.gvsig.fmap.mapcontext.MapContextLibrary
+org.gvsig.fmap.mapcontext.impl.MapContextImplLibrary
\ No newline at end of file

Property changes on: tags/dal_time_support_Build_1/libraries/libFMap_mapcontext
___________________________________________________________________
Added: svn:ignore
   + .classpath 
.project 
.settings 
maven-eclipse.xml
target
bin
hs_err_pid*
.externalToolBuilders
.settings
.classpath
.project


