[OpenLayers-Users] When drawing a point,
how to clear the previous point?
Christopher Schmidt
crschmidt at metacarta.com
Wed Jan 14 07:24:35 EST 2009
On Wed, Jan 14, 2009 at 02:36:53AM -0800, gingerbbm wrote:
>
> Dear all
>
> I'm sure this is simple but I'm not getting anywhere.
>
> I have a custom toolbar containing buttons such as "draw point", "draw
> line", "draw poly", etc.
> If the user selects "draw point" and clicks on the map, a point appears.
> What I need is for the next click on the map to clear the previous point,
> and draw a new one at the new location.
>
> How do I clear the previous point?
>
> I have investigated destroyFeatures() and if I tie that to the
> activate/deactivate function that I've written which is called as the user
> chooses a different button, that works fine. But is it possible to call this
> prior to each draw action if the current tool isn't deactivated?
>
> Hope this makes sense and that someone can point me in the right direction.
Check out the createFeature function defined on these controls:
http://crschmidt.net/mapping/save-feature.html
In this case, the features each have a seperate layer, so you can have
one of each filter; changing this behavior should be simple and is left
as an excercise to the reader.
> Many thanks
> Stuart
> --
> View this message in context: http://n2.nabble.com/When-drawing-a-point%2C-how-to-clear-the-previous-point--tp2156139p2156139.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list