Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/CreateLineMeasureCommand.cpp @ 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 | 1f877e0846fe |
children | ab81ee8fce1f |
comparison
equal
deleted
inserted
replaced
1313:f30905f5d246 | 1314:9b126de2cde2 |
---|---|
27 { | 27 { |
28 CreateLineMeasureCommand::CreateLineMeasureCommand( | 28 CreateLineMeasureCommand::CreateLineMeasureCommand( |
29 IViewport& viewport, | 29 IViewport& viewport, |
30 ScenePoint2D point) | 30 ScenePoint2D point) |
31 : CreateMeasureCommand(viewport) | 31 : CreateMeasureCommand(viewport) |
32 , measureTool_( | 32 , measureTool_(LineMeasureTool::Create(viewport)) |
33 boost::shared_ptr<LineMeasureTool>(new LineMeasureTool(viewport))) | |
34 { | 33 { |
35 | 34 |
36 std::unique_ptr<IViewport::ILock> lock(viewport_.Lock()); | 35 std::unique_ptr<IViewport::ILock> lock(viewport_.Lock()); |
37 ViewportController& controller = lock->GetController(); | 36 ViewportController& controller = lock->GetController(); |
38 controller.AddMeasureTool(measureTool_); | 37 controller.AddMeasureTool(measureTool_); |