forked from organicmaps/organicmaps-tmp
[generator] Translators can merge and clone.
This commit is contained in:
parent
004bf5d83b
commit
62bb019017
17 changed files with 482 additions and 158 deletions
|
@ -1,8 +1,7 @@
|
|||
#include "generator/translator.hpp"
|
||||
|
||||
#include "generator/collector_interface.hpp"
|
||||
#include "generator/emitter_interface.hpp"
|
||||
#include "generator/intermediate_data.hpp"
|
||||
#include "generator/collector_collection.hpp"
|
||||
#include "generator/filter_collection.hpp"
|
||||
#include "generator/osm_element.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
@ -11,62 +10,67 @@ using namespace feature;
|
|||
|
||||
namespace generator
|
||||
{
|
||||
Translator::Translator(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
std::shared_ptr<FeatureMakerBase> maker, FilterCollection const & filters,
|
||||
CollectorCollection const & collectors)
|
||||
: m_filters(filters)
|
||||
, m_collectors(collectors)
|
||||
, m_tagsEnricher(cache)
|
||||
Translator::Translator(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
std::shared_ptr<FeatureMakerBase> const & maker,
|
||||
std::shared_ptr<FilterInterface> const & filter,
|
||||
std::shared_ptr<CollectorInterface> const & collector)
|
||||
: m_filter(filter)
|
||||
, m_collector(collector)
|
||||
, m_tagsEnricher(cache->GetCache())
|
||||
, m_featureMaker(maker)
|
||||
, m_emitter(emitter)
|
||||
, m_processor(processor)
|
||||
, m_cache(cache)
|
||||
{
|
||||
CHECK(m_emitter, ());
|
||||
m_featureMaker->SetCache(cache);
|
||||
}
|
||||
|
||||
Translator::Translator(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
std::shared_ptr<FeatureMakerBase> maker)
|
||||
: Translator(emitter, cache, maker, {} /* filters */, {} /* collectors */) {}
|
||||
Translator::Translator(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
std::shared_ptr<FeatureMakerBase> const & maker)
|
||||
: Translator(processor, cache, maker, std::make_shared<FilterCollection>(), std::make_shared<CollectorCollection>())
|
||||
{
|
||||
}
|
||||
|
||||
void Translator::SetCollector(std::shared_ptr<CollectorInterface> const & collector)
|
||||
{
|
||||
m_collector = collector;
|
||||
}
|
||||
|
||||
void Translator::SetFilter(std::shared_ptr<FilterInterface> const & filter)
|
||||
{
|
||||
m_filter = filter;
|
||||
}
|
||||
|
||||
void Translator::Emit(OsmElement & element)
|
||||
{
|
||||
if (!m_filters.IsAccepted(element))
|
||||
if (!m_filter->IsAccepted(element))
|
||||
return;
|
||||
|
||||
Preprocess(element);
|
||||
m_tagsEnricher(element);
|
||||
m_collectors.Collect(element);
|
||||
m_collector->Collect(element);
|
||||
m_featureMaker->Add(element);
|
||||
FeatureBuilder feature;
|
||||
while (m_featureMaker->GetNextFeature(feature))
|
||||
{
|
||||
if (!m_filters.IsAccepted(feature))
|
||||
if (!m_filter->IsAccepted(feature))
|
||||
continue;
|
||||
|
||||
m_collectors.CollectFeature(feature, element);
|
||||
m_emitter->Process(feature);
|
||||
m_collector->CollectFeature(feature, element);
|
||||
m_processor->Process(feature);
|
||||
}
|
||||
}
|
||||
|
||||
bool Translator::Finish()
|
||||
void Translator::Finish()
|
||||
{
|
||||
m_collectors.Finish();
|
||||
m_collectors.Save();
|
||||
return m_emitter->Finish();
|
||||
m_collector->Finish();
|
||||
m_processor->Finish();
|
||||
}
|
||||
|
||||
void Translator::GetNames(std::vector<std::string> & names) const
|
||||
bool Translator::Save()
|
||||
{
|
||||
m_emitter->GetNames(names);
|
||||
}
|
||||
|
||||
void Translator::AddCollector(std::shared_ptr<CollectorInterface> collector)
|
||||
{
|
||||
m_collectors.Append(collector);
|
||||
}
|
||||
|
||||
void Translator::AddFilter(std::shared_ptr<FilterInterface> filter)
|
||||
{
|
||||
m_filters.Append(filter);
|
||||
m_collector->Save();
|
||||
return true;
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/collector_collection.hpp"
|
||||
#include "generator/collector_interface.hpp"
|
||||
#include "generator/feature_maker_base.hpp"
|
||||
#include "generator/filter_collection.hpp"
|
||||
#include "generator/filter_interface.hpp"
|
||||
#include "generator/intermediate_data.hpp"
|
||||
#include "generator/processor_interface.hpp"
|
||||
#include "generator/relation_tags_enricher.hpp"
|
||||
#include "generator/translator_interface.hpp"
|
||||
|
||||
|
@ -15,39 +16,50 @@ struct OsmElement;
|
|||
|
||||
namespace generator
|
||||
{
|
||||
class EmitterInterface;
|
||||
class CollectorInterface;
|
||||
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateDataReader;
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
// Implementing this base class allows an object to create FeatureBuilder1 from OsmElement and then process it.
|
||||
// Implementing this base class allows an object to create FeatureBuilder from OsmElement and then process it.
|
||||
// You can add any collectors and filters.
|
||||
class Translator : public TranslatorInterface
|
||||
{
|
||||
public:
|
||||
explicit Translator(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
std::shared_ptr<FeatureMakerBase> maker, FilterCollection const & filters,
|
||||
CollectorCollection const & collectors);
|
||||
explicit Translator(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
std::shared_ptr<FeatureMakerBase> maker);
|
||||
explicit Translator(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
std::shared_ptr<FeatureMakerBase> const & maker,
|
||||
std::shared_ptr<FilterInterface> const & filter,
|
||||
std::shared_ptr<CollectorInterface> const & collector);
|
||||
explicit Translator(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
std::shared_ptr<FeatureMakerBase> const & maker);
|
||||
|
||||
void SetCollector(std::shared_ptr<CollectorInterface> const & collector);
|
||||
void SetFilter(std::shared_ptr<FilterInterface> const & filter);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
void Emit(OsmElement & element) override;
|
||||
bool Finish() override;
|
||||
void GetNames(std::vector<std::string> & names) const override;
|
||||
|
||||
void AddCollector(std::shared_ptr<CollectorInterface> collector);
|
||||
void AddFilter(std::shared_ptr<FilterInterface> filter);
|
||||
void Finish() override;
|
||||
bool Save() override;
|
||||
|
||||
protected:
|
||||
FilterCollection m_filters;
|
||||
CollectorCollection m_collectors;
|
||||
template <typename T>
|
||||
decltype(auto) CloneBase() const
|
||||
{
|
||||
auto cache = m_cache->Clone();
|
||||
auto processor = m_processor->Clone();
|
||||
auto featureMaker = m_featureMaker->Clone();
|
||||
auto filter = m_filter->Clone();
|
||||
auto collector = m_collector->Clone(cache->GetCache());
|
||||
return std::make_shared<T>(processor, cache, featureMaker, filter, collector);
|
||||
}
|
||||
|
||||
std::shared_ptr<FilterInterface> m_filter;
|
||||
std::shared_ptr<CollectorInterface> m_collector;
|
||||
RelationTagsEnricher m_tagsEnricher;
|
||||
std::shared_ptr<FeatureMakerBase> m_featureMaker;
|
||||
std::shared_ptr<EmitterInterface> m_emitter;
|
||||
cache::IntermediateDataReader & m_cache;
|
||||
std::shared_ptr<FeatureProcessorInterface> m_processor;
|
||||
std::shared_ptr<cache::IntermediateData> m_cache;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "generator/translator_coastline.hpp"
|
||||
|
||||
#include "generator/collector_interface.hpp"
|
||||
#include "generator/feature_maker.hpp"
|
||||
#include "generator/filter_collection.hpp"
|
||||
#include "generator/filter_elements.hpp"
|
||||
#include "generator/filter_planet.hpp"
|
||||
#include "generator/generate_info.hpp"
|
||||
|
@ -12,6 +14,8 @@
|
|||
|
||||
#include "base/file_name_utils.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "defines.hpp"
|
||||
|
||||
using namespace feature;
|
||||
|
@ -37,12 +41,31 @@ public:
|
|||
};
|
||||
} // namespace
|
||||
|
||||
TranslatorCoastline::TranslatorCoastline(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache)
|
||||
: Translator(emitter, cache, std::make_shared<FeatureMaker>(cache))
|
||||
TranslatorCoastline::TranslatorCoastline(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache)
|
||||
: Translator(processor, cache, std::make_shared<FeatureMaker>(cache))
|
||||
{
|
||||
AddFilter(std::make_shared<FilterPlanet>());
|
||||
AddFilter(std::make_shared<CoastlineFilter>());
|
||||
AddFilter(std::make_shared<FilterElements>(base::JoinPath(GetPlatform().ResourcesDir(), SKIPPED_ELEMENTS_FILE)));
|
||||
auto filters = std::make_shared<FilterCollection>();
|
||||
filters->Append(std::make_shared<FilterPlanet>());
|
||||
filters->Append(std::make_shared<CoastlineFilter>());
|
||||
filters->Append(std::make_shared<FilterElements>(base::JoinPath(GetPlatform().ResourcesDir(), SKIPPED_ELEMENTS_FILE)));
|
||||
SetFilter(filters);
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorCoastline::Clone() const
|
||||
{
|
||||
return Translator::CloneBase<TranslatorCoastline>();
|
||||
}
|
||||
|
||||
void TranslatorCoastline::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
other.MergeInto(*this);
|
||||
}
|
||||
|
||||
void TranslatorCoastline::MergeInto(TranslatorCoastline & other) const
|
||||
{
|
||||
other.m_collector->Merge(*m_collector);
|
||||
other.m_processor->Merge(*m_processor);
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/emitter_interface.hpp"
|
||||
#include "generator/processor_interface.hpp"
|
||||
#include "generator/translator.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
@ -12,7 +12,7 @@ struct GenerateInfo;
|
|||
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateDataReader;
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
namespace generator
|
||||
|
@ -21,7 +21,17 @@ namespace generator
|
|||
class TranslatorCoastline : public Translator
|
||||
{
|
||||
public:
|
||||
explicit TranslatorCoastline(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache);
|
||||
explicit TranslatorCoastline(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
|
||||
protected:
|
||||
using Translator::Translator;
|
||||
|
||||
void MergeInto(TranslatorCoastline & other) const override;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -7,6 +7,15 @@
|
|||
|
||||
namespace generator
|
||||
{
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorCollection::Clone() const
|
||||
{
|
||||
auto p = std::make_shared<TranslatorCollection>();
|
||||
for (auto const & c : m_collection)
|
||||
p->Append(c->Clone());
|
||||
return p;
|
||||
}
|
||||
|
||||
void TranslatorCollection::Emit(OsmElement /* const */ & element)
|
||||
{
|
||||
for (auto & t : m_collection)
|
||||
|
@ -16,20 +25,29 @@ void TranslatorCollection::Emit(OsmElement /* const */ & element)
|
|||
}
|
||||
}
|
||||
|
||||
bool TranslatorCollection::Finish()
|
||||
void TranslatorCollection::Finish()
|
||||
{
|
||||
for (auto & t : m_collection)
|
||||
t->Finish();
|
||||
}
|
||||
|
||||
bool TranslatorCollection::Save()
|
||||
{
|
||||
return std::all_of(std::begin(m_collection), std::end(m_collection), [](auto & t) {
|
||||
return t->Finish();
|
||||
return t->Save();
|
||||
});
|
||||
}
|
||||
|
||||
void TranslatorCollection::GetNames(std::vector<std::string> & names) const
|
||||
void TranslatorCollection::Merge(TranslatorInterface const & collector)
|
||||
{
|
||||
for (auto & t : m_collection)
|
||||
{
|
||||
std::vector<std::string> temp;
|
||||
t->GetNames(temp);
|
||||
std::move(std::begin(temp), std::end(temp), std::back_inserter(names));
|
||||
}
|
||||
collector.MergeInto(*this);
|
||||
}
|
||||
|
||||
void TranslatorCollection::MergeInto(TranslatorCollection & collector) const
|
||||
{
|
||||
auto & otherCollection = collector.m_collection;
|
||||
CHECK_EQUAL(m_collection.size(), otherCollection.size(), ());
|
||||
for (size_t i = 0; i < m_collection.size(); ++i)
|
||||
otherCollection[i]->Merge(*m_collection[i]);
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -12,8 +12,14 @@ class TranslatorCollection : public CollectionBase<std::shared_ptr<TranslatorInt
|
|||
{
|
||||
public:
|
||||
// TranslatorInterface overrides:
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Emit(OsmElement /* const */ & element) override;
|
||||
bool Finish() override;
|
||||
void GetNames(std::vector<std::string> & names) const override;
|
||||
|
||||
void Finish() override;
|
||||
bool Save() override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorCollection & other) const override;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
|
||||
#include "generator/collector_addresses.hpp"
|
||||
#include "generator/collector_camera.hpp"
|
||||
#include "generator/collector_city_area.hpp"
|
||||
#include "generator/collector_collection.hpp"
|
||||
#include "generator/collector_interface.hpp"
|
||||
#include "generator/collector_tag.hpp"
|
||||
#include "generator/feature_maker.hpp"
|
||||
#include "generator/filter_collection.hpp"
|
||||
#include "generator/filter_elements.hpp"
|
||||
#include "generator/filter_planet.hpp"
|
||||
#include "generator/generate_info.hpp"
|
||||
|
@ -22,6 +25,7 @@
|
|||
|
||||
#include <cctype>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "defines.hpp"
|
||||
|
@ -33,19 +37,20 @@ namespace
|
|||
class RelationCollector
|
||||
{
|
||||
public:
|
||||
explicit RelationCollector(CollectorCollection & collectors) : m_collectors(collectors) {}
|
||||
explicit RelationCollector(std::shared_ptr<CollectorInterface> const & collectors)
|
||||
: m_collectors(collectors) {}
|
||||
|
||||
template <class Reader>
|
||||
base::ControlFlow operator()(uint64_t id, Reader & reader)
|
||||
{
|
||||
RelationElement element;
|
||||
CHECK(reader.Read(id, element), (id));
|
||||
m_collectors.CollectRelation(element);
|
||||
m_collectors->CollectRelation(element);
|
||||
return base::ControlFlow::Continue;
|
||||
}
|
||||
|
||||
private:
|
||||
CollectorInterface & m_collectors;
|
||||
std::shared_ptr<CollectorInterface> m_collectors;
|
||||
};
|
||||
|
||||
// https://www.wikidata.org/wiki/Wikidata:Identifiers
|
||||
|
@ -69,27 +74,40 @@ bool WikiDataValidator(std::string const & tagValue)
|
|||
}
|
||||
} // namespace
|
||||
|
||||
TranslatorCountry::TranslatorCountry(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
TranslatorCountry::TranslatorCountry(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info)
|
||||
: Translator(emitter, cache, std::make_shared<FeatureMaker>(cache))
|
||||
: Translator(processor, cache, std::make_shared<FeatureMaker>(cache))
|
||||
, m_tagAdmixer(info.GetIntermediateFileName("ways", ".csv"), info.GetIntermediateFileName("towns", ".csv"))
|
||||
, m_tagReplacer(base::JoinPath(GetPlatform().ResourcesDir(), REPLACED_TAGS_FILE))
|
||||
{
|
||||
AddFilter(std::make_shared<FilterPlanet>());
|
||||
AddFilter(std::make_shared<FilterElements>(base::JoinPath(GetPlatform().ResourcesDir(), SKIPPED_ELEMENTS_FILE)));
|
||||
auto filters = std::make_shared<FilterCollection>();
|
||||
filters->Append(std::make_shared<FilterPlanet>());
|
||||
filters->Append(std::make_shared<FilterElements>(base::JoinPath(GetPlatform().ResourcesDir(), SKIPPED_ELEMENTS_FILE)));
|
||||
SetFilter(filters);
|
||||
|
||||
AddCollector(std::make_shared<feature::MetalinesBuilder>(info.GetIntermediateFileName(METALINES_FILENAME)));
|
||||
auto collectors = std::make_shared<CollectorCollection>();
|
||||
collectors->Append(std::make_shared<feature::MetalinesBuilder>(info.GetIntermediateFileName(METALINES_FILENAME)));
|
||||
collectors->Append(std::make_shared<CityAreaCollector>(info.GetIntermediateFileName(CITIES_AREAS_TMP_FILENAME)));
|
||||
// These are the four collector that collect additional information for the future building of routing section.
|
||||
AddCollector(std::make_shared<MaxspeedsCollector>(info.GetIntermediateFileName(MAXSPEEDS_FILENAME)));
|
||||
AddCollector(std::make_shared<routing::RestrictionWriter>(info.GetIntermediateFileName(RESTRICTIONS_FILENAME),
|
||||
std::shared_ptr<cache::IntermediateDataReader>(&cache, [](cache::IntermediateDataReader *) {})));
|
||||
AddCollector(std::make_shared<routing::RoadAccessWriter>(info.GetIntermediateFileName(ROAD_ACCESS_FILENAME)));
|
||||
AddCollector(std::make_shared<routing::CameraCollector>(info.GetIntermediateFileName(CAMERAS_TO_WAYS_FILENAME)));
|
||||
|
||||
collectors->Append(std::make_shared<MaxspeedsCollector>(info.GetIntermediateFileName(MAXSPEEDS_FILENAME)));
|
||||
collectors->Append(std::make_shared<routing::RestrictionWriter>(info.GetIntermediateFileName(RESTRICTIONS_FILENAME), cache->GetCache()));
|
||||
collectors->Append(std::make_shared<routing::RoadAccessWriter>(info.GetIntermediateFileName(ROAD_ACCESS_FILENAME)));
|
||||
collectors->Append(std::make_shared<routing::CameraCollector>(info.GetIntermediateFileName(CAMERAS_TO_WAYS_FILENAME)));
|
||||
if (info.m_genAddresses)
|
||||
AddCollector(std::make_shared<CollectorAddresses>(info.GetAddressesFileName()));
|
||||
collectors->Append(std::make_shared<CollectorAddresses>(info.GetAddressesFileName()));
|
||||
if (!info.m_idToWikidataFilename.empty())
|
||||
AddCollector(std::make_shared<CollectorTag>(info.m_idToWikidataFilename, "wikidata" /* tagKey */, WikiDataValidator));
|
||||
collectors->Append(std::make_shared<CollectorTag>(info.m_idToWikidataFilename, "wikidata" /* tagKey */, WikiDataValidator));
|
||||
SetCollector(collectors);
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorCountry::Clone() const
|
||||
{
|
||||
auto copy = Translator::CloneBase<TranslatorCountry>();
|
||||
copy->m_tagAdmixer = m_tagAdmixer;
|
||||
copy->m_tagReplacer = m_tagReplacer;
|
||||
return copy;
|
||||
}
|
||||
|
||||
void TranslatorCountry::Preprocess(OsmElement & element)
|
||||
|
@ -99,20 +117,44 @@ void TranslatorCountry::Preprocess(OsmElement & element)
|
|||
CollectFromRelations(element);
|
||||
}
|
||||
|
||||
void TranslatorCountry::CollectFromRelations(OsmElement const & element)
|
||||
void TranslatorCountry::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
RelationCollector collector(m_collectors);
|
||||
if (element.IsNode())
|
||||
m_cache.ForEachRelationByNodeCached(element.m_id, collector);
|
||||
else if (element.IsWay())
|
||||
m_cache.ForEachRelationByWayCached(element.m_id, collector);
|
||||
other.MergeInto(*this);
|
||||
}
|
||||
|
||||
TranslatorCountryWithAds::TranslatorCountryWithAds(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache,
|
||||
void TranslatorCountry::MergeInto(TranslatorCountry & other) const
|
||||
{
|
||||
other.m_collector->Merge(*m_collector);
|
||||
other.m_processor->Merge(*m_processor);
|
||||
}
|
||||
|
||||
void TranslatorCountry::CollectFromRelations(OsmElement const & element)
|
||||
{
|
||||
auto const & cache = m_cache->GetCache();
|
||||
RelationCollector collector(m_collector);
|
||||
if (element.IsNode())
|
||||
cache->ForEachRelationByNodeCached(element.m_id, collector);
|
||||
else if (element.IsWay())
|
||||
cache->ForEachRelationByWayCached(element.m_id, collector);
|
||||
}
|
||||
|
||||
TranslatorCountryWithAds::TranslatorCountryWithAds(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info)
|
||||
: TranslatorCountry(emitter, cache, info)
|
||||
, m_osmTagMixer(base::JoinPath(GetPlatform().ResourcesDir(), MIXED_TAGS_FILE)) {}
|
||||
: TranslatorCountry(processor, cache, info)
|
||||
, m_osmTagMixer(base::JoinPath(GetPlatform().ResourcesDir(), MIXED_TAGS_FILE))
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorCountryWithAds::Clone() const
|
||||
{
|
||||
auto copy = Translator::CloneBase<TranslatorCountryWithAds>();
|
||||
copy->m_tagAdmixer = m_tagAdmixer;
|
||||
copy->m_tagReplacer = m_tagReplacer;
|
||||
copy->m_osmTagMixer = m_osmTagMixer;
|
||||
return copy;
|
||||
}
|
||||
|
||||
void TranslatorCountryWithAds::Preprocess(OsmElement & element)
|
||||
{
|
||||
|
@ -121,10 +163,20 @@ void TranslatorCountryWithAds::Preprocess(OsmElement & element)
|
|||
TranslatorCountry::Preprocess(element);
|
||||
}
|
||||
|
||||
bool TranslatorCountryWithAds::Finish()
|
||||
bool TranslatorCountryWithAds::Save()
|
||||
{
|
||||
MixFakeNodes(GetPlatform().ResourcesDir() + MIXED_NODES_FILE,
|
||||
std::bind(&TranslatorCountryWithAds::Emit, this, std::placeholders::_1));
|
||||
return TranslatorCountry::Finish();
|
||||
return TranslatorCountry::Save();
|
||||
}
|
||||
|
||||
void TranslatorCountryWithAds::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
TranslatorCountry::Merge(other);
|
||||
}
|
||||
|
||||
void TranslatorCountryWithAds::MergeInto(TranslatorCountryWithAds & other) const
|
||||
{
|
||||
TranslatorCountry::MergeInto(other);
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/emitter_interface.hpp"
|
||||
#include "generator/processor_interface.hpp"
|
||||
#include "generator/tag_admixer.hpp"
|
||||
#include "generator/translator.hpp"
|
||||
|
||||
|
@ -13,7 +13,7 @@ struct GenerateInfo;
|
|||
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateDataReader;
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
namespace generator
|
||||
|
@ -21,14 +21,22 @@ namespace generator
|
|||
// The TranslatorArea class implements translator for building countries.
|
||||
class TranslatorCountry : public Translator
|
||||
{
|
||||
public:
|
||||
explicit TranslatorCountry(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
public:
|
||||
explicit TranslatorCountry(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
void Preprocess(OsmElement & element) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorCountry & other) const override;
|
||||
|
||||
protected:
|
||||
using Translator::Translator;
|
||||
|
||||
void CollectFromRelations(OsmElement const & element);
|
||||
|
||||
TagAdmixer m_tagAdmixer;
|
||||
|
@ -39,15 +47,22 @@ private:
|
|||
class TranslatorCountryWithAds : public TranslatorCountry
|
||||
{
|
||||
public:
|
||||
explicit TranslatorCountryWithAds(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache,
|
||||
explicit TranslatorCountryWithAds(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
void Preprocess(OsmElement & element) override;
|
||||
bool Finish() override;
|
||||
bool Save() override;
|
||||
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorCountryWithAds & other) const override;
|
||||
|
||||
protected:
|
||||
using TranslatorCountry::TranslatorCountry;
|
||||
|
||||
private:
|
||||
OsmTagMixer m_osmTagMixer;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "generator/translator_geo_objects.hpp"
|
||||
|
||||
#include "generator/collector_interface.hpp"
|
||||
#include "generator/feature_maker.hpp"
|
||||
#include "generator/filter_collection.hpp"
|
||||
#include "generator/filter_interface.hpp"
|
||||
#include "generator/geo_objects/geo_objects_filter.hpp"
|
||||
#include "generator/intermediate_data.hpp"
|
||||
|
@ -9,11 +11,28 @@
|
|||
|
||||
namespace generator
|
||||
{
|
||||
TranslatorGeoObjects::TranslatorGeoObjects(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache)
|
||||
: Translator(emitter, cache, std::make_shared<FeatureMakerSimple>(cache))
|
||||
TranslatorGeoObjects::TranslatorGeoObjects(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache)
|
||||
: Translator(processor, cache, std::make_shared<FeatureMakerSimple>(cache))
|
||||
|
||||
{
|
||||
AddFilter(std::make_shared<geo_objects::GeoObjectsFilter>());
|
||||
SetFilter(std::make_shared<geo_objects::GeoObjectsFilter>());
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorGeoObjects::Clone() const
|
||||
{
|
||||
return Translator::CloneBase<TranslatorGeoObjects>();
|
||||
}
|
||||
|
||||
void TranslatorGeoObjects::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
other.MergeInto(*this);
|
||||
}
|
||||
|
||||
void TranslatorGeoObjects::MergeInto(TranslatorGeoObjects & other) const
|
||||
{
|
||||
other.m_collector->Merge(*m_collector);
|
||||
other.m_processor->Merge(*m_processor);
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/emitter_interface.hpp"
|
||||
#include "generator/processor_interface.hpp"
|
||||
#include "generator/translator.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateDataReader;
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
namespace generator
|
||||
|
@ -17,7 +17,16 @@ namespace generator
|
|||
class TranslatorGeoObjects : public Translator
|
||||
{
|
||||
public:
|
||||
explicit TranslatorGeoObjects(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache);
|
||||
explicit TranslatorGeoObjects(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorGeoObjects & other) const override;
|
||||
|
||||
protected:
|
||||
using Translator::Translator;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -7,15 +10,47 @@ struct OsmElement;
|
|||
|
||||
namespace generator
|
||||
{
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
class TranslatorRegion;
|
||||
class TranslatorGeoObjects;
|
||||
class TranslatorCountry;
|
||||
class TranslatorCountryWithAds;
|
||||
class TranslatorCoastline;
|
||||
class TranslatorWorld;
|
||||
class TranslatorWorldWithAds;
|
||||
class TranslatorStreets;
|
||||
class TranslatorCollection;
|
||||
|
||||
// Implementing this interface allows an object to create intermediate data from OsmElement.
|
||||
class TranslatorInterface
|
||||
{
|
||||
public:
|
||||
virtual ~TranslatorInterface() = default;
|
||||
|
||||
virtual std::shared_ptr<TranslatorInterface> Clone() const = 0;
|
||||
|
||||
virtual void Preprocess(OsmElement &) {}
|
||||
virtual void Emit(OsmElement & element) = 0;
|
||||
virtual bool Finish() = 0;
|
||||
virtual void GetNames(std::vector<std::string> & names) const = 0;
|
||||
virtual void Finish() = 0;
|
||||
virtual bool Save() = 0;
|
||||
|
||||
virtual void Merge(TranslatorInterface const &) = 0;
|
||||
|
||||
virtual void MergeInto(TranslatorRegion &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorGeoObjects &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorCountry &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorCountryWithAds &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorCoastline &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorWorld &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorWorldWithAds &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorStreets &) const { FailIfMethodUnsupported(); }
|
||||
virtual void MergeInto(TranslatorCollection &) const { FailIfMethodUnsupported(); }
|
||||
|
||||
private:
|
||||
void FailIfMethodUnsupported() const { CHECK(false, ("This method is unsupported.")); }
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "generator/regions/collector_region_info.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
|
@ -48,14 +49,32 @@ public:
|
|||
};
|
||||
} // namespace
|
||||
|
||||
TranslatorRegion::TranslatorRegion(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
GenerateInfo const & info)
|
||||
: Translator(emitter, cache, std::make_shared<FeatureMakerSimple>(cache))
|
||||
TranslatorRegion::TranslatorRegion(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info)
|
||||
: Translator(processor, cache, std::make_shared<FeatureMakerSimple>(cache))
|
||||
|
||||
{
|
||||
AddFilter(std::make_shared<FilterRegions>());
|
||||
SetFilter(std::make_shared<FilterRegions>());
|
||||
|
||||
auto filename = info.GetTmpFileName(info.m_fileName, regions::CollectorRegionInfo::kDefaultExt);
|
||||
AddCollector(std::make_shared<regions::CollectorRegionInfo>(filename));
|
||||
SetCollector(std::make_shared<regions::CollectorRegionInfo>(filename));
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorRegion::Clone() const
|
||||
{
|
||||
return Translator::CloneBase<TranslatorRegion>();
|
||||
}
|
||||
|
||||
void TranslatorRegion::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
other.MergeInto(*this);
|
||||
}
|
||||
|
||||
void TranslatorRegion::MergeInto(TranslatorRegion & other) const
|
||||
{
|
||||
other.m_collector->Merge(*m_collector);
|
||||
other.m_processor->Merge(*m_processor);
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/emitter_interface.hpp"
|
||||
#include "generator/processor_interface.hpp"
|
||||
#include "generator/translator.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
@ -12,7 +12,7 @@ struct GenerateInfo;
|
|||
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateDataReader;
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
namespace generator
|
||||
|
@ -21,7 +21,17 @@ namespace generator
|
|||
class TranslatorRegion : public Translator
|
||||
{
|
||||
public:
|
||||
explicit TranslatorRegion(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
explicit TranslatorRegion(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorRegion & other) const override;
|
||||
|
||||
protected:
|
||||
using Translator::Translator;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,16 +1,34 @@
|
|||
#include "generator/translator_streets.hpp"
|
||||
|
||||
#include "generator/collector_interface.hpp"
|
||||
#include "generator/feature_maker.hpp"
|
||||
#include "generator/streets/streets_filter.hpp"
|
||||
#include "generator/intermediate_data.hpp"
|
||||
|
||||
namespace generator
|
||||
{
|
||||
TranslatorStreets::TranslatorStreets(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache)
|
||||
: Translator(emitter, cache, std::make_shared<FeatureMakerSimple>(cache))
|
||||
TranslatorStreets::TranslatorStreets(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache)
|
||||
: Translator(processor, cache, std::make_shared<FeatureMakerSimple>(cache))
|
||||
|
||||
{
|
||||
AddFilter(std::make_shared<streets::StreetsFilter>());
|
||||
SetFilter(std::make_shared<streets::StreetsFilter>());
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorStreets::Clone() const
|
||||
{
|
||||
return Translator::CloneBase<TranslatorStreets>();
|
||||
}
|
||||
|
||||
void TranslatorStreets::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
other.MergeInto(*this);
|
||||
}
|
||||
|
||||
void TranslatorStreets::MergeInto(TranslatorStreets & other) const
|
||||
{
|
||||
other.m_collector->Merge(*m_collector);
|
||||
other.m_processor->Merge(*m_processor);
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/emitter_interface.hpp"
|
||||
#include "generator/processor_interface.hpp"
|
||||
#include "generator/translator.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateDataReader;
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
namespace generator
|
||||
|
@ -17,7 +17,16 @@ namespace generator
|
|||
class TranslatorStreets : public Translator
|
||||
{
|
||||
public:
|
||||
explicit TranslatorStreets(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache);
|
||||
explicit TranslatorStreets(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorStreets & other) const override;
|
||||
|
||||
protected:
|
||||
using Translator::Translator;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "generator/translator_world.hpp"
|
||||
|
||||
#include "generator/collector_interface.hpp"
|
||||
#include "generator/feature_maker.hpp"
|
||||
#include "generator/filter_collection.hpp"
|
||||
#include "generator/filter_planet.hpp"
|
||||
#include "generator/filter_elements.hpp"
|
||||
#include "generator/generate_info.hpp"
|
||||
|
@ -11,18 +13,33 @@
|
|||
|
||||
#include "base/file_name_utils.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "defines.hpp"
|
||||
|
||||
namespace generator
|
||||
{
|
||||
TranslatorWorld::TranslatorWorld(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
TranslatorWorld::TranslatorWorld(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info)
|
||||
: Translator(emitter, cache, std::make_shared<FeatureMaker>(cache))
|
||||
: Translator(processor, 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)));
|
||||
auto filters = std::make_shared<FilterCollection>();
|
||||
filters->Append(std::make_shared<FilterPlanet>());
|
||||
filters->Append(std::make_shared<FilterElements>(base::JoinPath(GetPlatform().ResourcesDir(), SKIPPED_ELEMENTS_FILE)));
|
||||
SetFilter(filters);
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorWorld::Clone() const
|
||||
{
|
||||
auto copy = Translator::CloneBase<TranslatorWorld>();
|
||||
copy->m_tagAdmixer = m_tagAdmixer;
|
||||
copy->m_tagReplacer = m_tagReplacer;
|
||||
return copy;
|
||||
}
|
||||
|
||||
void TranslatorWorld::Preprocess(OsmElement & element)
|
||||
|
@ -32,11 +49,34 @@ void TranslatorWorld::Preprocess(OsmElement & element)
|
|||
m_tagAdmixer(element);
|
||||
}
|
||||
|
||||
TranslatorWorldWithAds::TranslatorWorldWithAds(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache,
|
||||
void TranslatorWorld::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
other.MergeInto(*this);
|
||||
}
|
||||
|
||||
void TranslatorWorld::MergeInto(TranslatorWorld & other) const
|
||||
{
|
||||
other.m_collector->Merge(*m_collector);
|
||||
other.m_processor->Merge(*m_processor);
|
||||
}
|
||||
|
||||
TranslatorWorldWithAds::TranslatorWorldWithAds(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info)
|
||||
: TranslatorWorld(emitter, cache, info)
|
||||
, m_osmTagMixer(base::JoinPath(GetPlatform().ResourcesDir(), MIXED_TAGS_FILE)) {}
|
||||
: TranslatorWorld(processor, cache, info)
|
||||
, m_osmTagMixer(base::JoinPath(GetPlatform().ResourcesDir(), MIXED_TAGS_FILE))
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<TranslatorInterface>
|
||||
TranslatorWorldWithAds::Clone() const
|
||||
{
|
||||
auto copy = Translator::CloneBase<TranslatorWorldWithAds>();
|
||||
copy->m_tagAdmixer = m_tagAdmixer;
|
||||
copy->m_tagReplacer = m_tagReplacer;
|
||||
copy->m_osmTagMixer = m_osmTagMixer;
|
||||
return copy;
|
||||
}
|
||||
|
||||
void TranslatorWorldWithAds::Preprocess(OsmElement & element)
|
||||
{
|
||||
|
@ -45,10 +85,20 @@ void TranslatorWorldWithAds::Preprocess(OsmElement & element)
|
|||
TranslatorWorld::Preprocess(element);
|
||||
}
|
||||
|
||||
bool TranslatorWorldWithAds::Finish()
|
||||
bool TranslatorWorldWithAds::Save()
|
||||
{
|
||||
MixFakeNodes(GetPlatform().ResourcesDir() + MIXED_NODES_FILE,
|
||||
std::bind(&TranslatorWorldWithAds::Emit, this, std::placeholders::_1));
|
||||
return TranslatorWorld::Finish();
|
||||
return TranslatorWorld::Save();
|
||||
}
|
||||
|
||||
void TranslatorWorldWithAds::Merge(TranslatorInterface const & other)
|
||||
{
|
||||
TranslatorWorld::Merge(other);
|
||||
}
|
||||
|
||||
void TranslatorWorldWithAds::MergeInto(TranslatorWorldWithAds & other) const
|
||||
{
|
||||
TranslatorWorld::MergeInto(other);
|
||||
}
|
||||
} // namespace generator
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "generator/emitter_interface.hpp"
|
||||
#include "generator/processor_interface.hpp"
|
||||
#include "generator/tag_admixer.hpp"
|
||||
#include "generator/translator.hpp"
|
||||
|
||||
|
@ -13,7 +13,7 @@ struct GenerateInfo;
|
|||
|
||||
namespace cache
|
||||
{
|
||||
class IntermediateDataReader;
|
||||
class IntermediateData;
|
||||
} // namespace cache
|
||||
|
||||
namespace generator
|
||||
|
@ -22,13 +22,21 @@ namespace generator
|
|||
class TranslatorWorld : public Translator
|
||||
{
|
||||
public:
|
||||
explicit TranslatorWorld(std::shared_ptr<EmitterInterface> emitter, cache::IntermediateDataReader & cache,
|
||||
explicit TranslatorWorld(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
void Preprocess(OsmElement & element) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorWorld & other) const override;
|
||||
|
||||
protected:
|
||||
using Translator::Translator;
|
||||
|
||||
TagAdmixer m_tagAdmixer;
|
||||
TagReplacer m_tagReplacer;
|
||||
};
|
||||
|
@ -37,15 +45,22 @@ private:
|
|||
class TranslatorWorldWithAds : public TranslatorWorld
|
||||
{
|
||||
public:
|
||||
explicit TranslatorWorldWithAds(std::shared_ptr<EmitterInterface> emitter,
|
||||
cache::IntermediateDataReader & cache,
|
||||
explicit TranslatorWorldWithAds(std::shared_ptr<FeatureProcessorInterface> const & processor,
|
||||
std::shared_ptr<cache::IntermediateData> const & cache,
|
||||
feature::GenerateInfo const & info);
|
||||
|
||||
// TranslatorInterface overrides:
|
||||
void Preprocess(OsmElement & element) override;
|
||||
bool Finish() override;
|
||||
bool Save() override;
|
||||
|
||||
std::shared_ptr<TranslatorInterface> Clone() const override;
|
||||
|
||||
void Merge(TranslatorInterface const & other) override;
|
||||
void MergeInto(TranslatorWorldWithAds & other) const override;
|
||||
|
||||
protected:
|
||||
using TranslatorWorld::TranslatorWorld;
|
||||
|
||||
private:
|
||||
OsmTagMixer m_osmTagMixer;
|
||||
};
|
||||
} // namespace generator
|
||||
|
|
Loading…
Add table
Reference in a new issue