39 #include <QStringList>
56 mReconstructer(reconstructer)
67 mRecordSessions.clear();
73 mRecordSessions.push_back(session);
79 for(
int i = 0; i < mRecordSessions.size(); ++i)
81 if(mRecordSessions[i]->getUid() == session->getUid())
82 mRecordSessions.erase(mRecordSessions.begin() + i);
89 return mRecordSessions;
95 std::vector<RecordSessionPtr>::iterator it = mRecordSessions.begin();
96 for(; it != mRecordSessions.end(); ++it)
98 if((*it)->getUid() == uid)
106 QDomDocument doc = parentNode.ownerDocument();
107 QDomElement base = doc.createElement(
"stateManager");
108 parentNode.appendChild(base);
110 QDomElement sessionsNode = doc.createElement(
"recordSessions");
111 std::vector<RecordSessionPtr>::iterator it = mRecordSessions.begin();
112 for(; it != mRecordSessions.end(); ++it)
114 QDomElement sessionNode = doc.createElement(
"recordSession");
115 (*it)->addXml(sessionNode);
116 sessionsNode.appendChild(sessionNode);
118 base.appendChild(sessionsNode);
123 QDomNode recordsessionsNode = dataNode.namedItem(
"recordSessions");
124 QDomElement recodesessionNode = recordsessionsNode.firstChildElement(
"recordSession");
125 for (; !recodesessionNode.isNull(); recodesessionNode = recodesessionNode.nextSiblingElement(
"recordSession"))
129 session->parseXml(recodesessionNode);
142 std::vector<RecordSessionPtr>::iterator iter;
143 for (iter = recordsessions.begin(); iter != recordsessions.end(); ++iter)
145 QString index = (*iter)->getUid().split(
"_").front();
146 max = std::max(max, index.toInt());
157 QObject(parent), mPluginData(pluginData), mCurrentState(
AcquisitionService::sNOT_RUNNING),
163 this->checkIfReadySlot();
185 void Acquisition::checkIfReadySlot()
187 bool tracking = this->getServices()->tracking()->getState()>=
Tool::tsTRACKING;
188 ToolPtr tool = this->getServices()->tracking()->getActiveTool();
189 ToolPtr reference_frame = this->getServices()->tracking()->getReferenceTool();
190 if(tracking && reference_frame)
192 connect(reference_frame.get(), &
Tool::toolVisible,
this, &Acquisition::checkIfReadySlot, Qt::UniqueConnection);
194 QString mWhatsMissing;
195 mWhatsMissing.clear();
199 mWhatsMissing =
"<font color=green>Ready to record!</font><br>";
200 if (!tool || !tool->getVisible())
202 mWhatsMissing +=
"<font color=orange>Tool not visible</font><br>";
204 if(!reference_frame || !reference_frame->getVisible())
206 mWhatsMissing +=
"<font color=orange>Reference frame not visible.</font><br>";
211 mWhatsMissing.append(
"<font color=red>Need to start tracking.</font><br>");
215 this->setReady(tracking, mWhatsMissing);
218 void Acquisition::setReady(
bool val, QString text)
230 report(
"Already recording a session, stop before trying to start a new record session.");
234 mCurrentContext = context;
237 mLatestSession = session;
239 mLatestSession.reset(
new cx::RecordSession(mPluginData->getNewSessionId(), category));
241 mLatestSession->startNewInterval();
255 mLatestSession->stopLastInterval();
256 if (!mPluginData->getRecordSession(mLatestSession->getUid()))
257 mPluginData->addRecordSession(mLatestSession);
270 mLatestSession->cancelLastInterval();
271 mLatestSession.reset();
290 mCurrentState = newState;
Acqusition services abstract interface.
boost::shared_ptr< class UsReconstructionService > UsReconstructionServicePtr
void startPostProcessing()
boost::shared_ptr< class VisServices > VisServicesPtr
std::vector< RecordSessionPtr > getRecordSessions()
void removeRecordSession(RecordSessionPtr session)
void addXml(QDomNode &dataNode)
boost::shared_ptr< class AcquisitionData > AcquisitionDataPtr
void activeToolChanged(const QString &uId)
boost::shared_ptr< class RecordSession > RecordSessionPtr
AcquisitionService::STATE getState() const
virtual ~AcquisitionData()
void recordedSessionsChanged()
void addRecordSession(RecordSessionPtr session)
void startRecord(AcquisitionService::TYPES context, QString category, RecordSessionPtr session)
QString getInfoText(AcquisitionService::TYPES) const
AcquisitionDataPtr getPluginData()
void parseXml(QDomNode &dataNode)
void stopPostProcessing()
RecordSessionPtr getRecordSession(QString uid)
Acquisition(AcquisitionDataPtr pluginData, QObject *parent=0)
bool isReady(AcquisitionService::TYPES) const
void acquisitionStopped()
boost::shared_ptr< class Tool > ToolPtr