mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-26 04:00:49 +01:00
Fixed map fitting algorithm
This commit is contained in:
parent
f0b7abdb72
commit
8bc575aef2
@ -83,21 +83,17 @@ void Atlas::computeBounds()
|
|||||||
qSort(m.begin(), m.end(), xCmp);
|
qSort(m.begin(), m.end(), xCmp);
|
||||||
offsets[_maps.indexOf(m.first())].setX(w);
|
offsets[_maps.indexOf(m.first())].setX(w);
|
||||||
for (int i = 1; i < m.size(); i++) {
|
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());
|
w += round(m.at(i-1)->pp2xy(TL(m.at(i))).x());
|
||||||
offsets[_maps.indexOf(m.at(i))].setX(w);
|
offsets[_maps.indexOf(m.at(i))].setX(w);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
qSort(m.begin(), m.end(), yCmp);
|
qSort(m.begin(), m.end(), yCmp);
|
||||||
offsets[_maps.indexOf(m.first())].setY(h);
|
offsets[_maps.indexOf(m.first())].setY(h);
|
||||||
for (int i = 1; i < m.size(); i++) {
|
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());
|
h += round(m.at(i-1)->pp2xy(TL(m.at(i))).y());
|
||||||
offsets[_maps.indexOf(m.at(i))].setY(h);
|
offsets[_maps.indexOf(m.at(i))].setY(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < _maps.count(); i++)
|
for (int i = 0; i < _maps.count(); i++)
|
||||||
_bounds.append(QPair<QRectF, QRectF>(QRectF(TL(_maps.at(i)),
|
_bounds.append(QPair<QRectF, QRectF>(QRectF(TL(_maps.at(i)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user