diff Framework/Scene2DViewport/AngleMeasureTool.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 ac88989817e3
line wrap: on
line diff
--- a/Framework/Scene2DViewport/AngleMeasureTool.h	Tue Jun 25 15:24:13 2019 +0200
+++ b/Framework/Scene2DViewport/AngleMeasureTool.h	Tue Jun 25 17:54:46 2019 +0200
@@ -30,13 +30,14 @@
 
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
 
 #include <vector>
 #include <cmath>
 
 namespace OrthancStone
 {
-  class AngleMeasureTool : public MeasureTool
+  class AngleMeasureTool : public MeasureTool, public boost::enable_shared_from_this<AngleMeasureTool>
   {
   public:
     AngleMeasureTool(MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW);
@@ -50,6 +51,9 @@
     virtual bool HitTest(ScenePoint2D p) const ORTHANC_OVERRIDE;
     virtual void Highlight(ScenePoint2D p) ORTHANC_OVERRIDE;
     virtual void ResetHighlightState() ORTHANC_OVERRIDE;
+    virtual boost::shared_ptr<IFlexiblePointerTracker> CreateEditionTracker(const PointerEvent& e) ORTHANC_OVERRIDE;
+    virtual boost::shared_ptr<MeasureToolMemento> GetMemento() const ORTHANC_OVERRIDE;
+    virtual void SetMemento(boost::shared_ptr<MeasureToolMemento>) ORTHANC_OVERRIDE;
 
     enum AngleHighlightArea
     {
@@ -76,6 +80,14 @@
     boost::shared_ptr<LayerHolder>  layerHolder_;
     AngleHighlightArea              angleHighlightArea_;
   };
+
+  class AngleMeasureToolMemento : public MeasureToolMemento
+  {
+  public:
+    ScenePoint2D                    side1End_;
+    ScenePoint2D                    side2End_;
+    ScenePoint2D                    center_;
+  };
 }