Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/LayerHolder.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 | 712ff6ff3c19 |
children | 0aff28f15ea2 |
comparison
equal
deleted
inserted
replaced
817:68f888812af4 | 818:e42b491f1fb2 |
---|---|
23 #include "../Scene2D/PolylineSceneLayer.h" | 23 #include "../Scene2D/PolylineSceneLayer.h" |
24 #include "../Scene2D/Scene2D.h" | 24 #include "../Scene2D/Scene2D.h" |
25 #include "../Scene2DViewport/ViewportController.h" | 25 #include "../Scene2DViewport/ViewportController.h" |
26 #include "../StoneException.h" | 26 #include "../StoneException.h" |
27 | 27 |
28 using namespace Orthanc; | |
29 | |
30 namespace OrthancStone | 28 namespace OrthancStone |
31 { | 29 { |
32 LayerHolder::LayerHolder( | 30 LayerHolder::LayerHolder( |
33 ViewportControllerWPtr controllerW, | 31 boost::weak_ptr<ViewportController> controllerW, |
34 int polylineLayerCount, | 32 int polylineLayerCount, |
35 int textLayerCount) | 33 int textLayerCount) |
36 : textLayerCount_(textLayerCount) | 34 : textLayerCount_(textLayerCount) |
37 , polylineLayerCount_(polylineLayerCount) | 35 , polylineLayerCount_(polylineLayerCount) |
38 , controllerW_(controllerW) | 36 , controllerW_(controllerW) |
72 bool LayerHolder::AreLayersCreated() const | 70 bool LayerHolder::AreLayersCreated() const |
73 { | 71 { |
74 return (baseLayerIndex_ != -1); | 72 return (baseLayerIndex_ != -1); |
75 } | 73 } |
76 | 74 |
77 OrthancStone::Scene2DPtr LayerHolder::GetScene() | 75 boost::shared_ptr<Scene2D> LayerHolder::GetScene() |
78 { | 76 { |
79 ViewportControllerPtr controller = controllerW_.lock(); | 77 boost::shared_ptr<ViewportController> controller = controllerW_.lock(); |
80 ORTHANC_ASSERT(controller.get() != 0, "Zombie attack!"); | 78 ORTHANC_ASSERT(controller.get() != 0, "Zombie attack!"); |
81 return controller->GetScene(); | 79 return controller->GetScene(); |
82 } | 80 } |
83 | 81 |
84 void LayerHolder::DeleteLayers() | 82 void LayerHolder::DeleteLayers() |
91 baseLayerIndex_ = -1; | 89 baseLayerIndex_ = -1; |
92 } | 90 } |
93 | 91 |
94 PolylineSceneLayer* LayerHolder::GetPolylineLayer(int index /*= 0*/) | 92 PolylineSceneLayer* LayerHolder::GetPolylineLayer(int index /*= 0*/) |
95 { | 93 { |
94 using namespace Orthanc; | |
96 ORTHANC_ASSERT(baseLayerIndex_ != -1); | 95 ORTHANC_ASSERT(baseLayerIndex_ != -1); |
97 ORTHANC_ASSERT(GetScene()->HasLayer(GetPolylineLayerIndex(index))); | 96 ORTHANC_ASSERT(GetScene()->HasLayer(GetPolylineLayerIndex(index))); |
98 ISceneLayer* layer = | 97 ISceneLayer* layer = |
99 &(GetScene()->GetLayer(GetPolylineLayerIndex(index))); | 98 &(GetScene()->GetLayer(GetPolylineLayerIndex(index))); |
100 | 99 |
105 return concreteLayer; | 104 return concreteLayer; |
106 } | 105 } |
107 | 106 |
108 TextSceneLayer* LayerHolder::GetTextLayer(int index /*= 0*/) | 107 TextSceneLayer* LayerHolder::GetTextLayer(int index /*= 0*/) |
109 { | 108 { |
109 using namespace Orthanc; | |
110 ORTHANC_ASSERT(baseLayerIndex_ != -1); | 110 ORTHANC_ASSERT(baseLayerIndex_ != -1); |
111 ORTHANC_ASSERT(GetScene()->HasLayer(GetTextLayerIndex(index))); | 111 ORTHANC_ASSERT(GetScene()->HasLayer(GetTextLayerIndex(index))); |
112 ISceneLayer* layer = | 112 ISceneLayer* layer = |
113 &(GetScene()->GetLayer(GetTextLayerIndex(index))); | 113 &(GetScene()->GetLayer(GetTextLayerIndex(index))); |
114 | 114 |
119 return concreteLayer; | 119 return concreteLayer; |
120 } | 120 } |
121 | 121 |
122 int LayerHolder::GetPolylineLayerIndex(int index /*= 0*/) | 122 int LayerHolder::GetPolylineLayerIndex(int index /*= 0*/) |
123 { | 123 { |
124 using namespace Orthanc; | |
124 ORTHANC_ASSERT(index < polylineLayerCount_); | 125 ORTHANC_ASSERT(index < polylineLayerCount_); |
125 return baseLayerIndex_ + index; | 126 return baseLayerIndex_ + index; |
126 } | 127 } |
127 | 128 |
128 | 129 |
129 int LayerHolder::GetTextLayerIndex(int index /*= 0*/) | 130 int LayerHolder::GetTextLayerIndex(int index /*= 0*/) |
130 { | 131 { |
132 using namespace Orthanc; | |
131 ORTHANC_ASSERT(index < textLayerCount_); | 133 ORTHANC_ASSERT(index < textLayerCount_); |
132 | 134 |
133 // the text layers are placed right after the polyline layers | 135 // the text layers are placed right after the polyline layers |
134 // this means they are drawn ON TOP | 136 // this means they are drawn ON TOP |
135 return baseLayerIndex_ + polylineLayerCount_ + index; | 137 return baseLayerIndex_ + polylineLayerCount_ + index; |