diff Framework/Scene2DViewport/MeasureTool.h @ 866:c71ef52602a0 toa2019062501

Added the ability to edit existing measuring tools (demo not updated yet)
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 25 Jun 2019 17:54:46 +0200
parents a29c13497557
children 0aff28f15ea2
line wrap: on
line diff
--- a/Framework/Scene2DViewport/MeasureTool.h	Tue Jun 25 15:24:13 2019 +0200
+++ b/Framework/Scene2DViewport/MeasureTool.h	Tue Jun 25 17:54:46 2019 +0200
@@ -35,6 +35,9 @@
 
 namespace OrthancStone
 {
+  class IFlexiblePointerTracker;
+  class MeasureToolMemento;
+
   class MeasureTool : public IObserver
   {
   public:
@@ -73,6 +76,25 @@
     virtual bool HitTest(ScenePoint2D p) const = 0;
 
     /**
+    This method must return a memento the captures the tool state (not including
+    the highlighting state
+    */
+    virtual boost::shared_ptr<MeasureToolMemento> GetMemento() const = 0;
+
+    /**
+    This method must apply the supplied memento (this requires RTTI to check
+    the type)
+    */
+    virtual void SetMemento(boost::shared_ptr<MeasureToolMemento>) = 0;
+
+    /**
+    This must create an edition tracker suitable for the supplied click position,
+    or an empty pointer if no hit test (although this should have been checked
+    first)
+    */
+    virtual boost::shared_ptr<IFlexiblePointerTracker> CreateEditionTracker(const PointerEvent& e) = 0;
+
+    /**
     Will change the measuring tool to provide visual feedback on the GUI 
     element that is in the pointer hit zone
     */
@@ -116,6 +138,13 @@
     boost::weak_ptr<ViewportController> controllerW_;
     bool     enabled_;
   };
+
+  class MeasureToolMemento
+  {
+    public:
+      virtual ~MeasureToolMemento() {};
+  };
+
 }
 
 extern void TrackerSample_SetInfoDisplayMessage(