Files
comaps/drape_frontend/route_builder.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

55 lines
1.4 KiB
C++

#pragma once
#include "drape_frontend/color_constants.hpp"
#include "drape_frontend/route_shape.hpp"
#include "drape/pointers.hpp"
#include "traffic/speed_groups.hpp"
#include "geometry/polyline2d.hpp"
#include <functional>
#include <unordered_map>
#include <vector>
namespace dp
{
class TextureManager;
class GraphicsContext;
} // namespace dp
namespace df
{
class RouteBuilder
{
public:
using FlushFn = std::function<void(drape_ptr<SubrouteData> &&)>;
using FlushArrowsFn = std::function<void(drape_ptr<SubrouteArrowsData> &&)>;
using FlushMarkersFn = std::function<void(drape_ptr<SubrouteMarkersData> &&)>;
RouteBuilder(FlushFn && flushFn, FlushArrowsFn && flushArrowsFn,
FlushMarkersFn && flushMarkersFn);
void Build(ref_ptr<dp::GraphicsContext> context, dp::DrapeID subrouteId, SubrouteConstPtr subroute,
ref_ptr<dp::TextureManager> textures, int recacheId);
void BuildArrows(ref_ptr<dp::GraphicsContext> context, dp::DrapeID subrouteId,
std::vector<ArrowBorders> const & borders, ref_ptr<dp::TextureManager> textures, int recacheId);
void ClearRouteCache();
private:
FlushFn m_flushFn;
FlushArrowsFn m_flushArrowsFn;
FlushMarkersFn m_flushMarkersFn;
struct RouteCacheData
{
m2::PolylineD m_polyline;
double m_baseDepthIndex = 0.0;
};
std::unordered_map<dp::DrapeID, RouteCacheData> m_routeCache;
};
} // namespace df