Index: TouchesGeometryEvaluator.java
===================================================================
--- TouchesGeometryEvaluator.java	(revision 43033)
+++ TouchesGeometryEvaluator.java	(revision 43034)
@@ -3,28 +3,28 @@
  *
  * Copyright (C) 2007-2013 gvSIG Association.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3 of the License, or (at your option) any later
+ * version.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * For any additional information, do not hesitate to contact us
- * at info AT gvsig.com, or visit our website www.gvsig.com.
+ * For any additional information, do not hesitate to contact us at info AT
+ * gvsig.com, or visit our website www.gvsig.com.
  */
 package org.gvsig.fmap.mapcontext.layers.vectorial;
 
 import org.cresques.cts.ICoordTrans;
 import org.cresques.cts.IProjection;
+import org.gvsig.fmap.dal.ExpressionBuilder;
 import org.gvsig.fmap.dal.feature.Feature;
 import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
 import org.gvsig.fmap.dal.feature.FeatureType;
@@ -32,73 +32,80 @@
 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;
+    private final String geomName;
+    private final Geometry geometry;
+    private final Geometry geometryTrans;
+    private final boolean isDefault;
+    private final ExpressionBuilder builder;
+    private final IProjection projection;
 
-	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();
-		
-		IProjection fad_proj = fad.getSRS();
-		ICoordTrans ct = null;
-		
-		if (fad_proj != null && !fad_proj.equals(envelopeProjection)) {
-		    ct = envelopeProjection.getCT(fad_proj);
-		}
-		
-		if (ct != null) {
-			geometryTrans.reProject(ct);
-		}
-		this.geomName = geomName;
+    TouchesGeometryEvaluator(Geometry geometry,
+            IProjection projection,
+            FeatureType featureType,
+            String geomName,
+            ExpressionBuilder builder
+        ) {
+        FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
+                .get(geomName);
+        this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
+                geomName);
+        this.geometry = geometry;
+        this.geometryTrans = geometry.cloneGeometry();
+        this.projection = projection;
+        this.builder = builder;
 
-		this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
+        IProjection fad_proj = fad.getSRS();
+        ICoordTrans ct = null;
 
-	}
+        if (fad_proj != null && !fad_proj.equals(projection)) {
+            ct = projection.getCT(fad_proj);
+        }
 
-	public Object evaluate(EvaluatorData data) throws EvaluatorException {
-		try {
-			Geometry geom = null; 
-			if (isDefault) {
-				Feature feature = (Feature) data.getContextValue("feature");
-				geom = feature.getDefaultGeometry();
+        if (ct != null) {
+            geometryTrans.reProject(ct);
+        }
+        this.geomName = geomName;
 
-			} else {
-				geom = (Geometry) data.getDataValue(geomName);
-			}
-                        if ( geom == null ) {
-                            return Boolean.FALSE;
-                        }
-			return new Boolean(geometryTrans.touches(geom));
+        this.getFieldsInfo().addMatchFieldValue(geomName, geometryTrans);
 
-		} catch (Exception e) {
-			throw new EvaluatorException(e);
-		}
-	}
+    }
 
-	public String getName() {
-		return "touches with geometry";
-	}
+    @Override
+    public Object evaluate(EvaluatorData data) throws EvaluatorException {
+        try {
+            Geometry geom;
+            if (isDefault) {
+                Feature feature = (Feature) data.getContextValue("feature");
+                geom = feature.getDefaultGeometry();
 
-	public String getSQL() {
-		return " ST_touches(ST_GeomFromText('" + geometry.toString() + "', " + "'"
-				+ srs + "'" + "), " + geomName + ") ";
-	}
+            } else {
+                geom = (Geometry) data.getDataValue(geomName);
+            }
+            if (geom == null) {
+                return Boolean.FALSE;
+            }
+            return geometryTrans.touches(geom);
 
+        } catch (Exception e) {
+            throw new EvaluatorException(e);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return "touches with geometry";
+    }
+
+    @Override
+    public String getSQL() {
+        return this.builder.set(
+                builder.ST_Touches(
+                        builder.geometry(geometry, projection),
+                        builder.column(geomName)
+                )
+        ).toString();
+    }
 }
