mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Move the world maps bounds limit hack to the propper place
This commit is contained in:
parent
33bbd6a592
commit
08334d7fde
@ -1,6 +1,5 @@
|
||||
#include <QXmlStreamReader>
|
||||
#include <QDir>
|
||||
#include "map/osm.h"
|
||||
#include "vectortile.h"
|
||||
#include "gmap.h"
|
||||
|
||||
@ -104,11 +103,6 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <QMap>
|
||||
#include <QtEndian>
|
||||
#include "map/osm.h"
|
||||
#include "vectortile.h"
|
||||
#include "img.h"
|
||||
|
||||
@ -169,11 +168,6 @@ 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
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "IMG/style.h"
|
||||
#include "IMG/img.h"
|
||||
#include "IMG/gmap.h"
|
||||
#include "osm.h"
|
||||
#include "pcs.h"
|
||||
#include "rectd.h"
|
||||
#include "imgmap.h"
|
||||
@ -244,6 +245,11 @@ IMGMap::IMGMap(const QString &fileName, QObject *parent)
|
||||
return;
|
||||
}
|
||||
|
||||
// Limit world maps bounds so that the maps can be projected using
|
||||
// the default Web Mercator projection
|
||||
_dataBounds = (_data->bounds().height() > 120)
|
||||
? _data->bounds() & OSM::BOUNDS : _data->bounds();
|
||||
|
||||
_zoom = _data->zooms().min();
|
||||
updateTransform();
|
||||
|
||||
@ -305,7 +311,7 @@ Transform IMGMap::transform(int zoom) const
|
||||
{
|
||||
double scale = _projection.isGeographic()
|
||||
? 360.0 / (1<<zoom) : (2.0 * M_PI * WGS84_RADIUS) / (1<<zoom);
|
||||
PointD topLeft(_projection.ll2xy(_data->bounds().topLeft()));
|
||||
PointD topLeft(_projection.ll2xy(_dataBounds.topLeft()));
|
||||
return Transform(ReferencePoint(PointD(0, 0), topLeft),
|
||||
PointD(scale, scale));
|
||||
}
|
||||
@ -314,7 +320,7 @@ void IMGMap::updateTransform()
|
||||
{
|
||||
_transform = transform(_zoom);
|
||||
|
||||
RectD prect(_data->bounds(), _projection);
|
||||
RectD prect(_dataBounds, _projection);
|
||||
_bounds = QRectF(_transform.proj2img(prect.topLeft()),
|
||||
_transform.proj2img(prect.bottomRight()));
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
Projection _projection;
|
||||
Transform _transform;
|
||||
QRectF _bounds;
|
||||
RectC _dataBounds;
|
||||
|
||||
bool _valid;
|
||||
QString _errorString;
|
||||
|
Loading…
Reference in New Issue
Block a user