Commit 74b35067 authored by Bernhard Beschow's avatar Bernhard Beschow
Browse files

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.
parent b5672254
......@@ -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;
}
}
......
......@@ -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.
......@@ -77,11 +76,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
*/
......
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment