Hi list,

I try to use Control.SelectFeature but I can`t unselect (selection layer does 
not get removed). Here is my code:
var selectFeature = new OpenLayers.Control.SelectFeature(wfs2, {clickout: true, 
multiple: false, hover: false, toggle:false, toggleKey: "shiftKey", box: true, 
multipleKey: "ctrlKey"});

var wfs2 = new OpenLayers.Layer.Vector("WFS_Waldschutz", 
                { styleMap: styleMap,
                 strategies: [new OpenLayers.Strategy.Fixed()],
                 protocol: new OpenLayers.Protocol.WFS({ 
                   url: "http://myserver:81/geoserver/wfs?service=wfs";, 
                    featureNS: "http://mycomp.org";, 
                    featureType: "mylayer", 
                    geometryName: "SHAPE", 
                    srsName: "EPSG:4326",
                    version: "1.1.0" 
                  
                    }),
                   projection: new OpenLayers.Projection("EPSG:4326")
                });    

wfs2.events.on({'featureselected': function(feature){ 
                            select.addFeatures([feature.feature]); 
                            alert(this.selectedFeatures.length); 
                        }, 
                        'featureunselected': function(feature){
                            select.removeFeatures([feature.feature]);
                            alert(this.selectedFeatures.length); 
alert("unselected");
                        },
                    });  

var select = new OpenLayers.Layer.Vector("Selection", { 
            styleMap: new 
OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]), 
            displayInLayerSwitcher: true, visibility: true});

featureselected works (at firebug I can see that my app does not get to this 
break point). What`s wrong?

Thank you for any hints.
best regards
Sarah

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to