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:
Diffstat (limited to 'map/framework_light.hpp')
-rw-r--r--map/framework_light.hpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/map/framework_light.hpp b/map/framework_light.hpp
index fe0e1f25e1..89b4fa0af4 100644
--- a/map/framework_light.hpp
+++ b/map/framework_light.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "map/bookmark_manager.hpp"
+#include "map/local_ads_manager.hpp"
#include "map/user.hpp"
#include "ugc/storage.hpp"
@@ -28,6 +29,8 @@ enum RequestType
// and takes much time. For example it takes ~50ms on LG Nexus 5, ~100ms on Samsung A5, ~200ms on
// Fly IQ4403.
REQUEST_TYPE_LOCATION = 1u << 4,
+ REQUEST_TYPE_LOCAL_ADS_FEATURES = 1u << 5,
+ REQUEST_TYPE_LOCAL_ADS_STATISTICS = 1u << 6,
};
using RequestTypeMask = unsigned;
@@ -75,6 +78,18 @@ public:
request ^= REQUEST_TYPE_LOCATION;
}
+ if (request & REQUEST_TYPE_LOCAL_ADS_FEATURES)
+ {
+ m_localAdsFeaturesReader = std::make_unique<LocalAdsFeaturesReader>();
+ request ^= REQUEST_TYPE_LOCAL_ADS_FEATURES;
+ }
+
+ if (request & REQUEST_TYPE_LOCAL_ADS_STATISTICS)
+ {
+ m_localAdsStatistics = std::make_unique<Statistics>();
+ request ^= REQUEST_TYPE_LOCAL_ADS_STATISTICS;
+ }
+
CHECK_EQUAL(request, REQUEST_TYPE_EMPTY, ("Incorrect mask type:", request));
}
@@ -84,6 +99,12 @@ public:
template <RequestTypeMask Type>
auto Get(m2::PointD const & pt) const;
+ template <RequestTypeMask Type>
+ auto Get(double lat, double lon, double radiusInMeters, uint32_t maxCount);
+
+ template <RequestTypeMask Type>
+ auto Get();
+
private:
RequestTypeMask m_request;
bool m_userAuthStatus = false;
@@ -91,6 +112,8 @@ private:
size_t m_numberOfUnsentEdits = 0;
bool m_bookmarksCloudEnabled = false;
std::unique_ptr<CountryInfoReader> m_countryInfoReader;
+ std::unique_ptr<LocalAdsFeaturesReader> m_localAdsFeaturesReader;
+ std::unique_ptr<Statistics> m_localAdsStatistics;
};
template<>
@@ -130,4 +153,25 @@ auto Framework::Get<REQUEST_TYPE_LOCATION>(m2::PointD const & pt) const
return m_countryInfoReader->GetMwmInfo(pt);
}
+
+template <>
+auto Framework::Get<REQUEST_TYPE_LOCAL_ADS_FEATURES>(double lat, double lon,
+ double radiusInMeters, uint32_t maxCount)
+{
+ ASSERT(m_request & REQUEST_TYPE_LOCAL_ADS_FEATURES, (m_request));
+
+ CHECK(m_localAdsFeaturesReader, ());
+
+ return m_localAdsFeaturesReader->GetCampaignFeatures(lat, lon, radiusInMeters, maxCount);
+}
+
+template <>
+auto Framework::Get<REQUEST_TYPE_LOCAL_ADS_STATISTICS>()
+{
+ ASSERT(m_request & REQUEST_TYPE_LOCAL_ADS_STATISTICS, (m_request));
+
+ CHECK(m_localAdsStatistics, ());
+
+ return m_localAdsStatistics.get();
+}
} // namespace lightweight