[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [marble] src/lib/marble: no need for an icon on tags
From:       Bernhard Beschow <bbeschow () cs ! tu-berlin ! de>
Date:       2016-10-03 20:29:24
Message-ID: E1br9rY-000606-Tf () code ! kde ! org
[Download RAW message or body]

Git commit 74b35067566f9b48f591e2f65d176e39381a402f by Bernhard Beschow.
Committed on 03/10/2016 at 20:14.
Pushed by beschow into branch 'master'.

no need for an icon on tags

Icons other than yellow circles were only visible in very rare cases (which ones \
anyway?). Moreover, multiple tags with icons could even be misleading: If there was \
e.g. a building with an amenity, the tag icons would compete with each other. \
Therefore, and for the sake of simplicity, remove tag icons.

M  +15   -16   src/lib/marble/StyleBuilder.cpp
M  +0    -6    src/lib/marble/StyleBuilder.h
M  +0    -8    src/lib/marble/osm/OsmTagEditorWidget_p.cpp

http://commits.kde.org/marble/74b35067566f9b48f591e2f65d176e39381a402f

diff --git a/src/lib/marble/StyleBuilder.cpp b/src/lib/marble/StyleBuilder.cpp
index d8eabd6..8d0878d 100644
--- a/src/lib/marble/StyleBuilder.cpp
+++ b/src/lib/marble/StyleBuilder.cpp
@@ -37,6 +37,8 @@ class StyleBuilder::Private
 public:
     Private();
 
+    GeoDataStyle::ConstPtr presetStyle(GeoDataPlacemark::GeoDataVisualCategory \
visualCategory) const; +
     GeoDataStyle::Ptr createStyle(qreal width, qreal realWidth, const QColor& color,
                                       const QColor& outlineColor, bool fill, bool \
                outline,
                                       Qt::BrushStyle brushStyle, Qt::PenStyle \
penStyle, @@ -1201,7 +1203,7 @@ GeoDataStyle::ConstPtr \
StyleBuilder::createStyle(const StyleParameters &paramete  }
 
     auto const visualCategory = placemark->visualCategory();
-    GeoDataStyle::ConstPtr style = presetStyle(visualCategory);
+    GeoDataStyle::ConstPtr style = d->presetStyle(visualCategory);
 
     OsmPlacemarkData const & osmData = placemark->osmData();
     if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPointType) {
@@ -1291,7 +1293,7 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const \
StyleParameters &paramete  
         if (style->iconStyle().iconPath().isEmpty()) {
             const GeoDataPlacemark::GeoDataVisualCategory category = \
                determineVisualCategory(osmData);
-            const GeoDataStyle::ConstPtr categoryStyle = presetStyle(category);
+            const GeoDataStyle::ConstPtr categoryStyle = d->presetStyle(category);
             if (category != GeoDataPlacemark::None && \
!categoryStyle->iconStyle().icon().isNull()) {  GeoDataStyle::Ptr newStyle(new \
GeoDataStyle(*style));  newStyle->setIconStyle(categoryStyle->iconStyle());
@@ -1425,16 +1427,16 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const \
StyleParameters &paramete  return style;
 }
 
-GeoDataStyle::ConstPtr \
StyleBuilder::presetStyle(GeoDataPlacemark::GeoDataVisualCategory visualCategory) \
const +GeoDataStyle::ConstPtr \
StyleBuilder::Private::presetStyle(GeoDataPlacemark::GeoDataVisualCategory \
visualCategory) const  {
-    if (!d->m_defaultStyleInitialized) {
-        d->initializeDefaultStyles();
+    if (!m_defaultStyleInitialized) {
+        const_cast<StyleBuilder::Private *>(this)->initializeDefaultStyles(); // \
const cast due to lazy initialization  }
 
-    if (visualCategory != GeoDataPlacemark::None && \
                d->m_defaultStyle[visualCategory] ) {
-        return d->m_defaultStyle[visualCategory];
+    if (visualCategory != GeoDataPlacemark::None && m_defaultStyle[visualCategory] ) \
{ +        return m_defaultStyle[visualCategory];
     } else {
-        return d->m_defaultStyle[GeoDataPlacemark::Default];
+        return m_defaultStyle[GeoDataPlacemark::Default];
     }
 }
 
@@ -1886,13 +1888,6 @@ QString \
StyleBuilder::visualCategoryName(GeoDataPlacemark::GeoDataVisualCategory  return \
visualCategoryNames[category];  }
 
-GeoDataPlacemark::GeoDataVisualCategory StyleBuilder::osmVisualCategory(const \
                StyleBuilder::OsmTag &tag)
-{
-    Private::initializeOsmVisualCategories();
-
-    return Private::s_visualCategories.value(tag, GeoDataPlacemark::None);
-}
-
 QHash<StyleBuilder::OsmTag, GeoDataPlacemark::GeoDataVisualCategory>::const_iterator \
StyleBuilder::begin()  {
     Private::initializeOsmVisualCategories();
@@ -2029,9 +2024,11 @@ GeoDataPlacemark::GeoDataVisualCategory \
StyleBuilder::determineVisualCategory(co  return GeoDataPlacemark::NaturalIceShelf;
     }
 
+    Private::initializeOsmVisualCategories();
+
     for (auto iter = osmData.tagsBegin(), end=osmData.tagsEnd(); iter != end; \
++iter) {  const auto tag = OsmTag(iter.key(), iter.value());
-        GeoDataPlacemark::GeoDataVisualCategory category = osmVisualCategory(tag);
+        GeoDataPlacemark::GeoDataVisualCategory category = \
Private::s_visualCategories.value(tag, GeoDataPlacemark::None);  if (category != \
                GeoDataPlacemark::None) {
             if (category == GeoDataPlacemark::PlaceCity && \
osmData.containsTag("capital", "yes")) {  category = \
GeoDataPlacemark::PlaceCityCapital; @@ -2040,7 +2037,9 @@ \
                GeoDataPlacemark::GeoDataVisualCategory \
                StyleBuilder::determineVisualCategory(co
             } else if (category == GeoDataPlacemark::PlaceVillage && \
osmData.containsTag("capital", "yes")) {  category = \
GeoDataPlacemark::PlaceVillageCapital;  }
+        }
 
+        if (category != GeoDataPlacemark::None) {
             return category;
         }
     }
diff --git a/src/lib/marble/StyleBuilder.h b/src/lib/marble/StyleBuilder.h
index d3fb756..c0d7d5e 100644
--- a/src/lib/marble/StyleBuilder.h
+++ b/src/lib/marble/StyleBuilder.h
@@ -52,7 +52,6 @@ public:
     void setDefaultLabelColor( const QColor& color );
 
     GeoDataStyle::ConstPtr createStyle(const StyleParameters &parameters) const;
-    GeoDataStyle::ConstPtr presetStyle(GeoDataPlacemark::GeoDataVisualCategory \
visualCategory) const;  
     /**
      * @brief Returns the order in which the visual categories used in the theme \
shall be painted on the map. @@ -78,11 +77,6 @@ public:
     static QString visualCategoryName(GeoDataPlacemark::GeoDataVisualCategory \
category);  
     /**
-     * @brief  Convenience categorization of placemarks for Osm key=value pairs
-     */
-    static GeoDataPlacemark::GeoDataVisualCategory osmVisualCategory(const OsmTag \
                &tag);
-
-    /**
      * @brief begin and end provide an stl style iterator for the preset map
      */
     static QHash<OsmTag, GeoDataPlacemark::GeoDataVisualCategory>::const_iterator \
                begin();
diff --git a/src/lib/marble/osm/OsmTagEditorWidget_p.cpp \
b/src/lib/marble/osm/OsmTagEditorWidget_p.cpp index bf9df71..dfa880a 100644
--- a/src/lib/marble/osm/OsmTagEditorWidget_p.cpp
+++ b/src/lib/marble/osm/OsmTagEditorWidget_p.cpp
@@ -99,8 +99,6 @@ void OsmTagEditorWidgetPrivate::populatePresetTagsList()
 
 QTreeWidgetItem *OsmTagEditorWidgetPrivate::tagWidgetItem( const OsmTag &tag ) const
 {
-    static const StyleBuilder styleBuilder;
-
     QStringList itemText;
 
     itemText << tag.first;
@@ -108,12 +106,6 @@ QTreeWidgetItem *OsmTagEditorWidgetPrivate::tagWidgetItem( const \
OsmTag &tag ) c  
     QTreeWidgetItem *tagItem = new QTreeWidgetItem( itemText );
 
-    // Getting the icon preset for the tag ( if there's one available )
-    const GeoDataPlacemark::GeoDataVisualCategory category = \
                StyleBuilder::osmVisualCategory(tag);
-    GeoDataStyle::ConstPtr style = styleBuilder.presetStyle(category);
-    QPixmap iconPixmap = QPixmap::fromImage( style->iconStyle().icon() );
-    tagItem->setIcon( 1, QIcon( iconPixmap ) );
-
     return tagItem;
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic