forked from organicmaps/organicmaps-tmp
Don't make additional read of mwm header in app startup.
This commit is contained in:
parent
910e94c537
commit
b4d57fad50
5 changed files with 16 additions and 12 deletions
|
@ -108,7 +108,7 @@ string MwmSet::MwmLock::GetCountryName() const
|
|||
return src.substr(0, src.size() - strlen(DATA_FILE_EXTENSION));
|
||||
}
|
||||
|
||||
bool MwmSet::Add(string const & fileName)
|
||||
bool MwmSet::Add(string const & fileName, m2::RectD & r)
|
||||
{
|
||||
threads::MutexGuard mutexGuard(m_lock);
|
||||
UNUSED_VALUE(mutexGuard);
|
||||
|
@ -124,6 +124,8 @@ bool MwmSet::Add(string const & fileName)
|
|||
GetInfo(fileName, m_info[id]);
|
||||
m_info[id].m_lockCount = 0;
|
||||
m_info[id].m_status = MwmInfo::STATUS_ACTIVE;
|
||||
|
||||
r = m_info[id].m_limitRect;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,8 +56,15 @@ public:
|
|||
MwmValueBase * m_pValue;
|
||||
};
|
||||
|
||||
// Add new mwm. Returns false, if mwm with given fileName already exists.
|
||||
bool Add(string const & fileName);
|
||||
/// Add new mwm. Returns false, if mwm with given fileName already exists.
|
||||
/// @param[in] fileName File name (without full path) of country.
|
||||
/// @param[out] r Limit rect of country.
|
||||
bool Add(string const & fileName, m2::RectD & r);
|
||||
inline bool Add(string const & fileName)
|
||||
{
|
||||
m2::RectD dummy;
|
||||
return Add(fileName, dummy);
|
||||
}
|
||||
|
||||
// Remove mwm.
|
||||
void Remove(string const & fileName);
|
||||
|
|
|
@ -42,7 +42,9 @@ void FeaturesFetcher::AddMap(string const & file)
|
|||
{
|
||||
try
|
||||
{
|
||||
m_multiIndex.Add(file);
|
||||
m2::RectD r;
|
||||
m_multiIndex.Add(file, r);
|
||||
m_rect.Add(r);
|
||||
}
|
||||
catch (Reader::Exception const & e)
|
||||
{
|
||||
|
|
|
@ -62,8 +62,6 @@ namespace model
|
|||
//@}
|
||||
|
||||
index_t const & GetIndex() const { return m_multiIndex; }
|
||||
|
||||
void AddWorldRect(m2::RectD const & r) { m_rect.Add(r); }
|
||||
m2::RectD GetWorldRect() const;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "../indexer/feature.hpp"
|
||||
#include "../indexer/scales.hpp"
|
||||
#include "../indexer/drawing_rules.hpp"
|
||||
#include "../indexer/data_factory.hpp"
|
||||
|
||||
#include "../base/math.hpp"
|
||||
#include "../base/string_utils.hpp"
|
||||
|
@ -42,12 +41,8 @@ template <typename TModel>
|
|||
void Framework<TModel>::AddMap(string const & file)
|
||||
{
|
||||
LOG(LDEBUG, ("Loading map:", file));
|
||||
|
||||
threads::MutexGuard lock(m_modelSyn);
|
||||
|
||||
feature::DataHeader h;
|
||||
LoadMapHeader(GetPlatform().GetReader(file), h);
|
||||
|
||||
m_model.AddWorldRect(h.GetBounds());
|
||||
m_model.AddMap(file);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue