diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp index 6267b63c12..439598d9ac 100644 --- a/indexer/classificator.cpp +++ b/indexer/classificator.cpp @@ -301,16 +301,16 @@ namespace typedef vec_t::const_iterator iter_t; vec_t const & m_rules; - vec_t & m_keys; + drule::KeysT & m_keys; bool m_added; void add_rule(int ft, iter_t i) { static const int visible[3][drule::count_of_rules] = { - {0, 0, 1, 1, 1, 0, 0}, // fpoint - {1, 0, 0, 0, 0, 1, 0}, // fline - {1, 1, 1, 1, 0, 0, 0} // farea + { 0, 0, 1, 1, 1, 0, 0 }, // fpoint + { 1, 0, 0, 0, 0, 1, 0 }, // fline + { 1, 1, 1, 1, 0, 0, 0 } // farea }; if (visible[ft][i->m_type] == 1) @@ -321,7 +321,7 @@ namespace } public: - suitable_getter(vec_t const & rules, vec_t & keys) + suitable_getter(vec_t const & rules, drule::KeysT & keys) : m_rules(rules), m_keys(keys) { } @@ -330,14 +330,12 @@ namespace { iter_t i = lower_bound(m_rules.begin(), m_rules.end(), scale, less_scales()); while (i != m_rules.end() && i->m_scale == scale) - { add_rule(ft, i++); - } } }; } -void ClassifObject::GetSuitable(int scale, FeatureGeoType ft, vector & keys) const +void ClassifObject::GetSuitable(int scale, FeatureGeoType ft, drule::KeysT & keys) const { ASSERT ( ft <= FEATURE_TYPE_AREA, () ); diff --git a/indexer/classificator.hpp b/indexer/classificator.hpp index 60913fb108..68e5d76b4f 100644 --- a/indexer/classificator.hpp +++ b/indexer/classificator.hpp @@ -82,7 +82,7 @@ public: void ConcatChildNames(string & s) const; enum FeatureGeoType { FEATURE_TYPE_POINT = 0, FEATURE_TYPE_LINE, FEATURE_TYPE_AREA }; - void GetSuitable(int scale, FeatureGeoType ft, vector & keys) const; + void GetSuitable(int scale, FeatureGeoType ft, drule::KeysT & keys) const; inline vector const & GetDrawingRules() const { return m_drawRule; } bool IsDrawable(int scale) const; diff --git a/indexer/drawing_rule_def.cpp b/indexer/drawing_rule_def.cpp index 589188c4a0..47dc47dbbe 100644 --- a/indexer/drawing_rule_def.cpp +++ b/indexer/drawing_rule_def.cpp @@ -7,6 +7,7 @@ #include "../base/string_utils.hpp" #include "../std/cstdio.hpp" +#include "../std/iterator.hpp" namespace drule @@ -66,9 +67,9 @@ namespace drule }; } - void MakeUnique(vector & keys) + void MakeUnique(KeysT & keys) { sort(keys.begin(), keys.end(), less_key()); - keys.erase(unique(keys.begin(), keys.end(), equal_key()), keys.end()); + keys.resize(distance(keys.begin(), unique(keys.begin(), keys.end(), equal_key()))); } } diff --git a/indexer/drawing_rule_def.hpp b/indexer/drawing_rule_def.hpp index 3276506e57..bf334c0249 100644 --- a/indexer/drawing_rule_def.hpp +++ b/indexer/drawing_rule_def.hpp @@ -1,7 +1,8 @@ #pragma once +#include "../base/buffer_vector.hpp" + #include "../std/string.hpp" -#include "../std/vector.hpp" namespace drule @@ -36,6 +37,6 @@ namespace drule double const layer_base_priority = 2000; - void MakeUnique(vector & keys); - void SortByScaleTypeDepth(vector & keys); + typedef buffer_vector KeysT; + void MakeUnique(KeysT & keys); } diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp index 8018efc3d7..aac7979143 100644 --- a/indexer/feature_visibility.cpp +++ b/indexer/feature_visibility.cpp @@ -96,12 +96,12 @@ namespace { int m_scale; ClassifObject::FeatureGeoType m_ft; - vector & m_keys; + drule::KeysT & m_keys; string & m_name; public: DrawRuleGetter(int scale, feature::EGeomType ft, - vector & keys, string & name) + drule::KeysT & keys, string & name) : m_scale(scale), m_ft(ClassifObject::FeatureGeoType(ft)), m_keys(keys), m_name(name) { } @@ -125,7 +125,7 @@ namespace } pair GetDrawRule(FeatureBase const & f, int level, - vector & keys, string & names) + drule::KeysT & keys, string & names) { feature::TypesHolder types(f); @@ -205,7 +205,7 @@ namespace void operator() (ClassifObject const *) {} bool operator() (ClassifObject const * p, bool & res) { - vector keys; + drule::KeysT keys; p->GetSuitable(m_scale, m_ft, keys); for (size_t i = 0; i < keys.size(); ++i) diff --git a/indexer/feature_visibility.hpp b/indexer/feature_visibility.hpp index bc1ad86bd2..1b5ee5e6b1 100644 --- a/indexer/feature_visibility.hpp +++ b/indexer/feature_visibility.hpp @@ -55,7 +55,7 @@ namespace feature /// @return (geometry type, is coastline) pair GetDrawRule(FeatureBase const & f, int level, - vector & keys, string & names); + drule::KeysT & keys, string & names); /// Used to check whether user types belong to particular classificator set. class TypeSetChecker diff --git a/map/benchmark_tool/features_loading.cpp b/map/benchmark_tool/features_loading.cpp index 7eaedf47e3..ba9d18e0fa 100644 --- a/map/benchmark_tool/features_loading.cpp +++ b/map/benchmark_tool/features_loading.cpp @@ -43,7 +43,7 @@ namespace m_timer.Reset(); - vector keys; + drule::KeysT keys; string names; // for debug use only, in release it's empty (void)feature::GetDrawRule(ft, m_scale, keys, names); diff --git a/map/feature_styler.cpp b/map/feature_styler.cpp index bf4f7436ef..71ce63b88b 100644 --- a/map/feature_styler.cpp +++ b/map/feature_styler.cpp @@ -56,7 +56,7 @@ namespace di m_convertor(convertor), m_rect(rect) { - vector keys; + drule::KeysT keys; string names; // for debug use only, in release it's empty pair type = feature::GetDrawRule(f, zoom, keys, names); @@ -102,7 +102,6 @@ namespace di } double area = 0.0; - if (m_geometryType != feature::GEOM_POINT) { m2::RectD const bbox = f.GetLimitRect(zoom); @@ -160,7 +159,7 @@ namespace di if (!m_hasLineStyles && (keys[i].m_type == drule::line)) m_hasLineStyles = true; - m_rules[i] = di::DrawRule( drule::rules().Find(keys[i]), depth, isTransparent); + m_rules[i] = di::DrawRule(drule::rules().Find(keys[i]), depth, isTransparent); if ((m_geometryType == feature::GEOM_LINE) && !m_hasPathText && !m_primaryText.empty()) if (m_rules[i].m_rule->GetCaption(0) != 0)