Road warning marks automatically visible since certain zoom level.

This commit is contained in:
Daria Volvenkova 2019-03-18 15:58:44 +03:00 committed by Roman Kuznetsov
parent 4723ecedd4
commit 3148af8df9
6 changed files with 14 additions and 4 deletions

View file

@ -853,6 +853,7 @@ drape_ptr<UserMarkRenderParams> DrapeEngine::GenerateMarkRenderInfo(UserPointMar
renderInfo->m_minZoom = mark->GetMinZoom();
renderInfo->m_minTitleZoom = mark->GetMinTitleZoom();
renderInfo->m_isVisible = mark->IsVisible();
renderInfo->m_autoVisibleMinZoom = mark->GetAutoVisibleMinZoom();
renderInfo->m_pivot = mark->GetPivot();
renderInfo->m_pixelOffset = mark->GetPixelOffset();
renderInfo->m_titleDecl = mark->GetTitleDecl();

View file

@ -349,7 +349,7 @@ void CacheUserMarks(ref_ptr<dp::GraphicsContext> context, TileKey const & tileKe
continue;
UserMarkRenderParams & renderInfo = *it->second;
if (!renderInfo.m_isVisible)
if (!renderInfo.m_isVisible && renderInfo.m_autoVisibleMinZoom > tileKey.m_zoomLevel)
continue;
m2::PointD const tileCenter = tileKey.GetGlobalRect().Center();

View file

@ -8,6 +8,7 @@
#include "geometry/spline.hpp"
#include <limits>
#include <memory>
#include <unordered_map>
@ -38,6 +39,7 @@ struct UserMarkRenderParams
bool m_hasCreationAnimation = false;
bool m_justCreated = false;
bool m_isVisible = true;
int m_autoVisibleMinZoom = std::numeric_limits<int>::max();
FeatureID m_featureId;
bool m_isMarkAboveText = false;
};

View file

@ -64,6 +64,7 @@ public:
virtual float GetDepth() const = 0;
virtual DepthLayer GetDepthLayer() const = 0;
virtual bool IsVisible() const = 0;
virtual int GetAutoVisibleMinZoom() const = 0;
virtual drape_ptr<TitlesInfo> GetTitleDecl() const = 0;
virtual drape_ptr<SymbolNameZoomInfo> GetSymbolNames() const = 0;
virtual drape_ptr<SymbolNameZoomInfo> GetBadgeNames() const = 0;

View file

@ -205,6 +205,8 @@ enum class RoadWarningMarkType : uint8_t
class RoadWarningMark : public UserMark
{
int const kAutoVisibleMinZoom = 13;
public:
explicit RoadWarningMark(m2::PointD const & ptOrg);
@ -227,6 +229,8 @@ public:
drape_ptr<SymbolNameZoomInfo> GetSymbolNames() const override;
int GetAutoVisibleMinZoom() const override { return kAutoVisibleMinZoom; }
static std::string GetLocalizedRoadWarningType(RoadWarningMarkType type);
private:

View file

@ -9,9 +9,10 @@
#include "base/macros.hpp"
#include "std/string.hpp"
#include "std/unique_ptr.hpp"
#include "std/utility.hpp"
#include <limits>
#include <memory>
#include <string>
#include <utility>
class UserMark : public df::UserPointMark
{
@ -59,6 +60,7 @@ public:
bool IsDirty() const override { return m_isDirty; }
void ResetChanges() const override { m_isDirty = false; }
bool IsVisible() const override { return true; }
int GetAutoVisibleMinZoom() const override { return std::numeric_limits<int>::max(); }
m2::PointD const & GetPivot() const override;
m2::PointD GetPixelOffset() const override { return {}; }
dp::Anchor GetAnchor() const override { return dp::Center; }