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

holes.hpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e8a4cb997c43dadf0ad11c20743c182dc887e793 (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); }
  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 & 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);
  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 & cache);

  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