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

drawer.hpp « render - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bce940f7973f2e2a0f0ef98fec8d9a73506e9a56 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#pragma once

#include "graphics/defines.hpp"
#include "graphics/font_desc.hpp"

#include "indexer/feature_decl.hpp"

#include "geometry/point2d.hpp"

#include "std/function.hpp"

namespace di
{
  struct DrawRule;
  class PathInfo;
  class AreaInfo;
  struct FeatureStyler;
  struct FeatureInfo;
}

namespace graphics { class GlyphCache; }

class Drawer
{
  double m_visualScale;
  int m_level;
  FeatureID m_currentFeatureID;

protected:

  virtual void DrawSymbol(m2::PointD const & pt,
                          graphics::EPosition pos,
                          di::DrawRule const & rule) = 0;

  virtual void DrawCircle(m2::PointD const & pt,
                          graphics::EPosition pos,
                          di::DrawRule const & rule) = 0;

  virtual void DrawCircledSymbol(m2::PointD const & pt,
                                 graphics::EPosition pos,
                                 di::DrawRule const & symbolRule,
                                 di::DrawRule const & circleRule) = 0;

  virtual void DrawPath(di::PathInfo const & path,
                        di::DrawRule const * rules,
                        size_t count) = 0;

  virtual void DrawArea(di::AreaInfo const & area,
                        di::DrawRule const & rule) = 0;

  virtual void DrawText(m2::PointD const & pt,
                        graphics::EPosition pos,
                        di::FeatureStyler const & fs,
                        di::DrawRule const & rule) = 0;

  virtual void DrawPathText(di::PathInfo const & info,
                            di::FeatureStyler const & fs,
                            di::DrawRule const & rule) = 0;

  virtual void DrawPathNumber(di::PathInfo const & path,
                              di::FeatureStyler const & fs) = 0;

  void DrawFeatureStart(FeatureID const & id);
  void DrawFeatureEnd(FeatureID const & id);
  FeatureID const & GetCurrentFeatureID() const;

  using TRoadNumberCallbackFn = function<void (m2::PointD const & pt, graphics::FontDesc const & font, string const & text)>;
  void GenerateRoadNumbers(di::PathInfo const & path, di::FeatureStyler const & fs, TRoadNumberCallbackFn const & fn);

public:

  struct Params
  {
    double m_visualScale;
    Params();
  };

  Drawer(Params const & params = Params());
  virtual ~Drawer() {}

  double VisualScale() const;
  void SetScale(int level);

  virtual graphics::GlyphCache * GetGlyphCache() = 0;

  void Draw(di::FeatureInfo const & fi);
};