[OpenLayers-Users] feature selection events with ModifyFeature control

Ruff, Thomas Thomas.Ruff at solers.com
Wed Feb 4 16:30:29 PST 2015


Could anyone clarify the way feature selection works in OL 2.13.  Currently I'm using a ModifyFeature control that is not configured for standalone mode.  The user clicks features using the mouse and this effectively sets the select render intent on the feature.  The user can also select features from a grid control, in which case I call modifyFeature.selectFeature(featureRef), which also sets the select render intent for the feature.  That all works fine, but now I need to handle selectfeature events and do some extra stuff but when I registered a handler on the layer for the featureselected event like this:

layer.events.on({"featureselected": onFeatureSelectedHandler});

it never gets called.  So I found this link https://github.com/openlayers/openlayers/issues/972 that says this is not a bug I but still really don't understand standalone vs non-standalone mode.

I also tried adding a selectFeature control and supplying a callback function like this:

selectFeatureControl = new OpenLayers.Control.SelectFeature([layer],
    { onSelect: function () { console.info("selectFeature.onselect fired"); } }
);
map.addControls([modifyFeatureControl, selectFeatureControl]);

but that didn't work either.

What do I need to do in order to be able to receive selectFeature events and still do the other stuff described above?   Should I use standalone or non-standalone mode?  Do I have to use a selectFeature control regardless of the mode if I want an event to fire when a feature becomes selected?

Thanks,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20150205/b3e27282/attachment.html>


More information about the Users mailing list