comparison Framework/Scene2DViewport/MeasureCommands.h @ 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 c71ef52602a0
comparison
equal deleted inserted replaced
817:68f888812af4 818:e42b491f1fb2
20 #pragma once 20 #pragma once
21 21
22 #include "../Scene2D/Scene2D.h" 22 #include "../Scene2D/Scene2D.h"
23 23
24 // to be moved into Stone 24 // to be moved into Stone
25 #include "PointerTypes.h" 25 #include "PredeclaredTypes.h"
26 #include "MeasureTool.h" 26 #include "MeasureTool.h"
27 #include "LineMeasureTool.h" 27 #include "LineMeasureTool.h"
28 #include "AngleMeasureTool.h" 28 #include "AngleMeasureTool.h"
29 29
30 #include <boost/shared_ptr.hpp> 30 #include <boost/shared_ptr.hpp>
33 namespace OrthancStone 33 namespace OrthancStone
34 { 34 {
35 class TrackerCommand : public boost::noncopyable 35 class TrackerCommand : public boost::noncopyable
36 { 36 {
37 public: 37 public:
38 TrackerCommand(ViewportControllerWPtr controllerW) 38 TrackerCommand(boost::weak_ptr<ViewportController> controllerW)
39 : controllerW_(controllerW) 39 : controllerW_(controllerW)
40 { 40 {
41 41
42 } 42 }
43 virtual void Undo() = 0; 43 virtual void Undo() = 0;
44 virtual void Redo() = 0; 44 virtual void Redo() = 0;
45 45
46 protected: 46 protected:
47 ViewportControllerPtr GetController(); 47 boost::shared_ptr<ViewportController> GetController();
48 ViewportControllerWPtr controllerW_; 48 boost::weak_ptr<ViewportController> controllerW_;
49 }; 49 };
50 50
51 class CreateMeasureCommand : public TrackerCommand 51 class CreateMeasureCommand : public TrackerCommand
52 { 52 {
53 public: 53 public:
54 CreateMeasureCommand(ViewportControllerWPtr controllerW); 54 CreateMeasureCommand(boost::weak_ptr<ViewportController> controllerW);
55 ~CreateMeasureCommand(); 55 ~CreateMeasureCommand();
56 virtual void Undo() ORTHANC_OVERRIDE; 56 virtual void Undo() ORTHANC_OVERRIDE;
57 virtual void Redo() ORTHANC_OVERRIDE; 57 virtual void Redo() ORTHANC_OVERRIDE;
58 private: 58 private:
59 /** Must be implemented by the subclasses that create the actual tool */ 59 /** Must be implemented by the subclasses that create the actual tool */
60 virtual MeasureToolPtr GetMeasureTool() = 0; 60 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() = 0;
61 }; 61 };
62 62
63 class CreateLineMeasureCommand : public CreateMeasureCommand 63 class CreateLineMeasureCommand : public CreateMeasureCommand
64 { 64 {
65 public: 65 public:
66 CreateLineMeasureCommand( 66 CreateLineMeasureCommand(
67 MessageBroker& broker, 67 MessageBroker& broker,
68 ViewportControllerWPtr controllerW, 68 boost::weak_ptr<ViewportController> controllerW,
69 ScenePoint2D point); 69 ScenePoint2D point);
70 70
71 // the starting position is set in the ctor 71 // the starting position is set in the ctor
72 void SetEnd(ScenePoint2D scenePos); 72 void SetEnd(ScenePoint2D scenePos);
73 73
74 private: 74 private:
75 virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE 75 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() ORTHANC_OVERRIDE
76 { 76 {
77 return measureTool_; 77 return measureTool_;
78 } 78 }
79 LineMeasureToolPtr measureTool_; 79 boost::shared_ptr<LineMeasureTool> measureTool_;
80 }; 80 };
81 81
82 82
83 class CreateAngleMeasureCommand : public CreateMeasureCommand 83 class CreateAngleMeasureCommand : public CreateMeasureCommand
84 { 84 {
85 public: 85 public:
86 /** Ctor sets end of side 1*/ 86 /** Ctor sets end of side 1*/
87 CreateAngleMeasureCommand( 87 CreateAngleMeasureCommand(
88 MessageBroker& broker, 88 MessageBroker& broker,
89 ViewportControllerWPtr controllerW, 89 boost::weak_ptr<ViewportController> controllerW,
90 ScenePoint2D point); 90 ScenePoint2D point);
91 91
92 /** This method sets center*/ 92 /** This method sets center*/
93 void SetCenter(ScenePoint2D scenePos); 93 void SetCenter(ScenePoint2D scenePos);
94 94
95 /** This method sets end of side 2*/ 95 /** This method sets end of side 2*/
96 void SetSide2End(ScenePoint2D scenePos); 96 void SetSide2End(ScenePoint2D scenePos);
97 97
98 private: 98 private:
99 virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE 99 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() ORTHANC_OVERRIDE
100 { 100 {
101 return measureTool_; 101 return measureTool_;
102 } 102 }
103 AngleMeasureToolPtr measureTool_; 103 boost::shared_ptr<AngleMeasureTool> measureTool_;
104 }; 104 };
105 105
106 } 106 }
107 107