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

apply_feature_functors.hpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 18cb66349c9066bceb31948b2302e880e91e1f4b (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
90
91
92
93
94
95
96
97
98
99
100
101
102
#pragma once

#include "stylist.hpp"
#include "tile_key.hpp"

#include "../indexer/point_to_int64.hpp"

#include "../geometry/point2d.hpp"
#include "../geometry/spline.hpp"

class CircleRuleProto;
class SymbolRuleProto;
class CaptionDefProto;

namespace df
{

struct TextViewParams;
class EngineContext;

class BaseApplyFeature
{
public:
  BaseApplyFeature(EngineContext & context,
                   TileKey tileKey,
                   FeatureID const & id,
                   CaptionDescription const & captions);

protected:
  void ExtractCaptionParams(CaptionDefProto const * primaryProto,
                            CaptionDefProto const * secondaryProto,
                            double depth,
                            TextViewParams & params) const;

protected:
  EngineContext & m_context;
  TileKey m_tileKey;
  FeatureID m_id;
  CaptionDescription const & m_captions;
};

class ApplyPointFeature : public BaseApplyFeature
{
  typedef BaseApplyFeature TBase;
public:
  ApplyPointFeature(EngineContext & context,
                    TileKey tileKey,
                    FeatureID const & id,
                    CaptionDescription const & captions);

  void operator()(m2::PointD const & point);
  void ProcessRule(Stylist::rule_wrapper_t const & rule);
  void Finish();

private:
  bool m_hasPoint;
  double m_symbolDepth;
  double m_circleDepth;
  SymbolRuleProto const * m_symbolRule;
  CircleRuleProto const * m_circleRule;
  m2::PointF m_centerPoint;
};

class ApplyAreaFeature : public ApplyPointFeature
{
  typedef ApplyPointFeature TBase;
public:
  ApplyAreaFeature(EngineContext & context,
                   TileKey tileKey,
                   FeatureID const & id,
                   CaptionDescription const & captions);

  using TBase::operator ();

  void operator()(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3);
  void ProcessRule(Stylist::rule_wrapper_t const & rule);

private:
  vector<m2::PointF> m_triangles;
};

class ApplyLineFeature : public BaseApplyFeature
{
  typedef BaseApplyFeature TBase;
public:
  ApplyLineFeature(EngineContext & context,
                   TileKey tileKey,
                   FeatureID const & id,
                   CaptionDescription const & captions,
                   double currentScaleGtoP);

  void operator() (m2::PointD const & point);
  bool HasGeometry() const;
  void ProcessRule(Stylist::rule_wrapper_t const & rule);
  void Finish();

private:
  m2::SharedSpline m_spline;
  double m_currentScaleGtoP;
};

} // namespace df