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
|
#include "generator/translator_world.hpp"
#include "generator/feature_maker.hpp"
#include "generator/filter_planet.hpp"
#include "generator/filter_elements.hpp"
#include "generator/generate_info.hpp"
#include "generator/intermediate_data.hpp"
#include "generator/node_mixer.hpp"
#include "platform/platform.hpp"
#include "base/file_name_utils.hpp"
#include "defines.hpp"
namespace generator
{
TranslatorWorld::TranslatorWorld(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
feature::GenerateInfo const & info)
: Translator(emitter, cache, std::make_shared<FeatureMaker>(cache))
, m_tagAdmixer(info.GetIntermediateFileName("ways", ".csv"), info.GetIntermediateFileName("towns", ".csv"))
, m_tagReplacer(GetPlatform().ResourcesDir() + REPLACED_TAGS_FILE)
{
AddFilter(std::make_shared<FilterPlanet>());
AddFilter(std::make_shared<FilterElements>(base::JoinPath(GetPlatform().ResourcesDir(), SKIPPED_ELEMENTS_FILE)));
}
void TranslatorWorld::Preprocess(OsmElement & element)
{
// Here we can add new tags to the elements!
m_tagReplacer(element);
m_tagAdmixer(element);
}
TranslatorWorldWithAds::TranslatorWorldWithAds(std::shared_ptr<EmitterInterface> emitter,
cache::IntermediateDataReader & cache,
feature::GenerateInfo const & info)
: TranslatorWorld(emitter, cache, info)
, m_osmTagMixer(base::JoinPath(GetPlatform().ResourcesDir(), MIXED_TAGS_FILE)) {}
void TranslatorWorldWithAds::Preprocess(OsmElement & element)
{
// Here we can add new tags to the elements!
m_osmTagMixer(element);
TranslatorWorld::Preprocess(element);
}
bool TranslatorWorldWithAds::Finish()
{
MixFakeNodes(GetPlatform().ResourcesDir() + MIXED_NODES_FILE,
std::bind(&TranslatorWorldWithAds::Emit, this, std::placeholders::_1));
return TranslatorWorld::Finish();
}
} // namespace generator
|