From 2e1d268e159c44d1026358ab5fd18b37b2540aea Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Mon, 19 Dec 2016 11:31:25 +0300 Subject: [PATCH] Decreased route width for pedestrians and bicycles --- drape_frontend/route_renderer.cpp | 23 ++++++++++++++++++----- drape_frontend/route_renderer.hpp | 3 ++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drape_frontend/route_renderer.cpp b/drape_frontend/route_renderer.cpp index 7ccb2a84ec..5b61e2bd6e 100644 --- a/drape_frontend/route_renderer.cpp +++ b/drape_frontend/route_renderer.cpp @@ -19,7 +19,7 @@ namespace df namespace { -float const kHalfWidthInPixel[] = +float const kHalfWidthInPixelVehicle[] = { // 1 2 3 4 5 6 7 8 9 10 1.0f, 1.0f, 1.5f, 1.5f, 1.5f, 2.0f, 2.0f, 2.0f, 2.5f, 2.5f, @@ -27,6 +27,14 @@ float const kHalfWidthInPixel[] = 3.0f, 3.0f, 4.0f, 5.0f, 6.0, 8.0f, 10.0f, 10.0f, 18.0f, 27.0f }; +float const kHalfWidthInPixelOthers[] = +{ + // 1 2 3 4 5 6 7 8 9 10 + 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.2f, 1.2f, + //11 12 13 14 15 16 17 18 19 20 + 1.5f, 1.5f, 2.0f, 2.5f, 3.0, 4.0f, 5.0f, 5.0f, 9.0f, 13.0f +}; + int const kArrowAppearingZoomLevel = 14; int const kInvalidGroup = -1; @@ -120,17 +128,22 @@ RouteRenderer::RouteRenderer() : m_distanceFromBegin(0.0) {} -void RouteRenderer::InterpolateByZoom(ScreenBase const & screen, float & halfWidth, double & zoom) const +void RouteRenderer::InterpolateByZoom(ScreenBase const & screen, ColorConstant color, + float & halfWidth, double & zoom) const { double const zoomLevel = GetZoomLevel(screen.GetScale()); zoom = trunc(zoomLevel); int const index = zoom - 1.0; float const lerpCoef = zoomLevel - zoom; + float const * halfWidthInPixel = kHalfWidthInPixelVehicle; + if (color != ColorConstant::Route) + halfWidthInPixel = kHalfWidthInPixelOthers; + if (index < scales::UPPER_STYLE_SCALE) - halfWidth = kHalfWidthInPixel[index] + lerpCoef * (kHalfWidthInPixel[index + 1] - kHalfWidthInPixel[index]); + halfWidth = halfWidthInPixel[index] + lerpCoef * (halfWidthInPixel[index + 1] - halfWidthInPixel[index]); else - halfWidth = kHalfWidthInPixel[scales::UPPER_STYLE_SCALE]; + halfWidth = halfWidthInPixel[scales::UPPER_STYLE_SCALE]; halfWidth *= df::VisualParams::Instance().GetVisualScale(); } @@ -144,7 +157,7 @@ void RouteRenderer::UpdateRoute(ScreenBase const & screen, TCacheRouteArrowsCall // Interpolate values by zoom level. double zoom = 0.0; - InterpolateByZoom(screen, m_currentHalfWidth, zoom); + InterpolateByZoom(screen, m_routeData->m_color, m_currentHalfWidth, zoom); // Update arrows. if (zoom >= kArrowAppearingZoomLevel && !m_routeData->m_sourceTurns.empty()) diff --git a/drape_frontend/route_renderer.hpp b/drape_frontend/route_renderer.hpp index fb7019cc0a..330bea92a6 100644 --- a/drape_frontend/route_renderer.hpp +++ b/drape_frontend/route_renderer.hpp @@ -41,7 +41,8 @@ public: void UpdateDistanceFromBegin(double distanceFromBegin); private: - void InterpolateByZoom(ScreenBase const & screen, float & halfWidth, double & zoom) const; + void InterpolateByZoom(ScreenBase const & screen, ColorConstant color, + float & halfWidth, double & zoom) const; void RenderRouteSign(drape_ptr const & sign, ScreenBase const & screen, ref_ptr mng, dp::UniformValuesStorage const & commonUniforms);