comparison Framework/Scene2DViewport/LineMeasureTool.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
comparison
equal deleted inserted replaced
1313:f30905f5d246 1314:9b126de2cde2
36 namespace OrthancStone 36 namespace OrthancStone
37 { 37 {
38 class LineMeasureTool : public MeasureTool 38 class LineMeasureTool : public MeasureTool
39 { 39 {
40 public: 40 public:
41 LineMeasureTool(IViewport& viewport); 41 static boost::shared_ptr<LineMeasureTool> Create(IViewport& viewport);
42 42
43 ~LineMeasureTool(); 43 ~LineMeasureTool();
44 44
45 void SetStart(ScenePoint2D start); 45 void SetStart(ScenePoint2D start);
46 void SetEnd(ScenePoint2D end); 46 void SetEnd(ScenePoint2D end);
65 65
66 66
67 LineHighlightArea LineHitTest(ScenePoint2D p); 67 LineHighlightArea LineHitTest(ScenePoint2D p);
68 68
69 private: 69 private:
70 LineMeasureTool(IViewport& viewport);
71
70 virtual void RefreshScene() ORTHANC_OVERRIDE; 72 virtual void RefreshScene() ORTHANC_OVERRIDE;
71 void RemoveFromScene(); 73 void RemoveFromScene();
72 void SetLineHighlightArea(LineHighlightArea area); 74 void SetLineHighlightArea(LineHighlightArea area);
73 75
74 private: 76 private: