Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] More selection tools plugin

Thanks for your patch.
It seems Selection tools plugin is out of date for current uDig version.
Does somebody know a way to build a plugin which works with multiple releases ?

Emmanuel AUVINET
Alyotech Technologies

-----Message d'origine-----
De : Dave S-B [mailto:dev-lists@xxxxxxxxxxxxxxxxxxxxx] 
Envoyé : mardi 13 octobre 2009 12:39
À : User-friendly Desktop Internet GIS
Cc : AUVINET Emmanuel
Objet : More selection tools plugin

Below is a patch for the extra selection tools plugin in the community 
pages from Alyotech 
(http://udig.refractions.net/confluence/display/COM/More+selection+tools) 
which allows the plugin to work in uDig 1.2 (I'm using M7) if anyone 
else is interested.

Dave S-B
Lledr Solutions

Index: 
src/net/refractions/udig/tool/select/more/internal/command/PolygonalSelectionCommand.java
===================================================================
--- 
src/net/refractions/udig/tool/select/more/internal/command/PolygonalSelectionCommand.java    
(revision 31495)
+++ 
src/net/refractions/udig/tool/select/more/internal/command/PolygonalSelectionCommand.java    
(working copy)
@@ -12,12 +12,12 @@
 import net.refractions.udig.tool.select.more.internal.Messages;
 
 import org.eclipse.core.runtime.IProgressMonitor;
-//import org.opengis.filter.Filter;
-import org.geotools.filter.Filter;
-import org.geotools.filter.FilterFactory;
-import org.geotools.filter.FilterFactoryImpl;
-import org.geotools.filter.FilterType;
-import org.geotools.filter.GeometryFilter;
+import org.geotools.factory.CommonFactoryFinder;
+import org.geotools.factory.GeoTools;
+import org.opengis.feature.type.Name;
+import org.opengis.filter.Filter;
+import org.opengis.filter.FilterFactory2;
+import org.opengis.filter.spatial.Intersects;
 
 import com.vividsolutions.jts.geom.Polygon;
 
@@ -53,10 +53,12 @@
         for (Layer layer : layers) {
             undoState.put(layer, layer.getFilter());
         }
-        FilterFactory ff = new FilterFactoryImpl();
-        GeometryFilter filter = ff
-                .createGeometryFilter(FilterType.GEOMETRY_INTERSECTS);
-        filter.addRightGeometry(ff.createLiteralExpression(poly));
+        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools
+                .getDefaultHints());
+        Name geomAttribName = getMap().getEditManager().getSelectedLayer()
+                .getSchema().getGeometryDescriptor().getName();
+        Intersects filter = ff.intersects(ff.property(geomAttribName), ff
+                .literal(poly));
 
         // check for key modifiers for AND/OR toggle
         if (modifiers == NONE) {



Back to the top