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

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

#include "../indexer/feature_data.hpp"

#include "../base/buffer_vector.hpp"

#include "../std/function.hpp"
#include "../std/string.hpp"

class FeatureType;

namespace drule { class BaseRule; }

namespace df
{

struct CaptionDescription
{
  CaptionDescription();

  void Init(FeatureType const & f,
            int const zoomLevel);

  void FormatCaptions(FeatureType const & f,
                      feature::EGeomType type,
                      bool auxCaptionExists);

  string const & GetMainText() const;
  string const & GetAuxText() const;
  string const & GetRoadNumber() const;
  string GetPathName() const;
  double GetPopulationRank() const;
  bool IsNameExists() const;

private:
  void SwapCaptions(int const zoomLevel);
  void DiscardLongCaption(int const zoomLevel);

private:
  string m_mainText;
  string m_auxText;
  string m_roadNumber;
  string m_houseNumber;
  double m_populationRank;
};

class Stylist
{
public:
  Stylist();

  bool IsCoastLine() const;
  bool AreaStyleExists() const;
  bool LineStyleExists() const;
  bool PointStyleExists() const;

  CaptionDescription const & GetCaptionDescription() const;

  typedef pair<drule::BaseRule const *, double> rule_wrapper_t;
  typedef function<void (rule_wrapper_t const &)> rule_callback_t;
  void ForEachRule(rule_callback_t const & fn);

  bool IsEmpty() const;

private:
  friend bool InitStylist(FeatureType const &,
                          int const,
                          Stylist &);

  void RaiseCoastlineFlag();
  void RaiseAreaStyleFlag();
  void RaiseLineStyleFlag();
  void RaisePointStyleFlag();

  CaptionDescription & GetCaptionDescriptionImpl();

private:
  typedef buffer_vector<rule_wrapper_t, 8> rules_t;
  rules_t m_rules;

  uint8_t m_state;
  CaptionDescription m_captionDescriptor;
};

bool InitStylist(FeatureType const & f,
                 int const zoomLevel,
                 Stylist & s);

} // namespace df