diff options
author | Alex Zolotarev <alex@maps.me> | 2016-03-31 10:33:40 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2016-04-05 13:55:11 +0300 |
commit | c535bc4ab3d5ff852ad6a14f79f5251862a0539f (patch) | |
tree | d8b5284eda027bd7b293c23ff2daf1ca8afea29f /editor | |
parent | f5d1ff127fb68117a3f744ed732ecceaf416485b (diff) |
[editor] Correctly merge editable fields for building + any other type.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_config.cpp | 19 | ||||
-rw-r--r-- | editor/editor_config.hpp | 3 |
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; |