45 mUid(uid), mCoord(coord)
47 mTimestamp = QDateTime::currentDateTime();
70 QDomDocument doc = dataNode.ownerDocument();
72 dataNode.toElement().setAttribute(
"uid",
qstring_cast(mUid));
74 QDomElement coordNode = doc.createElement(
"coord");
75 coordNode.appendChild(doc.createTextNode(
qstring_cast(mCoord)));
76 dataNode.appendChild(coordNode);
78 QDomElement timestampNode = doc.createElement(
"timestamp");
80 dataNode.appendChild(timestampNode);
84 if (dataNode.isNull())
87 QDomElement base = dataNode.toElement();
89 mUid = base.attribute(
"uid");
90 mCoord = Vector3D::fromString(dataNode.namedItem(
"coord").toElement().text());
91 mTimestamp = QDateTime::fromString(dataNode.namedItem(
"timestamp").toElement().text(),
timestampSecondsFormat());
98 int i_lhs = lhs.
getUid().toInt(&ok);
99 int i_rhs = rhs.
getUid().toInt(&ok);
101 return i_lhs < i_rhs;
111 Landmarks::Landmarks() : QObject(NULL)
129 mLandmarks[landmark.
getUid()] = landmark;
130 emit landmarkAdded(landmark.
getUid());
133 void Landmarks::removeLandmark(QString uid)
135 mLandmarks.erase(uid);
136 emit landmarkRemoved(uid);
139 void Landmarks::clear()
141 while (!mLandmarks.empty())
142 this->removeLandmark(mLandmarks.begin()->first);
145 void Landmarks::addXml(QDomNode dataNode)
const
147 QDomElement landmarksNode = dataNode.toElement();
148 QDomDocument doc = dataNode.ownerDocument();
150 LandmarkMap::const_iterator it = mLandmarks.begin();
151 for (; it != mLandmarks.end(); ++it)
153 QDomElement landmarkNode = doc.createElement(
"landmark");
154 it->second.addXml(landmarkNode);
155 landmarksNode.appendChild(landmarkNode);
159 void Landmarks::parseXml(QDomNode dataNode)
161 QDomElement landmarksNode = dataNode.toElement();
163 if (dataNode.isNull())
166 QDomElement landmarkNode = landmarksNode.firstChildElement(
"landmark");
167 for (; !landmarkNode.isNull(); landmarkNode = landmarkNode.nextSiblingElement(
"landmark"))
171 this->setLandmark(landmark);
179 LandmarkProperty::LandmarkProperty(
const QString& uid,
const QString& name,
bool active) :
180 mUid(uid), mName(name), mActive(active)
213 dataNode.toElement().setAttribute(
"uid",
qstring_cast(mUid));
214 dataNode.toElement().setAttribute(
"active",
qstring_cast(mActive));
215 dataNode.toElement().setAttribute(
"name",
qstring_cast(mName));
219 if (dataNode.isNull())
222 QDomElement base = dataNode.toElement();
223 mUid = base.attribute(
"uid");
224 mActive = base.attribute(
"active").toInt();
225 mName = base.attribute(
"name");
QString qstring_cast(const T &val)
bool operator<(const Landmark &lhs, const Landmark &rhs)
One landmark, or fiducial, coordinate.
QDateTime getTimestamp() const
QString timestampSecondsFormat()
boost::shared_ptr< class Landmarks > LandmarksPtr
void addXml(QDomNode &dataNode)
Landmark(QString uid="", Vector3D coord=Vector3D(0, 0, 0))
void addXml(QDomNode &dataNode) const
void parseXml(QDomNode &dataNode)
Vector3D getCoord() const
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
std::map< QString, class Landmark > LandmarkMap
void setName(const QString &name)
void setActive(bool active)
void parseXml(QDomNode &dataNode)