diff options
author | Maxim Pimenov <m@maps.me> | 2016-04-26 20:48:19 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2016-05-01 10:28:03 +0300 |
commit | 861cdb910ca40f48dbaf8e096707f0b3b912bb42 (patch) | |
tree | 9599e020017dde614929b28a07aceead73363319 /indexer/osm_editor.cpp | |
parent | 0b20c90890459444778897c1fa5cd6a68538f30a (diff) |
[editor] Implemented search of a category for a newly added object.
Diffstat (limited to 'indexer/osm_editor.cpp')
-rw-r--r-- | indexer/osm_editor.cpp | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index 11cca69a57..868a108f90 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -894,36 +894,7 @@ Editor::Stats Editor::GetStats() const NewFeatureCategories Editor::GetNewFeatureCategories() const { - // TODO(mgsergio): Load types user can create from XML file. - // TODO: Not every editable type can be created by user. - CategoriesHolder const & cats = GetDefaultCategories(); - int8_t const locale = CategoriesHolder::MapLocaleToInteger(languages::GetCurrentOrig()); - Classificator const & cl = classif(); - NewFeatureCategories res; - for (auto const & classificatorType : m_config.GetTypesThatCanBeAdded()) - { - uint32_t const type = cl.GetTypeByReadableObjectName(classificatorType); - if (type == 0) - { - LOG(LWARNING, ("Unknown type in Editor's config:", classificatorType)); - continue; - } - res.m_allSorted.emplace_back(type, cats.GetReadableFeatureType(type, locale)); - } - sort(res.m_allSorted.begin(), res.m_allSorted.end(), [](Category const & c1, Category const & c2) - { - return c1.m_name < c2.m_name; - }); - // TODO(mgsergio): Store in Settings:: recent history of created types and use them here. - // Max history items count shoud be set in the config. - uint32_t const cafe = cl.GetTypeByPath({"amenity", "cafe"}); - res.m_lastUsed.emplace_back(cafe, cats.GetReadableFeatureType(cafe, locale)); - uint32_t const restaurant = cl.GetTypeByPath({"amenity", "restaurant"}); - res.m_lastUsed.emplace_back(restaurant, cats.GetReadableFeatureType(restaurant, locale)); - uint32_t const atm = cl.GetTypeByPath({"amenity", "atm"}); - res.m_lastUsed.emplace_back(atm, cats.GetReadableFeatureType(atm, locale)); - - return res; + return NewFeatureCategories(m_config); } FeatureID Editor::GenerateNewFeatureId(MwmSet::MwmId const & id) |