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
diff options
context:
space:
mode:
authorgorshenin <y.gorshenin@corp.mail.ru>2015-07-01 16:48:58 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:53:27 +0300
commita7bcdb5ae8b8e75c1a3806b00b19f3b80c72c5b3 (patch)
treee24caedef110b579fcedc15d29c62cc43e3f6d9c /map/feature_vec_model.cpp
parente0470160313b3ed0bc396ffec72b16fded6b8520 (diff)
Revert "[storage, framework, index] Storage redesign. Plain strings are replaced to CountryFile and LocalCountryFile."
Diffstat (limited to 'map/feature_vec_model.cpp')
-rw-r--r--map/feature_vec_model.cpp67
1 files changed, 40 insertions, 27 deletions
diff --git a/map/feature_vec_model.cpp b/map/feature_vec_model.cpp
index ca5f1f4ba0..ec7b701f25 100644
--- a/map/feature_vec_model.cpp
+++ b/map/feature_vec_model.cpp
@@ -13,20 +13,9 @@
#include "std/bind.hpp"
-using platform::CountryFile;
-using platform::LocalCountryFile;
namespace model
{
-FeaturesFetcher::FeaturesFetcher()
-{
- m_multiIndex.AddObserver(*this);
-}
-
-FeaturesFetcher::~FeaturesFetcher()
-{
- m_multiIndex.RemoveObserver(*this);
-}
// While reading any files (classificator or mwm), there are 2 types of possible exceptions:
// Reader::Exception, FileAbsentException.
@@ -44,47 +33,71 @@ void FeaturesFetcher::InitClassificator()
}
}
-pair<MwmSet::MwmLock, bool> FeaturesFetcher::RegisterMap(LocalCountryFile const & localFile)
+pair<MwmSet::MwmLock, bool> FeaturesFetcher::RegisterMap(string const & file)
{
- string const countryFileName = localFile.GetCountryFile().GetNameWithoutExt();
try
{
- pair<MwmSet::MwmLock, bool> result = m_multiIndex.RegisterMap(localFile);
- if (!result.second)
+ pair<MwmSet::MwmLock, bool> p = m_multiIndex.RegisterMap(file);
+ if (!p.second)
{
- LOG(LWARNING, ("Can't add map", countryFileName,
- "Probably it's already added or has newer data version."));
- return result;
+ LOG(LWARNING,
+ ("Can't add map", file, "Probably it's already added or has newer data version."));
+ return p;
}
- MwmSet::MwmLock & lock = result.first;
+ MwmSet::MwmLock & lock = p.first;
ASSERT(lock.IsLocked(), ("Mwm lock invariant violation."));
m_rect.Add(lock.GetInfo()->m_limitRect);
- return result;
+ return p;
}
catch (RootException const & e)
{
- LOG(LERROR, ("IO error while adding ", countryFileName, " map. ", e.what()));
+ LOG(LERROR, ("IO error while adding ", file, " map. ", e.what()));
return make_pair(MwmSet::MwmLock(), false);
}
}
-bool FeaturesFetcher::DeregisterMap(CountryFile const & countryFile)
+void FeaturesFetcher::DeregisterMap(string const & file) { m_multiIndex.Deregister(file); }
+
+void FeaturesFetcher::DeregisterAllMaps() { m_multiIndex.DeregisterAll(); }
+
+bool FeaturesFetcher::DeleteMap(string const & file)
+{
+ return m_multiIndex.DeleteMap(file);
+}
+
+pair<MwmSet::MwmLock, Index::UpdateStatus> FeaturesFetcher::UpdateMap(string const & file)
{
- return m_multiIndex.Deregister(countryFile);
+ return m_multiIndex.UpdateMap(file);
}
-void FeaturesFetcher::DeregisterAllMaps() { m_multiIndex.DeregisterAll(); }
+//void FeaturesFetcher::Clean()
+//{
+// m_rect.MakeEmpty();
+// // TODO: m_multiIndex.Clear(); - is it needed?
+//}
void FeaturesFetcher::ClearCaches()
{
m_multiIndex.ClearCache();
}
-void FeaturesFetcher::OnMapDeregistered(platform::LocalCountryFile const & localFile)
+/*
+bool FeaturesFetcher::IsLoaded(m2::PointD const & pt) const
{
- if (m_onMapDeregistered)
- m_onMapDeregistered(localFile);
+ vector<MwmInfo> info;
+ m_multiIndex.GetMwmInfo(info);
+
+ for (size_t i = 0; i < info.size(); ++i)
+ if (info[i].IsExist() &&
+ info[i].GetType() == MwmInfo::COUNTRY &&
+ info[i].m_limitRect.IsPointInside(pt))
+ {
+ return true;
+ }
+
+ return false;
}
+*/
m2::RectD FeaturesFetcher::GetWorldRect() const
{