[generator] Fixed RoutingCityBoundariesCollector.

This commit is contained in:
Maksim Andrianov 2019-11-15 18:50:14 +03:00 committed by gmoryes
parent 8694bdaab1
commit a68acefedc
4 changed files with 11 additions and 11 deletions

View file

@ -103,18 +103,18 @@ RoutingCityBoundariesCollector::LocalityData::Deserialize(ReaderSource<FileReade
// RoutingCityBoundariesCollector ------------------------------------------------------------------
RoutingCityBoundariesCollector::RoutingCityBoundariesCollector(
std::string const & filename, std::shared_ptr<cache::IntermediateData> cache)
std::string const & filename, std::shared_ptr<cache::IntermediateDataReader> const & cache)
: CollectorInterface(filename)
, m_writer(std::make_unique<RoutingCityBoundariesWriter>(GetTmpFilename()))
, m_cache(std::move(cache))
, m_featureMakerSimple(m_cache)
, m_cache(cache)
, m_featureMakerSimple(cache)
{
}
std::shared_ptr<CollectorInterface> RoutingCityBoundariesCollector::Clone(
std::shared_ptr<cache::IntermediateDataReader> const &) const
std::shared_ptr<cache::IntermediateDataReader> const & cache) const
{
return std::make_shared<RoutingCityBoundariesCollector>(GetFilename(), m_cache->Clone());
return std::make_shared<RoutingCityBoundariesCollector>(GetFilename(), cache ? m_cache : cache);
}
void RoutingCityBoundariesCollector::Collect(OsmElement const & osmElement)

View file

@ -41,11 +41,11 @@ public:
};
RoutingCityBoundariesCollector(std::string const & filename,
std::shared_ptr<cache::IntermediateData> cache);
std::shared_ptr<cache::IntermediateDataReader> const & cache);
// CollectorInterface overrides:
std::shared_ptr<CollectorInterface> Clone(
std::shared_ptr<cache::IntermediateDataReader> const & = {}) const override;
std::shared_ptr<cache::IntermediateDataReader> const & cache = {}) const override;
void Collect(OsmElement const & osmElement) override;
void Finish() override;
@ -58,7 +58,7 @@ public:
private:
std::unique_ptr<RoutingCityBoundariesWriter> m_writer;
std::shared_ptr<cache::IntermediateData> m_cache;
std::shared_ptr<cache::IntermediateDataReader> m_cache;
FeatureMakerSimple m_featureMakerSimple;
};

View file

@ -171,7 +171,7 @@ UNIT_CLASS_TEST(TestWithClassificator, CollectorRoutingCityBoundaries_1)
auto const filename = generator_tests::GetFileName();
SCOPE_GUARD(_, std::bind(Platform::RemoveFileIfExists, std::cref(filename)));
std::shared_ptr<cache::IntermediateData> cache;
std::shared_ptr<cache::IntermediateDataReader> cache;
auto c1 = std::make_shared<BoundariesCollector>(filename, cache);
Collect(*c1, {placeRelation1, placeRelation2, placeRelation3, placeRelation4});
@ -189,7 +189,7 @@ UNIT_CLASS_TEST(TestWithClassificator, CollectorRoutingCityBoundaries_2)
auto const filename = generator_tests::GetFileName();
SCOPE_GUARD(_, std::bind(Platform::RemoveFileIfExists, std::cref(filename)));
std::shared_ptr<cache::IntermediateData> cache;
std::shared_ptr<cache::IntermediateDataReader> cache;
auto c1 = std::make_shared<BoundariesCollector>(filename, cache);
auto c2 = c1->Clone();

View file

@ -107,7 +107,7 @@ TranslatorCountry::TranslatorCountry(std::shared_ptr<FeatureProcessorInterface>
std::make_shared<CityAreaCollector>(info.GetIntermediateFileName(CITIES_AREAS_TMP_FILENAME)));
// Collectors for gathering of additional information for the future building of routing section.
collectors->Append(std::make_shared<RoutingCityBoundariesCollector>(
info.GetIntermediateFileName(ROUTING_CITY_BOUNDARIES_TMP_FILENAME), cache));
info.GetIntermediateFileName(ROUTING_CITY_BOUNDARIES_TMP_FILENAME), cache->GetCache()));
collectors->Append(
std::make_shared<MaxspeedsCollector>(info.GetIntermediateFileName(MAXSPEEDS_FILENAME)));
collectors->Append(std::make_shared<routing::RestrictionWriter>(