diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index 409237ccef..3a470ed1d3 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -311,16 +311,8 @@ bool GenerateFinalFeatures(feature::GenerateInfo const & info, string const & na // stores cellIds for middle points CalculateMidPoints midPoints; - platform::CountryFile const country(name); - bool const speedCamerasProhibitedMwm = routing::AreSpeedCamerasProhibited(country); - uint32_t const speedCameraType = classif().GetTypeByPath({"highway", "speed_camera"}); - ForEachFromDatRawFormat(srcFilePath, [&speedCamerasProhibitedMwm, &speedCameraType, &midPoints]( - FeatureBuilder const & ft, uint64_t pos) { - // Removing point features with speed cameras type from geometry index for some countries. - if (speedCamerasProhibitedMwm && ft.IsPoint() && ft.HasType(speedCameraType)) - return; - - midPoints(ft, pos); + ForEachFromDatRawFormat(srcFilePath, [&midPoints](FeatureBuilder const & fb, uint64_t pos) { + midPoints(fb, pos); }); // sort features by their middle point diff --git a/generator/final_processor_intermediate_mwm.cpp b/generator/final_processor_intermediate_mwm.cpp index b549e83851..0cb1482c59 100644 --- a/generator/final_processor_intermediate_mwm.cpp +++ b/generator/final_processor_intermediate_mwm.cpp @@ -12,6 +12,8 @@ #include "generator/type_helper.hpp" #include "generator/utils.hpp" +#include "routing/speed_camera_prohibition.hpp" + #include "indexer/classificator.hpp" #include "indexer/feature_algo.hpp" @@ -469,9 +471,19 @@ void CountryFinalProcessor::Finish() auto const fullPath = base::JoinPath(m_temporaryMwmPath, filename); auto fbs = ReadAllDatRawFormat(fullPath); Sort(fbs); + + auto const isProhibited = routing::AreSpeedCamerasProhibited(platform::CountryFile(filename)); + static auto const speedCameraType = classif().GetTypeByPath({"highway", "speed_camera"}); + FeatureBuilderWriter<> collector(fullPath); for (auto & fb : fbs) + { + // Removing point features with speed cameras type from geometry index for some countries. + if (isProhibited && fb.IsPoint() && fb.HasType(speedCameraType)) + continue; + collector.Write(fb); + } }); }); }