1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Enable world basemap projection in web mercator projection

This commit is contained in:
Martin Tůma 2020-02-17 09:47:47 +01:00
parent 27edc4d6b5
commit 2c503a2406
3 changed files with 15 additions and 0 deletions

View File

@ -28,6 +28,9 @@ public:
double left() const {return _tl.lon();}
double right() const {return _br.lon();}
double width() const {return (right() - left());}
double height() const {return (top() - bottom());}
void setLeft(double val) {_tl.rlon() = val;}
void setRight(double val) {_br.rlon() = val;}
void setTop(double val) {_tl.rlat() = val;}

View File

@ -1,5 +1,6 @@
#include <QXmlStreamReader>
#include <QDir>
#include "map/osm.h"
#include "vectortile.h"
#include "gmap.h"
@ -103,6 +104,11 @@ bool GMAP::loadTile(const QDir &dir, bool baseMap)
if (tile->zooms().min() < _zooms.min())
_zooms.setMin(tile->zooms().min());
// Limit world maps bounds so that the maps can be projected using
// the default Web Mercator projection
if (_bounds.height() > 120)
_bounds &= OSM::BOUNDS;
return true;
}

View File

@ -1,5 +1,6 @@
#include <QMap>
#include <QtEndian>
#include "map/osm.h"
#include "vectortile.h"
#include "img.h"
@ -168,6 +169,11 @@ IMG::IMG(const QString &fileName) : _file(fileName)
tile->markAsBasemap();
}
// Limit world maps bounds so that the maps can be projected using
// the default Web Mercator projection
if (_bounds.height() > 120)
_bounds &= OSM::BOUNDS;
if (!_tileTree.Count())
_errorString = "No usable map tile found";
else