39 #include <QApplication>
51 mController = controller;
60 void TrackingSystemPlaybackService::start()
62 if (!this->forceBaseToConfiguredState())
64 reportWarning(
"ToolManager must be configured before setting playback");
68 std::vector<ToolPtr> original = mBase->getTools();
72 for (
unsigned i=0; i<original.size(); ++i)
76 mTools.push_back(current);
79 if (!history->empty())
81 timeRange.first = std::min(timeRange.first, history->begin()->first);
82 timeRange.second = std::max(timeRange.second, history->rbegin()->first);
86 mController->initialize(QDateTime::fromMSecsSinceEpoch(timeRange.first), timeRange.second - timeRange.first);
88 report(
"Opened Playback Mode");
93 void TrackingSystemPlaybackService::stop()
97 report(
"Closed Playback Mode");
101 bool TrackingSystemPlaybackService::forceBaseToConfiguredState()
120 for (
unsigned i=0; i<timeout/interval; ++i)
122 if (base->getState() == state)
124 qApp->processEvents();
131 std::vector<ToolPtr> retval;
132 std::copy(mTools.begin(), mTools.end(), back_inserter(retval));
141 bool TrackingSystemPlaybackService::isRunning()
const
143 return !mTools.empty();
152 if (!this->isRunning())
157 if (this->isRunning())
172 void TrackingSystemPlaybackService::onToolPositionChanged(
Transform3D matrix,
double timestamp)
176 mManual->set_prMt(matrix, timestamp-1);
virtual std::vector< ToolPtr > getTools()
virtual void setLoggingFolder(QString loggingFolder)
virtual void setState(const Tool::State val)
asynchronously request a state. Wait for signal stateChanged()
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class PlaybackTool > PlaybackToolPtr
double getMilliSecondsSinceEpoch()
boost::shared_ptr< class ManualTool > ManualToolPtr
TrackingSystemPlaybackService(PlaybackTimePtr controller, TrackingSystemServicePtr base, ManualToolPtr manual)
virtual TrackerConfigurationPtr getConfiguration()
boost::shared_ptr< class PlaybackTime > PlaybackTimePtr
boost::shared_ptr< class TrackerConfiguration > TrackerConfigurationPtr
void reportWarning(QString msg)
static TrackerConfigurationPtr getNullObject()
boost::shared_ptr< TimedTransformMap > TimedTransformMapPtr
virtual Tool::State getState() const
virtual ~TrackingSystemPlaybackService()
boost::shared_ptr< class TrackingSystemService > TrackingSystemServicePtr