Skip to content
Permalink
Browse files

Use a sensible default map extent for .gpx files with no data in them…

… (as

produced by the create gpx layer command). Fixes a problem where digitising
didn't work when loading a blank .gpx file as the first layer in qgis.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6279 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m
g_j_m committed Dec 18, 2006
1 parent 4282dec commit 57eeba70c6a1ebc5929776741ea40a22e2d46b70
Showing with 15 additions and 2 deletions.
  1. +12 −1 src/providers/gpx/gpsdata.cpp
  2. +3 −1 src/providers/gpx/gpsdata.h
@@ -135,6 +135,15 @@ QgsRect* GPSData::getExtent() const {
return new QgsRect(xMin, yMin, xMax, yMax);
}

void GPSData::setNoDataExtent() {
if (getNumberOfWaypoints() + getNumberOfRoutes() + getNumberOfTracks() == 0)
{
xMin = -1.0;
xMax = 1.0;
yMin = -1.0;
yMax = 1.0;
}
}

int GPSData::getNumberOfWaypoints() const {
return waypoints.size();
@@ -345,7 +354,9 @@ GPSData* GPSData::getData(const QString& filename) {
XML_ParserFree(p);
if (failed)
return 0;


data->setNoDataExtent();

dataObjects[filename] = std::pair<GPSData*, unsigned>(data, 0);
}
else
@@ -132,7 +132,9 @@ class GPSData {
which is the bounding box for this dataset. You'll have to deallocate it
yourself. */
QgsRect* getExtent() const;


/** Sets a default sensible extent. Only applies when there are no actual data. */
void setNoDataExtent();

/** Returns the number of waypoints in this dataset. */
int getNumberOfWaypoints() const;

0 comments on commit 57eeba7

Please sign in to comment.
You can’t perform that action at this time.