24 mUid(uid), mCoord(coord)
26 mTimestamp = QDateTime::currentDateTime();
49 QDomDocument doc = dataNode.ownerDocument();
51 dataNode.toElement().setAttribute(
"uid",
qstring_cast(mUid));
53 QDomElement coordNode = doc.createElement(
"coord");
54 coordNode.appendChild(doc.createTextNode(
qstring_cast(mCoord)));
55 dataNode.appendChild(coordNode);
57 QDomElement timestampNode = doc.createElement(
"timestamp");
59 dataNode.appendChild(timestampNode);
63 if (dataNode.isNull())
66 QDomElement base = dataNode.toElement();
68 mUid = base.attribute(
"uid");
69 mCoord = Vector3D::fromString(dataNode.namedItem(
"coord").toElement().text());
70 mTimestamp = QDateTime::fromString(dataNode.namedItem(
"timestamp").toElement().text(),
timestampSecondsFormat());
77 int i_lhs = lhs.
getUid().toInt(&ok);
78 int i_rhs = rhs.
getUid().toInt(&ok);
90 Landmarks::Landmarks() : QObject(NULL)
107 mLandmarks[landmark.
getUid()] = landmark;
108 emit landmarkAdded(landmark.
getUid());
111 void Landmarks::removeLandmark(QString uid)
113 mLandmarks.erase(uid);
114 emit landmarkRemoved(uid);
117 void Landmarks::clear()
119 while (!mLandmarks.empty())
120 this->removeLandmark(mLandmarks.begin()->first);
123 void Landmarks::addXml(QDomNode dataNode)
const
125 QDomElement landmarksNode = dataNode.toElement();
126 QDomDocument doc = dataNode.ownerDocument();
128 LandmarkMap::const_iterator it = mLandmarks.begin();
129 for (; it != mLandmarks.end(); ++it)
131 QDomElement landmarkNode = doc.createElement(
"landmark");
132 it->second.addXml(landmarkNode);
133 landmarksNode.appendChild(landmarkNode);
137 void Landmarks::parseXml(QDomNode dataNode)
139 QDomElement landmarksNode = dataNode.toElement();
141 if (dataNode.isNull())
144 QDomElement landmarkNode = landmarksNode.firstChildElement(
"landmark");
145 for (; !landmarkNode.isNull(); landmarkNode = landmarkNode.nextSiblingElement(
"landmark"))
149 this->setLandmark(landmark);
157 LandmarkProperty::LandmarkProperty(
const QString& uid,
const QString& name,
bool active) :
158 mUid(uid), mName(name), mActive(active)
191 dataNode.toElement().setAttribute(
"uid",
qstring_cast(mUid));
192 dataNode.toElement().setAttribute(
"active",
qstring_cast(mActive));
193 dataNode.toElement().setAttribute(
"name",
qstring_cast(mName));
197 if (dataNode.isNull())
200 QDomElement base = dataNode.toElement();
201 mUid = base.attribute(
"uid");
202 mActive = base.attribute(
"active").toInt();
203 mName = base.attribute(
"name");