mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Fixed bounds computation
This commit is contained in:
parent
9d5725f732
commit
b8a2b76d7c
@ -12,6 +12,7 @@
|
|||||||
#include "ozf.h"
|
#include "ozf.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "mapfile.h"
|
#include "mapfile.h"
|
||||||
|
#include "rectd.h"
|
||||||
#include "ozimap.h"
|
#include "ozimap.h"
|
||||||
|
|
||||||
|
|
||||||
@ -334,9 +335,9 @@ int OziMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
if (!rect.isValid())
|
if (!rect.isValid())
|
||||||
rescale(0);
|
rescale(0);
|
||||||
else {
|
else {
|
||||||
QPointF tl(_transform.proj2img(_projection.ll2xy(rect.topLeft())));
|
RectD prect(rect, _projection);
|
||||||
QPointF br(_transform.proj2img(_projection.ll2xy(rect.bottomRight())));
|
QRectF sbr(_transform.proj2img(prect.topLeft()),
|
||||||
QRect sbr(QRectF(tl, br).toRect().normalized());
|
_transform.proj2img(prect.bottomRight()));
|
||||||
|
|
||||||
for (int i = 0; i < _ozf->zooms(); i++) {
|
for (int i = 0; i < _ozf->zooms(); i++) {
|
||||||
rescale(i);
|
rescale(i);
|
||||||
|
@ -127,10 +127,8 @@ QRectF WMSMap::bounds()
|
|||||||
int WMSMap::zoomFit(const QSize &size, const RectC &rect)
|
int WMSMap::zoomFit(const QSize &size, const RectC &rect)
|
||||||
{
|
{
|
||||||
if (rect.isValid()) {
|
if (rect.isValid()) {
|
||||||
PointD tl(_projection.ll2xy(rect.topLeft()));
|
RectD prect(rect, _projection);
|
||||||
PointD br(_projection.ll2xy(rect.bottomRight()));
|
PointD sc(prect.width() / size.width(), prect.height() / size.height());
|
||||||
PointD sc((br.x() - tl.x()) / size.width(), (tl.y() - br.y())
|
|
||||||
/ size.height());
|
|
||||||
double resolution = qMax(qAbs(sc.x()), qAbs(sc.y()));
|
double resolution = qMax(qAbs(sc.x()), qAbs(sc.y()));
|
||||||
if (_projection.isGeographic())
|
if (_projection.isGeographic())
|
||||||
resolution *= deg2rad(WGS84_RADIUS);
|
resolution *= deg2rad(WGS84_RADIUS);
|
||||||
|
@ -103,10 +103,8 @@ QRectF WMTSMap::bounds()
|
|||||||
int WMTSMap::zoomFit(const QSize &size, const RectC &rect)
|
int WMTSMap::zoomFit(const QSize &size, const RectC &rect)
|
||||||
{
|
{
|
||||||
if (rect.isValid()) {
|
if (rect.isValid()) {
|
||||||
PointD tl(_projection.ll2xy(rect.topLeft()));
|
RectD prect(rect, _projection);
|
||||||
PointD br(_projection.ll2xy(rect.bottomRight()));
|
PointD sc(prect.width() / size.width(), prect.height() / size.height());
|
||||||
PointD sc((br.x() - tl.x()) / size.width(), (tl.y() - br.y())
|
|
||||||
/ size.height());
|
|
||||||
double resolution = qMax(qAbs(sc.x()), qAbs(sc.y()));
|
double resolution = qMax(qAbs(sc.x()), qAbs(sc.y()));
|
||||||
if (_projection.isGeographic())
|
if (_projection.isGeographic())
|
||||||
resolution *= deg2rad(WGS84_RADIUS);
|
resolution *= deg2rad(WGS84_RADIUS);
|
||||||
|
Loading…
Reference in New Issue
Block a user