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());
113 mLandmarks.erase(uid);
114 emit landmarkRemoved(uid);
119 while (!mLandmarks.empty())
120 this->removeLandmark(mLandmarks.begin()->first);
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);
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);
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");
QString qstring_cast(const T &val)
bool operator<(const Landmark &lhs, const Landmark &rhs)
LandmarkMap getLandmarks()
One landmark, or fiducial, coordinate.
QDateTime getTimestamp() const
void removeLandmark(QString uid)
QString timestampSecondsFormat()
LandmarkProperty(const QString &uid="", const QString &name="", bool active=true)
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 addXml(QDomNode dataNode) const
void setLandmark(Landmark landmark)
void parseXml(QDomNode &dataNode)
Vector3D getCoord() const
static LandmarksPtr create()
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)
void parseXml(QDomNode dataNode)
Namespace for all CustusX production code.