forked from organicmaps/organicmaps
Create MwmId in the Editor by map name.
This commit is contained in:
parent
a1472b3102
commit
f9d8af3def
2 changed files with 10 additions and 1 deletions
|
@ -23,6 +23,7 @@ class Editor final
|
|||
Editor();
|
||||
|
||||
public:
|
||||
using TMwmIdByMapNameFn = function<MwmSet::MwmId(string const & /*map*/)>;
|
||||
using TInvalidateFn = function<void()>;
|
||||
|
||||
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<MwmSet::MwmId, map<uint32_t, FeatureTypeInfo>> 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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue