summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-09-18 15:26:27 (GMT)
committerBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-09-18 16:38:48 (GMT)
commit2ba44684ca805f3631efac570119e8789d8763c6 (patch)
tree46d6d73c0c34c0a11ad9cca5628e48d059ba4c5a
parentda611f66129294ee6ce8dc6fae95ea020a6f92da (diff)
return building tags rather than building values
-rw-r--r--src/lib/marble/StyleBuilder.cpp87
-rw-r--r--src/lib/marble/StyleBuilder.h2
-rw-r--r--src/plugins/runner/osm/OsmWay.cpp86
-rw-r--r--src/plugins/runner/osm/OsmWay.h5
4 files changed, 115 insertions, 65 deletions
diff --git a/src/lib/marble/StyleBuilder.cpp b/src/lib/marble/StyleBuilder.cpp
index ae7d7ca..e8e5cd3 100644
--- a/src/lib/marble/StyleBuilder.cpp
+++ b/src/lib/marble/StyleBuilder.cpp
@@ -1148,8 +1148,8 @@ void StyleBuilder::Private::initializeOsmVisualCategories()
s_visualCategories[OsmTag("marble:feature", "bathymetry")] = GeoDataFeature::Bathymetry;
// Default for buildings
- foreach (const QString &value, buildingValues()) {
- s_visualCategories[OsmTag("building", value)] = GeoDataFeature::Building;
+ foreach (const auto &tag, buildingTags()) {
+ s_visualCategories[tag] = GeoDataFeature::Building;
}
}
@@ -1924,25 +1924,74 @@ QStringList StyleBuilder::shopValues()
return osmShopValues;
}
-QStringList StyleBuilder::buildingValues()
+QSet<StyleBuilder::OsmTag> StyleBuilder::buildingTags()
{
+ static const QString building = QStringLiteral("building");
// from https://taginfo.openstreetmap.org/keys/building#values
- static const QStringList osmBuildingValues = QStringList()
- << "yes" << "house" << "residential" << "garage" << "apartments"
- << "hut" << "industrial" << "detached" << "roof" << "garages"
- << "commercial" << "terrace" << "shed" << "school" << "retail"
- << "farm_auxiliary" << "church" << "cathedral" << "greenhouse" << "barn"
- << "service" << "manufacture" << "construction" << "cabin"
- << "farm" << "warehouse" << "House" << "office"
- << "civic" << "Residential" << "hangar" << "public" << "university"
- << "hospital" << "chapel" << "hotel" << "train_station" << "dormitory"
- << "kindergarten" << "stable" << "storage_tank" << "shop" << "college"
- << "supermarket" << "factory" << "bungalow" << "tower" << "silo"
- << "storage" << "station" << "education" << "carport" << "houseboat"
- << "castle" << "social_facility" << "water_tower" << "container"
- << "exhibition_hall" << "monastery" << "bunker" << "shelter";
-
- return osmBuildingValues;
+ static const QSet<OsmTag> osmBuildingTags = QSet<OsmTag>()
+ << OsmTag(building, "yes")
+ << OsmTag(building, "house")
+ << OsmTag(building, "residential")
+ << OsmTag(building, "garage")
+ << OsmTag(building, "apartments")
+ << OsmTag(building, "hut")
+ << OsmTag(building, "industrial")
+ << OsmTag(building, "detached")
+ << OsmTag(building, "roof")
+ << OsmTag(building, "garages")
+ << OsmTag(building, "commercial")
+ << OsmTag(building, "terrace")
+ << OsmTag(building, "shed")
+ << OsmTag(building, "school")
+ << OsmTag(building, "retail")
+ << OsmTag(building, "farm_auxiliary")
+ << OsmTag(building, "church")
+ << OsmTag(building, "cathedral")
+ << OsmTag(building, "greenhouse")
+ << OsmTag(building, "barn")
+ << OsmTag(building, "service")
+ << OsmTag(building, "manufacture")
+ << OsmTag(building, "construction")
+ << OsmTag(building, "cabin")
+ << OsmTag(building, "farm")
+ << OsmTag(building, "warehouse")
+ << OsmTag(building, "House")
+ << OsmTag(building, "office")
+ << OsmTag(building, "civic")
+ << OsmTag(building, "Residential")
+ << OsmTag(building, "hangar")
+ << OsmTag(building, "public")
+ << OsmTag(building, "university")
+ << OsmTag(building, "hospital")
+ << OsmTag(building, "chapel")
+ << OsmTag(building, "hotel")
+ << OsmTag(building, "train_station")
+ << OsmTag(building, "dormitory")
+ << OsmTag(building, "kindergarten")
+ << OsmTag(building, "stable")
+ << OsmTag(building, "storage_tank")
+ << OsmTag(building, "shop")
+ << OsmTag(building, "college")
+ << OsmTag(building, "supermarket")
+ << OsmTag(building, "factory")
+ << OsmTag(building, "bungalow")
+ << OsmTag(building, "tower")
+ << OsmTag(building, "silo")
+ << OsmTag(building, "storage")
+ << OsmTag(building, "station")
+ << OsmTag(building, "education")
+ << OsmTag(building, "carport")
+ << OsmTag(building, "houseboat")
+ << OsmTag(building, "castle")
+ << OsmTag(building, "social_facility")
+ << OsmTag(building, "water_tower")
+ << OsmTag(building, "container")
+ << OsmTag(building, "exhibition_hall")
+ << OsmTag(building, "monastery")
+ << OsmTag(building, "bunker")
+ << OsmTag(building, "shelter");
+
+ return osmBuildingTags;
}
GeoDataFeature::GeoDataVisualCategory StyleBuilder::determineVisualCategory(const OsmPlacemarkData &osmData)
diff --git a/src/lib/marble/StyleBuilder.h b/src/lib/marble/StyleBuilder.h
index cb55aa8..04c05e0 100644
--- a/src/lib/marble/StyleBuilder.h
+++ b/src/lib/marble/StyleBuilder.h
@@ -91,7 +91,7 @@ public:
static QHash<OsmTag, GeoDataFeature::GeoDataVisualCategory>::const_iterator end();
static QStringList shopValues();
- static QStringList buildingValues();
+ static QSet<OsmTag> buildingTags();
static GeoDataFeature::GeoDataVisualCategory determineVisualCategory(const OsmPlacemarkData &osmData);
diff --git a/src/plugins/runner/osm/OsmWay.cpp b/src/plugins/runner/osm/OsmWay.cpp
index dbdc9d8..fe99546 100644
--- a/src/plugins/runner/osm/OsmWay.cpp
+++ b/src/plugins/runner/osm/OsmWay.cpp
@@ -20,7 +20,7 @@
namespace Marble {
-QSet<QString> OsmWay::s_areaTags;
+QSet<StyleBuilder::OsmTag> OsmWay::s_areaTags;
void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes, QSet<qint64> &usedNodes) const
{
@@ -118,8 +118,8 @@ bool OsmWay::isArea() const
}
for (auto iter = m_osmData.tagsBegin(), end=m_osmData.tagsEnd(); iter != end; ++iter) {
- QString const keyValue = iter.key() + QLatin1Char('=') + iter.value();
- if (isAreaTag(keyValue)) {
+ const auto tag = StyleBuilder::OsmTag(iter.key(), iter.value());
+ if (isAreaTag(tag)) {
return true;
}
}
@@ -128,52 +128,52 @@ bool OsmWay::isArea() const
return isImplicitlyClosed;
}
-bool OsmWay::isAreaTag(const QString &keyValue)
+bool OsmWay::isAreaTag(const StyleBuilder::OsmTag &keyValue)
{
if (s_areaTags.isEmpty()) {
// All these tags can be found updated at
// http://wiki.openstreetmap.org/wiki/Map_Features#Landuse
- s_areaTags.insert(QStringLiteral("natural=water"));
- s_areaTags.insert(QStringLiteral("natural=wood"));
- s_areaTags.insert(QStringLiteral("natural=beach"));
- s_areaTags.insert(QStringLiteral("natural=wetland"));
- s_areaTags.insert(QStringLiteral("natural=glacier"));
- s_areaTags.insert(QStringLiteral("natural=scrub"));
- s_areaTags.insert(QStringLiteral("natural=cliff"));
- s_areaTags.insert(QStringLiteral("area=yes"));
- s_areaTags.insert(QStringLiteral("waterway=riverbank"));
-
- foreach(const QString &value, StyleBuilder::buildingValues() ) {
- s_areaTags.insert(QLatin1String("building=") + value);
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("natural"), QStringLiteral("water")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("natural"), QStringLiteral("wood")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("natural"), QStringLiteral("beach")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("natural"), QStringLiteral("wetland")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("natural"), QStringLiteral("glacier")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("natural"), QStringLiteral("scrub")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("natural"), QStringLiteral("cliff")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("area"), QStringLiteral("yes")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("waterway"), QStringLiteral("riverbank")));
+
+ foreach (const auto tag, StyleBuilder::buildingTags()) {
+ s_areaTags.insert(tag);
}
- s_areaTags.insert(QStringLiteral("man_made=bridge"));
-
- s_areaTags.insert(QStringLiteral("amenity=graveyard"));
- s_areaTags.insert(QStringLiteral("amenity=parking"));
- s_areaTags.insert(QStringLiteral("amenity=parking_space"));
- s_areaTags.insert(QStringLiteral("amenity=bicycle_parking"));
- s_areaTags.insert(QStringLiteral("amenity=college"));
- s_areaTags.insert(QStringLiteral("amenity=hospital"));
- s_areaTags.insert(QStringLiteral("amenity=kindergarten"));
- s_areaTags.insert(QStringLiteral("amenity=school"));
- s_areaTags.insert(QStringLiteral("amenity=university"));
- s_areaTags.insert(QStringLiteral("leisure=common"));
- s_areaTags.insert(QStringLiteral("leisure=garden"));
- s_areaTags.insert(QStringLiteral("leisure=golf_course"));
- s_areaTags.insert(QStringLiteral("leisure=marina"));
- s_areaTags.insert(QStringLiteral("leisure=playground"));
- s_areaTags.insert(QStringLiteral("leisure=pitch"));
- s_areaTags.insert(QStringLiteral("leisure=park"));
- s_areaTags.insert(QStringLiteral("leisure=sports_centre"));
- s_areaTags.insert(QStringLiteral("leisure=stadium"));
- s_areaTags.insert(QStringLiteral("leisure=swimming_pool"));
- s_areaTags.insert(QStringLiteral("leisure=track"));
-
- s_areaTags.insert(QStringLiteral("military=danger_area"));
-
- s_areaTags.insert(QStringLiteral("marble_land=landmass"));
- s_areaTags.insert(QStringLiteral("settlement=yes"));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("man_made"), QStringLiteral("bridge")));
+
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("graveyard")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("parking")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("parking_space")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("bicycle_parking")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("college")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("hospital")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("kindergarten")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("school")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("amenity"), QStringLiteral("university")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("common")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("garden")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("golf_course")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("marina")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("playground")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("pitch")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("park")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("sports_centre")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("stadium")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("swimming_pool")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("leisure"), QStringLiteral("track")));
+
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("military"), QStringLiteral("danger_area")));
+
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("marble_land"), QStringLiteral("landmass")));
+ s_areaTags.insert(StyleBuilder::OsmTag(QStringLiteral("settlement"), QStringLiteral("yes")));
}
return s_areaTags.contains(keyValue);
diff --git a/src/plugins/runner/osm/OsmWay.h b/src/plugins/runner/osm/OsmWay.h
index 5e51331..edad81c 100644
--- a/src/plugins/runner/osm/OsmWay.h
+++ b/src/plugins/runner/osm/OsmWay.h
@@ -14,6 +14,7 @@
#include "OsmNode.h"
#include <osm/OsmPlacemarkData.h>
#include <GeoDataDocument.h>
+#include <StyleBuilder.h>
#include <QSet>
#include <QString>
@@ -34,12 +35,12 @@ public:
private:
bool isArea() const;
- static bool isAreaTag(const QString &keyValue);
+ static bool isAreaTag(const StyleBuilder::OsmTag &keyValue);
OsmPlacemarkData m_osmData;
QVector<qint64> m_references;
- static QSet<QString> s_areaTags;
+ static QSet<StyleBuilder::OsmTag> s_areaTags;
};
typedef QHash<qint64,OsmWay> OsmWays;