comparison Framework/Scene2DViewport/LineMeasureTool.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 3d26447ddd28
children ab81ee8fce1f
comparison
equal deleted inserted replaced
1313:f30905f5d246 1314:9b126de2cde2
42 , lineHighlightArea_(LineHighlightArea_None) 42 , lineHighlightArea_(LineHighlightArea_None)
43 { 43 {
44 44
45 } 45 }
46 46
47 boost::shared_ptr<LineMeasureTool> LineMeasureTool::Create(IViewport& viewport)
48 {
49 boost::shared_ptr<LineMeasureTool> obj(new LineMeasureTool(viewport));
50 obj->MeasureTool::PostConstructor();
51 obj->RefreshScene();
52 return obj;
53 }
54
47 LineMeasureTool::~LineMeasureTool() 55 LineMeasureTool::~LineMeasureTool()
48 { 56 {
49 // this measuring tool is a RABI for the corresponding visual layers 57 // this measuring tool is a RABI for the corresponding visual layers
50 // stored in the 2D scene 58 // stored in the 2D scene
51 Disable(); 59 Disable();