comparison Framework/Scene2DViewport/MeasureTrackers.cpp @ 728:8190213e2279 am-dev

Merged default into am-dev
author Alain Mazy <am@osimis.io>
date Tue, 21 May 2019 13:25:58 +0200
parents 28b9e3a54200
children 8e31b174ab26
comparison
equal deleted inserted replaced
690:f185cfcb72a0 728:8190213e2279
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 "MeasureTrackers.h"
22 #include <Core/OrthancException.h>
23
24 using namespace Orthanc;
25
26 namespace OrthancStone
27 {
28
29 CreateMeasureTracker::CreateMeasureTracker(ViewportControllerWPtr controllerW)
30 : controllerW_(controllerW)
31 , alive_(true)
32 , commitResult_(true)
33 {
34 }
35
36 void CreateMeasureTracker::Cancel()
37 {
38 commitResult_ = false;
39 alive_ = false;
40 }
41
42 bool CreateMeasureTracker::IsAlive() const
43 {
44 return alive_;
45 }
46
47 CreateMeasureTracker::~CreateMeasureTracker()
48 {
49 // if the tracker completes successfully, we add the command
50 // to the undo stack
51
52 // otherwise, we simply undo it
53 if (commitResult_)
54 controllerW_.lock()->PushCommand(command_);
55 else
56 command_->Undo();
57 }
58
59 OrthancStone::Scene2DPtr CreateMeasureTracker::GetScene()
60 {
61 return controllerW_.lock()->GetScene();
62 }
63
64 }
65
66