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
path: root/map
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-05-18 12:04:58 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2015-11-30 16:07:44 +0300
commit2c9095792b519cd9b5781dccd78a57315571bb84 (patch)
tree5af71c38a2e38c3ab95c6f48902896d20c7fbe0a /map
parentde4c1f85115c9cd2eebaa58ea81deb3544f23e56 (diff)
Added reactions to country status buttons
Diffstat (limited to 'map')
-rw-r--r--map/framework.cpp38
-rw-r--r--map/framework.hpp8
2 files changed, 45 insertions, 1 deletions
diff --git a/map/framework.cpp b/map/framework.cpp
index a71c7b4517..0604788130 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -858,6 +858,36 @@ void Framework::ClearAllCaches()
m_searchEngine->ClearAllCaches();
}
+void Framework::OnDownloadMapCallback(storage::TIndex const & countryIndex)
+{
+ m_activeMaps->DownloadMap(countryIndex, TMapOptions::EMapOnly);
+}
+
+void Framework::OnDownloadMapCallbackUI(storage::TIndex const & countryIndex)
+{
+ GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadMapCallback, this, countryIndex));
+}
+
+void Framework::OnDownloadMapRoutingCallback(storage::TIndex const & countryIndex)
+{
+ m_activeMaps->DownloadMap(countryIndex, TMapOptions::EMapWithCarRouting);
+}
+
+void Framework::OnDownloadMapRoutingCallbackUI(storage::TIndex const & countryIndex)
+{
+ GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadMapRoutingCallback, this, countryIndex));
+}
+
+void Framework::OnDownloadRetryCallback(storage::TIndex const & countryIndex)
+{
+ m_activeMaps->RetryDownloading(countryIndex);
+}
+
+void Framework::OnDownloadRetryCallbackUI(storage::TIndex const & countryIndex)
+{
+ GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadRetryCallback, this, countryIndex));
+}
+
void Framework::MemoryWarning()
{
LOG(LINFO, ("MemoryWarning"));
@@ -1273,6 +1303,7 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory,
using TReadFeaturesFn = df::MapDataProvider::TReadFeaturesFn;
using TResolveCountryFn = df::MapDataProvider::TResolveCountryFn;
using TIsCountryLoadedFn = df::MapDataProvider::TIsCountryLoadedFn;
+ using TDownloadFn = df::MapDataProvider::TDownloadFn;
TReadIDsFn idReadFn = [this](df::MapDataProvider::TReadCallback<FeatureID> const & fn, m2::RectD const & r, int scale) -> void
{
@@ -1291,11 +1322,16 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory,
TIsCountryLoadedFn isCountryLoadedFn = bind(&Framework::IsCountryLoaded, this, _1);
+ TDownloadFn downloadMapFn = bind(&Framework::OnDownloadMapCallbackUI, this, _1);
+ TDownloadFn downloadMapRoutingFn = bind(&Framework::OnDownloadMapRoutingCallbackUI, this, _1);
+ TDownloadFn downloadRetryFn = bind(&Framework::OnDownloadRetryCallbackUI, this, _1);
+
df::DrapeEngine::Params p(contextFactory,
make_ref(&m_stringsBundle),
make_ref(m_storageAccessor),
df::Viewport(0, 0, w, h),
- df::MapDataProvider(idReadFn, featureReadFn, resolveCountry,isCountryLoadedFn),
+ df::MapDataProvider(idReadFn, featureReadFn, resolveCountry, isCountryLoadedFn,
+ downloadMapFn, downloadMapRoutingFn, downloadRetryFn),
vs);
m_drapeEngine = make_unique_dp<df::DrapeEngine>(p);
diff --git a/map/framework.hpp b/map/framework.hpp
index 47b4506583..7d88f4aa75 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -298,6 +298,14 @@ private:
void FillSearchResultsMarks(search::Results const & results);
+
+ void OnDownloadMapCallback(storage::TIndex const & countryIndex);
+ void OnDownloadMapCallbackUI(storage::TIndex const & countryIndex);
+ void OnDownloadMapRoutingCallback(storage::TIndex const & countryIndex);
+ void OnDownloadMapRoutingCallbackUI(storage::TIndex const & countryIndex);
+ void OnDownloadRetryCallback(storage::TIndex const & countryIndex);
+ void OnDownloadRetryCallbackUI(storage::TIndex const & countryIndex);
+
public:
using TSearchRequest = search::QuerySaver::TSearchRequest;