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

text_shape.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87676032ac95b662f207999cb13a4c4c313a3cea (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
56
57
58
59
60
61
62
63
64
#pragma once

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

#include "drape/constants.hpp"
#include "drape/glsl_types.hpp"

#include "geometry/point2d.hpp"

#include <vector>

namespace df
{
class StraightTextLayout;

class TextShape : public MapShape
{
public:
  TextShape(m2::PointD const & basePoint, TextViewParams const & params,
            TileKey const & tileKey, m2::PointF const & symbolSize, m2::PointF const & symbolOffset,
            dp::Anchor symbolAnchor, uint32_t textIndex);

  TextShape(m2::PointD const & basePoint, TextViewParams const & params,
            TileKey const & tileKey, std::vector<m2::PointF> const & symbolSizes,
            m2::PointF const & symbolOffset, dp::Anchor symbolAnchor, uint32_t textIndex);

  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; }

  // Only for testing purposes!
  void DisableDisplacing() { m_disableDisplacing = true; }

private:
  void DrawSubString(ref_ptr<dp::GraphicsContext> context, StraightTextLayout & layout,
                     dp::FontDecl const & font, glsl::vec2 const & baseOffset,
                     ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures,
                     bool isPrimary, bool isOptional) const;

  void DrawSubStringPlain(ref_ptr<dp::GraphicsContext> context, StraightTextLayout const & layout,
                          dp::FontDecl const & font, glsl::vec2 const & baseOffset,
                          ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures,
                          bool isPrimary, bool isOptional) const;

  void DrawSubStringOutlined(ref_ptr<dp::GraphicsContext> context,
                             StraightTextLayout const & layout, dp::FontDecl const & font,
                             glsl::vec2 const & baseOffset, ref_ptr<dp::Batcher> batcher,
                             ref_ptr<dp::TextureManager> textures, bool isPrimary,
                             bool isOptional) const;

  uint64_t GetOverlayPriority() const;

  m2::PointD m_basePoint;
  TextViewParams m_params;
  m2::PointI m_tileCoords;
  std::vector<m2::PointF> m_symbolSizes;
  dp::Anchor m_symbolAnchor;
  m2::PointF m_symbolOffset;
  uint32_t m_textIndex;

  bool m_disableDisplacing = false;
};
}  // namespace df