Index: FLyrVect.java
===================================================================
--- FLyrVect.java	(revision 38060)
+++ FLyrVect.java	(revision 38061)
@@ -55,7 +55,6 @@
 
 import org.apache.log4j.Logger;
 import org.cresques.cts.ICoordTrans;
-import org.gvsig.exceptions.BaseException;
 import org.gvsig.tools.file.PathGenerator;
 
 import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
@@ -88,7 +87,6 @@
 import com.iver.cit.gvsig.fmap.drivers.IVectorialDatabaseDriver;
 import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
 import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend;
-import com.iver.cit.gvsig.fmap.drivers.featureiterators.DefaultFeatureIterator;
 import com.iver.cit.gvsig.fmap.drivers.featureiterators.JoinFeatureIterator;
 import com.iver.cit.gvsig.fmap.edition.AfterFieldEditEvent;
 import com.iver.cit.gvsig.fmap.edition.AfterRowEditEvent;
@@ -124,7 +122,6 @@
 import com.iver.cit.gvsig.fmap.rendering.ZSort;
 import com.iver.cit.gvsig.fmap.rendering.styling.labeling.AttrInTableLabelingStrategy;
 import com.iver.cit.gvsig.fmap.rendering.styling.labeling.ILabelingStrategy;
-import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelClass;
 import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelingFactory;
 import com.iver.cit.gvsig.fmap.spatialindex.IPersistentSpatialIndex;
 import com.iver.cit.gvsig.fmap.spatialindex.ISpatialIndex;
@@ -145,20 +142,12 @@
  * @author Fernando González Cortés
  */
 
-// TODO Cuando no sea para pruebas debe no ser public
 public class FLyrVect extends FLyrDefault implements ILabelable,
         ClassifiableVectorial, SingleLayer, VectorialData, RandomVectorialData,
         AlphanumericData, InfoByPoint, SelectionListener, IEditionListener, LegendContentsChangedListener {
-    private static Logger logger = Logger.getLogger(FLyrVect.class.getName());
-    /**
-     * @deprecated Don´t use Strategy, you should be use iterators.
-     */
-//    public static boolean forTestOnlyVariableUseIterators_REMOVE_THIS_FIELD = true;
-    /**
-     * @deprecated Don´t use Strategy, you should be use iterators.
-     */
-//    private boolean useStrategy=false;
 
+	private static Logger logger = Logger.getLogger(FLyrVect.class.getName());
+
     /** Leyenda de la capa vectorial */
     private IVectorLegend legend;
     private int typeShape = -1;
@@ -628,8 +617,6 @@
 
    	public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
             Cancellable cancel, double scale) throws ReadDriverException {
-//    	forTestOnlyVariableUseIterators_REMOVE_THIS_FIELD = true;
-//    	if (!isUseStrategy()) {
    		if (isWaitTodraw()) {
 			return;
 		}
@@ -639,178 +626,10 @@
    		else {
    			_draw(image, g, viewPort, cancel, scale);
    		}
-//    	} else {
-////    		moved up to FLayers
-////    		if (isWithinScale(scale)) {
-//
-//
-//    			// Las que solo tienen etiquetado sin pintar el shape,
-//    			// no pasamos por ellas
-//    			boolean bDrawShapes = true;
-//    			if (legend instanceof SingleSymbolLegend) {
-//    				if (legend.getDefaultSymbol().isShapeVisible() == false)
-//    					bDrawShapes = false;
-//    			}
-//    			if (bDrawShapes) {
-//    				Strategy strategy = StrategyManager.getStrategy(this);
-//    				try {
-//    					prepareDrawing(image, g, viewPort);
-//    					strategy.draw(image, g, viewPort, cancel);
-//    				} catch (ReadDriverException e) {
-//    					this.setVisible(false);
-//    					this.setActive(false);
-//    					throw e;
-//    				}
-//    			}
-//    			if (getVirtualLayers() != null) {
-//    				getVirtualLayers().draw(image, g, viewPort, cancel, scale);
-//    			}
-////    		}
-//    	}
     }
 
