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

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

#include "../indexer/drawing_rules.hpp"

#include "../geometry/rect2d.hpp"

#include "../std/vector.hpp"

class FeatureType;

namespace graphics
{
  class GlyphCache;
}

class ScreenBase;

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

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

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

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

    typedef buffer_vector<di::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;

    graphics::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);
  };
}