NorMIT-nav  22.09
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 }
40 DummyToolManager::~ DummyToolManager()
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
cx::Tool
Interface to a tool, i.e. a pointer, US probe or similar.
Definition: cxTool.h:61
cx::DummyToolManager::getReferenceTool
virtual ToolPtr getReferenceTool() const
tool used as patient reference
Definition: cxDummyToolManager.cpp:120
cx::DummyToolManager::unInstallTrackingSystem
virtual void unInstallTrackingSystem(TrackingSystemServicePtr system)
Definition: cxDummyToolManager.cpp:147
cx::DummyToolManager::setCurrentTrackingSystemImplementation
virtual void setCurrentTrackingSystemImplementation(QString trackingSystemImplementation)
Definition: cxDummyToolManager.cpp:178
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::DummyToolManager::getState
virtual Tool::State getState() const
Definition: cxDummyToolManager.cpp:43
cx::DummyToolManager::resetTimeSynchronization
virtual void resetTimeSynchronization()
Reset time synchronization. Used for resetting time synchronization of incoming timestamps in OpenIGT...
Definition: cxDummyToolManager.cpp:157
cx::DummyToolManager::getTools
virtual ToolMap getTools()
get configured and initialized tools
Definition: cxDummyToolManager.cpp:83
cx::TrackerConfigurationPtr
boost::shared_ptr< class TrackerConfiguration > TrackerConfigurationPtr
Definition: cxTrackerConfiguration.h:24
cx::DummyToolManager::getTrackingSystems
virtual std::vector< TrackingSystemServicePtr > getTrackingSystems()
Definition: cxDummyToolManager.cpp:152
cx::DummyToolManager::getTool
virtual ToolPtr getTool(const QString &uid)
get a tool
Definition: cxDummyToolManager.cpp:88
cxDummyToolManager.h
cx::DummyToolManager::getConfiguration
virtual TrackerConfigurationPtr getConfiguration()
Definition: cxDummyToolManager.cpp:173
cx::DummyToolManager
Implementation of a ToolManager used for testing.
Definition: cxDummyToolManager.h:31
cx::DummyTool
Implementation of a Tool used for testing.
Definition: cxDummyTool.h:149
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::DummyToolManager::getCurrentTrackingSystemImplementation
virtual QString getCurrentTrackingSystemImplementation()
Definition: cxDummyToolManager.cpp:182
cx::DummyToolManager::DummyToolManagerPtr
boost::shared_ptr< DummyToolManager > DummyToolManagerPtr
Definition: cxDummyToolManager.h:36
cx::TrackingSystemServicePtr
boost::shared_ptr< class TrackingSystemService > TrackingSystemServicePtr
Definition: cxTrackingImplService.h:36
cx::DummyToolManager::setState
virtual void setState(const Tool::State val)
Definition: cxDummyToolManager.cpp:48
cx::Tool::State
State
Definition: cxTool.h:72
cx::TrackingService::stateChanged
void stateChanged()
cx::DummyToolManager::installTrackingSystem
virtual void installTrackingSystem(TrackingSystemServicePtr system)
Definition: cxDummyToolManager.cpp:142
cx::TrackingService::activeToolChanged
void activeToolChanged(const QString &uId)
cx::DummyToolManager::get_rMpr
virtual Transform3D get_rMpr() const
Definition: cxDummyToolManager.cpp:110
cx::DummyToolManager::getConfigurations
virtual std::vector< TrackerConfigurationPtr > getConfigurations()
Definition: cxDummyToolManager.cpp:161
cx::DummyToolManager::clearActiveTool
virtual void clearActiveTool()
Deselect active tool.
Definition: cxDummyToolManager.cpp:105
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cx::DummyToolManager::set_rMpr
virtual void set_rMpr(const Transform3D &val)
Definition: cxDummyToolManager.cpp:115
cx::DummyToolManager::create
static DummyToolManagerPtr create()
Definition: cxDummyToolManager.cpp:18
cx::Tool::tsTRACKING
@ tsTRACKING
emitting tracking data
Definition: cxTool.h:77
tsNONE
tsNONE
Not specified.
Definition: cxDefinitions.h:112
cx::DummyToolPtr
boost::shared_ptr< class DummyTool > DummyToolPtr
Definition: cxForwardDeclarations.h:44
cx::DummyToolManager::addTool
void addTool(DummyToolPtr tool)
Definition: cxDummyToolManager.cpp:125
cx::DummyToolManager::getActiveTool
virtual ToolPtr getActiveTool()
get the tool that has higest priority when tracking
Definition: cxDummyToolManager.cpp:94
cx::TrackingService::ToolMap
std::map< QString, ToolPtr > ToolMap
Definition: cxTrackingService.h:54
cx::DummyToolManager::setActiveTool
virtual void setActiveTool(const QString &uid)
set a tool to be the active tool
Definition: cxDummyToolManager.cpp:98