summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-25 19:23:21 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-11-05 16:47:12 (GMT)
commit0979657e38f8473c8abf0c32b29db23ecdf62e71 (patch)
treeb2cddc566c6ff2cadbc0002070a5af4d9f916622
parent47ea631f263a326c115f0289643fb111e1caa734 (diff)
Use placemark zoom level to restrict area icon visibility
-rw-r--r--src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp9
-rw-r--r--src/plugins/runner/osm/OsmRelation.cpp1
-rw-r--r--src/plugins/runner/osm/OsmWay.cpp1
3 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp
index 19dd1a3..5f91154 100644
--- a/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/AbstractGeoPolygonGraphicsItem.cpp
@@ -24,6 +24,8 @@
#include "MarbleDebug.h"
#include "ViewportParams.h"
+#include <QtMath>
+
namespace Marble
{
@@ -67,8 +69,11 @@ void AbstractGeoPolygonGraphicsItem::paint( GeoPainter* painter, const ViewportP
const GeoDataIconStyle& iconStyle = style()->iconStyle();
bool const hasIcon = !iconStyle.iconPath().isEmpty();
if (hasIcon) {
- QImage const icon = iconStyle.scaledIcon();
- painter->drawImage(latLonAltBox().center(), icon);
+ int const tileLevel = qLn( viewport->radius() * 4 / 256 ) / qLn( 2.0 );
+ if (tileLevel >= feature()->zoomLevel()) {
+ QImage const icon = iconStyle.scaledIcon();
+ painter->drawImage(latLonAltBox().center(), icon);
+ }
}
painter->restore();
}
diff --git a/src/plugins/runner/osm/OsmRelation.cpp b/src/plugins/runner/osm/OsmRelation.cpp
index ceaf828..cb13760 100644
--- a/src/plugins/runner/osm/OsmRelation.cpp
+++ b/src/plugins/runner/osm/OsmRelation.cpp
@@ -144,6 +144,7 @@ void OsmRelation::create(GeoDataDocument *document, OsmWays &ways, const OsmNode
placemark->setName(m_osmData.tagValue(QStringLiteral("name")));
placemark->setVisualCategory(outerCategory);
placemark->setStyle( GeoDataStyle::Ptr() );
+ placemark->setZoomLevel(17);
placemark->setVisible(outerCategory != GeoDataPlacemark::None);
placemark->setGeometry(polygon);
if (hasMultipleOuterRings) {
diff --git a/src/plugins/runner/osm/OsmWay.cpp b/src/plugins/runner/osm/OsmWay.cpp
index 151f91d..035d582 100644
--- a/src/plugins/runner/osm/OsmWay.cpp
+++ b/src/plugins/runner/osm/OsmWay.cpp
@@ -74,6 +74,7 @@ void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes, QSet<qint6
placemark->setName(m_osmData.tagValue(QStringLiteral("ref")));
}
placemark->setOsmData(osmData);
+ placemark->setZoomLevel(17);
placemark->setVisible(placemark->visualCategory() != GeoDataPlacemark::None);
document->append(placemark);