blob: c85587acb35bf7aeeacaae266b2b7a78e5b90b5a (
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
|
#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 & cache);
void operator() (uint64_t id) { m_merger.AddWay(id); }
feature::FeatureBuilder::Geometry & GetHoles();
private:
AreaWayMerger m_merger;
feature::FeatureBuilder::Geometry m_holes;
};
/// Find holes for way with 'id' in first relation.
class HolesProcessor
{
public:
explicit HolesProcessor(uint64_t id, cache::IntermediateDataReader & cache);
/// 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);
feature::FeatureBuilder::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 & cache);
void Build(OsmElement const * p);
feature::FeatureBuilder::Geometry & GetHoles() { return m_holes.GetHoles(); }
AreaWayMerger & GetOuter() { return m_outer; }
private:
HolesAccumulator m_holes;
AreaWayMerger m_outer;
};
} // namespace generator
|