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:
larsl 2004-07-12 10:54:41 +00:00
parent dc0795561e
commit 70b8806b9d
2 changed files with 19 additions and 0 deletions

View File

@ -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();

View File

@ -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,