comparison OrthancStone/Sources/Scene2DViewport/MeasureTrackers.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
40 private: 40 private:
41 bool commitResult_; 41 bool commitResult_;
42 42
43 protected: 43 protected:
44 boost::shared_ptr<CreateMeasureCommand> command_; 44 boost::shared_ptr<CreateMeasureCommand> command_;
45 boost::shared_ptr<IViewport> viewport_; 45 boost::weak_ptr<IViewport> viewport_;
46 bool alive_; 46 bool alive_;
47 47
48 explicit CreateMeasureTracker(boost::shared_ptr<IViewport> viewport); 48 /**
49 This will return a scoped lock to the viewport.
50 If the viewport does not exist anymore, then nullptr is returned.
51 */
52 IViewport::ILock* GetViewportLock();
53
54 explicit CreateMeasureTracker(boost::weak_ptr<IViewport> viewport);
49 55
50 virtual ~CreateMeasureTracker(); 56 virtual ~CreateMeasureTracker();
51 57
52 public: 58 public:
53 virtual void Cancel() ORTHANC_OVERRIDE; 59 virtual void Cancel() ORTHANC_OVERRIDE;
62 ScenePoint2D originalClickPosition_; 68 ScenePoint2D originalClickPosition_;
63 bool commitResult_; 69 bool commitResult_;
64 70
65 protected: 71 protected:
66 boost::shared_ptr<EditMeasureCommand> command_; 72 boost::shared_ptr<EditMeasureCommand> command_;
67 boost::shared_ptr<IViewport> viewport_; 73 boost::weak_ptr<IViewport> viewport_;
68 bool alive_; 74 bool alive_;
69 75
70 EditMeasureTracker(boost::shared_ptr<IViewport> viewport, 76 /**
77 This will return a scoped lock to the viewport.
78 If the viewport does not exist anymore, then nullptr is returned.
79 */
80 IViewport::ILock* GetViewportLock();
81
82 EditMeasureTracker(boost::weak_ptr<IViewport> viewport,
71 const PointerEvent& e); 83 const PointerEvent& e);
72 84
73 ~EditMeasureTracker(); 85 ~EditMeasureTracker();
74 86
75 ScenePoint2D GetOriginalClickPosition() const 87 ScenePoint2D GetOriginalClickPosition() const