Skip to content

Commit

Permalink
Fix for #546, too low precsision in GPX create layer. Also fixed some…
Browse files Browse the repository at this point in the history
… compiler wanrnings.

git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6478 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Feb 1, 2007
1 parent 81fde95 commit 109eca7
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/providers/gpx/gpsdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "gpsdata.h"
#include <qgslogger.h>

#define OUTPUT_PRECISION 12

QString GPSObject::xmlify(const QString& str) {
QString tmp = str;
tmp.replace("&", "&amp;");
Expand Down Expand Up @@ -84,7 +86,8 @@ void GPSExtended::writeXML(QTextStream& stream) {


void Waypoint::writeXML(QTextStream& stream) {
stream<<"<wpt lat=\""<<lat<<"\" lon=\""<<lon<<"\">\n";
stream << "<wpt lat=\"" << QString::number(lat, 'f', OUTPUT_PRECISION) <<
"\" lon=\"" << QString::number(lon, 'f', OUTPUT_PRECISION) << "\">\n";
GPSPoint::writeXML(stream);
stream<<"</wpt>\n";
}
Expand All @@ -93,9 +96,9 @@ void Waypoint::writeXML(QTextStream& stream) {
void Route::writeXML(QTextStream& stream) {
stream<<"<rte>\n";
GPSExtended::writeXML(stream);
for (int i = 0; i < points.size(); ++i) {
stream<<"<rtept lat=\""<<points[i].lat
<<"\" lon=\""<<points[i].lon<<"\">\n";
for (unsigned int i = 0; i < points.size(); ++i) {
stream<<"<rtept lat=\""<< QString::number(points[i].lat, 'f', OUTPUT_PRECISION)
<<"\" lon=\"" << QString::number(points[i].lon, 'f', OUTPUT_PRECISION) <<"\">\n";
points[i].writeXML(stream);
stream<<"</rtept>\n";
}
Expand All @@ -106,11 +109,13 @@ void Route::writeXML(QTextStream& stream) {
void Track::writeXML(QTextStream& stream) {
stream<<"<trk>\n";
GPSExtended::writeXML(stream);
for (int i = 0; i < segments.size(); ++i) {
for (unsigned int i = 0; i < segments.size(); ++i) {
stream<<"<trkseg>\n";
for (int j = 0; j < segments[i].points.size(); ++j) {
stream<<"<trkpt lat=\""<<segments[i].points[j].lat
<<"\" lon=\""<<segments[i].points[j].lon<<"\">\n";
for (unsigned int j = 0; j < segments[i].points.size(); ++j) {
stream<<"<trkpt lat=\"" <<
QString::number(segments[i].points[j].lat, 'f', OUTPUT_PRECISION) <<
"\" lon=\""<< QString::number(segments[i].points[j].lon, 'f', OUTPUT_PRECISION) <<
"\">\n";
segments[i].points[j].writeXML(stream);
stream<<"</trkpt>\n";
}
Expand Down

0 comments on commit 109eca7

Please sign in to comment.