diff Framework/Scene2DViewport/AngleMeasureTool.h @ 1314:9b126de2cde2 broker

Since the observer system now uses shared_ptr and many registrations are done in the constructors, and since we cannot called shared_from_this() in the constructors, it is mandatory to split construction from registration. This has been done by making many ctors protected and replacing them by factory methods that directly return shared_ptrs + added PostConstructor method when base classes perform shared_from_this() calls too.
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 16 Mar 2020 11:19:50 +0100
parents a5326ce4f24b
children ab81ee8fce1f
line wrap: on
line diff
--- a/Framework/Scene2DViewport/AngleMeasureTool.h	Mon Mar 16 11:12:39 2020 +0100
+++ b/Framework/Scene2DViewport/AngleMeasureTool.h	Mon Mar 16 11:19:50 2020 +0100
@@ -40,7 +40,7 @@
   class AngleMeasureTool : public MeasureTool
   {
   public:
-    AngleMeasureTool(IViewport& viewport);
+    static boost::shared_ptr<AngleMeasureTool> Create(IViewport& viewport);
 
     ~AngleMeasureTool();
 
@@ -70,6 +70,8 @@
     AngleHighlightArea AngleHitTest(ScenePoint2D p) const;
 
   private:
+    AngleMeasureTool(IViewport& viewport);
+
     virtual void        RefreshScene() ORTHANC_OVERRIDE;
     void                RemoveFromScene();
     void                SetAngleHighlightArea(AngleHighlightArea area);