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/drape
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2016-02-18 18:11:42 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:21:27 +0300
commit519e60dc3f675035281acf8fee4b2203a40e19fa (patch)
tree38d5208b20083e594364bf416bedfe4db0592f2d /drape
parent1a50ff67daaca26aaa7c058f50411b2647439345 (diff)
Remove buckets when current zoom is less than features min visible zoom.
Diffstat (limited to 'drape')
-rw-r--r--drape/batcher.cpp9
-rw-r--r--drape/batcher.hpp2
-rw-r--r--drape/render_bucket.cpp6
-rw-r--r--drape/render_bucket.hpp5
4 files changed, 22 insertions, 0 deletions
diff --git a/drape/batcher.cpp b/drape/batcher.cpp
index 682ead9183..99b8803a44 100644
--- a/drape/batcher.cpp
+++ b/drape/batcher.cpp
@@ -171,6 +171,14 @@ void Batcher::EndSession()
m_flushInterface = TFlushFn();
}
+void Batcher::SetFeatureMinZoom(int minZoom)
+{
+ m_featureMinZoom = minZoom;
+
+ for (auto const & bucket : m_buckets)
+ bucket.second->SetFeatureMinZoom(m_featureMinZoom);
+}
+
void Batcher::StartFeatureRecord(FeatureGeometryId feature, m2::RectD const & limitRect)
{
m_currentFeature = feature;
@@ -214,6 +222,7 @@ ref_ptr<RenderBucket> Batcher::GetBucket(GLState const & state)
ref_ptr<RenderBucket> result = make_ref(buffer);
if (m_currentFeature.IsValid())
result->StartFeatureRecord(m_currentFeature, m_featureLimitRect);
+ result->SetFeatureMinZoom(m_featureMinZoom);
m_buckets.emplace(BucketId(state, m_currentFeature.IsValid()), move(buffer));
diff --git a/drape/batcher.hpp b/drape/batcher.hpp
index 01f51b8f66..d8cc20d346 100644
--- a/drape/batcher.hpp
+++ b/drape/batcher.hpp
@@ -53,6 +53,7 @@ public:
// Begin/end processing of feature with FeatureGeometryId in the batcher.
void StartFeatureRecord(FeatureGeometryId feature, m2::RectD const & limitRect);
void EndFeatureRecord();
+ void SetFeatureMinZoom(int minZoom);
private:
template<typename TBacher>
@@ -97,6 +98,7 @@ private:
FeatureGeometryId m_currentFeature;
m2::RectD m_featureLimitRect;
+ int m_featureMinZoom = 0;
};
class BatcherFactory
diff --git a/drape/render_bucket.cpp b/drape/render_bucket.cpp
index fefe6f8029..c18bcd997c 100644
--- a/drape/render_bucket.cpp
+++ b/drape/render_bucket.cpp
@@ -108,6 +108,12 @@ void RenderBucket::Render()
m_buffer->Render();
}
+void RenderBucket::SetFeatureMinZoom(int minZoom)
+{
+ if (minZoom < m_featuresMinZoom)
+ m_featuresMinZoom = minZoom;
+}
+
void RenderBucket::StartFeatureRecord(FeatureGeometryId feature, const m2::RectD & limitRect)
{
m_featureInfo = make_pair(feature, FeatureGeometryInfo(limitRect));
diff --git a/drape/render_bucket.hpp b/drape/render_bucket.hpp
index c2837a96d1..809a9b7fba 100644
--- a/drape/render_bucket.hpp
+++ b/drape/render_bucket.hpp
@@ -4,6 +4,7 @@
#include "drape/pointers.hpp"
#include "std/function.hpp"
+#include "std/limits.hpp"
class ScreenBase;
@@ -54,6 +55,9 @@ public:
void StartFeatureRecord(FeatureGeometryId feature, m2::RectD const & limitRect);
void EndFeatureRecord(bool featureCompleted);
+ void SetFeatureMinZoom(int minZoom);
+ int GetMinZoom() const { return m_featuresMinZoom; }
+
using TCheckFeaturesWaiting = function<bool(m2::RectD const &)>;
bool IsFeaturesWaiting(TCheckFeaturesWaiting isFeaturesWaiting);
@@ -73,6 +77,7 @@ private:
using TFeaturesGeometryInfo = map<FeatureGeometryId, FeatureGeometryInfo>;
using TFeatureInfo = pair<FeatureGeometryId, FeatureGeometryInfo>;
+ int m_featuresMinZoom = numeric_limits<int>::max();
TFeatureInfo m_featureInfo;
TFeaturesGeometryInfo m_featuresGeometryInfo;