blob: ad9b5c6f4ceec82fc5fdb757218d1654990da578 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include "partners_api/taxi_base.hpp"
#include "geometry/distance_on_sphere.hpp"
namespace
{
// The maximum supported distance in meters by default.
double const kMaxSupportedDistance = 100000;
} // namespace
namespace taxi
{
bool ApiBase::IsDistanceSupported(ms::LatLon const & from, ms::LatLon const & to) const
{
return ms::DistanceOnEarth(from, to) <= kMaxSupportedDistance;
}
bool ApiItem::AreAllCountriesDisabled(storage::CountriesVec const & countryIds,
std::string const & city) const
{
if (countryIds.empty())
return true;
auto const & disabled = m_places.m_disabledPlaces;
if (disabled.IsCountriesEmpty())
return false;
bool isCountryDisabled = true;
for (auto const & countryId : countryIds)
isCountryDisabled = isCountryDisabled && disabled.Has(countryId, city);
return isCountryDisabled;
}
bool ApiItem::IsAnyCountryEnabled(storage::CountriesVec const & countryIds,
std::string const & city) const
{
if (countryIds.empty())
return false;
auto const & enabled = m_places.m_enabledPlaces;
if (enabled.IsCountriesEmpty())
return false;
for (auto const & countryId : countryIds)
{
if (enabled.Has(countryId, city))
return true;
}
return false;
}
bool ApiItem::IsMwmDisabled(storage::CountryId const & mwmId) const
{
auto const & disabled = m_places.m_disabledPlaces;
if (mwmId.empty())
return false;
return disabled.Has(mwmId);
}
bool ApiItem::IsMwmEnabled(storage::CountryId const & mwmId) const
{
auto const & enabled = m_places.m_enabledPlaces;
if (mwmId.empty())
return false;
return enabled.Has(mwmId);
}
} // namespace taxi
|