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 left() const {return _tl.lon();}
double right() const {return _br.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 setLeft(double val) {_tl.rlon() = val;}
void setRight(double val) {_br.rlon() = val;} void setRight(double val) {_br.rlon() = val;}
void setTop(double val) {_tl.rlat() = val;} void setTop(double val) {_tl.rlat() = val;}

View File

@ -1,5 +1,6 @@
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QDir> #include <QDir>
#include "map/osm.h"
#include "vectortile.h" #include "vectortile.h"
#include "gmap.h" #include "gmap.h"
@ -103,6 +104,11 @@ bool GMAP::loadTile(const QDir &dir, bool baseMap)
if (tile->zooms().min() < _zooms.min()) if (tile->zooms().min() < _zooms.min())
_zooms.setMin(tile->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; return true;
} }

View File

@ -1,5 +1,6 @@
#include <QMap> #include <QMap>
#include <QtEndian> #include <QtEndian>
#include "map/osm.h"
#include "vectortile.h" #include "vectortile.h"
#include "img.h" #include "img.h"
@ -168,6 +169,11 @@ IMG::IMG(const QString &fileName) : _file(fileName)
tile->markAsBasemap(); 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()) if (!_tileTree.Count())
_errorString = "No usable map tile found"; _errorString = "No usable map tile found";
else else