diff Samples/Common/MeasureTrackers.h @ 644:f939f449482c

Ongoing tracker work.
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 10 May 2019 16:15:55 +0200
parents 500c3f70b6c2
children 1e9ed656318e
line wrap: on
line diff
--- a/Samples/Common/MeasureTrackers.h	Thu May 09 14:54:12 2019 +0200
+++ b/Samples/Common/MeasureTrackers.h	Fri May 10 16:15:55 2019 +0200
@@ -20,8 +20,9 @@
 
 #pragma once
 
-#include "../../Framework/Scene2D/IPointerTracker.h"
+#include "IFlexiblePointerTracker.h"
 #include "../../Framework/Scene2D/Scene2D.h"
+#include "../../Framework/Scene2D/PointerEvent.h"
 
 #include "MeasureTools.h"
 #include "MeasureCommands.h"
@@ -30,11 +31,11 @@
 
 namespace OrthancStone
 {
-  class CreateMeasureTracker : public IPointerTracker
+  class CreateMeasureTracker : public IFlexiblePointerTracker
   {
   public:
-    virtual void Update(const PointerEvent& e) ORTHANC_OVERRIDE;
-    virtual void Release() ORTHANC_OVERRIDE;
+    virtual void Cancel() ORTHANC_OVERRIDE;
+    virtual bool IsActive() const ORTHANC_OVERRIDE;
   protected:
     CreateMeasureTracker(
       Scene2D&                        scene,
@@ -43,32 +44,14 @@
 
     ~CreateMeasureTracker();
   
+  protected:
+    Scene2D&                        scene_;
+    CreateMeasureCommandPtr         command_;
+    bool                            active_;
   private:
-    Scene2D&                        scene_;
     std::vector<TrackerCommandPtr>& undoStack_;
     std::vector<MeasureToolPtr>&    measureTools_;
     bool                            commitResult_;
-
-  protected:
-    CreateMeasureCommandPtr         command_;
   };
 
-  class CreateLineMeasureTracker : public CreateMeasureTracker
-  {
-  public:
-    /**
-    When you create this tracker, you need to supply it with the undo stack
-    where it will store the commands that perform the actual measure tool
-    creation and modification.
-    In turn, a container for these commands to store the actual measuring
-    must be supplied, too
-    */
-    CreateLineMeasureTracker(
-      Scene2D&                        scene,
-      std::vector<TrackerCommandPtr>& undoStack,
-      std::vector<MeasureToolPtr>&    measureTools,
-      const PointerEvent&             e);
-
-    ~CreateLineMeasureTracker();
-  };
 }