mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 19:55:53 +01:00
Yet another WMS bounding box computation fix
This commit is contained in:
parent
021558b114
commit
88d6904ded
@ -92,6 +92,28 @@ RectC RectC::operator&(const RectC &r) const
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RectC RectC::normalized() const
|
||||||
|
{
|
||||||
|
RectC r;
|
||||||
|
|
||||||
|
if (_br.lon() < _tl.lon()) {
|
||||||
|
r._tl.setLon(_br.lon());
|
||||||
|
r._br.setLon(_tl.lon());
|
||||||
|
} else {
|
||||||
|
r._tl.setLon(_tl.lon());
|
||||||
|
r._br.setLon(_br.lon());
|
||||||
|
}
|
||||||
|
if (_br.lat() < _tl.lat()) {
|
||||||
|
r._tl.setLat(_br.lat());
|
||||||
|
r._br.setLat(_tl.lat());
|
||||||
|
} else {
|
||||||
|
r._tl.setLat(_tl.lat());
|
||||||
|
r._br.setLat(_br.lat());
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
void RectC::unite(const Coordinates &c)
|
void RectC::unite(const Coordinates &c)
|
||||||
{
|
{
|
||||||
if (isNull()) {
|
if (isNull()) {
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
RectC &operator&=(const RectC &r) {*this = *this & r; return *this;}
|
RectC &operator&=(const RectC &r) {*this = *this & r; return *this;}
|
||||||
|
|
||||||
void unite(const Coordinates &c);
|
void unite(const Coordinates &c);
|
||||||
|
RectC normalized() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Coordinates _tl, _br;
|
Coordinates _tl, _br;
|
||||||
|
@ -80,8 +80,10 @@ bool WMSMap::loadWMS()
|
|||||||
|
|
||||||
_yx = (_setup.yx() && wms.version() >= "1.3.0") ? true : false;
|
_yx = (_setup.yx() && wms.version() >= "1.3.0") ? true : false;
|
||||||
_projection = wms.projection();
|
_projection = wms.projection();
|
||||||
_boundingBox = QRectF(_projection.ll2xy(wms.boundingBox().topLeft()),
|
RectC bb = wms.boundingBox().normalized();
|
||||||
_projection.ll2xy(wms.boundingBox().bottomRight()));
|
_boundingBox = QRectF(_projection.ll2xy(Coordinates(bb.topLeft().lon(),
|
||||||
|
bb.bottomRight().lat())), _projection.ll2xy(Coordinates(
|
||||||
|
bb.bottomRight().lon(), bb.topLeft().lat())));
|
||||||
_tileLoader = TileLoader(tileUrl(wms.version()), tilesDir(),
|
_tileLoader = TileLoader(tileUrl(wms.version()), tilesDir(),
|
||||||
_setup.authorization());
|
_setup.authorization());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user