-    /**
-     * Se llama antes de empezar a pintar.
-     * Es útil para preparar la cache a emplear, las leyendas, etc.
-     * @param image
-     * @param g
-     * @param viewPort
-     */
-    private void prepareDrawing(BufferedImage image, Graphics2D g, ViewPort viewPort) {
-
-    }
-
     public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
     		double scale, PrintRequestAttributeSet properties) throws ReadDriverException {
-    	// TEST METHOD
-
-
-    		/* SVN */
-
-    /*	boolean bDrawShapes = true;
-    	if (legend instanceof SingleSymbolLegend) {
-    		bDrawShapes = legend.getDefaultSymbol().isShapeVisible();
-    	}
-
-
-    	if (bDrawShapes) {
-    		double dpi = 72;
-
-    		PrintQuality resolution=(PrintQuality)properties.get(PrintQuality.class);
-    		if (resolution.equals(PrintQuality.NORMAL)){
-    			dpi = 300;
-    		} else if (resolution.equals(PrintQuality.HIGH)){
-    			dpi = 600;
-    		} else if (resolution.equals(PrintQuality.DRAFT)){
-    			dpi = 72;
-    		}
-
-
-    		try {
-    			prepareDrawing(null, g, viewPort);
-    			ArrayList<String> fieldList = new ArrayList<String>();
-    			String[] aux;
-
-    			// fields from legend
-    			if (legend instanceof IClassifiedVectorLegend) {
-    				aux = ((IClassifiedVectorLegend) legend).
-    									getClassifyingFieldNames();
-    				for (int i = 0; i < aux.length; i++) {
-    					fieldList.add(aux[i]);
-    				}
-    			}
-
-    			// fields from labeling
-    			if (isLabeled()) {
-    				aux = getLabelingStrategy().getUsedFields();
-    				for (int i = 0; i < aux.length; i++) {
-    					fieldList.add(aux[i]);
-    				}
-    			}
-
-    			ZSort zSort = ((IVectorLegend) getLegend()).getZSort();
-
-    			// if layer has map levels it will use a ZSort
-    			boolean useZSort = zSort != null && zSort.isUsingZSort();
-
-
-    			int mapLevelCount = (useZSort) ? zSort.getLevelCount() : 1;
-    			for (int mapPass = 0; mapPass < mapLevelCount; mapPass++) {
-    				// Get the iterator over the visible features
-    				IFeatureIterator it = getSource().getFeatureIterator(
-    						viewPort.getAdjustedExtent(),
-    						fieldList.toArray(new String[fieldList.size()]),
-    						viewPort.getProjection(),
-    						true);
-
-    				// Iteration over each feature
-    				while ( !cancel.isCanceled() && it.hasNext()) {
-    					IFeature feat = it.next();
-    					IGeometry geom = feat.getGeometry();
-
-    					// retreive the symbol associated to such feature
-    					ISymbol sym = legend.getSymbolByFeature(feat);
-
-    					if (useZSort) {
-    						// Check if this symbol is a multilayer
-							if (sym instanceof IMultiLayerSymbol) {
-								// if so, get the layer corresponding to the current
-								// level. If none, continue to next iteration
-								IMultiLayerSymbol mlSym = (IMultiLayerSymbol) sym;
-								for (int i = 0; i < mlSym.getLayerCount(); i++) {
-									ISymbol mySym = mlSym.getLayer(i);
-									if (zSort.getSymbolLevel(mySym) == mapPass) {
-										sym = mySym;
-										break;
-									}
-									System.out.println("avoided layer "+i+"of symbol '"+mlSym.getDescription()+"' (pass "+mapPass+")");
-								}
-
-								if (sym == null) {
-									continue;
-								}
-							} else {
-								// else, just draw the symbol in its level
-								if (zSort.getSymbolLevel(sym) != mapPass) {
-									System.out.println("avoided single layer symbol '"+sym.getDescription()+"' (pass "+mapPass+")");
-									continue;
-								}
-							}
-    					}
-
-    					// Check if this symbol is sized with CartographicSupport
-    					CartographicSupport csSym = null;
-    					int symbolType = sym.getSymbolType();
-    					boolean bDrawCartographicSupport = false;
-
-    					if (   symbolType == FShape.POINT
-    							|| symbolType == FShape.LINE
-    							|| sym instanceof CartographicSupport) {
-
-    						csSym = (CartographicSupport) sym;
-    						bDrawCartographicSupport = (csSym.getUnit() != -1);
-    					}
-
-    					System.err.println("passada "+mapPass+" pinte símboll "+sym.getDescription());
-
-    					if (!bDrawCartographicSupport) {
-    						geom.drawInts(g, viewPort, sym, null);
-    					} else {
-    						geom.drawInts(g, viewPort, dpi, (CartographicSupport) csSym);
-    					}
-
-    				}
-    				it.closeIterator();
-    			}
-    		} catch (ReadDriverException e) {
-    			this.setVisible(false);
-    			this.setActive(false);
-    			throw e;
-    		}
-	*/
-
-
-    	// TEST METHOD
     	boolean bDrawShapes = true;
     	if (legend instanceof SingleSymbolLegend) {
     		bDrawShapes = legend.getDefaultSymbol().isShapeVisible();
@@ -835,20 +654,19 @@
 
     			// fields from legend
     			if (legend instanceof IClassifiedVectorLegend) {
-    				aux = ((IClassifiedVectorLegend) legend).
-    				getClassifyingFieldNames();
+    				aux = ((IClassifiedVectorLegend) legend).getClassifyingFieldNames();
     				for (int i = 0; i < aux.length; i++) {
     					fieldList.add(aux[i]);
     				}
     			}
-//
-//    			// fields from labeling
-//    			if (isLabeled()) {
-//    				aux = getLabelingStrategy().getUsedFields();
-//    				for (int i = 0; i < aux.length; i++) {
-//    					fieldList.add(aux[i]);
-//    				}
-//    			}
+    			//
+    			//    			// fields from labeling
+    			//    			if (isLabeled()) {
+    			//    				aux = getLabelingStrategy().getUsedFields();
+    			//    				for (int i = 0; i < aux.length; i++) {
+    			//    					fieldList.add(aux[i]);
+    			//    				}
+    			//    			}
 
     			ZSort zSort = ((IVectorLegend) getLegend()).getZSort();
 
@@ -859,23 +677,23 @@
     			int mapLevelCount = (useZSort) ? zSort.getLevelCount() : 1;
     			for (int mapPass = 0; mapPass < mapLevelCount; mapPass++) {
     				// Get the iterator over the visible features
-//    				IFeatureIterator it = getSource().getFeatureIterator(
-//    						viewPort.getAdjustedExtent(),
-//    						fieldList.toArray(new String[fieldList.size()]),
-//    						viewPort.getProjection(),
-//    						true);
-        			IFeatureIterator it = null;
-        			if (isJoined()) {
-        				it = new JoinFeatureIterator(this, viewPort,
-        						fieldList.toArray(new String[fieldList.size()]));
-        			}
-        			else {
-        				it = getSource().getFeatureIterator(
-        					viewPort.getAdjustedExtent(),
-        					fieldList.toArray(new String[fieldList.size()]),
-        					viewPort.getProjection(),
-        					true);
-        			}
+    				//    				IFeatureIterator it = getSource().getFeatureIterator(
+    				//    						viewPort.getAdjustedExtent(),
+    				//    						fieldList.toArray(new String[fieldList.size()]),
+    				//    						viewPort.getProjection(),
+    				//    						true);
+    				IFeatureIterator it = null;
+    				if (isJoined()) {
+    					it = new JoinFeatureIterator(this, viewPort,
+    							fieldList.toArray(new String[fieldList.size()]));
+    				}
+    				else {
+    					it = getSource().getFeatureIterator(
+    							viewPort.getAdjustedExtent(),
+    							fieldList.toArray(new String[fieldList.size()]),
+    							viewPort.getProjection(),
+    							true);
+    				}
 
     				// Iteration over each feature
     				while ( !cancel.isCanceled() && it.hasNext()) {
@@ -885,32 +703,32 @@
     					// retreive the symbol associated to such feature
     					ISymbol sym = legend.getSymbolByFeature(feat);
     					if (sym == null) {
-							continue;
-						}
+    						continue;
+    					}
     					if (useZSort) {
-							int[] symLevels = zSort.getLevels(sym);
-							if(symLevels != null){
-								// Check if this symbol is a multilayer
-								if (sym instanceof IMultiLayerSymbol) {
-									// if so, get the layer corresponding to the current
-									// level. If none, continue to next iteration
-									IMultiLayerSymbol mlSym = (IMultiLayerSymbol) sym;
-									for (int i = 0; i < mlSym.getLayerCount(); i++) {
-										ISymbol mySym = mlSym.getLayer(i);
-										if (symLevels[i] == mapPass) {
-											sym = mySym;
-											break;
-										}
-										System.out.println("avoided layer "+i+"of symbol '"+mlSym.getDescription()+"' (pass "+mapPass+")");
-									}
-								} else {
-									// else, just draw the symbol in its level
-									if (symLevels[0] != mapPass) {
-										System.out.println("avoided single layer symbol '"+sym.getDescription()+"' (pass "+mapPass+")");
-										continue;
-									}
-								}
-							}
+    						int[] symLevels = zSort.getLevels(sym);
+    						if(symLevels != null){
+    							// Check if this symbol is a multilayer
+    							if (sym instanceof IMultiLayerSymbol) {
+    								// if so, get the layer corresponding to the current
+    								// level. If none, continue to next iteration
+    								IMultiLayerSymbol mlSym = (IMultiLayerSymbol) sym;
+    								for (int i = 0; i < mlSym.getLayerCount(); i++) {
+    									ISymbol mySym = mlSym.getLayer(i);
+    									if (symLevels[i] == mapPass) {
+    										sym = mySym;
+    										break;
+    									}
+    									System.out.println("avoided layer "+i+"of symbol '"+mlSym.getDescription()+"' (pass "+mapPass+")");
+    								}
+    							} else {
+    								// else, just draw the symbol in its level
+    								if (symLevels[0] != mapPass) {
+    									System.out.println("avoided single layer symbol '"+sym.getDescription()+"' (pass "+mapPass+")");
+    									continue;
+    								}
+    							}
+    						}
     					}
 
     					// Check if this symbol is sized with CartographicSupport
@@ -924,7 +742,7 @@
     						csSym = (CartographicSupport) sym;
     					}
 
-//    					System.err.println("passada "+mapPass+" pinte símboll "+sym.getDescription());
+    					//System.err.println("passada "+mapPass+" pinte símboll "+sym.getDescription());
 
     					if (csSym == null) {
     						geom.drawInts(g, viewPort, sym, null);
@@ -946,23 +764,9 @@
 
     public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
             double scale, PrintRequestAttributeSet properties) throws ReadDriverException {
-//    	if (forTestOnlyVariableUseIterators_REMOVE_THIS_FIELD) {
     	if (isVisible() && isWithinScale(scale)) {
     		_print(g, viewPort, cancel, scale, properties);
     	}
-//    	} else {
-////    		moved up to Flayers
-////    		if (isVisible() && isWithinScale(scale)) {
-//    			Strategy strategy = StrategyManager.getStrategy(this);
-//
-//    			strategy.print(g, viewPort, cancel, properties);
-//    			ILabelingStrategy labeling;
-//    			if ( (labeling = getLabelingStrategy() ) != null) {
-//    				// contains labels
-//    				labeling.print(g, viewPort, cancel, properties);
-//    			}
-////    		}
-//    	}
     }
 
     public void deleteSpatialIndex() {
@@ -1045,7 +849,6 @@
             //request for feature iteration based in spatial queries
             source.setSpatialIndex(spatialIndex);
         } catch (ReadDriverException e) {
-            // TODO Auto-generated catch block
             e.printStackTrace();
         }
     }
@@ -1341,10 +1144,6 @@
 
     			String recordsetName = xml.getStringProperty("recordset-name");
 
-//    			SelectableDataSource sds = new SelectableDataSource(LayerFactory
-//    					.getDataSourceFactory().createRandomDataSource(
-//    							recordsetName, DataSourceFactory.AUTOMATIC_OPENING));
-
     			LayerFactory.getDataSourceFactory().changeDataSourceName(
     					getSource().getRecordset().getName(), recordsetName);
     			SelectableDataSource sds = new SelectableDataSource(LayerFactory
@@ -1971,7 +1770,6 @@
         try {
 			strategy.setLayer(this);
 		} catch (ReadDriverException e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
     }
@@ -2024,24 +1822,6 @@
     	//return linkProperties.getLink(this)
     	return linkProperties.getLink(this,point,tolerance);
     }
-//    /**
-//     * @deprecated Don´t use Strategy, you should be use iterators.
-//     */
-//	public boolean isUseStrategy() {
-//		return useStrategy;
-//	}
-//	/**
-//     * @deprecated Don´t use Strategy, you should be use iterators.
-//     */
-//	public void setUseStrategy(boolean useStrategy) {
-//		this.useStrategy = useStrategy;
-//	}
-//
-//	@Override
-//	public void load() throws LoadLayerException {
-//		super.load();
-//		useStrategy=forTestOnlyVariableUseIterators_REMOVE_THIS_FIELD;
-//	}
 
 	public void selectionChanged(SelectionEvent e) {
 		this.updateDrawVersion();
