Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureTool.cpp @ 818:e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
directives to make usage more explicit, too.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 29 May 2019 10:51:28 +0200 |
parents | 66ac7a2d1e3a |
children | 0aff28f15ea2 |
comparison
equal
deleted
inserted
replaced
817:68f888812af4 | 818:e42b491f1fb2 |
---|---|
49 { | 49 { |
50 return enabled_; | 50 return enabled_; |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 ViewportControllerConstPtr MeasureTool::GetController() const | 54 boost::shared_ptr<const ViewportController> MeasureTool::GetController() const |
55 { | 55 { |
56 ViewportControllerConstPtr controller = controllerW_.lock(); | 56 boost::shared_ptr<const ViewportController> controller = controllerW_.lock(); |
57 if (!controller) | 57 if (!controller) |
58 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, | 58 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
59 "Using dead ViewportController object!"); | 59 "Using dead ViewportController object!"); |
60 return controller; | 60 return controller; |
61 } | 61 } |
62 | 62 |
63 ViewportControllerPtr MeasureTool::GetController() | 63 boost::shared_ptr<ViewportController> MeasureTool::GetController() |
64 { | 64 { |
65 #if 1 | 65 #if 1 |
66 return boost::const_pointer_cast<ViewportController> | 66 return boost::const_pointer_cast<ViewportController> |
67 (const_cast<const MeasureTool*>(this)->GetController()); | 67 (const_cast<const MeasureTool*>(this)->GetController()); |
68 //return boost::const_<ViewportControllerPtr> | 68 //return boost::const_<boost::shared_ptr<ViewportController>> |
69 // (const_cast<const MeasureTool*>(this)->GetController()); | 69 // (const_cast<const MeasureTool*>(this)->GetController()); |
70 #else | 70 #else |
71 ViewportControllerPtr controller = controllerW_.lock(); | 71 boost::shared_ptr<ViewportController> controller = controllerW_.lock(); |
72 if (!controller) | 72 if (!controller) |
73 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, | 73 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError, |
74 "Using dead ViewportController object!"); | 74 "Using dead ViewportController object!"); |
75 return controller; | 75 return controller; |
76 #endif | 76 #endif |
77 } | 77 } |
78 | 78 |
79 Scene2DPtr MeasureTool::GetScene() | 79 boost::shared_ptr<Scene2D> MeasureTool::GetScene() |
80 { | 80 { |
81 return GetController()->GetScene(); | 81 return GetController()->GetScene(); |
82 } | 82 } |
83 | 83 |
84 Scene2DConstPtr MeasureTool::GetScene() const | 84 boost::shared_ptr<const Scene2D> MeasureTool::GetScene() const |
85 { | 85 { |
86 return GetController()->GetScene(); | 86 return GetController()->GetScene(); |
87 } | 87 } |
88 | 88 |
89 MeasureTool::MeasureTool(MessageBroker& broker, | 89 MeasureTool::MeasureTool(MessageBroker& broker, |
90 ViewportControllerWPtr controllerW) | 90 boost::weak_ptr<ViewportController> controllerW) |
91 : IObserver(broker) | 91 : IObserver(broker) |
92 , controllerW_(controllerW) | 92 , controllerW_(controllerW) |
93 , enabled_(true) | 93 , enabled_(true) |
94 { | 94 { |
95 GetController()->RegisterObserverCallback( | 95 GetController()->RegisterObserverCallback( |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 bool MeasureTool::IsSceneAlive() const | 101 bool MeasureTool::IsSceneAlive() const |
102 { | 102 { |
103 ViewportControllerPtr controller = controllerW_.lock(); | 103 boost::shared_ptr<ViewportController> controller = controllerW_.lock(); |
104 return (controller.get() != NULL); | 104 return (controller.get() != NULL); |
105 } | 105 } |
106 | 106 |
107 void MeasureTool::OnSceneTransformChanged( | 107 void MeasureTool::OnSceneTransformChanged( |
108 const ViewportController::SceneTransformChanged& message) | 108 const ViewportController::SceneTransformChanged& message) |