blob: d1ebe1aa70453529f7c0a92f833246576a3951c5 (
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
|
#pragma once
#include "generator/feature_builder.hpp"
#include <queue>
struct OsmElement;
namespace generator
{
namespace cache
{
class IntermediateDataReader;
} // namespace cache
// Abstract class FeatureMakerBase is responsible for the conversion OsmElement to FeatureBuilder1.
// The main task of this class is to create features of the necessary types.
// At least one feature should turn out from one OSM element. You can get several features from one element.
class FeatureMakerBase
{
public:
explicit FeatureMakerBase(cache::IntermediateDataReader & cache);
virtual ~FeatureMakerBase() = default;
bool Add(OsmElement & element);
// The function returns true when the receiving feature was successful and a false when not successful.
bool GetNextFeature(feature::FeatureBuilder & feature);
size_t Size() const;
bool Empty() const;
protected:
virtual bool BuildFromNode(OsmElement & element, FeatureParams const & params) = 0;
virtual bool BuildFromWay(OsmElement & element, FeatureParams const & params) = 0;
virtual bool BuildFromRelation(OsmElement & element, FeatureParams const & params) = 0;
virtual void ParseParams(FeatureParams & params, OsmElement & element) const = 0;
cache::IntermediateDataReader & m_cache;
std::queue<feature::FeatureBuilder> m_queue;
};
void TransformAreaToPoint(feature::FeatureBuilder & feature);
void TransformAreaToLine(feature::FeatureBuilder & feature);
feature::FeatureBuilder MakePointFromArea(feature::FeatureBuilder const & feature);
feature::FeatureBuilder MakeLineFromArea(feature::FeatureBuilder const & feature);
} // namespace generator
|