Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
44
libs/routing/speed_camera_prohibition.cpp
Normal file
44
libs/routing/speed_camera_prohibition.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "routing/speed_camera_prohibition.hpp"
|
||||
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace
|
||||
{
|
||||
using CountrySetT = std::unordered_set<std::string_view>;
|
||||
|
||||
// List of country names where mwm should be generated without speed cameras.
|
||||
CountrySetT kSpeedCamerasProhibitedCountries = {
|
||||
"Germany",
|
||||
"Macedonia",
|
||||
"Switzerland",
|
||||
"Turkey",
|
||||
"Bosnia and Herzegovina",
|
||||
};
|
||||
|
||||
// List of country names where an end user should be warned about speed cameras.
|
||||
CountrySetT kSpeedCamerasPartlyProhibitedCountries = {
|
||||
"France",
|
||||
};
|
||||
|
||||
bool IsMwmContained(platform::CountryFile const & mwm, CountrySetT const & countryList)
|
||||
{
|
||||
return std::any_of(countryList.cbegin(), countryList.cend(),
|
||||
[&mwm](auto const & country) { return mwm.GetName().starts_with(country); });
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace routing
|
||||
{
|
||||
bool AreSpeedCamerasProhibited(platform::CountryFile const & mwm)
|
||||
{
|
||||
return IsMwmContained(mwm, kSpeedCamerasProhibitedCountries);
|
||||
}
|
||||
|
||||
bool AreSpeedCamerasPartlyProhibited(platform::CountryFile const & mwm)
|
||||
{
|
||||
return IsMwmContained(mwm, kSpeedCamerasPartlyProhibitedCountries);
|
||||
}
|
||||
} // namespace routing
|
||||
Loading…
Add table
Add a link
Reference in a new issue