From f9d8af3def6236239f1a26c299e683fa979b1e6b Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Tue, 22 Dec 2015 22:07:55 +0300 Subject: [PATCH] Create MwmId in the Editor by map name. --- indexer/osm_editor.hpp | 4 ++++ map/framework.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index 606b201ea4..ec8a5de436 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -23,6 +23,7 @@ class Editor final Editor(); public: + using TMwmIdByMapNameFn = function; using TInvalidateFn = function; enum FeatureStatus @@ -35,6 +36,7 @@ public: static Editor & Instance(); + void SetMwmIdByNameAndVersionFn(TMwmIdByMapNameFn && fn) { m_mwmIdByMapNameFn = move(fn); } void SetInvalidateFn(TInvalidateFn && fn) { m_invalidateFn = move(fn); } void Load(string const & fullFilePath); @@ -83,6 +85,8 @@ private: /// Deleted, edited and created features. map> m_features; + /// Get MwmId for each map, used in FeatureIDs and to check if edits are up-to-date. + TMwmIdByMapNameFn m_mwmIdByMapNameFn; /// Invalidate map viewport after edits. TInvalidateFn m_invalidateFn; }; // class Editor diff --git a/map/framework.cpp b/map/framework.cpp index ec231b0049..2b058c5f37 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -322,7 +322,12 @@ Framework::Framework() LOG(LINFO, ("System languages:", languages::GetPreferred())); - osm::Editor::Instance().SetInvalidateFn([this](){ InvalidateRect(GetCurrentViewport()); }); + osm::Editor & editor = osm::Editor::Instance(); + editor.SetMwmIdByNameAndVersionFn([this](string const & name) -> MwmSet::MwmId + { + return m_model.GetIndex().GetMwmIdByCountryFile(platform::CountryFile(name)); + }); + editor.SetInvalidateFn([this](){ InvalidateRect(GetCurrentViewport()); }); } Framework::~Framework()