summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-09 19:53:12 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-11-09 19:53:12 (GMT)
commit867ec8cb24a7d57daed41e73949c5441ead5e64d (patch)
tree9f761c096a362eadf3d88bceb7ab82a0b15fe26c
parent0c5a33442693a9fa2e175fc6e6502821da0ec6cb (diff)
Adapt number of tile border support points to tile level.
-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 b28c332..ac88890 100644
--- a/tools/vectorosm-tilecreator/VectorClipper.cpp
+++ b/tools/vectorosm-tilecreator/VectorClipper.cpp
@@ -49,15 +49,16 @@ VectorClipper::VectorClipper(GeoDataDocument* document, int maxZoomLevel) :
}
}
-GeoDataDocument *VectorClipper::clipTo(const GeoDataLatLonBox &tileBoundary, bool filterSmallAreas)
+GeoDataDocument *VectorClipper::clipTo(const GeoDataLatLonBox &tileBoundary, int zoomLevel)
{
bool const useBaseClipper = false;
if (useBaseClipper) {
return clipToBaseClipper(tileBoundary);
}
+ bool const filterSmallAreas = zoomLevel > 10 && zoomLevel < 17;
GeoDataDocument* tile = new GeoDataDocument();
- auto const clip = clipPath(tileBoundary);
+ auto const clip = clipPath(tileBoundary, zoomLevel);
GeoDataLinearRing ring;
ring << GeoDataCoordinates(tileBoundary.west(), tileBoundary.north());
ring << GeoDataCoordinates(tileBoundary.east(), tileBoundary.north());
@@ -248,19 +249,18 @@ GeoDataDocument *VectorClipper::clipTo(unsigned int zoomLevel, unsigned int tile
GeoDataLatLonBox tileBoundary;
m_tileProjection.geoCoordinates(zoomLevel, tileX, tileY, tileBoundary);
- bool const filterSmallAreas = zoomLevel > 10 && zoomLevel < 17;
- GeoDataDocument *tile = clipTo(tileBoundary, filterSmallAreas);
+ GeoDataDocument *tile = clipTo(tileBoundary, zoomLevel);
QString tileName = QString("%1/%2/%3").arg(zoomLevel).arg(tileX).arg(tileY);
tile->setName(tileName);
return tile;
}
-ClipperLib::Path VectorClipper::clipPath(const GeoDataLatLonBox &box) const
+ClipperLib::Path VectorClipper::clipPath(const GeoDataLatLonBox &box, int zoomLevel) const
{
using namespace ClipperLib;
Path path;
- int const steps = 20;
+ int const steps = qMax(1, 22 - 2 * zoomLevel);
qreal const scale = IntPoint::scale;
double x = box.west() * scale;
double const horizontalStep = (box.east() * scale - x) / steps;
diff --git a/tools/vectorosm-tilecreator/VectorClipper.h b/tools/vectorosm-tilecreator/VectorClipper.h
index 6cd9451..a7b47a1 100644
--- a/tools/vectorosm-tilecreator/VectorClipper.h
+++ b/tools/vectorosm-tilecreator/VectorClipper.h
@@ -32,14 +32,14 @@ class VectorClipper : public BaseFilter
public:
VectorClipper(GeoDataDocument* document, int maxZoomLevel);
- GeoDataDocument* clipTo(const GeoDataLatLonBox &box, bool filterSmallAreas);
GeoDataDocument* clipTo(unsigned int zoomLevel, unsigned int tileX, unsigned int tileY);
static bool canBeArea(GeoDataPlacemark::GeoDataVisualCategory visualCategory);
private:
+ GeoDataDocument* clipTo(const GeoDataLatLonBox &box, int zoomLevel);
GeoDataDocument* clipToBaseClipper(const GeoDataLatLonBox &box);
QVector<GeoDataPlacemark*> potentialIntersections(const GeoDataLatLonBox &box) const;
- ClipperLib::Path clipPath(const GeoDataLatLonBox &box) const;
+ ClipperLib::Path clipPath(const GeoDataLatLonBox &box, int zoomLevel) const;
qreal area(const GeoDataLinearRing &ring);
template<class T>