NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxTrackingImplService.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 =========================================================================*/
32 
33 #define _USE_MATH_DEFINES
34 
35 #include "cxTrackingImplService.h"
36 
37 #include "boost/bind.hpp"
38 
39 #include <QTimer>
40 #include <QDir>
41 #include <QList>
42 #include <QMetaType>
43 #include <QFileInfo>
44 #include <vtkDoubleArray.h>
45 #include <QCoreApplication>
46 
48 #include "cxLogger.h"
49 #include "cxTypeConversions.h"
50 #include "cxPositionStorageFile.h"
51 #include "cxTime.h"
52 #include "cxEnumConverter.h"
53 #include "cxDummyTool.h"
54 #include "cxToolImpl.h"
56 #include "cxManualToolAdapter.h"
57 #include "cxSettings.h"
58 #include "cxPlaybackTool.h"
59 
60 #include "cxPlaybackTime.h"
62 #include "cxXMLNodeWrapper.h"
64 #include "cxUtilHelpers.h"
65 
69 
70 #include "cxNullDeleter.h"
71 
72 namespace cx
73 {
74 
75 TrackingImplService::TrackingImplService(ctkPluginContext *context) :
76  mLastLoadPositionHistory(0),
77  mContext(context),
78  mToolTipOffset(0)
79 {
80  mSession = SessionStorageServiceProxy::create(mContext);
81  connect(mSession.get(), &SessionStorageService::sessionChanged, this, &TrackingImplService::onSessionChanged);
82  connect(mSession.get(), &SessionStorageService::cleared, this, &TrackingImplService::onSessionCleared);
83  connect(mSession.get(), &SessionStorageService::isLoading, this, &TrackingImplService::onSessionLoad);
84  connect(mSession.get(), &SessionStorageService::isSaving, this, &TrackingImplService::onSessionSave);
85 
86  this->initializeManualTool(); // do this after setting self.
87 
88  connect(settings(), SIGNAL(valueChangedFor(QString)), this, SLOT(globalConfigurationFileChangedSlot(QString)));
89 
90  this->listenForTrackingSystemServices(context);
91 }
92 
94 {
95  while (!mTrackingSystems.empty())
96  this->unInstallTrackingSystem(mTrackingSystems.back());
97 }
98 
99 
101 {
102  return false;
103 }
104 
105 void TrackingImplService::onSystemStateChanged()
106 {
107  this->rebuildCachedTools();
108  emit stateChanged();
109 }
110 
118 {
119  if (mPlaybackSystem)
120  {
121  mPlaybackSystem->setState(Tool::tsNONE);
122  this->unInstallTrackingSystem(mPlaybackSystem);
123  this->installTrackingSystem(mPlaybackSystem->getBase());
124  mPlaybackSystem.reset();
125  }
126 
127  if (controller)
128  {
129  mPlaybackSystem.reset(new TrackingSystemPlaybackService(controller, mTrackingSystems.back(), mManualTool));
130  this->unInstallTrackingSystem(mPlaybackSystem->getBase());
131  this->installTrackingSystem(mPlaybackSystem);
132  mPlaybackSystem->setState(Tool::tsTRACKING);
133  }
134 }
135 
137 {
138  return mPlaybackSystem && (mPlaybackSystem->getState()>=Tool::tsCONFIGURED);
139 }
140 
142 {
143  TrackingSystemServicePtr dummySystem;
144  dummySystem.reset(new TrackingSystemDummyService(tool));
145  this->installTrackingSystem(dummySystem);
146 
147  dummySystem->setState(Tool::tsTRACKING);
148  this->setActiveTool(tool->getUid());
149 }
150 
152 {
153  mTrackingSystems.push_back(system);
154  connect(system.get(), &TrackingSystemService::stateChanged, this, &TrackingImplService::onSystemStateChanged);
155  this->onSystemStateChanged();
156 }
157 
159 {
160  disconnect(system.get(), &TrackingSystemService::stateChanged, this, &TrackingImplService::onSystemStateChanged);
161 
162  for (unsigned i=0; i<mTrackingSystems.size(); ++i)
163  {
164  if (mTrackingSystems[i]!=system)
165  continue;
166  mTrackingSystems.erase(mTrackingSystems.begin()+i);
167  break;
168  }
169 
170  this->onSystemStateChanged();
171 }
172 
173 std::vector<TrackingSystemServicePtr> TrackingImplService::getTrackingSystems()
174 {
175  return mTrackingSystems;
176 }
177 
178 void TrackingImplService::initializeManualTool()
179 {
180  if (!mManualTool)
181  {
182  //adding a manual tool as default
183  mManualTool.reset(new ManualToolAdapter("ManualTool"));
184  mTools["ManualTool"] = mManualTool;
185  mManualTool->setVisible(true);
186  connect(mManualTool.get(), &Tool::toolVisible, this, &TrackingImplService::activeCheckSlot);
187  connect(mManualTool.get(), &Tool::toolTransformAndTimestamp, this, &TrackingImplService::activeCheckSlot);
188  connect(mManualTool.get(), &Tool::tooltipOffset, this, &TrackingImplService::onTooltipOffset);
189  }
190 
191  Transform3D rMpr = Transform3D::Identity(); // not known: not really important either
193  mManualTool->set_prMt(prMt);
194  this->activeCheckSlot();
195 }
196 
198 {
199  Tool::State state = Tool::tsNONE;
200  for (unsigned i=0; i<mTrackingSystems.size(); ++i)
201  state = std::max(state, mTrackingSystems[i]->getState());
202  return state;
203 }
204 
206 {
207  for (unsigned i=0; i<mTrackingSystems.size(); ++i)
208  mTrackingSystems[i]->setState(val);
209 }
210 
211 void TrackingImplService::listenForTrackingSystemServices(ctkPluginContext *context)
212 {
213  mServiceListener.reset(new ServiceTrackerListener<TrackingSystemService>(
214  context,
215  boost::bind(&TrackingImplService::onTrackingSystemAdded, this, _1),
216  boost::bind(&TrackingImplService::onTrackingSystemModified, this, _1),
217  boost::bind(&TrackingImplService::onTrackingSystemRemoved, this, _1)
218  ));
219  mServiceListener->open();
220 }
221 
222 void TrackingImplService::onTrackingSystemAdded(TrackingSystemService* service)
223 {
224  this->installTrackingSystem(TrackingSystemServicePtr(service, null_deleter()));
225 }
226 
227 void TrackingImplService::onTrackingSystemRemoved(TrackingSystemService* service)
228 {
229  this->unInstallTrackingSystem(TrackingSystemServicePtr(service, null_deleter()));
230 }
231 
232 void TrackingImplService::onTrackingSystemModified(TrackingSystemService* service)
233 {
234 }
235 
236 void TrackingImplService::rebuildCachedTools()
237 {
238  mTools.clear();
239  for (unsigned i=0; i<mTrackingSystems.size(); ++i)
240  {
241  this->addToolsFrom(mTrackingSystems[i]);
242  }
243  mTools[mManualTool->getUid()] = mManualTool;
244  this->imbueManualToolWithRealProperties();
245  this->setActiveTool(this->getManualTool()->getUid());
246  this->loadPositionHistory(); // the tools are always reconfigured after a setloggingfolder
247 }
248 
249 void TrackingImplService::imbueManualToolWithRealProperties()
250 {
251  // debug: give the manual tool properties from the first non-manual tool. Nice for testing tools
252  if (!settings()->value("giveManualToolPhysicalProperties").toBool())
253  return;
254 
255  for (ToolMap::iterator iter = mTools.begin(); iter != mTools.end(); ++iter)
256  {
257  if (iter->second == mManualTool)
258  continue;
259  if (iter->second->hasType(Tool::TOOL_REFERENCE))
260  continue;
261  mManualTool->setBase(iter->second);
262  mManualTool->startEmittingContinuousPositions(100);
263 
264  report("Manual tool imbued with properties from " + iter->first);
265  break;
266  }
267 }
268 
269 void TrackingImplService::addToolsFrom(TrackingSystemServicePtr system)
270 {
271  std::vector<ToolPtr> tools = system->getTools();
272  for (unsigned i=0; i<tools.size(); ++i)
273  {
274  ToolPtr tool = tools[i];
275  mTools[tool->getUid()] = tool;
276  connect(tool.get(), SIGNAL(toolVisible(bool)), this, SLOT(activeCheckSlot()));
277  connect(tool.get(), &Tool::toolTransformAndTimestamp, this, &TrackingImplService::activeCheckSlot);
278  connect(tool.get(), &Tool::tooltipOffset, this, &TrackingImplService::onTooltipOffset);
279 
280  if (tool->hasType(Tool::TOOL_REFERENCE))
281  mReferenceTool = tool;
282  }
283 }
284 
285 void TrackingImplService::onTooltipOffset(double val)
286 {
287  mToolTipOffset = val;
288  for (ToolMap::iterator iter = mTools.begin(); iter != mTools.end(); ++iter)
289  {
290  iter->second->setTooltipOffset(val);
291  }
292 }
293 
295 {
296  SessionToolHistoryMap retval;
297 
298  ToolMap tools = this->getTools();
299  ToolMap::iterator it = tools.begin();
300  for (; it != tools.end(); ++it)
301  {
302  TimedTransformMap toolMap = it->second->getSessionHistory(startTime, stopTime);
303  if (toolMap.empty())
304  continue;
305  retval[it->second] = toolMap;
306  }
307  return retval;
308 }
309 
311 {
312  return mTools;
313 }
314 
316 {
317  if (uid == "active")
318  return this->getActiveTool();
319 
320  ToolPtr retval;
321  ToolMap::iterator it = mTools.find(uid);
322  if (it != mTools.end())
323  retval = it->second;
324 
325  return retval;
326 }
327 
329 {
330  return mActiveTool;
331 }
332 
333 void TrackingImplService::setActiveTool(const QString& uid)
334 {
335  if (mActiveTool && mActiveTool->getUid() == uid)
336  return;
337 
338  ToolPtr newTool;
339  newTool = this->getTool(uid);
340 
341  ToolPtr oldTool = mActiveTool;
342  mActiveTool = newTool; // set active before calling setters, which possibly can emit signal and cause cycles.
343 
344  // special case for manual tool
345  if (newTool && newTool->hasType(Tool::TOOL_MANUAL) && mManualTool)
346  {
347  if (oldTool && (oldTool!=mManualTool))
348  mManualTool->set_prMt(oldTool->get_prMt(), oldTool->getTimestamp() -1);
349  mManualTool->setVisible(true);
350  }
351  else
352  {
353  mManualTool->setVisible(false);
354  }
355 
356  emit activeToolChanged(uid);
357 }
358 
360 {
361  return mReferenceTool;
362 }
363 
364 void TrackingImplService::savePositionHistory()
365 {
366  QString filename = this->getLoggingFolder() + "/toolpositions.snwpos";
367 
368  PositionStorageWriter writer(filename);
369 
370  ToolMap::iterator it = mTools.begin();
371  for (; it != mTools.end(); ++it)
372  {
373  ToolPtr current = it->second;
374  TimedTransformMapPtr data = current->getPositionHistory();
375 
376  if (!data)
377  continue;
378 
379  // save only data acquired after mLastLoadPositionHistory:
380  TimedTransformMap::iterator iter = data->lower_bound(mLastLoadPositionHistory);
381  for (; iter != data->end(); ++iter)
382  writer.write(iter->second, (iter->first), current->getUid());
383  }
384 
385  mLastLoadPositionHistory = getMilliSecondsSinceEpoch();
386 }
387 
388 void TrackingImplService::loadPositionHistory()
389 {
390  if (this->getState()==Tool::tsNONE)
391  return;
392  // save all position data acquired so far, in case of multiple calls.
393  this->savePositionHistory();
394 
395  QString filename = this->getLoggingFolder()+ "/toolpositions.snwpos";
396 
397  PositionStorageReader reader(filename);
398 
399  Transform3D matrix = Transform3D::Identity();
400  double timestamp;
401  QString toolUid;
402 
403  QStringList missingTools;
404 
405  while (!reader.atEnd())
406  {
407  if (!reader.read(&matrix, &timestamp, &toolUid))
408  break;
409 
410  ToolPtr current = this->getTool(toolUid);
411  if (current)
412  {
413  (*current->getPositionHistory())[timestamp] = matrix;
414  }
415  else
416  {
417  missingTools << toolUid;
418  }
419  }
420 
421  missingTools.removeDuplicates();
422  missingTools.removeAll("");
423 
424  if (!missingTools.empty())
425  {
426  reportWarning(QString("Loaded position history, but some of the tools "
427  "are not present in the configuration:"
428  "\n \t%1").arg(missingTools.join("\n \t")));
429  }
430 
431  mLastLoadPositionHistory = getMilliSecondsSinceEpoch();
432 }
433 
434 //void TrackingImplService::setLoggingFolder(QString loggingFolder)
435 //{
436 // if (mLoggingFolder == loggingFolder)
437 // return;
438 
439 // for (unsigned i=0; i<mTrackingSystems.size(); ++i)
440 // mTrackingSystems[i]->setLoggingFolder(loggingFolder);
441 // mLoggingFolder = loggingFolder;
442 //}
443 
444 void TrackingImplService::globalConfigurationFileChangedSlot(QString key)
445 {
446  if (key.contains("TrackingPositionFilter"))
447  {
448  this->resetTrackingPositionFilters();
449  }
450 }
451 
452 void TrackingImplService::resetTrackingPositionFilters()
453 {
454  bool enabled = settings()->value("TrackingPositionFilter/enabled", false).toInt();
455 
456  for (ToolMap::iterator iter=mTools.begin(); iter!=mTools.end(); ++iter)
457  {
459  if (enabled)
460  filter.reset(new TrackingPositionFilter());
461  iter->second->resetTrackingPositionFilter(filter);
462  }
463 }
464 
465 void TrackingImplService::activeCheckSlot()
466 {
467  if (this->manualToolHasMostRecentTimestamp() && mManualTool->getVisible())
468  {
469  this->setActiveTool(this->getManualTool()->getUid());
470  return;
471  }
472 
473  bool use = settings()->value("Automation/autoSelectActiveTool").toBool();
474  if (!use)
475  return;
476 
477  //make a sorted vector of all visible tools
478  std::vector<ToolPtr> tools = this->getVisibleTools();
479  tools.push_back(mManualTool);
480 
481  if (!tools.empty())
482  {
483  //sort most important tool to the start of the vector:
484  sort(tools.begin(), tools.end(), toolTypeSort);
485  const QString uid = tools[0]->getUid();
486  this->setActiveTool(uid);
487  }
488 }
489 
490 bool TrackingImplService::manualToolHasMostRecentTimestamp()
491 {
492  // original comment (was wrapped in an ifplayblack):
493  // In static playback mode, tools does not turn invisible since
494  // time dont move. Here we check whether manual tool has a newer
495  // timestamp than the playback tools. If it has, make it active.
496  // This enables automatic change to manual tool if the user
497  // manipulates the manual tool in some way.
498 
499  double mts = this->getManualTool()->getTimestamp();
500 // std::cout << " manual tooltime " << mts << std::endl;
501 
502  double bestTime = 0;
503  for (ToolMap::iterator it = mTools.begin(); it != mTools.end(); ++it)
504  {
505 // std::cout << " tool " << it->first << " -- "<< it->second->getTimestamp() << std::endl;
506  if (it->second->hasType(Tool::TOOL_MANUAL))
507  continue;
508 // std::cout << " tool " << it->first << " : "<< it->second->getTimestamp() - mts << std::endl;
509  bestTime = std::max(bestTime, it->second->getTimestamp());
510  }
511 // double ahead = mts -bestTime;
512 // std::cout << " mts -bestTime " << " : "<< (mts -bestTime) << std::endl;
513 // std::cout << " mts > bestTime " << " : "<< bool(mts > bestTime) << std::endl;
514 
515  return (mts > bestTime);
516 }
517 
518 std::vector<ToolPtr> TrackingImplService::getVisibleTools()
519 {
520  std::vector<ToolPtr> retval;
521  for (ToolMap::iterator it = mTools.begin(); it != mTools.end(); ++it)
522  if (it->second->getVisible())
523  retval.push_back(it->second);
524  return retval;
525 }
526 
527 
528 
529 namespace
530 {
534 int getPriority(ToolPtr tool)
535 {
536  if (tool->hasType(Tool::TOOL_MANUAL)) // place this first, in case a tool has several attributes.
537  return 2;
538 
539  if (tool->hasType(Tool::TOOL_US_PROBE))
540  return 4;
541  if (tool->hasType(Tool::TOOL_POINTER))
542  return 3;
543  if (tool->hasType(Tool::TOOL_REFERENCE))
544  return 1;
545  return 0;
546 }
547 }
548 
555 bool toolTypeSort(const ToolPtr tool1, const ToolPtr tool2)
556 {
557  return getPriority(tool2) < getPriority(tool1);
558 }
559 
560 QString TrackingImplService::getLoggingFolder()
561 {
562  return mSession->getSubFolder("Logs/");
563 }
564 
565 void TrackingImplService::onSessionChanged()
566 {
567  QString loggingFolder = this->getLoggingFolder();
568 
569  for (unsigned i=0; i<mTrackingSystems.size(); ++i)
570  mTrackingSystems[i]->setLoggingFolder(loggingFolder);
571 }
572 
573 void TrackingImplService::onSessionCleared()
574 {
575  mManualTool->set_prMt(Transform3D::Identity());
576 }
577 
578 void TrackingImplService::onSessionLoad(QDomElement& node)
579 {
580  XMLNodeParser root(node);
581  QDomElement toolManagerNode = root.descend("managers/toolManager").node().toElement();
582  if (!toolManagerNode.isNull())
583  this->parseXml(toolManagerNode);
584 
585 }
586 
587 void TrackingImplService::onSessionSave(QDomElement& node)
588 {
589  XMLNodeAdder root(node);
590  QDomElement managerNode = root.descend("managers").node().toElement();
591  this->addXml(managerNode);
592 
593  this->savePositionHistory();
594 }
595 
596 void TrackingImplService::addXml(QDomNode& parentNode)
597 {
598  XMLNodeAdder parent(parentNode);
599  XMLNodeAdder base(parent.addElement("toolManager"));
600 
601  base.addTextToElement("toolTipOffset", qstring_cast(mToolTipOffset));
602  base.addTextToElement("manualTool", "\n" + qstring_cast(mManualTool->get_prMt()));
603 
604  //Tools
605  XMLNodeAdder toolsNode(base.addElement("tools"));
606  ToolMap tools = this->getTools();
607  ToolMap::iterator toolIt = tools.begin();
608  for (; toolIt != tools.end(); ++toolIt)
609  {
610  cxToolPtr tool = boost::dynamic_pointer_cast<ToolImpl>(toolIt->second);
611  if (tool)
612  {
613  toolsNode.addObjectToElement("tool", tool);
614  }
615  }
616 
617 }
618 
619 void TrackingImplService::parseXml(QDomNode& dataNode)
620 {
621  if (dataNode.isNull())
622  return;
623 
624  XMLNodeParser base(dataNode);
625 
626  QString manualToolText = dataNode.namedItem("manualTool").toElement().text();
627  mManualTool->set_prMt(Transform3D::fromString(manualToolText));
628 
629  mToolTipOffset = base.parseDoubleFromElementWithDefault("toolTipOffset", 0.0);
630  this->onTooltipOffset(mToolTipOffset);
631 
632  //Tools
633  ToolMap tools = this->getTools();
634  XMLNodeParser toolssNode(dataNode.namedItem("tools"));
635  std::vector<QDomElement> toolNodes = toolssNode.getDuplicateElements("tool");
636 
637  for (unsigned i=0; i<toolNodes.size(); ++i)
638  {
639  QDomElement toolNode = toolNodes[i];
640  QString tool_uid = toolNode.attribute("uid");
641  if (tools.find(tool_uid) != tools.end())
642  {
643  cxToolPtr tool = boost::dynamic_pointer_cast<ToolImpl>(tools.find(tool_uid)->second);
644  tool->parseXml(toolNode);
645  }
646  }
647 }
648 
650 {
651  return mManualTool;
652 }
653 
663 {
664  ToolPtr active = this->getActiveTool();
665 
666  // Turned off the check for valid probe fix #1038: No probe sector in 3D scene if no xml emtry for probe.
667  // This will work for digital interfaces where the probe sector definition comes from the interface, and not from the xml file.
668 // if (active && active->getProbe() && active->getProbe()->isValid())
669  if (active && active->getProbe())
670  return active;
671 
672  ToolMap tools = this->getTools();
673 
674  // look for visible probes
675  for (ToolMap::iterator iter = tools.begin(); iter != tools.end(); ++iter)
676  if (iter->second->getProbe() && iter->second->getProbe()->isValid() && iter->second->getVisible())
677  return iter->second;
678 
679  // pick the first probe, visible or not.
680  for (ToolMap::iterator iter = tools.begin(); iter != tools.end(); ++iter)
681  if (iter->second->getProbe() && iter->second->getProbe()->isValid())
682  return iter->second;
683 
684  return ToolPtr();
685 }
686 
687 
689 {
690  for (unsigned i=0; i<mTrackingSystems.size(); ++i)
691  {
692  TrackerConfigurationPtr config = mTrackingSystems[i]->getConfiguration();
693  if (config)
694  return config;
695  }
696  return TrackerConfigurationPtr();
697 }
698 
699 
700 } //namespace cx
int getPriority(DataPtr data)
QString qstring_cast(const T &val)
Transform3D createTransformRotateY(const double angle)
virtual void runDummyTool(DummyToolPtr tool)
void isLoading(QDomElement &root)
emitted while loading a session. Xml storage is available, getRootFolder() is set to loaded value...
virtual ToolPtr getFirstProbe()
Find a probe that can be connected to a rt source.
std::map< ToolPtr, TimedTransformMap > SessionToolHistoryMap
virtual ToolPtr getTool(const QString &uid)
get a specific tool
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< ToolImpl > cxToolPtr
Definition: cxToolImpl.h:83
double getMilliSecondsSinceEpoch()
Definition: cxTime.cpp:65
static SessionStorageServicePtr create(ctkPluginContext *pluginContext)
void toolTransformAndTimestamp(Transform3D matrix, double timestamp)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: cxSettings.cpp:87
virtual Tool::State getState() const
virtual void setState(const Tool::State val)
virtual void setPlaybackMode(PlaybackTimePtr controller)
configured with basic info
Definition: cxTool.h:96
void sessionChanged()
emitted after change to a new session (new or loaded or cleared)
Reference tool.
Definition: cxTool.h:105
bool toolTypeSort(const ToolPtr tool1, const ToolPtr tool2)
function for sorting tools by type
boost::shared_ptr< class PlaybackTime > PlaybackTimePtr
virtual void setActiveTool(const QString &uid)
can be set to either a connected or configured tool
boost::shared_ptr< class DummyTool > DummyToolPtr
boost::shared_ptr< class TrackerConfiguration > TrackerConfigurationPtr
void activeToolChanged(const QString &uId)
void toolVisible(bool visible)
void reportWarning(QString msg)
Definition: cxLogger.cpp:91
void tooltipOffset(double offset)
boost::shared_ptr< TimedTransformMap > TimedTransformMapPtr
Definition: cxTool.h:57
virtual ToolMap getTools()
get all configured and initialized tools
virtual TrackerConfigurationPtr getConfiguration()
virtual ToolPtr getManualTool()
a mouse-controllable virtual tool that is available even when not tracking.
virtual void unInstallTrackingSystem(TrackingSystemServicePtr system)
Representation of a mouse/keyboard-controlled virtual tool.
Definition: cxTool.h:106
not available
Definition: cxTool.h:95
Settings * settings()
Shortcut for accessing the settings instance.
Definition: cxSettings.cpp:42
Writer class for the position file.
void cleared()
emitted when session is cleared, before isLoading is called
Helper class for listening to services being added, modified and removed.
std::map< QString, ToolPtr > ToolMap
virtual std::vector< TrackingSystemServicePtr > getTrackingSystems()
virtual ToolPtr getReferenceTool() const
get the tool that is used as a reference, if any
Interface towards a dummy tracking system.
void report(QString msg)
Definition: cxLogger.cpp:90
TrackingImplService(ctkPluginContext *context)
Adapter class for ManualTool.A ManualToolAdapter inherits from manual tool, but also contains a cx::T...
virtual ToolPtr getActiveTool()
get the tool that has higest priority when tracking
Transform3D createTransformRotateZ(const double angle)
virtual bool isPlaybackMode() const
emitting tracking data
Definition: cxTool.h:98
Interface towards a playback tracking system.Wraps another tracking system, enabling playback of the ...
boost::shared_ptr< class TrackingPositionFilter > TrackingPositionFilterPtr
Definition: cxTool.h:58
virtual SessionToolHistoryMap getSessionHistory(double startTime, double stopTime)
Ultrasond probe. The tool has a Probe subinterface with a sector and a video stream.
Definition: cxTool.h:108
virtual void installTrackingSystem(TrackingSystemServicePtr system)
void isSaving(QDomElement &root)
xml storage is available
Navigation pointer. Pointing functionality such as tool offset.
Definition: cxTool.h:107
#define M_PI
std::map< double, Transform3D > TimedTransformMap
boost::shared_ptr< class Tool > ToolPtr
boost::shared_ptr< class TrackingSystemService > TrackingSystemServicePtr