From 3e6ae6d1ae30a068c4f65ae593cd9579b30a8710 Mon Sep 17 00:00:00 2001 From: larsl Date: Sun, 16 May 2004 21:23:27 +0000 Subject: [PATCH] Added url/link parsing to the GPX provider git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@1416 c8812cc2-4d05-0410-92ff-de0c093fc19c --- ChangeLog | 5 ++++- configure.in | 4 ++-- providers/gpx/gpsdata.cpp | 9 +++++++++ providers/gpx/qgsgpxprovider.cpp | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97dd0ec9d49..6abdb21b00b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,11 @@ QGIS Change Log -ChangeLog,v 1.78 2004/05/16 15:16:05 larsl Exp +ChangeLog,v 1.79 2004/05/16 21:23:27 larsl Exp ------------------------------------------------------------------------------ Version 0.3 'Madison' .... development version +2004-05-16 [larsl] 0.2.0devel21 +** Added url/link parsing to the GPX provider + 2004-05-16 [larsl] 0.2.0devel20 ** Corrected file name extension for PNG files diff --git a/configure.in b/configure.in index 3063f7018d2..54cccaa9638 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -dnl configure.in,v 1.82 2004/05/16 15:16:05 larsl Exp +dnl configure.in,v 1.83 2004/05/16 21:23:27 larsl Exp AC_INIT @@ -24,7 +24,7 @@ dnl --------------------------------------------------------------------------- MAJOR_VERSION=0 MINOR_VERSION=2 MICRO_VERSION=0 -EXTRA_VERSION=20 +EXTRA_VERSION=21 if test $EXTRA_VERSION -eq 0; then VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION} else diff --git a/providers/gpx/gpsdata.cpp b/providers/gpx/gpsdata.cpp index 1893272669c..e17c65824e0 100644 --- a/providers/gpx/gpsdata.cpp +++ b/providers/gpx/gpsdata.cpp @@ -202,6 +202,11 @@ bool GPSData::parseGPX(QDomNode& node) { if (!node2.isNull()) wpt.name = (const char*)node2.firstChild().nodeValue(); + // url is optional + node2 = node.namedItem("url"); + if (!node2.isNull()) + wpt.url = (const char*)node2.firstChild().nodeValue(); + // ele is optional node2 = node.namedItem("ele"); if (!node2.isNull()) @@ -370,6 +375,10 @@ bool GPSData::parseLOC(QDomNode& node) { if (!(node2 = node.namedItem("name")).isNull()) wpt.name = (const char*)node2.firstChild().nodeValue(); + // link is optional + if (!(node2 = node.namedItem("link")).isNull()) + wpt.url = (const char*)node2.firstChild().nodeValue(); + // coord with lat and lon is required if ((node2 = node.namedItem("coord")).isNull()) return false; diff --git a/providers/gpx/qgsgpxprovider.cpp b/providers/gpx/qgsgpxprovider.cpp index 146c540d3bf..210cab47b3b 100644 --- a/providers/gpx/qgsgpxprovider.cpp +++ b/providers/gpx/qgsgpxprovider.cpp @@ -57,6 +57,7 @@ QgsGPXProvider::QgsGPXProvider(QString uri) : mDataSourceUri(uri), attributeFields.push_back(QgsField("lat", "text")); attributeFields.push_back(QgsField("lon", "text")); attributeFields.push_back(QgsField("ele", "text")); + attributeFields.push_back(QgsField("url", "text")); } else if (mFeatureType == "route" || mFeatureType == "track") { mGeomType = 2; @@ -147,6 +148,7 @@ QgsFeature *QgsGPXProvider::getNextFeature(bool fetchAttributes) { result->addAttribute("lon", QString("%1").arg(wpt.lon)); if (!isnan(wpt.ele)) result->addAttribute("ele", QString("%1").arg(wpt.ele)); + result->addAttribute("url", wpt.url); } ++mFid;