[OpenLayers-Users] feature selection events with ModifyFeature control

Ruff, Thomas Thomas.Ruff at solers.com
Wed Feb 4 22:28:19 PST 2015


Ok, I tried that earlier today and it didn't work so maybe I just have a bug.  I did verify that the features are actually being marked as selected on the layer, I'm just not getting the callback.  I'll take a closer look next week when I'm back it the office.  Are you getting the featureselected event from the layer or the onSelect callback from the SelectFeature control?  Thanks Jerome.



If anybody has a good explanation of what standalone mode means or when to use it I'm still interested though.

________________________________
From: Jerome A. Wendell [jawendell at suddenlink.net]
Sent: Wednesday, February 04, 2015 7:10 PM
To: Ruff, Thomas; openlayers-users at lists.osgeo.org
Subject: RE: [OpenLayers-Users] feature selection events with ModifyFeature control

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/20150205/630c13f2/attachment-0001.html>


More information about the Users mailing list