Welcome to mirror list, hosted at ThFree Co, Russian Federation.

path_text_shape.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 65f6a6dcd77a36556edbb40649a7d96963f988c6 (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
#pragma once

#include "drape_frontend/map_shape.hpp"
#include "drape_frontend/path_text_handle.hpp"
#include "drape_frontend/shape_view_params.hpp"
#include "drape_frontend/text_layout.hpp"

#include "geometry/spline.hpp"

#include <memory>
#include <vector>

namespace dp
{
class OverlayHandle;
}  // namespace dp

namespace df
{
class PathTextShape : public MapShape
{
public:
  PathTextShape(m2::SharedSpline const & spline, PathTextViewParams const & params,
                TileKey const & tileKey, uint32_t baseTextIndex);
  bool CalculateLayout(ref_ptr<dp::TextureManager> textures);

  std::vector<double> GetOffsets() const { return m_context->GetOffsets(); }

  void Draw(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::Batcher> batcher,
            ref_ptr<dp::TextureManager> textures) const override;
  MapShapeType GetType() const override { return MapShapeType::OverlayType; }

private:
  uint64_t GetOverlayPriority(uint32_t textIndex, size_t textLength) const;

  void DrawPathTextPlain(ref_ptr<dp::GraphicsContext> context,
                         ref_ptr<dp::TextureManager> textures,
                         ref_ptr<dp::Batcher> batcher) const;
  void DrawPathTextOutlined(ref_ptr<dp::GraphicsContext> context,
                            ref_ptr<dp::TextureManager> textures,
                            ref_ptr<dp::Batcher> batcher) const;
  drape_ptr<dp::OverlayHandle> CreateOverlayHandle(uint32_t textIndex,
                                                   ref_ptr<dp::TextureManager> textures) const;

  m2::SharedSpline m_spline;
  PathTextViewParams m_params;
  m2::PointI const m_tileCoords;
  uint32_t const m_baseTextIndex;
  std::shared_ptr<PathTextContext> m_context;
};
}  // namespace df