summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-08-14 12:14:12 (GMT)
committerBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-08-14 12:16:35 (GMT)
commit7f47e23a53ab93e19a8368bf92d9b4f699e09241 (patch)
tree4ef6a106e90074c0e1d9cd2bc6e25f51e58bab7a
parentdaf5d5405c4f944c0f64fd1d1eb8c2e9be3842e7 (diff)
move additional OSM tags to less prominent place
-rw-r--r--src/lib/marble/osm/OsmPresetLibrary.cpp146
-rw-r--r--src/lib/marble/osm/OsmPresetLibrary.h12
-rw-r--r--src/lib/marble/osm/OsmTagEditorWidget_p.cpp124
-rw-r--r--src/lib/marble/osm/OsmTagEditorWidget_p.h5
4 files changed, 123 insertions, 164 deletions
diff --git a/src/lib/marble/osm/OsmPresetLibrary.cpp b/src/lib/marble/osm/OsmPresetLibrary.cpp
index 6bf5ab1..21b325d 100644
--- a/src/lib/marble/osm/OsmPresetLibrary.cpp
+++ b/src/lib/marble/osm/OsmPresetLibrary.cpp
@@ -20,7 +20,6 @@ namespace Marble
{
QMap<OsmPresetLibrary::OsmTag, GeoDataFeature::GeoDataVisualCategory> OsmPresetLibrary::s_visualCategories;
-QList<OsmPresetLibrary::OsmTag> OsmPresetLibrary::s_additionalOsmTags;
void OsmPresetLibrary::initializeOsmVisualCategories()
{
@@ -339,139 +338,6 @@ void OsmPresetLibrary::initializeOsmVisualCategories()
}
}
-void OsmPresetLibrary::initializeAdditionalOsmTags()
-{
- // Only initialize the list once
- if( !s_additionalOsmTags.isEmpty() ) {
- return;
- }
-
- // Recommended for nodes
- s_additionalOsmTags << OsmTag( "power", "pole" );
- s_additionalOsmTags << OsmTag( "power", "generator" );
- s_additionalOsmTags << OsmTag( "barrier", "fence" );
- s_additionalOsmTags << OsmTag( "barrier", "wall" );
- s_additionalOsmTags << OsmTag( "barrier", "gate" );
-
-
-
- // Recommended for ways
- s_additionalOsmTags << OsmTag( "lanes", "" );
- s_additionalOsmTags << OsmTag( "maxspeed", "" );
- s_additionalOsmTags << OsmTag( "maxheight", "" );
- s_additionalOsmTags << OsmTag( "maxweight", "" );
- s_additionalOsmTags << OsmTag( "oneway", "yes" );
- s_additionalOsmTags << OsmTag( "service", "driveway" );
- s_additionalOsmTags << OsmTag( "service", "parking_aisle" );
- s_additionalOsmTags << OsmTag( "service", "alley" );
- s_additionalOsmTags << OsmTag( "tunnel", "yes" );
- s_additionalOsmTags << OsmTag( "abutters", "commercial" );
- s_additionalOsmTags << OsmTag( "abutters", "industrial" );
- s_additionalOsmTags << OsmTag( "abutters", "mixed" );
- s_additionalOsmTags << OsmTag( "abutters", "residential" );
-
-
-
- // Recommended for areas
- s_additionalOsmTags << OsmTag( "surface", "unpaved" );
- s_additionalOsmTags << OsmTag( "surface", "paved" );
- s_additionalOsmTags << OsmTag( "surface", "gravel" );
- s_additionalOsmTags << OsmTag( "surface", "dirt" );
- s_additionalOsmTags << OsmTag( "surface", "grass" );
-
-
- // Relations
- s_additionalOsmTags << OsmTag( "type", "route" );
- s_additionalOsmTags << OsmTag( "type", "route_master" );
- s_additionalOsmTags << OsmTag( "type", "public_transport" );
- s_additionalOsmTags << OsmTag( "type", "destination_sign" );
- s_additionalOsmTags << OsmTag( "type", "waterway" );
- s_additionalOsmTags << OsmTag( "type", "enforcement" );
-
-
-
- // Relations: route
- s_additionalOsmTags << OsmTag( "route", "road" );
- s_additionalOsmTags << OsmTag( "route", "bicycle" );
- s_additionalOsmTags << OsmTag( "route", "foot" );
- s_additionalOsmTags << OsmTag( "route", "hiking" );
- s_additionalOsmTags << OsmTag( "route", "bus" );
- s_additionalOsmTags << OsmTag( "route", "trolleybus" );
- s_additionalOsmTags << OsmTag( "route", "ferry" );
- s_additionalOsmTags << OsmTag( "route", "detour" );
- s_additionalOsmTags << OsmTag( "route", "train" );
- s_additionalOsmTags << OsmTag( "route", "tram" );
- s_additionalOsmTags << OsmTag( "route", "mtb" );
- s_additionalOsmTags << OsmTag( "route", "horse" );
- s_additionalOsmTags << OsmTag( "route", "ski" );
- s_additionalOsmTags << OsmTag( "roundtrip", "yes" );
- s_additionalOsmTags << OsmTag( "network", "" );
- s_additionalOsmTags << OsmTag( "ref", "" );
- s_additionalOsmTags << OsmTag( "operator", "" );
-
-
-
- // Relations: route_master
- s_additionalOsmTags << OsmTag( "route_master", "train" );
- s_additionalOsmTags << OsmTag( "route_master", "subway" );
- s_additionalOsmTags << OsmTag( "route_master", "monorail" );
- s_additionalOsmTags << OsmTag( "route_master", "tram" );
- s_additionalOsmTags << OsmTag( "route_master", "bus" );
- s_additionalOsmTags << OsmTag( "route_master", "trolleybus" );
- s_additionalOsmTags << OsmTag( "route_master", "ferry" );
- s_additionalOsmTags << OsmTag( "route_master", "bicycle" );
-
-
-
- // Relations: public_transport
- s_additionalOsmTags << OsmTag( "public_transport", "stop_area" );
- s_additionalOsmTags << OsmTag( "public_transport", "stop_area_group" );
-
-
-
- // Relations: waterway
- s_additionalOsmTags << OsmTag( "waterway", "river" );
- s_additionalOsmTags << OsmTag( "waterway", "stream" );
- s_additionalOsmTags << OsmTag( "waterway", "canal" );
- s_additionalOsmTags << OsmTag( "waterway", "drain" );
- s_additionalOsmTags << OsmTag( "waterway", "ditch" );
-
-
-
- // Relations: enforcement
- s_additionalOsmTags << OsmTag( "enforcement", "maxheight" );
- s_additionalOsmTags << OsmTag( "enforcement", "maxweight" );
- s_additionalOsmTags << OsmTag( "enforcement", "maxspeed" );
- s_additionalOsmTags << OsmTag( "enforcement", "mindistance" );
- s_additionalOsmTags << OsmTag( "enforcement", "traffic_signals" );
- s_additionalOsmTags << OsmTag( "enforcement", "check" );
- s_additionalOsmTags << OsmTag( "enforcement", "access" );
- s_additionalOsmTags << OsmTag( "enforcement", "toll" );
-
-
-
- // Others
- s_additionalOsmTags << OsmTag( "height", "" );
- s_additionalOsmTags << OsmTag( "rooms", "" );
- s_additionalOsmTags << OsmTag( "beds", "" );
- s_additionalOsmTags << OsmTag( "wheelchair", "" );
- s_additionalOsmTags << OsmTag( "website", "" );
- s_additionalOsmTags << OsmTag( "email", "" );
- s_additionalOsmTags << OsmTag( "fee", "" );
- s_additionalOsmTags << OsmTag( "destination", "" );
- s_additionalOsmTags << OsmTag( "indoor", "yes" );
-
-
-
- // Recommended for all
- s_additionalOsmTags << OsmTag( "addr:street", "" );
- s_additionalOsmTags << OsmTag( "addr:housenumber", "" );
- s_additionalOsmTags << OsmTag( "addr:postcode", "" );
- s_additionalOsmTags << OsmTag( "addr:country", "" );
- s_additionalOsmTags << OsmTag( "access", "private" );
- s_additionalOsmTags << OsmTag( "access", "permissive" );
-}
-
GeoDataFeature::GeoDataVisualCategory OsmPresetLibrary::osmVisualCategory(const OsmTag &tag)
{
initializeOsmVisualCategories();
@@ -491,18 +357,6 @@ QMap<OsmPresetLibrary::OsmTag, GeoDataFeature::GeoDataVisualCategory>::const_ite
return s_visualCategories.constEnd();
}
-QList<OsmPresetLibrary::OsmTag>::const_iterator OsmPresetLibrary::additionalTagsBegin()
-{
- initializeAdditionalOsmTags();
- return s_additionalOsmTags.constBegin();
-}
-
-QList<OsmPresetLibrary::OsmTag>::const_iterator OsmPresetLibrary::additionalTagsEnd()
-{
- initializeAdditionalOsmTags();
- return s_additionalOsmTags.constEnd();
-}
-
QStringList OsmPresetLibrary::shopValues()
{
// from https://taginfo.openstreetmap.org/keys/building#values
diff --git a/src/lib/marble/osm/OsmPresetLibrary.h b/src/lib/marble/osm/OsmPresetLibrary.h
index e1e36a1..01f775e 100644
--- a/src/lib/marble/osm/OsmPresetLibrary.h
+++ b/src/lib/marble/osm/OsmPresetLibrary.h
@@ -42,12 +42,6 @@ public:
static QMap<OsmTag, GeoDataFeature::GeoDataVisualCategory>::const_iterator begin();
static QMap<OsmTag, GeoDataFeature::GeoDataVisualCategory>::const_iterator end();
- /**
- * @brief additionalTagsBegin and end provide an stl style iterator for the additional tags map
- */
- static QList<OsmTag>::const_iterator additionalTagsBegin();
- static QList<OsmTag>::const_iterator additionalTagsEnd();
-
static QStringList shopValues();
static QStringList buildingValues();
@@ -55,17 +49,11 @@ public:
private:
static void initializeOsmVisualCategories();
- static void initializeAdditionalOsmTags();
/**
* @brief s_visualCategories contains osm tag mappings to GeoDataVisualCategories
*/
static QMap<OsmTag, GeoDataFeature::GeoDataVisualCategory> s_visualCategories;
-
- /**
- * @brief s_additionalOsmTags is a list of useful, popular osm tags that currently don't have a visual category associated with them
- */
- static QList<OsmTag> s_additionalOsmTags;
};
diff --git a/src/lib/marble/osm/OsmTagEditorWidget_p.cpp b/src/lib/marble/osm/OsmTagEditorWidget_p.cpp
index 873fd48..bb5b1ba 100644
--- a/src/lib/marble/osm/OsmTagEditorWidget_p.cpp
+++ b/src/lib/marble/osm/OsmTagEditorWidget_p.cpp
@@ -117,6 +117,8 @@ QTreeWidgetItem *OsmTagEditorWidgetPrivate::tagWidgetItem( const OsmTag &tag ) c
QList<OsmTagEditorWidgetPrivate::OsmTag> OsmTagEditorWidgetPrivate::recommendedTags() const
{
+ static QVector<OsmTag> additionalOsmTags = createAdditionalOsmTags();
+
QList<OsmTag> recommendedTags;
QStringList filter = generateTagFilter();
@@ -130,12 +132,9 @@ QList<OsmTagEditorWidgetPrivate::OsmTag> OsmTagEditorWidgetPrivate::recommendedT
}
}
- QList<OsmTag>::const_iterator additionalIt = OsmPresetLibrary::additionalTagsBegin();
- QList<OsmTag>::const_iterator additionalEnd = OsmPresetLibrary::additionalTagsEnd();
-
- for ( ; additionalIt != additionalEnd; ++additionalIt ) {
- if ( filter.contains( additionalIt->first ) ) {
- recommendedTags += *additionalIt;
+ foreach (const auto additionalOsmTag, additionalOsmTags) {
+ if (filter.contains(additionalOsmTag.first)) {
+ recommendedTags += additionalOsmTag;
}
}
@@ -366,4 +365,117 @@ void OsmTagEditorWidgetPrivate::addPattern( QStringList &filter, const OsmPlacem
}
}
+QVector<OsmTagEditorWidgetPrivate::OsmTag> OsmTagEditorWidgetPrivate::createAdditionalOsmTags()
+{
+ const QVector<OsmTag> additionalOsmTags = QVector<OsmTag>()
+
+ // Recommended for nodes
+ << OsmTag("power", "pole")
+ << OsmTag("power", "generator")
+ << OsmTag("barrier", "fence")
+ << OsmTag("barrier", "wall")
+ << OsmTag("barrier", "gate")
+
+ // Recommended for ways
+ << OsmTag("lanes", "")
+ << OsmTag("maxspeed", "")
+ << OsmTag("maxheight", "")
+ << OsmTag("maxweight", "")
+ << OsmTag("oneway", "yes")
+ << OsmTag("service", "driveway")
+ << OsmTag("service", "parking_aisle")
+ << OsmTag("service", "alley")
+ << OsmTag("tunnel", "yes")
+ << OsmTag("abutters", "commercial")
+ << OsmTag("abutters", "industrial")
+ << OsmTag("abutters", "mixed")
+ << OsmTag("abutters", "residential")
+
+ // Recommended for areas
+ << OsmTag("surface", "unpaved")
+ << OsmTag("surface", "paved")
+ << OsmTag("surface", "gravel")
+ << OsmTag("surface", "dirt")
+ << OsmTag("surface", "grass")
+
+ // Relations
+ << OsmTag("type", "route")
+ << OsmTag("type", "route_master")
+ << OsmTag("type", "public_transport")
+ << OsmTag("type", "destination_sign")
+ << OsmTag("type", "waterway")
+ << OsmTag("type", "enforcement")
+
+ // Relations: route
+ << OsmTag("route", "road")
+ << OsmTag("route", "bicycle")
+ << OsmTag("route", "foot")
+ << OsmTag("route", "hiking")
+ << OsmTag("route", "bus")
+ << OsmTag("route", "trolleybus")
+ << OsmTag("route", "ferry")
+ << OsmTag("route", "detour")
+ << OsmTag("route", "train")
+ << OsmTag("route", "tram")
+ << OsmTag("route", "mtb")
+ << OsmTag("route", "horse")
+ << OsmTag("route", "ski")
+ << OsmTag("roundtrip", "yes")
+ << OsmTag("network", "")
+ << OsmTag("ref", "")
+ << OsmTag("operator", "")
+
+ // Relations: route_master
+ << OsmTag("route_master", "train")
+ << OsmTag("route_master", "subway")
+ << OsmTag("route_master", "monorail")
+ << OsmTag("route_master", "tram")
+ << OsmTag("route_master", "bus")
+ << OsmTag("route_master", "trolleybus")
+ << OsmTag("route_master", "ferry")
+ << OsmTag("route_master", "bicycle")
+
+ // Relations: public_transport
+ << OsmTag("public_transport", "stop_area")
+ << OsmTag("public_transport", "stop_area_group")
+
+ // Relations: waterway
+ << OsmTag("waterway", "river")
+ << OsmTag("waterway", "stream")
+ << OsmTag("waterway", "canal")
+ << OsmTag("waterway", "drain")
+ << OsmTag("waterway", "ditch")
+
+ // Relations: enforcement
+ << OsmTag("enforcement", "maxheight")
+ << OsmTag("enforcement", "maxweight")
+ << OsmTag("enforcement", "maxspeed")
+ << OsmTag("enforcement", "mindistance")
+ << OsmTag("enforcement", "traffic_signals")
+ << OsmTag("enforcement", "check")
+ << OsmTag("enforcement", "access")
+ << OsmTag("enforcement", "toll")
+
+ // Others
+ << OsmTag("height", "")
+ << OsmTag("rooms", "")
+ << OsmTag("beds", "")
+ << OsmTag("wheelchair", "")
+ << OsmTag("website", "")
+ << OsmTag("email", "")
+ << OsmTag("fee", "")
+ << OsmTag("destination", "")
+ << OsmTag("indoor", "yes")
+
+ // Recommended for all
+ << OsmTag("addr:street", "")
+ << OsmTag("addr:housenumber", "")
+ << OsmTag("addr:postcode", "")
+ << OsmTag("addr:country", "")
+ << OsmTag("access", "private")
+ << OsmTag("access", "permissive");
+
+ return additionalOsmTags;
+}
+
}
diff --git a/src/lib/marble/osm/OsmTagEditorWidget_p.h b/src/lib/marble/osm/OsmTagEditorWidget_p.h
index cbc47cf..33b8c06 100644
--- a/src/lib/marble/osm/OsmTagEditorWidget_p.h
+++ b/src/lib/marble/osm/OsmTagEditorWidget_p.h
@@ -56,6 +56,11 @@ private:
*/
void addPattern( QStringList &filter, const OsmPlacemarkData &osmData, const QStringList &pattern ) const;
+ /**
+ * @brief returns a list of useful, popular osm tags that currently don't have a visual category associated with them
+ */
+ static QVector<OsmTag> createAdditionalOsmTags();
+
GeoDataPlacemark *m_placemark;
static const QString m_customTagAdderText;
};