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

Adapt number of tile border support points to tile level.

parent 0c5a3344
......@@ -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;
......
......@@ -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>
......
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