comparison Samples/Common/MeasureCommands.cpp @ 632:500c3f70b6c2

- Added a ClearAllChains method to PolylineSceneLayer --> revision must change when calling it ==> BumpRevision has been added to base class - Added some docs = Added GetMinDepth + GetMaxDepth to Scene2D (to alleviate the need for app- specific "Z depth registry" : clients may simply add a new layer on top or at the bottom of the existing layer set. - Added the line tracker measurement tools, commands and trackers. Generic base classes + Line measure - started work on the line measure handles
author Benjamin Golinvaux <bgo@osimis.io>
date Thu, 09 May 2019 10:41:31 +0200
parents
children 6a144a45b2d8
comparison
equal deleted inserted replaced
618:0925b27e8750 632:500c3f70b6c2
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 Scene2D& scene, MeasureToolList& measureTools)
38 : TrackerCommand(scene)
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 Scene2D& scene, MeasureToolList& measureTools, ScenePoint2D point)
52 : CreateMeasureCommand(scene, measureTools)
53 , measureTool_(new LineMeasureTool(scene))
54 {
55 measureTool_ = LineMeasureToolPtr(new LineMeasureTool(scene));
56 measureTools_.push_back(measureTool_);
57 measureTool_->Set(point, point);
58 }
59
60 void CreateLineMeasureCommand::Update(ScenePoint2D scenePos)
61 {
62 measureTool_->SetEnd(scenePos);
63 }
64
65 }