mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-19 04:02:09 +01:00
Properly handle Mapsforge world maps
This commit is contained in:
parent
441ccc59d0
commit
d39bd296f6
@ -377,6 +377,7 @@ bool MapData::readHeader()
|
|||||||
|
|
||||||
_bounds = RectC(Coordinates(MD(minLon), MD(maxLat)),
|
_bounds = RectC(Coordinates(MD(minLon), MD(maxLat)),
|
||||||
Coordinates(MD(maxLon), MD(minLat)));
|
Coordinates(MD(maxLon), MD(minLat)));
|
||||||
|
_bounds &= OSM::BOUNDS;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ Coordinates OSM::m2ll(const QPointF &p)
|
|||||||
|
|
||||||
QPoint OSM::mercator2tile(const QPointF &m, int zoom)
|
QPoint OSM::mercator2tile(const QPointF &m, int zoom)
|
||||||
{
|
{
|
||||||
return QPoint(qFloor((m.x() + 180.0) / 360.0 * (1<<zoom)),
|
return QPoint(qMin(qFloor((m.x() + 180.0) / 360.0 * (1<<zoom)), (1<<zoom) - 1),
|
||||||
qFloor((1.0 - (m.y() / 180.0)) / 2.0 * (1<<zoom)));
|
qMin(qFloor((1.0 - (m.y() / 180.0)) / 2.0 * (1<<zoom)), (1<<zoom) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF OSM::tile2mercator(const QPoint &p, int zoom)
|
QPointF OSM::tile2mercator(const QPoint &p, int zoom)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user