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:
authorvng <viktor.govako@gmail.com>2012-02-15 22:52:45 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:34:08 +0300
commit53bcf037e7d850eb77c1bc7dfd964b31a5d43557 (patch)
treeb30d8a7015e351e20da4f17a2bfdb4ae767336b4 /indexer/feature_visibility.cpp
parentfd4d12b7c3bea550e964f93da08160f42304e66b (diff)
[search] Do index only for visibly types in MWM. Closed #626.
Diffstat (limited to 'indexer/feature_visibility.cpp')
-rw-r--r--indexer/feature_visibility.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp
index 8881da212e..e3e80370b1 100644
--- a/indexer/feature_visibility.cpp
+++ b/indexer/feature_visibility.cpp
@@ -267,6 +267,44 @@ int MinDrawableScaleForFeature(FeatureBase const & f)
namespace
{
+ class DoGetScalesRange
+ {
+ pair<int, int> m_scales;
+ public:
+ DoGetScalesRange() : m_scales(1000, -1000) {}
+ typedef bool ResultType;
+
+ void operator() (ClassifObject const *) {}
+ bool operator() (ClassifObject const * p, bool & res)
+ {
+ res = true;
+
+ pair<int, int> scales = p->GetDrawScaleRange();
+ if (scales.first != -1)
+ {
+ m_scales.first = min(m_scales.first, scales.first);
+ m_scales.second = max(m_scales.second, scales.second);
+ }
+
+ return false;
+ }
+
+ pair<int, int> GetScale() const
+ {
+ return (m_scales.first > m_scales.second ? make_pair(-1, -1) : m_scales);
+ }
+ };
+}
+
+pair<int, int> DrawableScaleRangeForType(uint32_t type)
+{
+ DoGetScalesRange doGet;
+ (void)classif().ProcessObjects(type, doGet);
+ return doGet.GetScale();
+}
+
+namespace
+{
bool IsDrawable(feature::TypesHolder const & types, int level)
{
Classificator const & c = classif();