** Added URL parsing and attribute fields for route and track GPX layers

git-svn-id: http://svn.osgeo.org/qgis/trunk@1421 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
larsl 2004-05-17 10:32:19 +00:00
parent 061fe72f94
commit 7639902d1e
5 changed files with 25 additions and 7 deletions

View File

@ -1,8 +1,11 @@
QGIS Change Log
ChangeLog,v 1.80 2004/05/17 09:27:27 timlinux Exp
ChangeLog,v 1.81 2004/05/17 10:32:19 larsl Exp
------------------------------------------------------------------------------
Version 0.3 'Madison' .... development version
2004-05-17 [larsl] 0.2.0devel23
** Added URL parsing and attribute fields for route and track GPX layers
2004-05-17 [ts] 0.2.0devel22
** Added support to Save As Image to save in any QImageIO supported format.
File->SaveAsImage dialog filter list now generated automagically by

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl configure.in,v 1.84 2004/05/17 09:27:27 timlinux Exp
dnl configure.in,v 1.85 2004/05/17 10:32:19 larsl Exp
AC_INIT
@ -24,7 +24,7 @@ dnl ---------------------------------------------------------------------------
MAJOR_VERSION=0
MINOR_VERSION=2
MICRO_VERSION=0
EXTRA_VERSION=22
EXTRA_VERSION=23
if test $EXTRA_VERSION -eq 0; then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
else

View File

@ -281,6 +281,11 @@ bool GPSData::parseGPX(QDomNode& node) {
if (!node2.isNull())
rte.name = (const char*)node2.firstChild().nodeValue();
// url is optional
node2 = node.namedItem("url");
if (!node2.isNull())
rte.url = (const char*)node2.firstChild().nodeValue();
routes.push_back(rte);
}
@ -353,6 +358,12 @@ bool GPSData::parseGPX(QDomNode& node) {
node2 = node.namedItem("name");
if (!node2.isNull())
trk.name = (const char*)node2.firstChild().nodeValue();
// url is optional
node2 = node.namedItem("url");
if (!node2.isNull())
trk.url = (const char*)node2.firstChild().nodeValue();
tracks.push_back(trk);
}

View File

@ -57,7 +57,6 @@ 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;
@ -66,6 +65,7 @@ QgsGPXProvider::QgsGPXProvider(QString uri) : mDataSourceUri(uri),
std::cerr<<"Unknown feature type: "<<mFeatureType<<std::endl;
return;
}
attributeFields.push_back(QgsField("url", "text"));
mFileName = uri.left(fileNameEnd);
@ -146,7 +146,9 @@ QgsFeature *QgsGPXProvider::getNextFeature(bool fetchAttributes) {
result->addAttribute("name", wpt.name);
result->addAttribute("lat", QString("%1").arg(wpt.lat));
result->addAttribute("lon", QString("%1").arg(wpt.lon));
if (!isnan(wpt.ele))
if (isnan(wpt.ele))
result->addAttribute("ele", "");
else
result->addAttribute("ele", QString("%1").arg(wpt.ele));
result->addAttribute("url", wpt.url);
}
@ -187,6 +189,7 @@ QgsFeature *QgsGPXProvider::getNextFeature(bool fetchAttributes) {
// add attributes if they are wanted
if (fetchAttributes) {
result->addAttribute("name", rte.name);
result->addAttribute("url", rte.url);
}
++mFid;
@ -227,6 +230,7 @@ QgsFeature *QgsGPXProvider::getNextFeature(bool fetchAttributes) {
// add attributes if they are wanted
if (fetchAttributes) {
result->addAttribute("name", trk.name);
result->addAttribute("url", trk.url);
}
++mFid;
@ -238,7 +242,7 @@ QgsFeature *QgsGPXProvider::getNextFeature(bool fetchAttributes) {
return result;
}
QgsFeature * getNextFeature(std::list<int>& attlist)
QgsFeature * QgsGPXProvider::getNextFeature(std::list<int>& attlist)
{
return 0;//soon
}

View File

@ -116,7 +116,7 @@ public:
of the file.
*/
void reset();
/**Returns the minimum value of an attribute
@param position the number of the attribute*/
QString minValue(int position);