forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathholes.hpp
62 lines (48 loc) · 1.4 KB
/
holes.hpp
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
#pragma once
#include "generator/feature_builder.hpp"
#include "generator/ways_merger.hpp"
#include "base/control_flow.hpp"
#include <cstdint>
struct OsmElement;
namespace generator
{
namespace cache
{
class IntermediateDataReader;
} // namespace cache
class HolesAccumulator
{
public:
explicit HolesAccumulator(cache::IntermediateDataReader & holder);
void operator() (uint64_t id) { m_merger.AddWay(id); }
FeatureBuilder1::Geometry & GetHoles();
private:
AreaWayMerger m_merger;
FeatureBuilder1::Geometry m_holes;
};
/// Find holes for way with 'id' in first relation.
class HolesProcessor
{
public:
explicit HolesProcessor(uint64_t id, cache::IntermediateDataReader & holder);
/// 1. relations process function
base::ControlFlow operator() (uint64_t /* id */, RelationElement const & e);
/// 2. "ways in relation" process function
void operator() (uint64_t id, std::string const & role);
FeatureBuilder1::Geometry & GetHoles() { return m_holes.GetHoles(); }
private:
uint64_t m_id; ///< id of way to find it's holes
HolesAccumulator m_holes;
};
class HolesRelation
{
public:
explicit HolesRelation(cache::IntermediateDataReader & holder);
void Build(OsmElement const * p);
FeatureBuilder1::Geometry & GetHoles() { return m_holes.GetHoles(); }
AreaWayMerger & GetOuter() { return m_outer; }
private:
HolesAccumulator m_holes;
AreaWayMerger m_outer;
};
} // namespace generator