summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-07 18:46:39 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-11-07 18:46:39 (GMT)
commit4df750adb0a170df607613be5f258c77ef5b0d35 (patch)
tree4f70ba8286a11e882e395574b85f1350af254d89
parentc29df33b130e65cafcb11f116b258b7113b3619b (diff)
Use a consistent default zoom value.
-rw-r--r--src/plugins/runner/osm/OsmNode.cpp11
-rw-r--r--src/plugins/runner/osm/OsmNode.h4
-rw-r--r--src/plugins/runner/osm/OsmRelation.cpp4
-rw-r--r--src/plugins/runner/osm/OsmWay.cpp4
4 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/runner/osm/OsmNode.cpp b/src/plugins/runner/osm/OsmNode.cpp
index 42b4c79..7287b38 100644
--- a/src/plugins/runner/osm/OsmNode.cpp
+++ b/src/plugins/runner/osm/OsmNode.cpp
@@ -63,8 +63,8 @@ void OsmNode::create(GeoDataDocument *document) const
}
placemark->setVisualCategory(category);
placemark->setStyle( GeoDataStyle::Ptr() );
- placemark->setZoomLevel(zoomLevelFor(category, 18));
- placemark->setPopularity(popularityFor(category, 100));
+ placemark->setZoomLevel(zoomLevelFor(category));
+ placemark->setPopularity(popularityFor(category));
if (category >= GeoDataPlacemark::PlaceCity && category <= GeoDataPlacemark::PlaceVillageCapital) {
int const population = m_osmData.tagValue(QStringLiteral("population")).toInt();
@@ -99,8 +99,9 @@ int OsmNode::populationIndex(qint64 population) const
return popidx;
}
-int OsmNode::zoomLevelFor(GeoDataPlacemark::GeoDataVisualCategory category, int defaultValue)
+int OsmNode::zoomLevelFor(GeoDataPlacemark::GeoDataVisualCategory category)
{
+ int const defaultValue = 18;
if (m_zoomLevels.isEmpty()) {
m_zoomLevels[GeoDataPlacemark::PlaceCityCapital] = 9;
m_zoomLevels[GeoDataPlacemark::PlaceCity] = 9;
@@ -125,10 +126,10 @@ int OsmNode::zoomLevelFor(GeoDataPlacemark::GeoDataVisualCategory category, int
return m_zoomLevels.value(category, defaultValue);
}
-qint64 OsmNode::popularityFor(GeoDataPlacemark::GeoDataVisualCategory category, qint64 defaultValue)
+qint64 OsmNode::popularityFor(GeoDataPlacemark::GeoDataVisualCategory category)
{
+ qint64 const defaultValue = 100;
if (m_popularities.isEmpty()) {
-
QVector<GeoDataPlacemark::GeoDataVisualCategory> popularities;
popularities << GeoDataPlacemark::PlaceCityCapital;
popularities << GeoDataPlacemark::PlaceTownCapital;
diff --git a/src/plugins/runner/osm/OsmNode.h b/src/plugins/runner/osm/OsmNode.h
index 5f89ff2..9599b86 100644
--- a/src/plugins/runner/osm/OsmNode.h
+++ b/src/plugins/runner/osm/OsmNode.h
@@ -33,8 +33,8 @@ public:
void create(GeoDataDocument* document) const;
- static int zoomLevelFor(GeoDataPlacemark::GeoDataVisualCategory category, int defaultValue);
- static qint64 popularityFor(GeoDataPlacemark::GeoDataVisualCategory category, qint64 defaultValue);
+ static int zoomLevelFor(GeoDataPlacemark::GeoDataVisualCategory category);
+ static qint64 popularityFor(GeoDataPlacemark::GeoDataVisualCategory category);
private:
int populationIndex(qint64 population) const;
diff --git a/src/plugins/runner/osm/OsmRelation.cpp b/src/plugins/runner/osm/OsmRelation.cpp
index 272d648..70144fd 100644
--- a/src/plugins/runner/osm/OsmRelation.cpp
+++ b/src/plugins/runner/osm/OsmRelation.cpp
@@ -144,8 +144,8 @@ 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(OsmNode::zoomLevelFor(outerCategory, 17));
- placemark->setPopularity(OsmNode::popularityFor(outerCategory, 100));
+ placemark->setZoomLevel(OsmNode::zoomLevelFor(outerCategory));
+ placemark->setPopularity(OsmNode::popularityFor(outerCategory));
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 3055ce0..98dedbe 100644
--- a/src/plugins/runner/osm/OsmWay.cpp
+++ b/src/plugins/runner/osm/OsmWay.cpp
@@ -74,8 +74,8 @@ void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes, QSet<qint6
placemark->setName(m_osmData.tagValue(QStringLiteral("ref")));
}
placemark->setOsmData(osmData);
- placemark->setZoomLevel(OsmNode::zoomLevelFor(placemark->visualCategory(), 17));
- placemark->setPopularity(OsmNode::popularityFor(placemark->visualCategory(), 100));
+ placemark->setZoomLevel(OsmNode::zoomLevelFor(placemark->visualCategory()));
+ placemark->setPopularity(OsmNode::popularityFor(placemark->visualCategory()));
placemark->setVisible(placemark->visualCategory() != GeoDataPlacemark::None);
document->append(placemark);