comparison OrthancStone/Sources/Scene2DViewport/MeasureCommands.h @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Framework/Scene2DViewport/MeasureCommands.h@ab81ee8fce1f
children 85e117739eca
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20 #pragma once
21
22 #include "../Viewport/IViewport.h"
23
24 // to be moved into Stone
25 #include "PredeclaredTypes.h"
26 #include "MeasureTool.h"
27 #include "LineMeasureTool.h"
28 #include "AngleMeasureTool.h"
29
30 #include <boost/shared_ptr.hpp>
31 #include <boost/noncopyable.hpp>
32
33 namespace OrthancStone
34 {
35 class MeasureCommand : public boost::noncopyable
36 {
37 public:
38 MeasureCommand(boost::shared_ptr<IViewport> viewport) : viewport_(viewport)
39 {}
40 virtual void Undo() = 0;
41 virtual void Redo() = 0;
42
43 virtual ~MeasureCommand() {};
44
45 protected:
46 boost::shared_ptr<IViewport> viewport_;
47 };
48
49 class CreateMeasureCommand : public MeasureCommand
50 {
51 public:
52 CreateMeasureCommand(boost::shared_ptr<IViewport> viewport);
53 virtual ~CreateMeasureCommand();
54 virtual void Undo() ORTHANC_OVERRIDE;
55 virtual void Redo() ORTHANC_OVERRIDE;
56 private:
57 /** Must be implemented by the subclasses that create the actual tool */
58 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() = 0;
59 };
60
61 class EditMeasureCommand : public MeasureCommand
62 {
63 public:
64 EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport);
65 virtual ~EditMeasureCommand();
66 virtual void Undo() ORTHANC_OVERRIDE;
67 virtual void Redo() ORTHANC_OVERRIDE;
68
69 /** This memento is the original object state */
70 boost::shared_ptr<MeasureToolMemento> mementoOriginal_;
71
72 private:
73 /** Must be implemented by the subclasses that edit the actual tool */
74 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() = 0;
75
76 protected:
77
78 /** This memento is updated by the subclasses upon modifications */
79 boost::shared_ptr<MeasureToolMemento> mementoModified_;
80 };
81
82 class DeleteMeasureCommand : public MeasureCommand
83 {
84 public:
85 DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::shared_ptr<IViewport> viewport);
86 virtual ~DeleteMeasureCommand();
87 virtual void Undo() ORTHANC_OVERRIDE;
88 virtual void Redo() ORTHANC_OVERRIDE;
89
90 /** This memento is the original object state */
91 boost::shared_ptr<MeasureToolMemento> mementoOriginal_;
92
93 private:
94 /** Must be implemented by the subclasses that edit the actual tool */
95 virtual boost::shared_ptr<MeasureTool> GetMeasureTool()
96 {
97 return measureTool_;
98 }
99
100 boost::shared_ptr<MeasureTool> measureTool_;
101
102 protected:
103
104 /** This memento is updated by the subclasses upon modifications */
105 boost::shared_ptr<MeasureToolMemento> mementoModified_;
106 };
107 }
108