diff options
Diffstat (limited to 'drape_frontend/route_renderer.hpp')
-rw-r--r-- | drape_frontend/route_renderer.hpp | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/drape_frontend/route_renderer.hpp b/drape_frontend/route_renderer.hpp index 2a0ff6167f..7ca388d9ee 100644 --- a/drape_frontend/route_renderer.hpp +++ b/drape_frontend/route_renderer.hpp @@ -1,5 +1,6 @@ #pragma once +#include "drape_frontend/circles_pack_shape.hpp" #include "drape_frontend/route_builder.hpp" #include "drape/drape_global.hpp" @@ -8,10 +9,12 @@ #include "geometry/screenbase.hpp" +#include <chrono> #include <functional> #include <string> #include <vector> #include <unordered_map> +#include <unordered_set> namespace df { @@ -23,11 +26,18 @@ extern std::string const kRouteBicycle; class RouteRenderer final { public: - using TCacheRouteArrowsCallback = std::function<void(dp::DrapeID, std::vector<ArrowBorders> const &)>; + using CacheRouteArrowsCallback = std::function<void(dp::DrapeID, std::vector<ArrowBorders> const &)>; + using PreviewPointsRequestCallback = std::function<void(size_t)>; - RouteRenderer(); + struct PreviewInfo + { + m2::PointD m_startPoint; + m2::PointD m_finishPoint; + }; - void UpdateRoute(ScreenBase const & screen, TCacheRouteArrowsCallback const & callback); + RouteRenderer(PreviewPointsRequestCallback && previewPointsRequest); + + void UpdateRoute(ScreenBase const & screen, CacheRouteArrowsCallback const & callback); void RenderRoute(ScreenBase const & screen, bool trafficShown, ref_ptr<dp::GpuProgramManager> mng, dp::UniformValuesStorage const & commonUniforms); @@ -40,6 +50,11 @@ public: void AddRouteArrowsData(drape_ptr<RouteArrowsData> && routeArrowsData, ref_ptr<dp::GpuProgramManager> mng); + void AddPreviewRenderData(drape_ptr<CirclesPackRenderData> && renderData, + ref_ptr<dp::GpuProgramManager> mng); + + bool UpdatePreview(ScreenBase const & screen); + void Clear(); void ClearRouteData(); void ClearGLDependentResources(); @@ -47,6 +62,12 @@ public: void UpdateDistanceFromBegin(double distanceFromBegin); void SetFollowingEnabled(bool enabled); + void AddPreviewSegment(dp::DrapeID id, PreviewInfo && info); + void RemovePreviewSegment(dp::DrapeID id); + void RemoveAllPreviewSegments(); + + void SetRouteSegmentVisibility(dp::DrapeID id, bool isVisible); + private: struct RouteAdditional { @@ -55,18 +76,29 @@ private: float m_currentHalfWidth = 0.0f; }; - void InterpolateByZoom(drape_ptr<RouteSegment> const & routeSegment, ScreenBase const & screen, - float & halfWidth, double & zoom) const; void RenderRouteData(drape_ptr<RouteData> const & routeData, ScreenBase const & screen, bool trafficShown, ref_ptr<dp::GpuProgramManager> mng, dp::UniformValuesStorage const & commonUniforms); void RenderRouteArrowData(dp::DrapeID segmentId, RouteAdditional const & routeAdditional, ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> mng, dp::UniformValuesStorage const & commonUniforms); + void RenderPreviewData(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> mng, + dp::UniformValuesStorage const & commonUniforms); + void ClearPreviewHandles(); + CirclesPackHandle * GetPreviewHandle(size_t & index); double m_distanceFromBegin; std::vector<drape_ptr<RouteData>> m_routeData; std::unordered_map<dp::DrapeID, RouteAdditional> m_routeAdditional; bool m_followingEnabled; + std::unordered_set<dp::DrapeID> m_hiddenSegments; + + PreviewPointsRequestCallback m_previewPointsRequest; + std::vector<drape_ptr<CirclesPackRenderData>> m_previewRenderData; + std::vector<std::pair<CirclesPackHandle *, size_t>> m_previewHandlesCache; + bool m_waitForPreviewRenderData; + std::unordered_map<dp::DrapeID, PreviewInfo> m_previewSegments; + m2::PointD m_previewPivot = m2::PointD::Zero(); + std::chrono::steady_clock::time_point m_showPreviewTimestamp; }; } // namespace df |