comparison Framework/Scene2DViewport/MeasureCommands.h @ 1331:ab81ee8fce1f broker

- Viewport is not passed and stored as a shared_ptr instead of raw reference. - ViewportController can now be injected with an undo stack (not a ctor param anymore, as a preparation for the move of the undo stack to an interactor) - Added (temp) flag to disable emscripten events registration in the WebAssemblyViewport (because legacy client code deals with them directly) - Added emscripten_clear_timeout in ~WebGLViewportsRegistry - Removed GenericToolbox::HoldingRef whose responsibility is better served with proper callback un-registration.
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 30 Mar 2020 14:23:46 +0200
parents a5326ce4f24b
children
comparison
equal deleted inserted replaced
1329:8d3e669f01a2 1331:ab81ee8fce1f
33 namespace OrthancStone 33 namespace OrthancStone
34 { 34 {
35 class MeasureCommand : public boost::noncopyable 35 class MeasureCommand : public boost::noncopyable
36 { 36 {
37 public: 37 public:
38 MeasureCommand(IViewport& viewport) : viewport_(viewport) 38 MeasureCommand(boost::shared_ptr<IViewport> viewport) : viewport_(viewport)
39 {} 39 {}
40 virtual void Undo() = 0; 40 virtual void Undo() = 0;
41 virtual void Redo() = 0; 41 virtual void Redo() = 0;
42 42
43 virtual ~MeasureCommand() {}; 43 virtual ~MeasureCommand() {};
44 44
45 protected: 45 protected:
46 IViewport& viewport_; 46 boost::shared_ptr<IViewport> viewport_;
47 }; 47 };
48 48
49 class CreateMeasureCommand : public MeasureCommand 49 class CreateMeasureCommand : public MeasureCommand
50 { 50 {
51 public: 51 public:
52 CreateMeasureCommand(IViewport& viewport); 52 CreateMeasureCommand(boost::shared_ptr<IViewport> viewport);
53 virtual ~CreateMeasureCommand(); 53 virtual ~CreateMeasureCommand();
54 virtual void Undo() ORTHANC_OVERRIDE; 54 virtual void Undo() ORTHANC_OVERRIDE;
55 virtual void Redo() ORTHANC_OVERRIDE; 55 virtual void Redo() ORTHANC_OVERRIDE;
56 private: 56 private:
57 /** Must be implemented by the subclasses that create the actual tool */ 57 /** Must be implemented by the subclasses that create the actual tool */
59 }; 59 };
60 60
61 class EditMeasureCommand : public MeasureCommand 61 class EditMeasureCommand : public MeasureCommand
62 { 62 {
63 public: 63 public:
64 EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, IViewport& viewport); 64 EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport);
65 virtual ~EditMeasureCommand(); 65 virtual ~EditMeasureCommand();
66 virtual void Undo() ORTHANC_OVERRIDE; 66 virtual void Undo() ORTHANC_OVERRIDE;
67 virtual void Redo() ORTHANC_OVERRIDE; 67 virtual void Redo() ORTHANC_OVERRIDE;
68 68
69 /** This memento is the original object state */ 69 /** This memento is the original object state */
80 }; 80 };
81 81
82 class DeleteMeasureCommand : public MeasureCommand 82 class DeleteMeasureCommand : public MeasureCommand
83 { 83 {
84 public: 84 public:
85 DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, IViewport& viewport); 85 DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport);
86 virtual ~DeleteMeasureCommand(); 86 virtual ~DeleteMeasureCommand();
87 virtual void Undo() ORTHANC_OVERRIDE; 87 virtual void Undo() ORTHANC_OVERRIDE;
88 virtual void Redo() ORTHANC_OVERRIDE; 88 virtual void Redo() ORTHANC_OVERRIDE;
89 89
90 /** This memento is the original object state */ 90 /** This memento is the original object state */