summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-03 17:35:57 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-03 17:35:57 (GMT)
commitc2e83a463664c370ff83b4d6632615c8b96d80c9 (patch)
tree55369b182fe21fd4b6cdf091928e842920100efd
parentad0515bd2782e38e9560a02326dd9600b5285721 (diff)
Improve precision
-rw-r--r--tools/vectorosm-tilecreator/VectorClipper.cpp12
-rw-r--r--tools/vectorosm-tilecreator/VectorClipper.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/tools/vectorosm-tilecreator/VectorClipper.cpp b/tools/vectorosm-tilecreator/VectorClipper.cpp
index 4ff30a1..3298297 100644
--- a/tools/vectorosm-tilecreator/VectorClipper.cpp
+++ b/tools/vectorosm-tilecreator/VectorClipper.cpp
@@ -264,19 +264,19 @@ ClipperLib::Path VectorClipper::clipPath(const GeoDataLatLonBox &box) const
double y = box.north() * m_scale;
double const verticalStep = (box.south() * m_scale - y) / (steps-1);
for (int i=0; i<steps; ++i) {
- path << IntPoint(qRound(x), qRound(y));
+ path << IntPoint(qRound64(x), qRound64(y));
x += horizontalStep;
}
for (int i=0; i<steps; ++i) {
- path << IntPoint(qRound(x), qRound(y));
+ path << IntPoint(qRound64(x), qRound64(y));
y += verticalStep;
}
for (int i=0; i<steps; ++i) {
- path << IntPoint(qRound(x), qRound(y));
+ path << IntPoint(qRound64(x), qRound64(y));
x -= horizontalStep;
}
for (int i=0; i<steps; ++i) {
- path << IntPoint(qRound(x), qRound(y));
+ path << IntPoint(qRound64(x), qRound64(y));
y -= verticalStep;
}
return path;
@@ -288,7 +288,7 @@ void VectorClipper::clipPolygon(const GeoDataPlacemark *placemark, const Clipper
using namespace ClipperLib;
Path path;
foreach(auto const & node, polygon->outerBoundary()) {
- path << IntPoint(node.longitude() * m_scale, node.latitude() * m_scale);
+ path << IntPoint(qRound64(node.longitude() * m_scale), qRound64(node.latitude() * m_scale));
}
Clipper clipper;
@@ -318,7 +318,7 @@ void VectorClipper::clipPolygon(const GeoDataPlacemark *placemark, const Clipper
clipper.AddPath(path, ptClip, true);
Path innerPath;
foreach(auto const & node, innerBoundaries.at(index)) {
- innerPath << IntPoint(node.longitude() * m_scale, node.latitude() * m_scale);
+ innerPath << IntPoint(qRound64(node.longitude() * m_scale), qRound64(node.latitude() * m_scale));
}
clipper.AddPath(innerPath, ptSubject, true);
Paths innerPaths;
diff --git a/tools/vectorosm-tilecreator/VectorClipper.h b/tools/vectorosm-tilecreator/VectorClipper.h
index 7143e95..cd91614 100644
--- a/tools/vectorosm-tilecreator/VectorClipper.h
+++ b/tools/vectorosm-tilecreator/VectorClipper.h
@@ -44,7 +44,7 @@ private:
using namespace ClipperLib;
Path path;
foreach(auto const & node, *ring) {
- path << IntPoint(node.longitude() * m_scale, node.latitude() * m_scale);
+ path << IntPoint(qRound64(node.longitude() * m_scale), qRound64(node.latitude() * m_scale));
}
Clipper clipper;
@@ -78,7 +78,7 @@ private:
void copyTags(const GeoDataPlacemark &source, GeoDataPlacemark &target) const;
void copyTags(const OsmPlacemarkData &originalPlacemarkData, OsmPlacemarkData& targetOsmData) const;
- static qint64 const m_scale = 10000000;
+ static qint64 const m_scale = 10000000000;
QMap<TileId, QVector<GeoDataPlacemark*> > m_items;
int m_maxZoomLevel;