CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxTrackingSystemDummyService.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 =========================================================================*/
12 
13 #include "cxDummyTool.h"
14 #include "cxLogger.h"
15 #include "cxTrackerConfiguration.h"
16 
17 namespace cx
18 {
19 
21 {
22  mState = Tool::tsINITIALIZED;
23 
24  if (tool)
25  {
26  mTools.push_back(tool);
27  report("Running dummy tool " + tool->getUid());
28  }
29 }
30 
32 {
33 
34 }
35 
37 {
38  std::vector<ToolPtr> retval;
39  std::copy(mTools.begin(), mTools.end(), back_inserter(retval));
40  return retval;
41 }
42 
44 {
45  return mState;
46 }
47 
49 {
50  if (mState==val)
51  return;
52  mState = val;
53 
54  if (mState>=Tool::tsTRACKING)
55  {
56  for (unsigned i=0; i<mTools.size(); ++i)
57  {
58  mTools[i]->setVisible(true);
59  mTools[i]->startTracking(30);
60  }
61  }
62  else
63  {
64  for (unsigned i=0; i<mTools.size(); ++i)
65  {
66  mTools[i]->setVisible(false);
67  mTools[i]->stopTracking();
68  }
69  }
70 
71  emit stateChanged();
72 }
73 
75 {
76 
77 }
78 
80 {
82 }
83 
84 //void ToolManagerUsingIGSTK::runDummyTool(DummyToolPtr tool)
85 //{
86 // TrackingSystemServicePtr dummySystem;
87 // dummySystem.reset(new TrackingSystemDummyService(tool));
88 // this->installTrackingSystem(dummySystem);
89 // this->setActiveTool(tool->getUid());
90 // dummySystem->setState(Tool::tsTRACKING);
91 
92 // report("Running dummy tool " + tool->getUid());
93 
94 // mTools[tool->getUid()] = tool;
95 // tool->setVisible(true);
96 // connect(tool.get(), SIGNAL(toolVisible(bool)), this, SLOT(dominantCheckSlot()));
97 // tool->startTracking(30);
98 // this->setActiveTool(tool->getUid());
99 
100 // report("Dummy: Config/Init/Track started in toolManager");
101 // mState = Tool::tsCONFIGURED;
102 // emit configured();
103 // emit stateChanged();
104 
105 // this->initializedSlot(true);
106 // this->trackerTrackingSlot(true);
107 //}
108 
109 } // namespace cx
virtual TrackerConfigurationPtr getConfiguration()
virtual void setState(const Tool::State val)
asynchronously request a state. Wait for signal stateChanged()
void stateChanged()
Reset time synchronization. Used for resetting time synchronization of incoming timestamps in OpenIGT...
virtual std::vector< ToolPtr > getTools()
boost::shared_ptr< class DummyTool > DummyToolPtr
boost::shared_ptr< class TrackerConfiguration > TrackerConfigurationPtr
static TrackerConfigurationPtr getNullObject()
connected to hardware, if any, ready to use
Definition: cxTool.h:76
void report(QString msg)
Definition: cxLogger.cpp:69
emitting tracking data
Definition: cxTool.h:77
virtual void setLoggingFolder(QString loggingFolder)
Namespace for all CustusX production code.