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:
authorygorshenin <mipt.vi002@gmail.com>2016-04-06 15:22:13 +0300
committerygorshenin <mipt.vi002@gmail.com>2016-04-06 15:22:13 +0300
commit8a83e58bbf083f2123956727f58300ab57b7b4e7 (patch)
tree5242f9ccccc0a918bf979b3040e25c89450e93a6 /editor
parent317fde62d5dedb5280fb3569f75247f8a4f88d09 (diff)
parentbaf4a0c0cd07bea2472e9934970a0f16778898cd (diff)
Merge pull request #2670 from deathbaba/building-levels-support
[editor] Building levels support in the core.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_config.cpp19
-rw-r--r--editor/editor_config.hpp3
2 files changed, 18 insertions, 4 deletions
diff --git a/editor/editor_config.cpp b/editor/editor_config.cpp
index eaa70d2faf..9920464136 100644
--- a/editor/editor_config.cpp
+++ b/editor/editor_config.cpp
@@ -37,7 +37,7 @@ static unordered_map<string, EType> const kNamesToFMD= {
{"height", feature::Metadata::FMD_HEIGHT},
// {"", feature::Metadata::FMD_MIN_HEIGHT},
{"denomination", feature::Metadata::FMD_DENOMINATION},
- {"building_levels", feature::Metadata::FMD_BUILDING_LEVELS}
+ {"building:levels", feature::Metadata::FMD_BUILDING_LEVELS}
// description
};
@@ -120,9 +120,22 @@ EditorConfig::EditorConfig(string const & fileName)
Reload();
}
-bool EditorConfig::GetTypeDescription(vector<string> const & classificatorTypes,
+bool EditorConfig::GetTypeDescription(vector<string> classificatorTypes,
TypeAggregatedDescription & outDesc) const
{
+ bool isBuilding = false;
+ for (auto it = classificatorTypes.begin(); it != classificatorTypes.end(); ++it)
+ {
+ if (*it == "building")
+ {
+ outDesc.m_address = isBuilding = true;
+ outDesc.m_editableFields.push_back(feature::Metadata::FMD_BUILDING_LEVELS);
+ outDesc.m_editableFields.push_back(feature::Metadata::FMD_POSTCODE);
+ classificatorTypes.erase(it);
+ break;
+ }
+ }
+
auto const typeNodes = GetPrioritizedTypes(m_document);
auto const it = find_if(begin(typeNodes), end(typeNodes),
[&classificatorTypes](pugi::xml_node const & node)
@@ -131,7 +144,7 @@ bool EditorConfig::GetTypeDescription(vector<string> const & classificatorTypes,
node.attribute("id").value()) != end(classificatorTypes);
});
if (it == end(typeNodes))
- return false;
+ return isBuilding;
return TypeDescriptionFromXml(m_document, *it, outDesc);
}
diff --git a/editor/editor_config.hpp b/editor/editor_config.hpp
index 7985185af4..399f03c10a 100644
--- a/editor/editor_config.hpp
+++ b/editor/editor_config.hpp
@@ -43,7 +43,8 @@ class EditorConfig
public:
EditorConfig(string const & fileName = "editor.config");
- bool GetTypeDescription(vector<string> const & classificatorTypes, TypeAggregatedDescription & outDesc) const;
+ // TODO(mgsergio): Reduce overhead by matching uint32_t types instead of strings.
+ bool GetTypeDescription(vector<string> classificatorTypes, TypeAggregatedDescription & outDesc) const;
vector<string> GetTypesThatCanBeAdded() const;
bool EditingEnable() const;