CustusX  2023.01.05-dev+develop.0da12
An IGT application
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) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 #include "cxDummyToolManager.h"
14 
15 namespace cx
16 {
17 
19 {
20  DummyToolManagerPtr retval;
21  retval.reset(new DummyToolManager());
22  return retval;
23 }
24 
25 DummyToolManager::DummyToolManager() :
26  m_rMpr(Transform3D::Identity()),
27 // mToolTipOffset(0),
28 // mConfigured(false),
29 // mInitialized(false),
30 // mIsTracking(false),
31  mState(Tool::tsNONE)
32 {
33  DummyToolPtr tool1(new DummyTool());
34 
35  mActiveTool = tool1;
36  mReferenceTool = tool1;
37 
38  mDummyTools.insert(std::pair<QString, DummyToolPtr>(tool1->getUid(), tool1));
39 }
41 {}
42 
44 {
45  return mState;
46 }
47 
49 {
50  if (val==mState)
51  return;
52 
53  if (val==Tool::tsTRACKING)
54  this->startTracking();
55  else if (mState==Tool::tsTRACKING)
56  this->stopTracking();
57 
58  mState = val;
59  emit stateChanged();
60 }
61 
62 void DummyToolManager::startTracking()
63 {
64  DummyToolMapConstIter it = mDummyTools.begin();
65  while(it != mDummyTools.end())
66  {
67  ((*it).second)->startTracking();
68  ++it;
69  }
70 
71 }
72 
73 void DummyToolManager::stopTracking()
74 {
75  DummyToolMapConstIter it = mDummyTools.begin();
76  while(it != mDummyTools.end())
77  {
78  ((*it).second)->stopTracking();
79  ++it;
80  }
81 }
82 
84 {
85  return TrackingService::ToolMap(mDummyTools.begin(), mDummyTools.end());
86 }
87 
89 {
90  DummyToolMapConstIter it = mDummyTools.find(uid);
91  return (*it).second;
92 }
93 
95 {
96  return mActiveTool;
97 }
98 void DummyToolManager::setActiveTool(const QString& uid)
99 {
100  DummyToolMapConstIter it = mDummyTools.find(uid);
101  mActiveTool = (*it).second;
102  emit activeToolChanged(uid);
103 }
104 
106 {
107  mActiveTool = DummyToolPtr();
108 }
109 
111 {
112  return m_rMpr;
113 }
114 
116 {
117  m_rMpr = val;
118 }
119 
121 {
122  return mReferenceTool;
123 }
124 
126 {
127  mDummyTools.insert(std::make_pair(tool->getUid(), tool));
128 }
129 
130 //void DummyToolManager::setTooltipOffset(double offset)
131 //{
132 // if (similar(offset, mToolTipOffset))
133 // return;
134 // mToolTipOffset = offset;
135 // emit tooltipOffset(mToolTipOffset);
136 //}
137 //double DummyToolManager::getTooltipOffset() const
138 //{
139 // return mToolTipOffset;
140 //}
141 
143 {
144 
145 }
146 
148 {
149 
150 }
151 
152 std::vector<TrackingSystemServicePtr> DummyToolManager::getTrackingSystems()
153 {
154  return std::vector<TrackingSystemServicePtr> ();
155 }
156 
158 {
159 }
160 
161 std::vector<TrackerConfigurationPtr> DummyToolManager::getConfigurations()
162 {
163  std::vector<TrackerConfigurationPtr> retval;
164  retval.push_back(TrackerConfigurationPtr());
165  return retval;
166 }
167 
168 /*TrackerConfigurationPtr DummyToolManager::getConfiguration(QString trackingSystemImplementation)
169 {
170  return TrackerConfigurationPtr();
171 }*/
172 
174 {
175  return TrackerConfigurationPtr();
176 }
177 
178 void DummyToolManager::setCurrentTrackingSystemImplementation(QString trackingSystemImplementation)
179 {
180 }
181 
183 {
184  return QString();
185 }
186 
187 } //namespace cx
virtual void clearActiveTool()
Deselect active tool.
boost::shared_ptr< DummyToolManager > DummyToolManagerPtr
virtual ToolPtr getReferenceTool() const
tool used as patient reference
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual ToolPtr getActiveTool()
get the tool that has higest priority when tracking
virtual QString getCurrentTrackingSystemImplementation()
void addTool(DummyToolPtr tool)
virtual std::vector< TrackerConfigurationPtr > getConfigurations()
virtual void setActiveTool(const QString &uid)
set a tool to be the active tool
virtual void unInstallTrackingSystem(TrackingSystemServicePtr system)
virtual TrackerConfigurationPtr getConfiguration()
boost::shared_ptr< class DummyTool > DummyToolPtr
boost::shared_ptr< class TrackerConfiguration > TrackerConfigurationPtr
void activeToolChanged(const QString &uId)
virtual ToolMap getTools()
get configured and initialized tools
virtual Transform3D get_rMpr() const
virtual void installTrackingSystem(TrackingSystemServicePtr system)
not available
Definition: cxTool.h:74
virtual Tool::State getState() const
Implementation of a Tool used for testing.
Definition: cxDummyTool.h:149
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:77
virtual ToolPtr getTool(const QString &uid)
get a tool
static DummyToolManagerPtr create()
virtual void setCurrentTrackingSystemImplementation(QString trackingSystemImplementation)
virtual void resetTimeSynchronization()
Reset time synchronization. Used for resetting time synchronization of incoming timestamps in OpenIGT...
virtual void setState(const Tool::State val)
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr
boost::shared_ptr< class TrackingSystemService > TrackingSystemServicePtr