Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp @ 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 | 52b8b96cb55f |
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp Wed Oct 28 20:06:55 2020 +0100 +++ b/OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.cpp Wed Oct 28 20:14:34 2020 +0100 @@ -43,7 +43,7 @@ // the params in the LayerHolder ctor specify the number of polyline and text // layers AngleMeasureTool::AngleMeasureTool( - boost::shared_ptr<IViewport> viewport) + boost::weak_ptr<IViewport> viewport) : MeasureTool(viewport) #if ORTHANC_STONE_ENABLE_OUTLINED_TEXT == 1 , layerHolder_(boost::shared_ptr<LayerHolder>(new LayerHolder(viewport,1,5))) @@ -54,7 +54,7 @@ { } - boost::shared_ptr<AngleMeasureTool> AngleMeasureTool::Create(boost::shared_ptr<IViewport> viewport) + boost::shared_ptr<AngleMeasureTool> AngleMeasureTool::Create(boost::weak_ptr<IViewport> viewport) { boost::shared_ptr<AngleMeasureTool> obj(new AngleMeasureTool(viewport)); obj->MeasureTool::PostConstructor(); @@ -142,7 +142,7 @@ AngleMeasureTool::AngleHighlightArea AngleMeasureTool::AngleHitTest(ScenePoint2D p) const { - std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); + std::unique_ptr<IViewport::ILock> lock(GetViewportLock()); const ViewportController& controller = lock->GetController(); const Scene2D& scene = controller.GetScene(); @@ -202,7 +202,7 @@ boost::shared_ptr<IFlexiblePointerTracker> AngleMeasureTool::CreateEditionTracker(const PointerEvent& e) { - std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); + std::unique_ptr<IViewport::ILock> lock(GetViewportLock()); ViewportController& controller = lock->GetController(); const Scene2D& scene = controller.GetScene(); @@ -216,7 +216,7 @@ new EditLineMeasureTracker( boost::shared_ptr<LineMeasureTool> measureTool; MessageBroker & broker, - boost::shared_ptr<IViewport> viewport, + boost::weak_ptr<IViewport> viewport, const PointerEvent & e); */ @@ -235,7 +235,7 @@ { if (IsSceneAlive()) { - std::unique_ptr<IViewport::ILock> lock(viewport_->Lock()); + std::unique_ptr<IViewport::ILock> lock(GetViewportLock()); ViewportController& controller = lock->GetController(); Scene2D& scene = controller.GetScene();