mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
Started adding DOM writing to GPSData
git-svn-id: http://svn.osgeo.org/qgis/trunk@1744 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
dc0795561e
commit
70b8806b9d
@ -306,6 +306,22 @@ bool GPSData::parseDom(QDomDocument& qdd) {
|
||||
}
|
||||
|
||||
|
||||
void GPSData::fillDom(QDomDocument& qdd) {
|
||||
QDomElement gpxElt = qdd.createElement("gpx");
|
||||
qdd.appendChild(gpxElt);
|
||||
gpxElt.setAttribute("version", "1.0");
|
||||
for (int i = 0; i < waypoints.size(); ++i) {
|
||||
QDomElement wptElt = qdd.createElement("wpt");
|
||||
wptElt.setAttribute("lat", QString("%1").arg(waypoints[i].lat, 0, 'f'));
|
||||
wptElt.setAttribute("lon", QString("%1").arg(waypoints[i].lon, 0, 'f'));
|
||||
QDomElement nameElt = qdd.createElement("name");
|
||||
nameElt.appendChild(qdd.createTextNode(waypoints[i].name));
|
||||
wptElt.appendChild(nameElt);
|
||||
gpxElt.appendChild(wptElt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GPSData::parseGPX(QDomNode& node) {
|
||||
// start parsing child nodes
|
||||
node = node.firstChild();
|
||||
|
@ -172,6 +172,9 @@ class GPSData {
|
||||
QDomDocument and return true, otherwise it will return false. */
|
||||
bool parseDom(QDomDocument& qdd);
|
||||
|
||||
/** This function will fill the given QDomDocument with child nodes that
|
||||
represent the data in this GPSData object as a GPX tree. */
|
||||
void fillDom(QDomDocument& qdd);
|
||||
|
||||
/** This function returns a pointer to the GPSData object associated with
|
||||
the file @c filename. If the file does not exist or can't be parsed,
|
||||
|
Loading…
x
Reference in New Issue
Block a user