AnsweredAssumed Answered

Draw widget - graphics in undo stack?

Question asked by khibmaesri-ca-esridist Employee on Mar 15, 2019
Latest reply on Mar 15, 2019 by rscheitlin

Question: How do I clear the undo stack from the Draw widget from a widget other than Draw itself?


I have 2 widgets, the OTB Draw widget and another widget that re-loads graphics (Save Session)


When loading a new session via my Save Session widget, it will first remove all graphics from the map, then reload the graphics from the session file. I have to clear the graphics, if I remove the layers outright, it puts Draw into a bad state. This all works fine and good. 


I run into problems when I try to reload session/graphics and go back and use the Draw widget. If I had already used Draw, made some graphics, loaded the new session, I end up in a state with the graphics from the session file on my screen (so far, working as expected). When I go back and use Draw and add a new graphic, I lose everything from my loaded session and the graphics that were previously created (but had been removed) show up again. I've verified that I've cleaned out all the graphics layers, the geometry is GONE. The only place they can be coming from is the undo/redo stack of the Draw widget. As I can walk through the Undo of all the graphics I created before I had loaded the session and "cleared" the graphics.


So I believe I need to clear the Draw's Undo stack or  completely re-load the Draw widget (assuming that would clear the stack).


Any ideas?