Commit c2e83a46 authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Improve precision

parent ad0515bd
......@@ -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;
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment