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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
#pragma once
#include "base/base.hpp"
#include "std/vector.hpp"
#include "std/string.hpp"
namespace feature { class TypesHolder; }
class FeatureType;
namespace ftypes
{
class BaseChecker
{
size_t const m_level;
virtual bool IsMatched(uint32_t type) const;
protected:
vector<uint32_t> m_types;
public:
BaseChecker(size_t level = 2) : m_level(level) {}
virtual ~BaseChecker() {}
bool operator() (feature::TypesHolder const & types) const;
bool operator() (FeatureType const & ft) const;
bool operator() (vector<uint32_t> const & types) const;
static uint32_t PrepareToMatch(uint32_t type, uint8_t level);
};
class IsPeakChecker : public BaseChecker
{
public:
IsPeakChecker();
static IsPeakChecker const & Instance();
};
class IsATMChecker : public BaseChecker
{
public:
IsATMChecker();
static IsATMChecker const & Instance();
};
class IsFuelStationChecker : public BaseChecker
{
public:
IsFuelStationChecker();
static IsFuelStationChecker const & Instance();
};
class IsStreetChecker : public BaseChecker
{
public:
IsStreetChecker();
static IsStreetChecker const & Instance();
};
class IsOneWayChecker : public BaseChecker
{
public:
IsOneWayChecker();
static IsOneWayChecker const & Instance();
};
class IsRoundAboutChecker : public BaseChecker
{
public:
IsRoundAboutChecker();
static IsRoundAboutChecker const & Instance();
};
class IsLinkChecker : public BaseChecker
{
IsLinkChecker();
public:
static IsLinkChecker const & Instance();
};
class IsBuildingChecker : public BaseChecker
{
IsBuildingChecker();
public:
static IsBuildingChecker const & Instance();
uint32_t GetMainType() const { return m_types[0]; }
};
class IsBridgeChecker : public BaseChecker
{
virtual bool IsMatched(uint32_t type) const;
public:
IsBridgeChecker();
static IsBridgeChecker const & Instance();
};
class IsTunnelChecker : public BaseChecker
{
virtual bool IsMatched(uint32_t type) const;
public:
IsTunnelChecker();
static IsTunnelChecker const & Instance();
};
/// Type of locality (do not change values and order - they have detalization order)
/// COUNTRY < STATE < CITY < ...
enum Type { NONE = -1, COUNTRY = 0, STATE, CITY, TOWN, VILLAGE, LOCALITY_COUNT };
class IsLocalityChecker : public BaseChecker
{
public:
IsLocalityChecker();
Type GetType(feature::TypesHolder const & types) const;
Type GetType(FeatureType const & f) const;
static IsLocalityChecker const & Instance();
};
/// @name Get city radius and population.
/// @param r Radius in meters.
//@{
uint32_t GetPopulation(FeatureType const & ft);
double GetRadiusByPopulation(uint32_t p);
uint32_t GetPopulationByRadius(double r);
/// Check if type conforms the path. Strings in the path can be
/// feature types like "highway", "living_street", "bridge" and so on
/// or *. * means any class.
/// The root name ("world") is ignored
bool IsTypeConformed(uint32_t type, vector<string> const & path);
// Highway class. The order is important.
// The enum values follow from the biggest roads (Trunk) to the smallest ones (Service).
enum class HighwayClass
{
Undefined = 0, // There has not been any attempt of calculating HighwayClass.
Error, // There was an attempt of calculating HighwayClass but it was not successful.
Trunk,
Primary,
Secondary,
Tertiary,
LivingStreet,
Service,
Count // This value is used for internals only.
};
string DebugPrint(HighwayClass const cls);
HighwayClass GetHighwayClass(feature::TypesHolder const & types);
HighwayClass GetHighwayClass(FeatureType const & ft);
//@}
} // namespace ftypes
|