[OpenLayers-Users] Remove features in DrawControl without deactivate the control
dinl
dinl_ at hotmail.com
Mon Jul 21 09:01:55 PDT 2014
Hi, I'm trying to remove the last feature drawed in the map while the control
draw is still activated, similar to ctrl + z behavior, I can remove the last
feature with this code:
var lineLayer = map.getLayersByName("line_Layer");
var numFeaturesL = lineLayer [0].features.length-1;
var numComponentsL = lineLayer [0].features[0].geometry.components.length-1;
var pointToRemove = lineLayer
[0].features[numFeaturesL].geometry.components[numComponentsL];
lineLayer [0].features[numFeaturesL].geometry.removeComponent(pointToRemove
);
lineLayer [0].redraw();
But this code needs to close the draw with a double click in order to the
features been added to the layer,there is anyway to remove without these
condition?.
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Remove-features-in-DrawControl-without-deactivate-the-control-tp5152206.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list