[OpenLayers-Users] Remove features in DrawControl without deactivate the control

Germán Carrillo carrillo.german at gmail.com
Wed Jul 23 09:55:28 PDT 2014


Hi dinl,

have a look at this example:

http://openlayers.org/dev/examples/draw-undo-redo.html


Regards,

Germán


2014-07-21 11:01 GMT-05:00 dinl <dinl_ at hotmail.com>:

> 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.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
-----------
   |\__
(:>__)(
   |/

Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
http://twitter.com/GeoTux2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140723/6d8f0775/attachment.html>


More information about the Users mailing list