34 #include <QDomDocument>
35 #include <QDomElement>
65 QDateTime time = QDateTime::currentDateTime();
73 QDateTime time = QDateTime::currentDateTime();
91 QString format(
"hh:mm");
94 return QString(
"%1 %2 %3")
104 return QString(
"%1_%2")
105 .arg(
mId, 2, 10, QChar(
'0'))
112 return QString(
"%1_%2_%3")
121 adder.
node().toElement().setAttribute(
"uid", this->
getUid());
126 QDomElement interval = adder.
addElement(
"interval");
148 QDomElement base = node.toElement();
154 for (
unsigned i=0; i<intervals.size(); ++i)
156 QDomElement source = intervals[i].toElement();
177 return node.firstChildElement(
"description").isElement();
182 if (parentNode.isNull())
184 reportWarning(
"RecordSession::parseXml() parentnode is null");
188 QDomElement base = parentNode.toElement();
190 QString uid = base.attribute(
"uid");
193 double starttime = parentNode.namedItem(
"start").toElement().text().toDouble(&ok);
194 double stoptime = parentNode.namedItem(
"stop").toElement().text().toDouble(&ok);
195 QString description = parentNode.namedItem(
"description").toElement().text();
197 mCategory = description.split(
"_"+uid).first();
199 mIntervals.push_back(std::make_pair(QDateTime::fromMSecsSinceEpoch(starttime),
200 QDateTime::fromMSecsSinceEpoch(stoptime)));
205 mId = uid.split(
"_").first().toInt();
215 for (
unsigned i=0; i<session->mIntervals.size(); ++i)
218 values = tool->getSessionHistory(session->mIntervals[i].first.toMSecsSinceEpoch(),
219 session->mIntervals[i].second.toMSecsSinceEpoch());
220 retval.insert(values.begin(), values.end());
224 if(retval.empty() && session && verbose)
226 CX_LOG_ERROR() << QString(
"Could not find any tracking data for tool [%1] in session [%2]. ")
227 .arg(tool.get() ? tool->getName() :
"NULL")
228 .arg(session.get() ? session->getHumanDescription() :
"NULL");
236 std::map<double, cx::ToolPositionMetadata> retval;
240 for (
unsigned i=0; i<session->mIntervals.size(); ++i)
242 double startTime = session->mIntervals[i].first.toMSecsSinceEpoch();
243 double stopTime = session->mIntervals[i].second.toMSecsSinceEpoch();
244 const std::map<double, cx::ToolPositionMetadata>& values = tool->getMetadataHistory();
246 retval.insert(values.lower_bound(startTime),
247 values.upper_bound(stopTime));
251 if(retval.empty() && session && verbose)
253 CX_LOG_ERROR() << QString(
"Could not find any tracking meta data for tool [%1] in session [%2]. ")
254 .arg(tool.get() ? tool->getName() :
"NULL")
255 .arg(session.get() ? session->getHumanDescription() :
"NULL");
static std::map< double, ToolPositionMetadata > getToolHistory_metadata(ToolPtr tool, RecordSessionPtr session, bool verbose)
void cancelLastInterval()
std::pair< QDateTime, QDateTime > IntervalType
QDomElement addElement(QString name)
unsigned getIntervalCount() const
QString timestampMilliSecondsFormat()
std::vector< QDomElement > getDuplicateElements(QString name)
QDateTime timestamp2datetime(QString in) const
void addXml(QDomNode &node)
void setIdAndTimestampFromUid(QString uid)
std::vector< IntervalType > mIntervals
QString timestampSecondsFormat()
static TimedTransformMap getToolHistory_prMt(ToolPtr tool, RecordSessionPtr session, bool verbose)
boost::shared_ptr< class RecordSession > RecordSessionPtr
void reportWarning(QString msg)
std::pair< QDateTime, QDateTime > getInterval(int i)
QDomElement addTextToElement(QString name, QString text)
QString getHumanDescription() const
description useful for display in gui.
bool isOldStyleXmlFormat(QDomNode &node)
QString getDescription() const
another legacy uid, used for folder creation etc
QString parseTextFromElement(QString name)
QDateTime getTimestamp() const
void parseXml_oldstyle(QDomNode &parentNode)
QString datetime2timestamp(QDateTime in) const
void parseXml(QDomNode &node)
std::map< double, Transform3D > TimedTransformMap
boost::shared_ptr< class Tool > ToolPtr