[OpenLayers-Users] Modify feature
Tondo
gpktondo at gmail.com
Tue Mar 20 15:22:32 EDT 2012
Hi list,
My situation is as follows: I have a map where is no layer and the user is
able to add WFS layers as OpenLayers.Layer.Vector class. So I was forced to
create dummy vector (not bound with map) and bind it to Editing tools
(OL.Control.ModifyFeature and DrawFeature class). First question is: Is it
possible to cause this some issues?
If user starts to edit some features (hits button) this function is called:
/function(button, pressed){
//Doesnt have any sense if there are no vectors
if (map.getLayersByClass('OpenLayers.Layer.Vector').length < 1) {
button.toggle(false);
return;
}
if (pressed == true) {
if (activeLayer != "") modifyControl.layer = activeLayer;
modifyControl.activate();
//sm is global variable - getSelectionModel, that is able to
//bind feature to something by pasing argument to it's build-in
//method ".bind()" - GeoExt stuff. It's got also "beforeSelect"
//that fires function to unbind all stuff - prevents
multiple features
sm.unbind();
sm.bind(modifyControl.selectControl);
} else {
modifyControl.unselectFeature();
modifyControl.deactivate();
//we are not working just with editing tools, but also with
//attribute talbe. If editing is disabled, we bind selection
//model to vector layer
sm.unbind();
sm.bind(activeLayer);
}
}/
User is able to choose active layer (geoExt stuff again) via radio buttons.
The code's here:
/function(node) {
sm.clearSelections();
sm.unbind();
if (modifyControl.active) {
modifyControl.unselectFeature();
modifyControl.layer = node.layer;
//the same stuff - just bind it
sm.bind(modifyControl.selectControl);
} else {
//if editing tools are not used, just bind it to vector
//for using other stuff
sm.bind(node.layer);
}
//and change active layer
activeLayer = node.layer;
}/
Before this function is called, data store containing features is realoaded
and reconfigured...
Now how it behaves? I can see I have selected feature. I can also see modify
feature style, but I can't drag verticies.
Any help will be greatly appreciated. Any...
Thank you very much.
Regards,
Tom
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Modify-feature-tp4638011p4638011.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list