[generator:streets] Generate streets in separate process

This commit is contained in:
Anatoly Serdtcev 2019-04-23 13:30:40 +03:00 committed by mpimenov
parent 1632ef8b0d
commit f3d8045593
19 changed files with 233 additions and 81 deletions

View file

@ -96,17 +96,13 @@ set(SRC
geo_objects/geo_object_info_getter.hpp
geo_objects/geo_objects_filter.cpp
geo_objects/geo_objects_filter.hpp
geo_objects/key_value_storage.cpp
geo_objects/key_value_storage.hpp
geo_objects/region_info_getter.cpp
geo_objects/region_info_getter.hpp
geo_objects/streets_builder.cpp
geo_objects/streets_builder.hpp
holes.cpp
holes.hpp
intermediate_data.cpp
intermediate_data.hpp
intermediate_elements.hpp
key_value_storage.cpp
key_value_storage.hpp
locality_sorter.cpp
locality_sorter.hpp
maxspeeds_builder.cpp
@ -163,6 +159,8 @@ set(SRC
regions/region_base.hpp
regions/region_info.cpp
regions/region_info.hpp
regions/region_info_getter.cpp
regions/region_info_getter.hpp
regions/regions.cpp
regions/regions.hpp
regions/regions_builder.cpp
@ -195,6 +193,12 @@ set(SRC
srtm_parser.hpp
statistics.cpp
statistics.hpp
streets/streets.cpp
streets/streets.hpp
streets/streets_builder.cpp
streets/streets_builder.hpp
streets/streets_filter.cpp
streets/streets_filter.hpp
tag_admixer.hpp
tesselator.cpp
tesselator.hpp
@ -218,6 +222,8 @@ set(SRC
translator_interface.hpp
translator_region.cpp
translator_region.hpp
translator_streets.cpp
translator_streets.hpp
translator_world.cpp
translator_world.hpp
type_helper.cpp

View file

@ -27,6 +27,7 @@
#include "generator/road_access_generator.hpp"
#include "generator/routing_index_generator.hpp"
#include "generator/search_index_builder.hpp"
#include "generator/streets/streets.hpp"
#include "generator/statistics.hpp"
#include "generator/traffic_generator.hpp"
#include "generator/transit_generator.hpp"
@ -113,6 +114,8 @@ DEFINE_bool(preprocess, false, "1st pass - create nodes/ways/relations data.");
DEFINE_bool(generate_features, false, "2nd pass - generate intermediate features.");
DEFINE_bool(generate_region_features, false,
"Generate intermediate features for regions to use in regions index and borders generation.");
DEFINE_bool(generate_streets_features, false,
"Generate intermediate features for streets to use in server-side forward geocoder.");
DEFINE_bool(generate_geo_objects_features, false,
"Generate intermediate features for geo objects to use in geo objects index.");
DEFINE_bool(generate_geometry, false,
@ -196,6 +199,8 @@ DEFINE_bool(generate_traffic_keys, false,
// Generating geo objects key-value.
DEFINE_string(regions_index, "", "Input regions index file.");
DEFINE_string(regions_key_value, "", "Input regions key-value file.");
DEFINE_string(streets_features, "", "Input tmp.mwm file with streets.");
DEFINE_string(streets_key_value, "", "Output streets key-value file.");
DEFINE_string(geo_objects_features, "", "Input tmp.mwm file with geo objects.");
DEFINE_string(ids_without_addresses, "", "Output file with objects ids without addresses.");
DEFINE_string(geo_objects_key_value, "", "Output geo objects key-value file.");
@ -293,6 +298,7 @@ int GeneratorToolMain(int argc, char ** argv)
FLAGS_make_routing_index || FLAGS_make_cross_mwm || FLAGS_make_transit_cross_mwm ||
FLAGS_make_city_roads || FLAGS_generate_maxspeed || FLAGS_generate_traffic_keys ||
FLAGS_transit_path != "" || FLAGS_ugc_data != "" || FLAGS_popular_places_data != "" ||
FLAGS_generate_streets_features || FLAGS_streets_key_value != "" ||
FLAGS_generate_geo_objects_features || FLAGS_geo_objects_key_value != "" ||
FLAGS_dump_wikipedia_urls != "" || FLAGS_wikipedia_pages != "" || FLAGS_popularity_csv != "")
{
@ -361,12 +367,15 @@ int GeneratorToolMain(int argc, char ** argv)
}
}
}
else if (FLAGS_generate_region_features || FLAGS_generate_geo_objects_features)
else if (FLAGS_generate_region_features || FLAGS_generate_streets_features ||
FLAGS_generate_geo_objects_features)
{
CHECK(!FLAGS_generate_features && !FLAGS_make_coasts,
("FLAGS_generate_features and FLAGS_make_coasts should "
"not be used with FLAGS_generate_region_features"));
CHECK(!(FLAGS_generate_region_features && FLAGS_generate_geo_objects_features), ());
CHECK((FLAGS_generate_region_features + FLAGS_generate_streets_features +
FLAGS_generate_geo_objects_features) == 1,
("At most one features generation option is allowed simultaneously"));
genInfo.m_fileName = FLAGS_output;
@ -378,6 +387,12 @@ int GeneratorToolMain(int argc, char ** argv)
translators.Append(CreateTranslator(TranslatorType::Regions, emitter, cacheLoader.GetCache(), genInfo));
}
if (FLAGS_generate_streets_features)
{
auto emitter = CreateEmitter(EmitterType::SimpleWithPreserialize, genInfo);
translators.Append(CreateTranslator(TranslatorType::Streets, emitter, cacheLoader.GetCache()));
}
if (FLAGS_generate_geo_objects_features)
{
auto emitter = CreateEmitter(EmitterType::SimpleWithPreserialize, genInfo);
@ -388,6 +403,13 @@ int GeneratorToolMain(int argc, char ** argv)
return EXIT_FAILURE;
}
if (!FLAGS_streets_key_value.empty())
{
streets::GenerateStreets(FLAGS_regions_index, FLAGS_regions_key_value,
FLAGS_streets_features, FLAGS_geo_objects_features,
FLAGS_streets_key_value, FLAGS_verbose);
}
if (!FLAGS_geo_objects_key_value.empty())
{
if (!geo_objects::GenerateGeoObjects(FLAGS_regions_index, FLAGS_regions_key_value,

View file

@ -1,6 +1,6 @@
#pragma once
#include "generator/geo_objects/key_value_storage.hpp"
#include "generator/key_value_storage.hpp"
#include "indexer/locality_index.hpp"

View file

@ -4,11 +4,10 @@
#include "generator/feature_generator.hpp"
#include "generator/geo_objects/geo_object_info_getter.hpp"
#include "generator/geo_objects/geo_objects_filter.hpp"
#include "generator/geo_objects/key_value_storage.hpp"
#include "generator/geo_objects/region_info_getter.hpp"
#include "generator/geo_objects/streets_builder.hpp"
#include "generator/key_value_storage.hpp"
#include "generator/locality_sorter.hpp"
#include "generator/regions/region_base.hpp"
#include "generator/regions/region_info_getter.hpp"
#include "indexer/classificator.hpp"
#include "indexer/ftypes_matcher.hpp"
@ -136,7 +135,7 @@ MakeTempGeoObjectsIndex(std::string const & pathToGeoObjectsTmpMwm)
void FilterAddresslessByCountryAndRepackMwm(std::string const & pathInGeoObjectsTmpMwm,
std::string_view const & includeCountries,
RegionInfoGetter const & regionInfoGetter)
regions::RegionInfoGetter const & regionInfoGetter)
{
auto const path = Platform().TmpPathForFile();
feature::FeaturesCollector collector(path);
@ -168,13 +167,13 @@ void FilterAddresslessByCountryAndRepackMwm(std::string const & pathInGeoObjects
LOG(LERROR, ("Error: Cannot rename", path, "to", pathInGeoObjectsTmpMwm));
}
void BuildGeoObjectsWithAddresses(RegionInfoGetter const & regionInfoGetter,
void BuildGeoObjectsWithAddresses(regions::RegionInfoGetter const & regionInfoGetter,
std::string const & pathInGeoObjectsTmpMwm,
std::ostream & streamGeoObjectsKv, bool)
{
size_t countGeoObjects = 0;
auto const fn = [&](FeatureBuilder1 & fb, uint64_t /* currPos */) {
if (!(GeoObjectsFilter::IsBuilding(fb) || GeoObjectsFilter::HasHouse(fb)))
if (!GeoObjectsFilter::IsBuilding(fb) && !GeoObjectsFilter::HasHouse(fb))
return;
auto regionKeyValue = regionInfoGetter.FindDeepest(fb.GetKeyPoint());
@ -200,7 +199,7 @@ void BuildGeoObjectsWithoutAddresses(GeoObjectInfoGetter const & geoObjectInfoGe
auto const fn = [&](FeatureBuilder1 & fb, uint64_t /* currPos */) {
if (!GeoObjectsFilter::IsPoi(fb))
return;
if (GeoObjectsFilter::IsBuilding(fb) || GeoObjectsFilter::HasHouse(fb) || GeoObjectsFilter::IsStreet(fb))
if (GeoObjectsFilter::IsBuilding(fb) || GeoObjectsFilter::HasHouse(fb))
return;
auto const house = FindHousePoi(fb, geoObjectInfoGetter);
@ -217,14 +216,6 @@ void BuildGeoObjectsWithoutAddresses(GeoObjectInfoGetter const & geoObjectInfoGe
feature::ForEachFromDatRawFormat(pathInGeoObjectsTmpMwm, fn);
LOG(LINFO, ("Added ", countGeoObjects, "geo objects without addresses."));
}
void BuildStreets(RegionInfoGetter const & regionInfoGetter,
std::string const & pathInGeoObjectsTmpMwm,
std::ostream & streamGeoObjectsKv, bool /* verbose */)
{
StreetsBuilder streetsBuilder{regionInfoGetter};
streetsBuilder.Build(pathInGeoObjectsTmpMwm, streamGeoObjectsKv);
}
} // namespace
bool GenerateGeoObjects(std::string const & pathInRegionsIndex,
@ -240,7 +231,7 @@ bool GenerateGeoObjects(std::string const & pathInRegionsIndex,
LOG(LINFO, ("Finish generating geo objects.", timer.ElapsedSeconds(), "seconds."));
});
RegionInfoGetter regionInfoGetter{pathInRegionsIndex, pathInRegionsKv};
regions::RegionInfoGetter regionInfoGetter{pathInRegionsIndex, pathInRegionsKv};
LOG(LINFO, ("Size of regions key-value storage:", regionInfoGetter.GetStorage().Size()));
if (allowAddresslessForCountries != "*")
@ -255,8 +246,6 @@ bool GenerateGeoObjects(std::string const & pathInRegionsIndex,
pathInGeoObjectsTmpMwm);
std::ofstream streamGeoObjectsKv(pathOutGeoObjectsKv);
BuildStreets(regionInfoGetter, pathInGeoObjectsTmpMwm, streamGeoObjectsKv, verbose);
LOG(LINFO, ("Streets were built."));
BuildGeoObjectsWithAddresses(regionInfoGetter, pathInGeoObjectsTmpMwm, streamGeoObjectsKv, verbose);
LOG(LINFO, ("Geo objects with addresses were built."));

View file

@ -1,6 +1,5 @@
#include "generator/geo_objects/geo_objects_filter.hpp"
#include "generator/geo_objects/streets_builder.hpp"
#include "generator/osm_element_helpers.hpp"
#include "indexer/ftypes_matcher.hpp"
@ -11,8 +10,7 @@ namespace geo_objects
{
bool GeoObjectsFilter::IsAccepted(OsmElement const & element)
{
return osm_element::IsBuilding(element) || osm_element::HasHouse(element) || osm_element::IsPoi(element) ||
geo_objects::StreetsBuilder::IsStreet(element);
return osm_element::IsBuilding(element) || osm_element::HasHouse(element) || osm_element::IsPoi(element);
}
bool GeoObjectsFilter::IsAccepted(FeatureBuilder1 const & feature)
@ -20,7 +18,7 @@ bool GeoObjectsFilter::IsAccepted(FeatureBuilder1 const & feature)
if (!feature.GetParams().IsValid())
return false;
return IsBuilding(feature) || HasHouse(feature) || IsPoi(feature) || IsStreet(feature);
return IsBuilding(feature) || HasHouse(feature) || IsPoi(feature);
}
// static
@ -42,11 +40,5 @@ bool GeoObjectsFilter::IsPoi(FeatureBuilder1 const & fb)
auto const & poiChecker = ftypes::IsPoiChecker::Instance();
return poiChecker(fb.GetTypes());
}
// static
bool GeoObjectsFilter::IsStreet(FeatureBuilder1 const & fb)
{
return geo_objects::StreetsBuilder::IsStreet(fb);
}
} // namespace geo_objects
} // namespace generator

View file

@ -2,7 +2,6 @@
#include "generator/feature_builder.hpp"
#include "generator/filter_interface.hpp"
#include "generator/intermediate_data.hpp"
#include "generator/osm_element.hpp"
namespace generator
@ -19,7 +18,6 @@ public:
static bool IsBuilding(FeatureBuilder1 const & fb);
static bool HasHouse(FeatureBuilder1 const & fb);
static bool IsPoi(FeatureBuilder1 const & fb);
static bool IsStreet(FeatureBuilder1 const & fb);
};
} // namespace geo_objects
} // namespace generator

View file

@ -1,4 +1,4 @@
#include "generator/geo_objects/key_value_storage.hpp"
#include "generator/key_value_storage.hpp"
#include "coding/reader.hpp"
@ -7,8 +7,6 @@
namespace generator
{
namespace geo_objects
{
KeyValueStorage::KeyValueStorage(std::string const & path,
std::function<bool(KeyValue const &)> const & pred)
{
@ -77,5 +75,4 @@ size_t KeyValueStorage::Size() const
{
return m_values.size();
}
} // namespace geo_objects
} // namespace generator

View file

@ -13,8 +13,6 @@
namespace generator
{
namespace geo_objects
{
using KeyValue = std::pair<uint64_t, base::Json>;
class KeyValueStorage
@ -38,5 +36,4 @@ private:
std::unordered_map<uint64_t, base::Json> m_values;
};
} // namespace geo_objects
} // namespace generator

View file

@ -1,4 +1,4 @@
#include "generator/geo_objects/region_info_getter.hpp"
#include "generator/regions/region_info_getter.hpp"
#include "coding/mmap_reader.hpp"
@ -6,7 +6,7 @@
namespace generator
{
namespace geo_objects
namespace regions
{
RegionInfoGetter::RegionInfoGetter(std::string const & indexPath, std::string const & kvPath)
: m_index{indexer::ReadIndex<indexer::RegionsIndexBox<IndexReader>, MmapReader>(indexPath)}
@ -84,7 +84,7 @@ int RegionInfoGetter::GetRank(base::Json const & json) const
boost::optional<uint64_t> RegionInfoGetter::GetPid(base::Json const & json) const
{
auto && properties = base::GetJSONObligatoryField(json.get(), "properties");
auto && pid = base::GetJSONOptionalField(json.get(), "pid");
auto && pid = base::GetJSONOptionalField(properties, "pid");
if (!pid || base::JSONIsNull(pid))
return {};
return static_cast<uint64_t>(FromJSON<int64_t>(pid));
@ -94,5 +94,5 @@ KeyValueStorage const & RegionInfoGetter::GetStorage() const noexcept
{
return m_storage;
}
} // namespace geo_objects
} // namespace regions
} // namespace generator

View file

@ -1,6 +1,6 @@
#pragma once
#include "generator/geo_objects/key_value_storage.hpp"
#include "generator/key_value_storage.hpp"
#include "indexer/borders.hpp"
#include "indexer/locality_index.hpp"
@ -20,7 +20,7 @@
namespace generator
{
namespace geo_objects
namespace regions
{
class RegionInfoGetter
{
@ -47,5 +47,5 @@ private:
indexer::Borders m_borders;
KeyValueStorage m_storage;
};
} // namespace geo_objects
} // namespace regions
} // namespace generator

View file

@ -0,0 +1,43 @@
#include "generator/streets/streets.hpp"
#include "generator/regions/region_info_getter.hpp"
#include "generator/streets/streets_builder.hpp"
#include "base/logging.hpp"
#include "base/scope_guard.hpp"
#include "base/timer.hpp"
#include <fstream>
namespace generator
{
namespace streets
{
void GenerateStreets(std::string const & pathInRegionsIndex, std::string const & pathInRegionsKv,
std::string const & pathInStreetsTmpMwm,
std::string const & pathInGeoObjectsTmpMwm,
std::string const & pathOutStreetsKv, bool verbose)
{
LOG(LINFO, ("Start generating streets..."));
auto timer = base::Timer();
SCOPE_GUARD(finishGeneratingStreets, [&timer]() {
LOG(LINFO, ("Finish generating streets.", timer.ElapsedSeconds(), "seconds."));
});
regions::RegionInfoGetter regionInfoGetter{pathInRegionsIndex, pathInRegionsKv};
LOG(LINFO, ("Size of regions key-value storage:", regionInfoGetter.GetStorage().Size()));
StreetsBuilder streetsBuilder{regionInfoGetter};
streetsBuilder.AssembleStreets(pathInStreetsTmpMwm);
LOG(LINFO, ("Streets were built."));
streetsBuilder.AssembleBindings(pathInGeoObjectsTmpMwm);
LOG(LINFO, ("Binding's streets were built."));
std::ofstream streamStreetsKv(pathOutStreetsKv);
streetsBuilder.SaveStreetsKv(streamStreetsKv);
LOG(LINFO, ("Streets key-value storage saved to", pathOutStreetsKv));
}
} // namespace streets
} // namespace generator

View file

@ -0,0 +1,17 @@
#pragma once
#include <string>
namespace generator
{
namespace streets
{
// This function generates key-value pairs for streets.
// Streets are generated by highway features and from geo object features with addresses (houses and POI).
// Locality of street are defined through region index file and key-value pairs file of regions.
void GenerateStreets(std::string const & pathInRegionsIndex, std::string const & pathInRegionsKv,
std::string const & pathInStreetsTmpMwm,
std::string const & pathInGeoObjectsTmpMwm,
std::string const & pathOutStreetsKv, bool verbose);
} // namespace streets
} // namespace generator

View file

@ -1,4 +1,4 @@
#include "generator/geo_objects/streets_builder.hpp"
#include "generator/streets/streets_builder.hpp"
#include "indexer/classificator.hpp"
#include "indexer/ftypes_matcher.hpp"
@ -11,38 +11,38 @@
namespace generator
{
namespace geo_objects
namespace streets
{
StreetsBuilder::StreetsBuilder(RegionInfoGetter const & regionInfoGetter)
StreetsBuilder::StreetsBuilder(regions::RegionInfoGetter const & regionInfoGetter)
: m_regionInfoGetter{regionInfoGetter}
{ }
void StreetsBuilder::Build(std::string const & pathInGeoObjectsTmpMwm, std::ostream & streamGeoObjectsKv)
void StreetsBuilder::AssembleStreets(std::string const & pathInStreetsTmpMwm)
{
auto const transform = [this, &streamGeoObjectsKv](FeatureBuilder1 & fb, uint64_t /* currPos */) {
if (IsStreet(fb))
{
AddStreet(fb);
return;
}
auto const transform = [this](FeatureBuilder1 & fb, uint64_t /* currPos */) {
AddStreet(fb);
};
feature::ForEachFromDatRawFormat(pathInStreetsTmpMwm, transform);
}
void StreetsBuilder::AssembleBindings(std::string const & pathInGeoObjectsTmpMwm)
{
auto const transform = [this](FeatureBuilder1 & fb, uint64_t /* currPos */) {
auto streetName = fb.GetParams().GetStreet();
if (!streetName.empty())
AddStreetBinding(std::move(streetName), fb);
};
feature::ForEachFromDatRawFormat(pathInGeoObjectsTmpMwm, transform);
SaveStreetGeoObjects(streamGeoObjectsKv);
}
void StreetsBuilder::SaveStreetGeoObjects(std::ostream & streamGeoObjectsKv)
void StreetsBuilder::SaveStreetsKv(std::ostream & streamStreetsKv)
{
for (auto const & region : m_regions)
SaveRegionStreetGeoObjects(streamGeoObjectsKv, region.first, region.second);
SaveRegionStreetsKv(streamStreetsKv, region.first, region.second);
}
void StreetsBuilder::SaveRegionStreetGeoObjects(std::ostream & streamGeoObjectsKv, uint64_t regionId,
RegionStreets const & streets)
void StreetsBuilder::SaveRegionStreetsKv(std::ostream & streamStreetsKv, uint64_t regionId,
RegionStreets const & streets)
{
auto const & regionsStorage = m_regionInfoGetter.GetStorage();
auto const && regionObject = regionsStorage.Find(regionId);
@ -56,7 +56,7 @@ void StreetsBuilder::SaveRegionStreetGeoObjects(std::ostream & streamGeoObjectsK
auto const id = static_cast<int64_t>(streetId.GetEncodedId());
auto const value = MakeStreetValue(regionId, *regionObject, street.first);
streamGeoObjectsKv << id << " " << value.get() << "\n";
streamStreetsKv << id << " " << value.get() << "\n";
}
}
@ -192,5 +192,5 @@ bool StreetsBuilder::IsStreet(FeatureBuilder1 const & fb)
return false;
}
} // namespace geo_objects
} // namespace streets
} // namespace generator

View file

@ -1,9 +1,9 @@
#pragma once
#include "generator/feature_builder.hpp"
#include "generator/geo_objects/key_value_storage.hpp"
#include "generator/geo_objects/region_info_getter.hpp"
#include "generator/key_value_storage.hpp"
#include "generator/osm_element.hpp"
#include "generator/regions/region_info_getter.hpp"
#include "coding/reader.hpp"
@ -21,14 +21,16 @@
namespace generator
{
namespace geo_objects
namespace streets
{
class StreetsBuilder
{
public:
StreetsBuilder(RegionInfoGetter const & regionInfoGetter);
explicit StreetsBuilder(regions::RegionInfoGetter const & regionInfoGetter);
void Build(std::string const & pathInGeoObjectsTmpMwm, std::ostream & streamGeoObjectsKv);
void AssembleStreets(std::string const & pathInStreetsTmpMwm);
void AssembleBindings(std::string const & pathInGeoObjectsTmpMwm);
void SaveStreetsKv(std::ostream & streamStreetsKv);
static bool IsStreet(OsmElement const & element);
static bool IsStreet(FeatureBuilder1 const & fb);
@ -36,9 +38,8 @@ public:
private:
using RegionStreets = std::unordered_map<std::string, base::GeoObjectId>;
void SaveStreetGeoObjects(std::ostream & streamGeoObjectsKv);
void SaveRegionStreetGeoObjects(std::ostream & streamGeoObjectsKv, uint64_t regionId,
RegionStreets const & streets);
void SaveRegionStreetsKv(std::ostream & streamStreetsKv, uint64_t regionId,
RegionStreets const & streets);
void AddStreet(FeatureBuilder1 & fb);
void AddStreetBinding(std::string && streetName, FeatureBuilder1 & fb);
@ -51,8 +52,8 @@ private:
base::GeoObjectId NextOsmSurrogateId();
std::unordered_map<uint64_t, RegionStreets> m_regions;
RegionInfoGetter const & m_regionInfoGetter;
regions::RegionInfoGetter const & m_regionInfoGetter;
uint64_t m_osmSurrogateCounter{0};
};
} // namespace geo_objects
} // namespace streets
} // namespace generator

View file

@ -0,0 +1,26 @@
#include "generator/streets/streets_filter.hpp"
#include "generator/streets/streets_builder.hpp"
#include "generator/osm_element_helpers.hpp"
namespace generator
{
namespace streets
{
bool StreetsFilter::IsAccepted(OsmElement const & element)
{
return StreetsBuilder::IsStreet(element);
}
bool StreetsFilter::IsAccepted(FeatureBuilder1 const & feature)
{
return feature.GetParams().IsValid() && IsStreet(feature);
}
// static
bool StreetsFilter::IsStreet(FeatureBuilder1 const & fb)
{
return StreetsBuilder::IsStreet(fb);
}
} // namespace streets
} // namespace generator

View file

@ -0,0 +1,21 @@
#pragma once
#include "generator/feature_builder.hpp"
#include "generator/filter_interface.hpp"
#include "generator/osm_element.hpp"
namespace generator
{
namespace streets
{
class StreetsFilter : public FilterInterface
{
public:
// FilterInterface overrides:
bool IsAccepted(OsmElement const & element) override;
bool IsAccepted(FeatureBuilder1 const & feature) override;
static bool IsStreet(FeatureBuilder1 const & fb);
};
} // namespace streets
} // namespace generator

View file

@ -3,6 +3,7 @@
#include "generator/factory_utils.hpp"
#include "generator/translator_coastline.hpp"
#include "generator/translator_country.hpp"
#include "generator/translator_streets.hpp"
#include "generator/translator_geo_objects.hpp"
#include "generator/translator_interface.hpp"
#include "generator/translator_region.hpp"
@ -18,6 +19,7 @@ namespace generator
enum class TranslatorType
{
Regions,
Streets,
GeoObjects,
Country,
Coastline,
@ -35,6 +37,8 @@ std::shared_ptr<TranslatorInterface> CreateTranslator(TranslatorType type, Args&
return create<TranslatorCountry>(std::forward<Args>(args)...);
case TranslatorType::Regions:
return create<TranslatorRegion>(std::forward<Args>(args)...);
case TranslatorType::Streets:
return create<TranslatorStreets>(std::forward<Args>(args)...);
case TranslatorType::GeoObjects:
return create<TranslatorGeoObjects>(std::forward<Args>(args)...);
case TranslatorType::World:

View file

@ -0,0 +1,16 @@
#include "generator/translator_streets.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))
{
AddFilter(std::make_shared<streets::StreetsFilter>());
}
} // namespace generator

View file

@ -0,0 +1,23 @@
#pragma once
#include "generator/emitter_interface.hpp"
#include "generator/translator.hpp"
#include <memory>
namespace cache
{
class IntermediateDataReader;
} // namespace cache
namespace generator
{
// The TranslatorStreets class implements translator for streets.
// Every Street is either a highway or a place=square.
class TranslatorStreets : public Translator
{
public:
explicit TranslatorStreets(std::shared_ptr<EmitterInterface> emitter,
cache::IntermediateDataReader & cache);
};
} // namespace generator