mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
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
This commit is contained in:
parent
4282deca33
commit
57eeba70c6
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user