CustusX  20.03-rc1
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  return m_rMpr;
108 }
109 
111 {
112  m_rMpr = val;
113 }
114 
116 {
117  return mReferenceTool;
118 }
119 
121 {
122  mDummyTools.insert(std::make_pair(tool->getUid(), tool));
123 }
124 
125 //void DummyToolManager::setTooltipOffset(double offset)
126 //{
127 // if (similar(offset, mToolTipOffset))
128 // return;
129 // mToolTipOffset = offset;
130 // emit tooltipOffset(mToolTipOffset);
131 //}
132 //double DummyToolManager::getTooltipOffset() const
133 //{
134 // return mToolTipOffset;
135 //}
136 
138 {
139 
140 }
141 
143 {
144 
145 }
146 
147 std::vector<TrackingSystemServicePtr> DummyToolManager::getTrackingSystems()
148 {
149  return std::vector<TrackingSystemServicePtr> ();
150 }
151 
152 
153 } //namespace cx
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
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)
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 setState(const Tool::State val)
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr
boost::shared_ptr< class TrackingSystemService > TrackingSystemServicePtr