1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Fixed map fitting algorithm

This commit is contained in:
Martin Tůma 2017-04-04 01:19:17 +02:00
parent f0b7abdb72
commit 8bc575aef2

View File

@ -83,21 +83,17 @@ void Atlas::computeBounds()
qSort(m.begin(), m.end(), xCmp);
offsets[_maps.indexOf(m.first())].setX(w);
for (int i = 1; i < m.size(); i++) {
if (TL(m.at(i)).x() > TL(m.at(i-1)).x()) {
w += round(m.at(i-1)->pp2xy(TL(m.at(i))).x());
offsets[_maps.indexOf(m.at(i))].setX(w);
}
}
qSort(m.begin(), m.end(), yCmp);
offsets[_maps.indexOf(m.first())].setY(h);
for (int i = 1; i < m.size(); i++) {
if (TL(m.at(i)).y() < TL(m.at(i-1)).y()) {
h += round(m.at(i-1)->pp2xy(TL(m.at(i))).y());
offsets[_maps.indexOf(m.at(i))].setY(h);
}
}
}
for (int i = 0; i < _maps.count(); i++)
_bounds.append(QPair<QRectF, QRectF>(QRectF(TL(_maps.at(i)),