[OpenLayers-Users] feature selection events with ModifyFeature control

Jerome A. Wendell jawendell at suddenlink.net
Wed Feb 4 19:10:19 PST 2015


Tom,

 

I am using a ModifyFeature control in a similar way in OL 2.13.  I have
standalone set to false.  I had to setup a SelectFeature control on the same
layer for my layer event functions to work.

 

Hope this helps!

 

Jerome Wendell

 

From: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Ruff, Thomas
Sent: Wednesday, February 04, 2015 7:30 PM
To: openlayers-users at lists.osgeo.org
Subject: [OpenLayers-Users] feature selection events with ModifyFeature
control

 

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/20150204/52511766/attachment.html>


More information about the Users mailing list