Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureCommands.cpp @ 698:8b6adfb62a2f refactor-viewport-controller
Code is broken -- stashing ongoing work in a branch
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 15 May 2019 16:56:17 +0200 |
parents | |
children | 059e1fd05fd6 |
comparison
equal
deleted
inserted
replaced
660:cb3b76d16234 | 698:8b6adfb62a2f |
---|---|
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-2019 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 | |
21 #include "MeasureCommands.h" | |
22 | |
23 namespace OrthancStone | |
24 { | |
25 void CreateMeasureCommand::Undo() | |
26 { | |
27 // simply disable the measure tool upon undo | |
28 GetMeasureTool()->Disable(); | |
29 } | |
30 | |
31 void CreateMeasureCommand::Redo() | |
32 { | |
33 GetMeasureTool()->Enable(); | |
34 } | |
35 | |
36 CreateMeasureCommand::CreateMeasureCommand( | |
37 Scene2DWPtr sceneW, MeasureToolList& measureTools) | |
38 : TrackerCommand(sceneW) | |
39 , measureTools_(measureTools) | |
40 { | |
41 | |
42 } | |
43 | |
44 CreateMeasureCommand::~CreateMeasureCommand() | |
45 { | |
46 // deleting the command should not change the model state | |
47 // we thus leave it as is | |
48 } | |
49 | |
50 CreateLineMeasureCommand::CreateLineMeasureCommand( | |
51 MessageBroker& broker, | |
52 Scene2DWPtr sceneW, | |
53 MeasureToolList& measureTools, | |
54 ScenePoint2D point) | |
55 : CreateMeasureCommand(sceneW, measureTools) | |
56 , measureTool_(new LineMeasureTool(broker,sceneW)) | |
57 { | |
58 measureTools_.push_back(measureTool_); | |
59 measureTool_->Set(point, point); | |
60 } | |
61 | |
62 void CreateLineMeasureCommand::SetEnd(ScenePoint2D scenePos) | |
63 { | |
64 measureTool_->SetEnd(scenePos); | |
65 } | |
66 | |
67 CreateAngleMeasureCommand::CreateAngleMeasureCommand( | |
68 MessageBroker& broker, | |
69 Scene2DWPtr sceneW, | |
70 MeasureToolList& measureTools, | |
71 ScenePoint2D point) | |
72 : CreateMeasureCommand(sceneW, measureTools) | |
73 , measureTool_(new AngleMeasureTool(broker,sceneW)) | |
74 { | |
75 measureTools_.push_back(measureTool_); | |
76 measureTool_->SetSide1End(point); | |
77 measureTool_->SetCenter(point); | |
78 measureTool_->SetSide2End(point); | |
79 } | |
80 | |
81 /** This method sets center*/ | |
82 void CreateAngleMeasureCommand::SetCenter(ScenePoint2D scenePos) | |
83 { | |
84 measureTool_->SetCenter(scenePos); | |
85 } | |
86 | |
87 /** This method sets end of side 2*/ | |
88 void CreateAngleMeasureCommand::SetSide2End(ScenePoint2D scenePos) | |
89 { | |
90 measureTool_->SetSide2End(scenePos); | |
91 } | |
92 | |
93 } |