comparison OrthancStone/Sources/Scene2DViewport/MeasureTool.h @ 1606:874e178f34e9

- ViewportController now has weak ptr to Viewport - Measuring tools + related commands and all trackers now store only a weak_ptr to the Viewport and lock() on demand for usage - LayerHolder and FixedPoint aligner store only a weak_ptr to the Viewport, too - Fixed float/double warning in GrayscaleWindowingSceneTracker
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 28 Oct 2020 20:14:34 +0100
parents 8563ea5d8ae4
children 9ac2a65d4172
comparison
equal deleted inserted replaced
1605:b3c439d96d3e 1606:874e178f34e9
44 private: 44 private:
45 bool enabled_; 45 bool enabled_;
46 46
47 47
48 protected: 48 protected:
49 explicit MeasureTool(boost::shared_ptr<IViewport> viewport); 49 explicit MeasureTool(boost::weak_ptr<IViewport> viewport);
50 50
51 void PostConstructor(); 51 void PostConstructor();
52 52
53 /** 53 /**
54 The measuring tool may exist in a standalone fashion, without any available 54 The measuring tool may exist in a standalone fashion, without any available
72 72
73 /** 73 /**
74 Protected to allow sub-classes to use this weak pointer in factory methods 74 Protected to allow sub-classes to use this weak pointer in factory methods
75 (pass them to created objects) 75 (pass them to created objects)
76 */ 76 */
77 boost::shared_ptr<IViewport> viewport_; 77 boost::weak_ptr<IViewport> viewport_;
78 78
79 /**
80 This will return a scoped lock to the viewport.
81 If the viewport does not exist anymore, then nullptr is returned.
82 */
83 IViewport::ILock* GetViewportLock();
84 IViewport::ILock* GetViewportLock() const;
79 85
80 public: 86 public:
81 virtual ~MeasureTool() 87 virtual ~MeasureTool()
82 { 88 {
83 } 89 }