diff --git a/drape_frontend/arrow3d.cpp b/drape_frontend/arrow3d.cpp index 3fcf06b67f..a45b72a897 100644 --- a/drape_frontend/arrow3d.cpp +++ b/drape_frontend/arrow3d.cpp @@ -70,6 +70,13 @@ Arrow3d::Arrow3d(ref_ptr context) m_shadowMesh.SetAttribute("a_pos", kVerticesBufferInd, 0 /* offset */, kComponentsInVertex); } +// static +double Arrow3d::GetMaxBottomSize() +{ + double const kBottomSize = 1.0; + return kBottomSize * kArrowSize * kArrow3dScaleMax * kOutlineScale; +} + void Arrow3d::SetPosition(const m2::PointD & position) { m_position = position; diff --git a/drape_frontend/arrow3d.hpp b/drape_frontend/arrow3d.hpp index 25f63fd6aa..c747902d4f 100644 --- a/drape_frontend/arrow3d.hpp +++ b/drape_frontend/arrow3d.hpp @@ -30,6 +30,8 @@ class Arrow3d public: explicit Arrow3d(ref_ptr context); + static double GetMaxBottomSize(); + void SetPosition(m2::PointD const & position); void SetAzimuth(double azimuth); void SetTexture(ref_ptr texMng); diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index 49a72cfc87..858fa809ea 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -924,4 +924,11 @@ void DrapeEngine::UpdateVisualScale(double vs, bool needStopRendering) make_unique_dp(), MessagePriority::Normal); } + +void DrapeEngine::UpdateMyPositionRoutingOffset(bool useDefault, int offsetY) +{ + m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, + make_unique_dp(useDefault, offsetY), + MessagePriority::Normal); +} } // namespace df diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index 5da2847fb4..eb51b695ca 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -241,6 +241,7 @@ public: void ShowDebugInfo(bool shown); void UpdateVisualScale(double vs, bool needStopRendering); + void UpdateMyPositionRoutingOffset(bool useDefault, int offsetY); private: void AddUserEvent(drape_ptr && e); diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index f5bf4ceb98..b257e0d687 100755 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -423,6 +423,14 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) break; } + case Message::Type::UpdateMyPositionRoutingOffset: + { + ref_ptr msg = message; + m_myPositionController->UpdateRoutingOffsetY(msg->UseDefault(), msg->GetOffsetY()); + m_myPositionController->UpdatePosition(); + break; + } + case Message::Type::MapShapes: { ref_ptr msg = message; @@ -435,8 +443,8 @@ void FrontendRenderer::AcceptMessage(ref_ptr message) m_selectObjectMessage.reset(); AddUserEvent(make_unique_dp(m_userEventStream.GetVisibleViewport())); } + break; } - break; case Message::Type::ChangeMyPositionMode: { diff --git a/drape_frontend/message.cpp b/drape_frontend/message.cpp index 4f3b9af55b..14e50cc8e5 100644 --- a/drape_frontend/message.cpp +++ b/drape_frontend/message.cpp @@ -29,6 +29,7 @@ std::string DebugPrint(Message::Type msgType) case Message::Type::GuiLayerRecached: return "GuiLayerRecached"; case Message::Type::GuiRecache: return "GuiRecache"; case Message::Type::GuiLayerLayout: return "GuiLayerLayout"; + case Message::Type::UpdateMyPositionRoutingOffset: return "UpdateMyPositionRoutingOffset"; case Message::Type::MapShapesRecache: return "MapShapesRecache"; case Message::Type::MapShapes: return "MapShapes"; case Message::Type::ChangeMyPositionMode: return "ChangeMyPositionMode"; diff --git a/drape_frontend/message.hpp b/drape_frontend/message.hpp index 24c647afa2..a9b6864e1b 100644 --- a/drape_frontend/message.hpp +++ b/drape_frontend/message.hpp @@ -30,6 +30,7 @@ public: GuiLayerRecached, GuiRecache, GuiLayerLayout, + UpdateMyPositionRoutingOffset, MapShapesRecache, MapShapes, ChangeMyPositionMode, diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp index bb732f61d4..166a5008d5 100644 --- a/drape_frontend/message_subclasses.hpp +++ b/drape_frontend/message_subclasses.hpp @@ -359,6 +359,24 @@ private: gui::TWidgetsLayoutInfo m_layoutInfo; }; +class UpdateMyPositionRoutingOffsetMessage: public Message +{ +public: + UpdateMyPositionRoutingOffsetMessage(bool useDefault, int offsetY) + : m_useDefault(useDefault) + , m_offsetY(offsetY) + {} + + Type GetType() const override { return Type::UpdateMyPositionRoutingOffset; } + + bool UseDefault() const { return m_useDefault; } + int GetOffsetY() const { return m_offsetY; } + +private: + bool m_useDefault; + int m_offsetY; +}; + class ShowChoosePositionMarkMessage : public Message { public: diff --git a/drape_frontend/my_position_controller.cpp b/drape_frontend/my_position_controller.cpp index 3414376f6f..3b328d4c3f 100644 --- a/drape_frontend/my_position_controller.cpp +++ b/drape_frontend/my_position_controller.cpp @@ -25,8 +25,7 @@ namespace df { namespace { -int const kPositionOffsetY = 104; -int const kPositionOffsetYIn3D = 104; +int const kPositionRoutingOffsetY = 104; double const kGpsBearingLifetimeSec = 5.0; double const kMinSpeedThresholdMps = 1.0; @@ -152,7 +151,7 @@ MyPositionController::MyPositionController(Params && params, ref_ptrUpdateVisualScale(vs, m_isRenderingEnabled); } +void Framework::UpdateMyPositionRoutingOffset(bool useDefault, int offsetY) +{ + if (m_drapeEngine != nullptr) + m_drapeEngine->UpdateMyPositionRoutingOffset(useDefault, offsetY); +} + ref_ptr Framework::GetDrapeEngine() { return make_ref(m_drapeEngine); diff --git a/map/framework.hpp b/map/framework.hpp index 7a5e2488c2..08988c0aaf 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -531,6 +531,10 @@ public: void UpdateVisualScale(double vs); + /// Sets the distance between the bottom edge of the arrow and the bottom edge of the visible viewport + /// in follow routing mode or resets it to the default value. + void UpdateMyPositionRoutingOffset(bool useDefault, int offsetY); + private: /// Depends on initialized Drape engine. void SaveViewport();