Fraxinus  16.5.0-fx-rc5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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) 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 =========================================================================*/
33 
34 #include "cxDummyTool.h"
35 #include "cxLogger.h"
36 #include "cxTrackerConfiguration.h"
37 
38 namespace cx
39 {
40 
42 {
43  mState = Tool::tsINITIALIZED;
44 
45  if (tool)
46  {
47  mTools.push_back(tool);
48  report("Running dummy tool " + tool->getUid());
49  }
50 }
51 
53 {
54 
55 }
56 
58 {
59  std::vector<ToolPtr> retval;
60  std::copy(mTools.begin(), mTools.end(), back_inserter(retval));
61  return retval;
62 }
63 
65 {
66  return mState;
67 }
68 
70 {
71  if (mState==val)
72  return;
73  mState = val;
74 
75  if (mState>=Tool::tsTRACKING)
76  {
77  for (unsigned i=0; i<mTools.size(); ++i)
78  {
79  mTools[i]->setVisible(true);
80  mTools[i]->startTracking(30);
81  }
82  }
83  else
84  {
85  for (unsigned i=0; i<mTools.size(); ++i)
86  {
87  mTools[i]->setVisible(false);
88  mTools[i]->stopTracking();
89  }
90  }
91 
92  emit stateChanged();
93 }
94 
96 {
97 
98 }
99 
101 {
103 }
104 
105 //void ToolManagerUsingIGSTK::runDummyTool(DummyToolPtr tool)
106 //{
107 // TrackingSystemServicePtr dummySystem;
108 // dummySystem.reset(new TrackingSystemDummyService(tool));
109 // this->installTrackingSystem(dummySystem);
110 // this->setActiveTool(tool->getUid());
111 // dummySystem->setState(Tool::tsTRACKING);
112 
113 // report("Running dummy tool " + tool->getUid());
114 
115 // mTools[tool->getUid()] = tool;
116 // tool->setVisible(true);
117 // connect(tool.get(), SIGNAL(toolVisible(bool)), this, SLOT(dominantCheckSlot()));
118 // tool->startTracking(30);
119 // this->setActiveTool(tool->getUid());
120 
121 // report("Dummy: Config/Init/Track started in toolManager");
122 // mState = Tool::tsCONFIGURED;
123 // emit configured();
124 // emit stateChanged();
125 
126 // this->initializedSlot(true);
127 // this->trackerTrackingSlot(true);
128 //}
129 
130 } // namespace cx
virtual TrackerConfigurationPtr getConfiguration()
virtual void setState(const Tool::State val)
asynchronously request a state. Wait for signal stateChanged()
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:97
void report(QString msg)
Definition: cxLogger.cpp:90
emitting tracking data
Definition: cxTool.h:98
virtual void setLoggingFolder(QString loggingFolder)