[OpenLayers-Users] feature selection events with ModifyFeature control
Jerome A. Wendell
jawendell at suddenlink.net
Thu Feb 5 05:31:01 PST 2015
Tom,
I am getting the features selected from the function called by my layer
events.
Jerome Wendell
From: Ruff, Thomas [mailto:Thomas.Ruff at solers.com]
Sent: Thursday, February 05, 2015 1:28 AM
To: jawendell at suddenlink.net; openlayers-users at lists.osgeo.org
Subject: RE: [OpenLayers-Users] feature selection events with ModifyFeature
control
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/5513ff91/attachment.html>
More information about the Users
mailing list