diff --git a/generator/relation_tags.cpp b/generator/relation_tags.cpp index a83792ba52..d5879d3669 100644 --- a/generator/relation_tags.cpp +++ b/generator/relation_tags.cpp @@ -2,11 +2,11 @@ #include "generator/osm_element.hpp" -#include"indexer/classificator.hpp" +#include "indexer/classificator.hpp" -#include "base/stl_helpers.hpp" #include "base/string_utils.hpp" + namespace generator { RelationTagsBase::RelationTagsBase() : m_cache(14 /* logCacheSize */) {} @@ -25,8 +25,7 @@ bool RelationTagsBase::IsSkipRelation(std::string_view type) bool RelationTagsBase::IsKeyTagExists(std::string const & key) const { - auto const & tags = m_current->m_tags; - return base::AnyOf(tags, [&](OsmElement::Tag const & p) { return p.m_key == key; }); + return m_current->HasTag(key); } void RelationTagsBase::AddCustomTag(std::pair const & p) @@ -37,6 +36,12 @@ void RelationTagsBase::AddCustomTag(std::pair const & m_current->AddTag(p.first, p.second); } +void RelationTagsBase::AddTagIfNotExist(std::pair const & p) +{ + if (!m_current->HasTag(p.first)) + m_current->AddTag(p.first, p.second); +} + void RelationTagsNode::Process(RelationElement const & e) { auto const type = e.GetType(); @@ -142,9 +147,9 @@ void RelationTagsWay::Process(RelationElement const & e) if (isHighway) { if (route == "bicycle") - Base::AddCustomTag({"bicycle", "yes"}); + Base::AddTagIfNotExist({"bicycle", "yes"}); else if (route == "foot" || route == "hiking") - Base::AddCustomTag({"foot", "yes"}); + Base::AddTagIfNotExist({"foot", "yes"}); } if (!fetchTags) diff --git a/generator/relation_tags.hpp b/generator/relation_tags.hpp index c139cc1088..6fefa436eb 100644 --- a/generator/relation_tags.hpp +++ b/generator/relation_tags.hpp @@ -41,6 +41,7 @@ protected: static bool IsSkipRelation(std::string_view type); bool IsKeyTagExists(std::string const & key) const; void AddCustomTag(std::pair const & p); + void AddTagIfNotExist(std::pair const & p); virtual void Process(RelationElement const & e) = 0; uint64_t m_featureID = 0;