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

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

#include "indexer/drawing_rules.hpp"

#include "geometry/rect2d.hpp"

#include <cstddef>
#include <cstdint>

class FeatureType;
class ScreenBase;

namespace software_renderer
{
const int maxDepth = 20000;
const int minDepth = -20000;

class GlyphCache;

struct DrawRule
{
  drule::BaseRule const * m_rule;
  double m_depth;

  DrawRule() : m_rule(0), m_depth(0.0) {}
  DrawRule(drule::BaseRule const * p, double depth);

  uint32_t GetID(size_t threadSlot) const;
  void SetID(size_t threadSlot, uint32_t id) const;
};

struct FeatureStyler
{
  FeatureStyler() = default;
  FeatureStyler(FeatureType const & f,
                int const zoom,
                double const visualScale,
                GlyphCache * glyphCache,
                ScreenBase const * convertor,
                m2::RectD const * rect);

  typedef buffer_vector<DrawRule, 8> StylesContainerT;
  StylesContainerT m_rules;

  bool m_isCoastline;
  bool m_hasLineStyles;
  bool m_hasPointStyles;
  bool m_hasPathText;
  int m_geometryType;

  double m_visualScale;

  string m_primaryText;
  string m_secondaryText;
  string m_refText;

  typedef buffer_vector<double, 16> ClipIntervalsT;
  ClipIntervalsT m_intervals;

  typedef buffer_vector<double, 8> TextOffsetsT;
  TextOffsetsT m_offsets;

  uint8_t m_fontSize;

  GlyphCache * m_glyphCache;
  ScreenBase const * m_convertor;
  m2::RectD const * m_rect;

  double m_popRank;

  bool IsEmpty() const;

  string const GetPathName() const;

  bool FilterTextSize(drule::BaseRule const * pRule) const;

private:
  uint8_t GetTextFontSize(drule::BaseRule const * pRule) const;
  void LayoutTexts(double pathLength);
};
}  // namespace software_renderer