blob: bf13acf107a29ba107c29ee5bf95d9e64a75d2b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#pragma once
#include "drape_frontend/circles_pack_shape.hpp"
#include "drape_frontend/gps_track_point.hpp"
#include "drape/gpu_program_manager.hpp"
#include "drape/pointers.hpp"
#include "drape/uniform_values_storage.hpp"
#include "geometry/screenbase.hpp"
#include "geometry/spline.hpp"
#include <functional>
#include <map>
#include <vector>
namespace df
{
class GpsTrackRenderer final
{
public:
using TRenderDataRequestFn = std::function<void(size_t)>;
explicit GpsTrackRenderer(TRenderDataRequestFn const & dataRequestFn);
void AddRenderData(ref_ptr<dp::GpuProgramManager> mng,
drape_ptr<CirclesPackRenderData> && renderData);
void UpdatePoints(std::vector<GpsTrackPoint> const & toAdd,
std::vector<uint32_t> const & toRemove);
void RenderTrack(ScreenBase const & screen, int zoomLevel,
ref_ptr<dp::GpuProgramManager> mng,
dp::UniformValuesStorage const & commonUniforms);
void Update();
void Clear();
void ClearRenderData();
private:
size_t GetAvailablePointsCount() const;
dp::Color CalculatePointColor(size_t pointIndex, m2::PointD const & curPoint,
double lengthFromStart, double fullLength) const;
dp::Color GetColorBySpeed(double speed) const;
TRenderDataRequestFn m_dataRequestFn;
std::vector<drape_ptr<CirclesPackRenderData>> m_renderData;
std::vector<GpsTrackPoint> m_points;
m2::Spline m_pointsSpline;
bool m_needUpdate;
bool m_waitForRenderData;
std::vector<std::pair<CirclesPackHandle *, size_t>> m_handlesCache;
float m_radius;
m2::PointD m_pivot;
};
} // namespace df
|