diff Framework/Scene2DViewport/MeasureTool.h @ 1305:a5326ce4f24b broker

Trackers and measuring tools now use the viewport instead of ViewportController, so that proper locks can be used
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 04 Mar 2020 09:45:38 +0100
parents 7ec8fea061b9
children 9b126de2cde2
line wrap: on
line diff
--- a/Framework/Scene2DViewport/MeasureTool.h	Wed Mar 04 09:44:34 2020 +0100
+++ b/Framework/Scene2DViewport/MeasureTool.h	Wed Mar 04 09:45:38 2020 +0100
@@ -75,7 +75,7 @@
     true, then a click at that position will return a tracker to edit the 
     measuring tool
     */
-    virtual bool HitTest(ScenePoint2D p) const = 0;
+    virtual bool HitTest(ScenePoint2D p) = 0;
 
     /**
     This method must return a memento the captures the tool state (not including
@@ -113,7 +113,7 @@
     virtual std::string GetDescription() = 0;
 
   protected:
-    MeasureTool(boost::weak_ptr<ViewportController> controllerW);
+    MeasureTool(IViewport& viewport);
 
     /**
     The measuring tool may exist in a standalone fashion, without any available
@@ -129,17 +129,20 @@
     */
     virtual void RefreshScene() = 0;
 
-    boost::shared_ptr<const ViewportController> GetController() const;
-    boost::shared_ptr<ViewportController>      GetController();
-
     /**
     enabled_ is not accessible by subclasses because there is a state machine
     that we do not wanna mess with
     */
     bool IsEnabled() const;
 
+    /**
+    Protected to allow sub-classes to use this weak pointer in factory methods
+    (pass them to created objects)
+    */
+    IViewport& viewport_;
+
+
   private:
-    boost::weak_ptr<ViewportController> controllerW_;
     bool     enabled_;
   };