diff --git a/generator/dumper.cpp b/generator/dumper.cpp index 8053344fa6..38b53d30ce 100644 --- a/generator/dumper.cpp +++ b/generator/dumper.cpp @@ -35,7 +35,7 @@ namespace feature { ++m_totalCount; string s1, s2; - f.GetPreferredDrawableNames(s1, s2); + f.GetPreferredNames(s1, s2); if (!s1.empty()) ++m_namesCount; diff --git a/indexer/drawing_rule_def.cpp b/indexer/drawing_rule_def.cpp index d1070fed00..589188c4a0 100644 --- a/indexer/drawing_rule_def.cpp +++ b/indexer/drawing_rule_def.cpp @@ -45,16 +45,11 @@ namespace drule { bool operator() (drule::Key const & r1, drule::Key const & r2) const { - if (r1.m_scale == r2.m_scale) - { - if (r1.m_type == r2.m_type) - { - // assume that unique algo leaves the first element (with max priority), others - go away - return (r1.m_priority > r2.m_priority); - } - else return (r1.m_type < r2.m_type); - } - else return (r1.m_scale < r2.m_scale); + // assume that unique algo leaves the first element (with max priority), others - go away + if (r1.m_type == r2.m_type) + return (r1.m_priority > r2.m_priority); + else + return (r1.m_type < r2.m_type); } }; @@ -62,32 +57,11 @@ namespace drule { bool operator() (drule::Key const & r1, drule::Key const & r2) const { - if (r1.m_scale == r2.m_scale) - { - // many line and area rules - is ok, other rules - one is enough - // By VNG: Why many area styles ??? Did I miss something ??? - if (r1.m_type == drule::line /*|| r1.m_type == drule::area*/) - return (r1 == r2); - else - return (r1.m_type == r2.m_type); - } - else return false; - } - }; - - struct less_scale_type_depth - { - bool operator() (drule::Key const & r1, drule::Key const & r2) const - { - if (r1.m_scale == r2.m_scale) - { - if (r1.m_type == r2.m_type) - { - return (r1.m_priority < r2.m_priority); - } - else return (r1.m_type < r2.m_type); - } - else return (r1.m_scale < r2.m_scale); + // many line rules - is ok, other rules - one is enough + if (r1.m_type == drule::line) + return (r1 == r2); + else + return (r1.m_type == r2.m_type); } }; } @@ -97,9 +71,4 @@ namespace drule sort(keys.begin(), keys.end(), less_key()); keys.erase(unique(keys.begin(), keys.end(), equal_key()), keys.end()); } - - void SortByScaleTypeDepth(vector & keys) - { - sort(keys.begin(), keys.end(), less_scale_type_depth()); - } } diff --git a/indexer/feature.cpp b/indexer/feature.cpp index f5fc4f555e..ab6032ec27 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -238,7 +238,7 @@ struct BestMatchedLangNames } }; -void FeatureType::GetPrefferedNames(string & defaultName, string & intName) const +void FeatureType::GetPreferredNames(string & defaultName, string & intName) const { ParseCommon(); @@ -270,26 +270,6 @@ string FeatureType::GetHouseNumber() const return (GetFeatureType() == GEOM_AREA ? m_Params.house.Get() : string()); } -void FeatureType::GetPreferredDrawableNames(string & defaultName, string & intName) const -{ - // ParseCommon is called behind: - string name; - GetPrefferedNames(name, intName); - - // Get house number if feature has one. - defaultName = GetHouseNumber(); - - if (defaultName.empty()) - { - defaultName.swap(name); - } - else - { - // Draw main feature name as second name after house number. - intName.swap(name); - } -} - bool FeatureType::GetName(int8_t lang, string & name) const { if (!HasName()) diff --git a/indexer/feature.hpp b/indexer/feature.hpp index 1ff1d5deac..37ab4366d7 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -235,9 +235,7 @@ public: /// @param[out] intName optionally choosen from tags "name:" by the algorithm //@{ /// Just get feature names. - void GetPrefferedNames(string & defaultName, string & intName) const; - /// Additional - take into account house number for defaultName - void GetPreferredDrawableNames(string & defaultName, string & intName) const; + void GetPreferredNames(string & defaultName, string & intName) const; bool GetName(int8_t lang, string & name) const; //@} diff --git a/map/address_finder.cpp b/map/address_finder.cpp index afe460a876..ff939ecd95 100644 --- a/map/address_finder.cpp +++ b/map/address_finder.cpp @@ -99,7 +99,7 @@ namespace if (IsInclude(d, types)) { string name, house; - f.GetPrefferedNames(name, house /*dummy parameter*/); + f.GetPreferredNames(name, house /*dummy parameter*/); house = f.GetHouseNumber(); // if geom type is not GEOM_POINT, result center point doesn't matter in future use diff --git a/map/feature_styler.cpp b/map/feature_styler.cpp index 78dbab2118..bbbd84619c 100644 --- a/map/feature_styler.cpp +++ b/map/feature_styler.cpp @@ -69,7 +69,19 @@ namespace di m_geometryType = type.first; m_isCoastline = type.second; - f.GetPreferredDrawableNames(m_primaryText, m_secondaryText); + f.GetPreferredNames(m_primaryText, m_secondaryText); + + // Get house number if feature has one. + string houseNumber = f.GetHouseNumber(); + + if (!houseNumber.empty()) + { + if (m_primaryText.empty()) + houseNumber.swap(m_primaryText); + else + m_primaryText = m_primaryText + " (" + houseNumber + ")"; + } + m_refText = f.GetRoadNumber(); double const population = static_cast(f.GetPopulation()); @@ -159,8 +171,7 @@ namespace di if (keys[i].m_type == drule::caption) if (m_rules[i].m_rule->GetCaption(0) != 0) - if (!m_rules[i].m_rule->GetCaption(0)->has_offset_y()) - hasCaptionWithoutOffset = true; + hasCaptionWithoutOffset = !m_rules[i].m_rule->GetCaption(0)->has_offset_y(); } // placing a text on the path