[OpenLayers-Users] annotations undo-redo

Alexandre Dubé adube at mapgears.com
Wed Nov 21 07:19:24 PST 2012


Hi,

   If you used an OpenLayers.Layer.ModifyFeature control, the according 
OpenLayers.Layer.Vector events would be fired upon modification.  See 
this example while having your browser console opened, you'll see the 
events being fired :

   http://openlayers.org/dev/examples/modify-feature.html

   Those events are fired by a controls (only the ModifyFeature and 
Split, actually), but are held inside the Vector layer object itself.  
Some others are inside the control itself and also fired by the control 
(TransformFeature).

   Try to look at the ModifyFeature control and see if it could be the 
main widget controling your annotation modifications/selections.  I'd 
try using it in a custom Control class with an inner ModifyFeature 
control for that purpose and do the rest manually (program the rest).  
That way, even though you'd need to write some code, it would be done 
properly.

HTH,

Alexandre,


On 12-11-21 06:16 AM, Dimitrios Sferopoulos wrote:
> Hi all,
>
> I'm trying to implement an undo-redo functionality for openlayers 
> annotations. Unfortunately openlayers is a bit inconsistent with 
> raising events, for example moving a feature does not raise any event 
> whatsoever. Also changing the style of a feature is not firing any 
> event neither.
>
> I don't want to go through the pain of adding listeners to every 
> individual button on my annotations toolbar that does not fire an 
> openlayers event as that would be rather messy.
>
> What would be the way to go with this? Is it possible to extend 
> openlayers to for example raise an event when a feature is moved?
>
>
> Cheers
> Dimitrios
>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list