summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-17 19:13:26 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-20 17:02:01 (GMT)
commit3199b4f490bd4260aeba21d18e46f6427b38c79e (patch)
tree5cd77f9a7f91690ca94847098f428055ca09fe1f
parent42d1c5068ce22ee385a03abab8b173dbd5fc4372 (diff)
Fix clip path calculation
(cherry picked from commit 057b74d278197339683d727862e138afe3468979)
-rw-r--r--tools/vectorosm-tilecreator/VectorClipper.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/vectorosm-tilecreator/VectorClipper.cpp b/tools/vectorosm-tilecreator/VectorClipper.cpp
index da290b8..cf0fc29 100644
--- a/tools/vectorosm-tilecreator/VectorClipper.cpp
+++ b/tools/vectorosm-tilecreator/VectorClipper.cpp
@@ -255,25 +255,29 @@ ClipperLib::Path VectorClipper::clipPath(const GeoDataLatLonBox &box) const
Path path;
int const steps = 20;
double x = box.west() * m_scale;
- double const horizontalStep = (box.east() * m_scale - x) / (steps-1);
+ double const horizontalStep = (box.east() * m_scale - x) / steps;
double y = box.north() * m_scale;
- double const verticalStep = (box.south() * m_scale - y) / (steps-1);
+ double const verticalStep = (box.south() * m_scale - y) / steps;
for (int i=0; i<steps; ++i) {
path << IntPoint(qRound64(x), qRound64(y));
x += horizontalStep;
}
+ path << IntPoint(qRound64(box.east() * m_scale), qRound64(box.north() * m_scale));
for (int i=0; i<steps; ++i) {
path << IntPoint(qRound64(x), qRound64(y));
y += verticalStep;
}
+ path << IntPoint(qRound64(box.east() * m_scale), qRound64(box.south() * m_scale));
for (int i=0; i<steps; ++i) {
path << IntPoint(qRound64(x), qRound64(y));
x -= horizontalStep;
}
+ path << IntPoint(qRound64(box.west() * m_scale), qRound64(box.south() * m_scale));
for (int i=0; i<steps; ++i) {
path << IntPoint(qRound64(x), qRound64(y));
y -= verticalStep;
}
+ path << IntPoint(qRound64(box.west() * m_scale), qRound64(box.north() * m_scale));
return path;
}