Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorDmitry Yunitsky <yunik@mapswithme.com>2016-04-28 15:32:36 +0300
committerAlex Zolotarev <alex@maps.me>2016-05-01 10:28:03 +0300
commit9c12757d30e021641b17d48a50a8e8c8cb945b2e (patch)
tree978aaecf7f94449f72ef89673819bcdd2cf66572 /editor
parent9d7fc9dbbe1a2fc816c5afa049b8eab4f827bb2c (diff)
Fixed build : moved indexer-dependent file from editor.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor.pro2
-rw-r--r--editor/new_feature_categories.cpp92
-rw-r--r--editor/new_feature_categories.hpp58
3 files changed, 0 insertions, 152 deletions
diff --git a/editor/editor.pro b/editor/editor.pro
index c8b3f768b9..0491b9262a 100644
--- a/editor/editor.pro
+++ b/editor/editor.pro
@@ -12,7 +12,6 @@ SOURCES += \
changeset_wrapper.cpp \
editor_config.cpp \
editor_notes.cpp \
- new_feature_categories.cpp \
opening_hours_ui.cpp \
osm_auth.cpp \
osm_feature_matcher.cpp \
@@ -24,7 +23,6 @@ HEADERS += \
changeset_wrapper.hpp \
editor_config.hpp \
editor_notes.hpp \
- new_feature_categories.hpp \
opening_hours_ui.hpp \
osm_auth.hpp \
osm_feature_matcher.hpp \
diff --git a/editor/new_feature_categories.cpp b/editor/new_feature_categories.cpp
deleted file mode 100644
index 24733ed7aa..0000000000
--- a/editor/new_feature_categories.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-#include "new_feature_categories.hpp"
-
-#include "indexer/categories_holder.hpp"
-#include "indexer/classificator.hpp"
-
-#include "base/assert.hpp"
-#include "base/stl_helpers.hpp"
-
-#include "std/algorithm.hpp"
-
-namespace osm
-{
-NewFeatureCategories::NewFeatureCategories(editor::EditorConfig const & config)
-{
- // TODO(mgsergio): Load types user can create from XML file.
- // TODO: Not every editable type can be created by user.
- // TODO(mgsergio): Store in Settings:: recent history of created types and use them here.
- // Max history items count shoud be set in the config.
- Classificator const & cl = classif();
- for (auto const & classificatorType : config.GetTypesThatCanBeAdded())
- {
- uint32_t const type = cl.GetTypeByReadableObjectName(classificatorType);
- if (type == 0)
- {
- LOG(LWARNING, ("Unknown type in Editor's config:", classificatorType));
- continue;
- }
- m_types.push_back(type);
- }
-}
-
-NewFeatureCategories::NewFeatureCategories(NewFeatureCategories && other)
- : m_index(move(other.m_index))
- , m_types(move(other.m_types))
- , m_categoriesByLang(move(other.m_categoriesByLang))
-{
-}
-
-void NewFeatureCategories::AddLanguage(string lang)
-{
- auto langCode = CategoriesHolder::MapLocaleToInteger(lang);
- if (langCode == CategoriesHolder::kUnsupportedLocaleCode)
- {
- lang = "en";
- langCode = CategoriesHolder::kEnglishCode;
- }
- if (m_categoriesByLang.find(lang) != m_categoriesByLang.end())
- return;
-
- NewFeatureCategories::TNames names;
- names.reserve(m_types.size());
- for (auto const & type : m_types)
- {
- m_index.AddCategoryByTypeAndLang(type, langCode);
- names.emplace_back(m_index.GetCategoriesHolder()->GetReadableFeatureType(type, langCode), type);
- }
- my::SortUnique(names);
- m_categoriesByLang[lang] = names;
-}
-
-NewFeatureCategories::TNames NewFeatureCategories::Search(string const & query, string lang) const
-{
- auto langCode = CategoriesHolder::MapLocaleToInteger(lang);
- if (langCode == CategoriesHolder::kUnsupportedLocaleCode)
- {
- lang = "en";
- langCode = CategoriesHolder::kEnglishCode;
- }
- vector<uint32_t> resultTypes;
- m_index.GetAssociatedTypes(query, resultTypes);
-
- NewFeatureCategories::TNames result(resultTypes.size());
- for (size_t i = 0; i < result.size(); ++i)
- {
- result[i].first =
- m_index.GetCategoriesHolder()->GetReadableFeatureType(resultTypes[i], langCode);
- result[i].second = resultTypes[i];
- }
- my::SortUnique(result);
- return result;
-}
-
-NewFeatureCategories::TNames const & NewFeatureCategories::GetAllCategoryNames(
- string const & lang) const
-{
- auto it = m_categoriesByLang.find(lang);
- if (it == m_categoriesByLang.end())
- it = m_categoriesByLang.find("en");
- CHECK(it != m_categoriesByLang.end(), ());
- return it->second;
-}
-} // namespace osm
diff --git a/editor/new_feature_categories.hpp b/editor/new_feature_categories.hpp
deleted file mode 100644
index 0e46108a3c..0000000000
--- a/editor/new_feature_categories.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#pragma once
-
-#include "editor/editor_config.hpp"
-
-#include "indexer/categories_index.hpp"
-
-#include "base/macros.hpp"
-
-#include "std/cstdint.hpp"
-#include "std/map.hpp"
-#include "std/string.hpp"
-#include "std/utility.hpp"
-#include "std/vector.hpp"
-
-namespace osm
-{
-// This class holds an index of categories that can be set for a newly added feature.
-class NewFeatureCategories
-{
-public:
- using TName = pair<string, uint32_t>;
- using TNames = vector<TName>;
-
- NewFeatureCategories(editor::EditorConfig const & config);
-
- NewFeatureCategories(NewFeatureCategories && other);
-
- NewFeatureCategories() = default;
-
- NewFeatureCategories & operator=(NewFeatureCategories && other) = default;
-
- // Adds all known synonyms in language |lang| for all categories that
- // can be applied to a newly added feature.
- // If one language is added more than once, all the calls except for the
- // first one are ignored.
- // If |lang| is not supported, "en" is used.
- void AddLanguage(string lang);
-
- // Returns names (in language |lang|) and types of categories that have a synonym containing
- // the substring |query| (in any language that was added before).
- // If |lang| is not supported, "en" is used.
- // The returned list is sorted.
- TNames Search(string const & query, string lang) const;
-
- // Returns all registered names of categories in language |lang| and
- // types corresponding to these names. The language must have been added before.
- // If |lang| is not supported, "en" is used.
- // The returned list is sorted.
- TNames const & GetAllCategoryNames(string const & lang) const;
-
-private:
- indexer::CategoriesIndex m_index;
- vector<uint32_t> m_types;
- map<string, TNames> m_categoriesByLang;
-
- DISALLOW_COPY(NewFeatureCategories);
-};
-} // namespace osm