Fraxinus  16.5.0-fx-rc3
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxDummyToolManager.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 
34 #include "cxDummyToolManager.h"
35 
36 namespace cx
37 {
38 
40 {
41  DummyToolManagerPtr retval;
42  retval.reset(new DummyToolManager());
43  return retval;
44 }
45 
46 DummyToolManager::DummyToolManager() :
47  m_rMpr(Transform3D::Identity()),
48 // mToolTipOffset(0),
49 // mConfigured(false),
50 // mInitialized(false),
51 // mIsTracking(false),
52  mState(Tool::tsNONE)
53 {
54  DummyToolPtr tool1(new DummyTool());
55 
56  mActiveTool = tool1;
57  mReferenceTool = tool1;
58 
59  mDummyTools.insert(std::pair<QString, DummyToolPtr>(tool1->getUid(), tool1));
60 }
62 {}
63 
65 {
66  return mState;
67 }
68 
70 {
71  if (val==mState)
72  return;
73 
74  if (val==Tool::tsTRACKING)
75  this->startTracking();
76  else if (mState==Tool::tsTRACKING)
77  this->stopTracking();
78 
79  mState = val;
80  emit stateChanged();
81 }
82 
83 void DummyToolManager::startTracking()
84 {
85  DummyToolMapConstIter it = mDummyTools.begin();
86  while(it != mDummyTools.end())
87  {
88  ((*it).second)->startTracking();
89  ++it;
90  }
91 
92 }
93 
94 void DummyToolManager::stopTracking()
95 {
96  DummyToolMapConstIter it = mDummyTools.begin();
97  while(it != mDummyTools.end())
98  {
99  ((*it).second)->stopTracking();
100  ++it;
101  }
102 }
103 
105 {
106  return TrackingService::ToolMap(mDummyTools.begin(), mDummyTools.end());
107 }
108 
110 {
111  DummyToolMapConstIter it = mDummyTools.find(uid);
112  return (*it).second;
113 }
114 
116 {
117  return mActiveTool;
118 }
119 void DummyToolManager::setActiveTool(const QString& uid)
120 {
121  DummyToolMapConstIter it = mDummyTools.find(uid);
122  mActiveTool = (*it).second;
123  emit activeToolChanged(uid);
124 }
125 
127 {
128  return m_rMpr;
129 }
130 
132 {
133  m_rMpr = val;
134 }
135 
137 {
138  return mReferenceTool;
139 }
140 
142 {
143  mDummyTools.insert(std::make_pair(tool->getUid(), tool));
144 }
145 
146 //void DummyToolManager::setTooltipOffset(double offset)
147 //{
148 // if (similar(offset, mToolTipOffset))
149 // return;
150 // mToolTipOffset = offset;
151 // emit tooltipOffset(mToolTipOffset);
152 //}
153 //double DummyToolManager::getTooltipOffset() const
154 //{
155 // return mToolTipOffset;
156 //}
157 
159 {
160 
161 }
162 
164 {
165 
166 }
167 
168 std::vector<TrackingSystemServicePtr> DummyToolManager::getTrackingSystems()
169 {
170  return std::vector<TrackingSystemServicePtr> ();
171 }
172 
173 
174 } //namespace cx
boost::shared_ptr< DummyToolManager > DummyToolManagerPtr
tsNONE
Not specified.
virtual ToolPtr getReferenceTool() const
tool used as patient reference
Interface to a tool, i.e. a pointer, US probe or similar.
Definition: cxTool.h:82
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual ToolPtr getActiveTool()
get the tool that has higest priority when tracking
void addTool(DummyToolPtr tool)
virtual void setActiveTool(const QString &uid)
set a tool to be the active tool
virtual void unInstallTrackingSystem(TrackingSystemServicePtr system)
boost::shared_ptr< class DummyTool > DummyToolPtr
void activeToolChanged(const QString &uId)
virtual ToolMap getTools()
get configured and initialized tools
virtual Transform3D get_rMpr() const
virtual void installTrackingSystem(TrackingSystemServicePtr system)
virtual Tool::State getState() const
Implementation of a Tool used for testing.
Definition: cxDummyTool.h:170
std::map< QString, ToolPtr > ToolMap
virtual void set_rMpr(const Transform3D &val)
virtual std::vector< TrackingSystemServicePtr > getTrackingSystems()
Implementation of a ToolManager used for testing.
emitting tracking data
Definition: cxTool.h:98
virtual ToolPtr getTool(const QString &uid)
get a tool
static DummyToolManagerPtr create()
virtual void setState(const Tool::State val)
boost::shared_ptr< class Tool > ToolPtr
boost::shared_ptr< class TrackingSystemService > TrackingSystemServicePtr