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:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-07-04 14:00:25 +0300
committerVlad Mihaylenko <vxmihaylenko@gmail.com>2018-07-20 14:51:41 +0300
commit00da2f0826c5ef90dc72f9874d05d0b46ebb27f5 (patch)
tree16783bdaf6cac5f9353ca359ed7b73954daf55e7
parentc3191975331f85d0789f7037f280303bce48becb (diff)
Check min visible scale of overlays when build the overlay tree.
-rw-r--r--drape/overlay_handle.cpp12
-rw-r--r--drape/overlay_handle.hpp6
-rw-r--r--drape/overlay_tree.cpp7
-rw-r--r--drape/overlay_tree.hpp3
-rw-r--r--drape_frontend/circles_pack_shape.cpp2
-rw-r--r--drape_frontend/colored_symbol_shape.cpp9
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp2
-rw-r--r--drape_frontend/gui/shape.cpp2
-rw-r--r--drape_frontend/path_text_handle.cpp3
-rw-r--r--drape_frontend/path_text_handle.hpp2
-rw-r--r--drape_frontend/path_text_shape.cpp2
-rw-r--r--drape_frontend/poi_symbol_shape.cpp1
-rw-r--r--drape_frontend/text_handle.cpp8
-rw-r--r--drape_frontend/text_handle.hpp4
-rw-r--r--drape_frontend/text_shape.cpp7
15 files changed, 45 insertions, 25 deletions
diff --git a/drape/overlay_handle.cpp b/drape/overlay_handle.cpp
index d6a6e6a4e7..511bb70b2b 100644
--- a/drape/overlay_handle.cpp
+++ b/drape/overlay_handle.cpp
@@ -28,13 +28,14 @@ private:
};
OverlayHandle::OverlayHandle(OverlayID const & id, dp::Anchor anchor,
- uint64_t priority, bool isBillboard)
+ uint64_t priority, int minVisibleScale, bool isBillboard)
: m_id(id)
, m_anchor(anchor)
, m_priority(priority)
, m_overlayRank(OverlayRank0)
, m_extendingSize(0.0)
, m_pivotZ(0.0)
+ , m_minVisibleScale(minVisibleScale)
, m_isBillboard(isBillboard)
, m_isVisible(false)
, m_enableCaching(false)
@@ -59,6 +60,11 @@ void OverlayHandle::SetIsVisible(bool isVisible)
m_isVisible = isVisible;
}
+int OverlayHandle::GetMinVisibleScale() const
+{
+ return m_minVisibleScale;
+}
+
bool OverlayHandle::IsBillboard() const
{
return m_isBillboard;
@@ -204,8 +210,8 @@ m2::RectD OverlayHandle::GetPixelRectPerspective(ScreenBase const & screen) cons
SquareHandle::SquareHandle(OverlayID const & id, dp::Anchor anchor, m2::PointD const & gbPivot,
m2::PointD const & pxSize, m2::PointD const & pxOffset,
uint64_t priority, bool isBound, std::string const & debugStr,
- bool isBillboard)
- : TBase(id, anchor, priority, isBillboard)
+ int minVisibleScale, bool isBillboard)
+ : TBase(id, anchor, priority, minVisibleScale, isBillboard)
, m_pxHalfSize(pxSize.x / 2.0, pxSize.y / 2.0)
, m_gbPivot(gbPivot)
, m_pxOffset(pxOffset)
diff --git a/drape/overlay_handle.hpp b/drape/overlay_handle.hpp
index 9ca30199b8..66462f2724 100644
--- a/drape/overlay_handle.hpp
+++ b/drape/overlay_handle.hpp
@@ -92,13 +92,14 @@ public:
using Rects = std::vector<m2::RectF>;
OverlayHandle(OverlayID const & id, dp::Anchor anchor,
- uint64_t priority, bool isBillboard);
+ uint64_t priority, int minVisibleScale, bool isBillboard);
virtual ~OverlayHandle() {}
bool IsVisible() const;
void SetIsVisible(bool isVisible);
+ int GetMinVisibleScale() const;
bool IsBillboard() const;
virtual m2::PointD GetPivot(ScreenBase const & screen, bool perspective) const;
@@ -171,6 +172,7 @@ protected:
m2::RectD GetPixelRectPerspective(ScreenBase const & screen) const;
private:
+ int m_minVisibleScale;
bool const m_isBillboard;
bool m_isVisible;
@@ -206,7 +208,7 @@ public:
SquareHandle(OverlayID const & id, dp::Anchor anchor, m2::PointD const & gbPivot,
m2::PointD const & pxSize, m2::PointD const & pxOffset,
uint64_t priority, bool isBound, std::string const & debugStr,
- bool isBillboard = false);
+ int minVisibleScale, bool isBillboard);
m2::RectD GetPixelRect(ScreenBase const & screen, bool perspective) const override;
void GetPixelShape(ScreenBase const & screen, bool perspective, Rects & rects) const override;
diff --git a/drape/overlay_tree.cpp b/drape/overlay_tree.cpp
index 43cba0a10c..32cc336554 100644
--- a/drape/overlay_tree.cpp
+++ b/drape/overlay_tree.cpp
@@ -115,13 +115,14 @@ bool OverlayTree::IsNeedUpdate() const
return m_frameCounter == kInvalidFrame;
}
-void OverlayTree::StartOverlayPlacing(ScreenBase const & screen)
+void OverlayTree::StartOverlayPlacing(ScreenBase const & screen, int zoomLevel)
{
ASSERT(IsNeedUpdate(), ());
TBase::Clear();
m_handlesCache.clear();
m_traits.SetModelView(screen);
m_displacementInfo.clear();
+ m_zoomLevel = zoomLevel;
}
void OverlayTree::Remove(ref_ptr<OverlayHandle> handle)
@@ -140,6 +141,10 @@ void OverlayTree::Add(ref_ptr<OverlayHandle> handle)
ScreenBase const & modelView = GetModelView();
handle->SetIsVisible(false);
+
+ if (m_zoomLevel < handle->GetMinVisibleScale())
+ return;
+
handle->SetCachingEnable(true);
// Skip duplicates.
diff --git a/drape/overlay_tree.hpp b/drape/overlay_tree.hpp
index 91a9887a1a..2d94bfd7b6 100644
--- a/drape/overlay_tree.hpp
+++ b/drape/overlay_tree.hpp
@@ -64,7 +64,7 @@ public:
bool Frame();
bool IsNeedUpdate() const;
- void StartOverlayPlacing(ScreenBase const & screen);
+ void StartOverlayPlacing(ScreenBase const & screen, int zoomLevel);
void Add(ref_ptr<OverlayHandle> handle);
void Remove(ref_ptr<OverlayHandle> handle);
void EndOverlayPlacing();
@@ -117,5 +117,6 @@ private:
HandlesCache m_displacers;
uint32_t m_frameUpdatePeriod;
+ int m_zoomLevel = 1;
};
} // namespace dp
diff --git a/drape_frontend/circles_pack_shape.cpp b/drape_frontend/circles_pack_shape.cpp
index 65c4966243..e25b19fd91 100644
--- a/drape_frontend/circles_pack_shape.cpp
+++ b/drape_frontend/circles_pack_shape.cpp
@@ -58,7 +58,7 @@ dp::BindingInfo const & GetCirclesPackDynamicBindingInfo()
} // namespace
CirclesPackHandle::CirclesPackHandle(size_t pointsCount)
- : OverlayHandle(FeatureID(), dp::Anchor::Center, 0, false)
+ : OverlayHandle(FeatureID(), dp::Anchor::Center, 0 /* priority */, 1 /* minVisibleScale */, false)
, m_needUpdate(false)
{
m_buffer.resize(pointsCount * dp::Batcher::VertexPerQuad);
diff --git a/drape_frontend/colored_symbol_shape.cpp b/drape_frontend/colored_symbol_shape.cpp
index 445c27a2f3..1daaaac18b 100644
--- a/drape_frontend/colored_symbol_shape.cpp
+++ b/drape_frontend/colored_symbol_shape.cpp
@@ -48,8 +48,9 @@ public:
DynamicSquareHandle(dp::OverlayID const & id, dp::Anchor anchor, m2::PointD const & gbPivot,
std::vector<m2::PointF> const & pxSizes, m2::PointD const & pxOffset,
uint64_t priority, bool isBound, std::string const & debugStr,
- bool isBillboard)
- : TBase(id, anchor, gbPivot, m2::PointD::Zero(), pxOffset, priority, isBound, debugStr, isBillboard)
+ int minVisibleScale, bool isBillboard)
+ : TBase(id, anchor, gbPivot, m2::PointD::Zero(), pxOffset, priority, isBound, debugStr, minVisibleScale,
+ isBillboard)
, m_pxSizes(pxSizes)
{
ASSERT_GREATER(pxSizes.size(), 0, ());
@@ -281,13 +282,13 @@ void ColoredSymbolShape::Draw(ref_ptr<dp::Batcher> batcher,
{
handle = make_unique_dp<DynamicSquareHandle>(overlayId, m_params.m_anchor, m_point, m_overlaySizes,
m2::PointD(m_params.m_offset), GetOverlayPriority(), true /* isBound */,
- debugName, true /* isBillboard */);
+ debugName, m_params.m_minVisibleScale, true /* isBillboard */);
}
else
{
handle = make_unique_dp<dp::SquareHandle>(overlayId, m_params.m_anchor, m_point, m2::PointD(pixelSize),
m2::PointD(m_params.m_offset), GetOverlayPriority(), true /* isBound */,
- debugName, true /* isBillboard */);
+ debugName, m_params.m_minVisibleScale, true /* isBillboard */);
}
if (m_params.m_specialDisplacement == SpecialDisplacement::UserMark ||
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index 223515878b..5cf22ffa33 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -1147,7 +1147,7 @@ void FrontendRenderer::ProcessSelection(ref_ptr<SelectObjectMessage> msg)
void FrontendRenderer::BeginUpdateOverlayTree(ScreenBase const & modelView)
{
if (m_overlayTree->Frame())
- m_overlayTree->StartOverlayPlacing(modelView);
+ m_overlayTree->StartOverlayPlacing(modelView, m_currentZoomLevel);
}
void FrontendRenderer::UpdateOverlayTree(ScreenBase const & modelView, drape_ptr<RenderGroup> & renderGroup)
diff --git a/drape_frontend/gui/shape.cpp b/drape_frontend/gui/shape.cpp
index 99f873c4ff..c78b9d16b8 100644
--- a/drape_frontend/gui/shape.cpp
+++ b/drape_frontend/gui/shape.cpp
@@ -13,7 +13,7 @@
namespace gui
{
Handle::Handle(uint32_t id, dp::Anchor anchor, m2::PointF const & pivot, m2::PointF const & size)
- : dp::OverlayHandle(FeatureID(MwmSet::MwmId(), id), anchor, 0, false)
+ : dp::OverlayHandle(FeatureID(MwmSet::MwmId(), id), anchor, 0 /* priority */, 1 /* minVisibleScale */, false)
, m_pivot(glsl::ToVec2(pivot))
, m_size(size)
{}
diff --git a/drape_frontend/path_text_handle.cpp b/drape_frontend/path_text_handle.cpp
index 051825b3fd..403814605b 100644
--- a/drape_frontend/path_text_handle.cpp
+++ b/drape_frontend/path_text_handle.cpp
@@ -252,9 +252,10 @@ PathTextHandle::PathTextHandle(dp::OverlayID const & id,
float depth, uint32_t textIndex,
uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager,
+ int minVisibleScale,
bool isBillboard)
: TextHandle(id, context->GetLayout()->GetText(), dp::Center, priority,
- fixedHeight, textureManager, isBillboard)
+ fixedHeight, textureManager, minVisibleScale, isBillboard)
, m_context(context)
, m_textIndex(textIndex)
, m_depth(depth)
diff --git a/drape_frontend/path_text_handle.hpp b/drape_frontend/path_text_handle.hpp
index c6bf52f3dc..25dd4e7ecf 100644
--- a/drape_frontend/path_text_handle.hpp
+++ b/drape_frontend/path_text_handle.hpp
@@ -52,7 +52,7 @@ public:
float depth, uint32_t textIndex,
uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager,
- bool isBillboard);
+ int minVisibleScale, bool isBillboard);
void BeforeUpdate() override;
bool Update(ScreenBase const & screen) override;
diff --git a/drape_frontend/path_text_shape.cpp b/drape_frontend/path_text_shape.cpp
index c3f89f7751..efd476ff4d 100644
--- a/drape_frontend/path_text_shape.cpp
+++ b/drape_frontend/path_text_shape.cpp
@@ -157,7 +157,7 @@ drape_ptr<dp::OverlayHandle> PathTextShape::CreateOverlayHandle(uint32_t textInd
auto const priority = GetOverlayPriority(textIndex, layout->GetText().size());
return make_unique_dp<PathTextHandle>(overlayId, m_context, m_params.m_depth,
textIndex, priority, layout->GetFixedHeight(),
- textures, true /* isBillboard */);
+ textures, m_params.m_minVisibleScale, true /* isBillboard */);
}
void PathTextShape::Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const
diff --git a/drape_frontend/poi_symbol_shape.cpp b/drape_frontend/poi_symbol_shape.cpp
index ab0f28ead6..3edd88b185 100644
--- a/drape_frontend/poi_symbol_shape.cpp
+++ b/drape_frontend/poi_symbol_shape.cpp
@@ -153,6 +153,7 @@ drape_ptr<dp::OverlayHandle> PoiSymbolShape::CreateOverlayHandle(m2::PointF cons
GetOverlayPriority(),
true /* isBound */,
m_params.m_symbolName,
+ m_params.m_minVisibleScale,
true /* isBillboard */);
handle->SetPivotZ(m_params.m_posZ);
handle->SetExtendingSize(m_params.m_extendingSize);
diff --git a/drape_frontend/text_handle.cpp b/drape_frontend/text_handle.cpp
index e09b7d30e2..849ee227f0 100644
--- a/drape_frontend/text_handle.cpp
+++ b/drape_frontend/text_handle.cpp
@@ -12,8 +12,8 @@ namespace df
TextHandle::TextHandle(dp::OverlayID const & id, strings::UniString const & text,
dp::Anchor anchor, uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager,
- bool isBillboard)
- : OverlayHandle(id, anchor, priority, isBillboard)
+ int minVisibleScale, bool isBillboard)
+ : OverlayHandle(id, anchor, priority, minVisibleScale, isBillboard)
, m_forceUpdateNormals(false)
, m_isLastVisible(false)
, m_text(text)
@@ -26,8 +26,8 @@ TextHandle::TextHandle(dp::OverlayID const & id, strings::UniString const & text
dp::Anchor anchor, uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager,
gpu::TTextDynamicVertexBuffer && normals,
- bool isBillboard)
- : OverlayHandle(id, anchor, priority, isBillboard)
+ int minVisibleScale, bool isBillboard)
+ : OverlayHandle(id, anchor, priority, minVisibleScale, isBillboard)
, m_buffer(move(normals))
, m_forceUpdateNormals(false)
, m_isLastVisible(false)
diff --git a/drape_frontend/text_handle.hpp b/drape_frontend/text_handle.hpp
index 05545baa3f..2dd060350d 100644
--- a/drape_frontend/text_handle.hpp
+++ b/drape_frontend/text_handle.hpp
@@ -21,13 +21,13 @@ public:
TextHandle(dp::OverlayID const & id, strings::UniString const & text,
dp::Anchor anchor, uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager,
- bool isBillboard = false);
+ int minVisibleScale, bool isBillboard);
TextHandle(dp::OverlayID const & id, strings::UniString const & text,
dp::Anchor anchor, uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager,
gpu::TTextDynamicVertexBuffer && normals,
- bool IsBillboard = false);
+ int minVisibleScale, bool IsBillboard);
bool Update(ScreenBase const & screen) override;
diff --git a/drape_frontend/text_shape.cpp b/drape_frontend/text_shape.cpp
index 3de76e5263..68f9978710 100644
--- a/drape_frontend/text_shape.cpp
+++ b/drape_frontend/text_shape.cpp
@@ -30,8 +30,9 @@ public:
glsl::vec2 const & pxSize, glsl::vec2 const & offset,
uint64_t priority, int fixedHeight,
ref_ptr<dp::TextureManager> textureManager, bool isOptional,
- gpu::TTextDynamicVertexBuffer && normals, bool isBillboard = false)
- : TextHandle(id, text, anchor, priority, fixedHeight, textureManager, std::move(normals), isBillboard)
+ gpu::TTextDynamicVertexBuffer && normals, int minVisibleScale, bool isBillboard)
+ : TextHandle(id, text, anchor, priority, fixedHeight, textureManager, std::move(normals), minVisibleScale,
+ isBillboard)
, m_pivot(glsl::ToPoint(pivot))
, m_offset(glsl::ToPoint(offset))
, m_size(glsl::ToPoint(pxSize))
@@ -340,6 +341,7 @@ void TextShape::DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDe
textures,
isOptional,
std::move(dynamicBuffer),
+ m_params.m_minVisibleScale,
true);
if (m_symbolSizes.size() > 1)
handle->SetDynamicSymbolSizes(layout, m_symbolSizes, m_symbolAnchor);
@@ -400,6 +402,7 @@ void TextShape::DrawSubStringOutlined(StraightTextLayout const & layout, dp::Fon
textures,
isOptional,
std::move(dynamicBuffer),
+ m_params.m_minVisibleScale,
true);
if (m_symbolSizes.size() > 1)
handle->SetDynamicSymbolSizes(layout, m_symbolSizes, m_symbolAnchor);