Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2019-02-18 19:28:17 +0300
committerVlad Mihaylenko <vxmihaylenko@gmail.com>2019-02-20 13:25:42 +0300
commit19ffa837e6de5d310bdb27452f5b74b9d64a4f56 (patch)
treedf525b3c8d962f4ac7d616018f1919b855f2e782 /routing
parent61f3a3626cc1ac29107dc146842b4ac479a0f2cd (diff)
Review fixes.
Diffstat (limited to 'routing')
-rw-r--r--routing/index_router.cpp26
-rw-r--r--routing/index_router.hpp4
-rw-r--r--routing/route.cpp12
-rw-r--r--routing/route.hpp11
-rw-r--r--routing/speed_camera_prohibition.cpp24
-rw-r--r--routing/speed_camera_prohibition.hpp4
6 files changed, 43 insertions, 38 deletions
diff --git a/routing/index_router.cpp b/routing/index_router.cpp
index 67b996939e..a1f2906273 100644
--- a/routing/index_router.cpp
+++ b/routing/index_router.cpp
@@ -955,18 +955,25 @@ RouterResultCode IndexRouter::RedressRoute(vector<Segment> const & segments,
ReconstructRoute(*m_directionsEngine, roadGraph, m_trafficStash, delegate, junctions, move(times),
route);
+ CHECK(m_numMwmIds, ());
auto & worldGraph = starter.GetGraph();
for (auto & routeSegment : route.GetRouteSegments())
{
routeSegment.SetTransitInfo(worldGraph.GetTransitInfo(routeSegment.GetSegment()));
- if (m_vehicleType == VehicleType::Car && routeSegment.IsRealSegment())
+ // Removing speed cameras from the route with method AreSpeedCamerasProhibited(...)
+ // at runtime is necessary for maps from Jan 2019 with speed cameras where it's prohibited
+ // to use them.
+ if (m_vehicleType == VehicleType::Car && routeSegment.IsRealSegment()
+ && !AreSpeedCamerasProhibited(m_numMwmIds->GetFile(routeSegment.GetSegment().GetMwmId())))
+ {
routeSegment.SetSpeedCameraInfo(worldGraph.GetSpeedCamInfo(routeSegment.GetSegment()));
+ }
}
- vector<platform::CountryFile> speedcamProhibited;
- FillsSpeedcamProhibitedMwms(segments, speedcamProhibited);
- route.StealSpeedcamProhibited(move(speedcamProhibited));
+ vector<platform::CountryFile> speedCamProhibited;
+ FillSpeedCamProhibitedMwms(segments, speedCamProhibited);
+ route.SetMwmsPartlyProhibitedForSpeedCams(move(speedCamProhibited));
if (delegate.IsCancelled())
return RouterResultCode::Cancelled;
@@ -1022,8 +1029,8 @@ RouterResultCode IndexRouter::ConvertTransitResult(set<NumMwmId> const & mwmIds,
return RouterResultCode::TransitRouteNotFoundTooLongPedestrian;
}
-void IndexRouter::FillsSpeedcamProhibitedMwms(vector<Segment> const & segments,
- vector<platform::CountryFile> & speedcamProhibitedMwms) const
+void IndexRouter::FillSpeedCamProhibitedMwms(vector<Segment> const & segments,
+ vector<platform::CountryFile> & speedCamProhibitedMwms) const
{
CHECK(m_numMwmIds, ());
@@ -1033,9 +1040,12 @@ void IndexRouter::FillsSpeedcamProhibitedMwms(vector<Segment> const & segments,
for (auto const id : mwmIds)
{
+ if (id == kFakeNumMwmId)
+ continue;
+
auto const & country = m_numMwmIds->GetFile(id);
- if (ShouldWarnAboutSpeedcam(country))
- speedcamProhibitedMwms.push_back(country);
+ if (AreSpeedCamerasPartlyProhibited(country))
+ speedCamProhibitedMwms.emplace_back(country);
}
}
} // namespace routing
diff --git a/routing/index_router.hpp b/routing/index_router.hpp
index 351ae7ea1d..7b86e0d4bf 100644
--- a/routing/index_router.hpp
+++ b/routing/index_router.hpp
@@ -126,8 +126,8 @@ private:
/// \brief Fills |speedcamProhibitedMwms| with mwms which are crossed by |segments|
/// where speed cameras are prohibited.
- void FillsSpeedcamProhibitedMwms(std::vector<Segment> const & segments,
- std::vector<platform::CountryFile> & speedcamProhibitedMwms) const;
+ void FillSpeedCamProhibitedMwms(std::vector<Segment> const & segments,
+ std::vector<platform::CountryFile> & speedCamProhibitedMwms) const;
template <typename Graph>
RouterResultCode ConvertResult(typename AStarAlgorithm<Graph>::Result result) const
diff --git a/routing/route.cpp b/routing/route.cpp
index 99e35eee66..a72fe7aace 100644
--- a/routing/route.cpp
+++ b/routing/route.cpp
@@ -368,19 +368,19 @@ double Route::GetSegLenMeters(size_t segIdx) const
(segIdx == 0 ? 0.0 : m_routeSegments[segIdx - 1].GetDistFromBeginningMeters());
}
-void Route::StealSpeedcamProhibited(vector<platform::CountryFile> && speedcamProhibited)
+void Route::SetMwmsPartlyProhibitedForSpeedCams(vector<platform::CountryFile> && mwms)
{
- m_speedcamProhibited = move(speedcamProhibited);
+ m_speedCamProhibitedMwms = move(mwms);
}
-bool Route::CrossSpeedcomProhibited() const
+bool Route::CrossMwmsPartlyProhibitedForSpeedCams() const
{
- return m_speedcamProhibited.empty();
+ return m_speedCamProhibitedMwms.empty();
}
-std::vector<platform::CountryFile> const & Route::GetSpeedcamProhibited() const
+std::vector<platform::CountryFile> const & Route::GetMwmsPartlyProhibitedForSpeedCams() const
{
- return m_speedcamProhibited;
+ return m_speedCamProhibitedMwms;
}
double Route::GetETAToLastPassedPointSec() const
diff --git a/routing/route.hpp b/routing/route.hpp
index 60b3cd8237..3ffc3e348b 100644
--- a/routing/route.hpp
+++ b/routing/route.hpp
@@ -374,16 +374,15 @@ public:
/// \returns Length of the route segment with |segIdx| in meters.
double GetSegLenMeters(size_t segIdx) const;
- /// \brief Moves |speedcamProhibited| to |m_speedcamProhibited|.
- void StealSpeedcamProhibited(std::vector<platform::CountryFile> && speedcamProhibited);
+ void SetMwmsPartlyProhibitedForSpeedCams(std::vector<platform::CountryFile> && mwms);
- /// \returns true if the route crosses at lease one mwm where there are restrictions on warning
+ /// \returns true if the route crosses at least one mwm where there are restrictions on warning
/// about speed cameras.
- bool CrossSpeedcomProhibited() const;
+ bool CrossMwmsPartlyProhibitedForSpeedCams() const;
/// \returns mwm list which is crossed by the route and where there are restrictions on warning
/// about speed cameras.
- std::vector<platform::CountryFile> const & GetSpeedcamProhibited() const;
+ std::vector<platform::CountryFile> const & GetMwmsPartlyProhibitedForSpeedCams() const;
private:
friend std::string DebugPrint(Route const & r);
@@ -417,6 +416,6 @@ private:
uint64_t m_routeId = 0;
// Mwms which are crossed by the route where speed cameras are prohibited.
- std::vector<platform::CountryFile> m_speedcamProhibited;
+ std::vector<platform::CountryFile> m_speedCamProhibitedMwms;
};
} // namespace routing
diff --git a/routing/speed_camera_prohibition.cpp b/routing/speed_camera_prohibition.cpp
index 03b7915f3a..1ae4441c16 100644
--- a/routing/speed_camera_prohibition.cpp
+++ b/routing/speed_camera_prohibition.cpp
@@ -6,18 +6,14 @@
namespace
{
-// List of country names where mwm should be generated without speedcameras.
-std::vector<std::string> kCountryBlockListForMapGeneration = {
- "Cyprus",
- "Macedonia",
- "Switzerland",
- "Turkey",
+// List of country names where mwm should be generated without speed cameras.
+std::vector<std::string> kSpeedCamerasProhibitedCountries = {
+ "Cyprus", "Macedonia", "Switzerland", "Turkey",
};
-// List of country names where an end user should be warned about speedcameras.
-std::vector<std::string> kCountryWarnList = {
- "France",
- "Germany",
+// List of country names where an end user should be warned about speed cameras.
+std::vector<std::string> kSpeedCamerasPartlyProhibitedCountries = {
+ "France", "Germany",
};
bool IsMwmContained(platform::CountryFile const & mwm, std::vector<std::string> const & countryList)
@@ -34,13 +30,13 @@ bool IsMwmContained(platform::CountryFile const & mwm, std::vector<std::string>
namespace routing
{
-bool ShouldRemoveSpeedcamWhileMapGeneration(platform::CountryFile const & mwm)
+bool AreSpeedCamerasProhibited(platform::CountryFile const & mwm)
{
- return IsMwmContained(mwm, kCountryBlockListForMapGeneration);
+ return IsMwmContained(mwm, kSpeedCamerasProhibitedCountries);
}
-bool ShouldWarnAboutSpeedcam(platform::CountryFile const & mwm)
+bool AreSpeedCamerasPartlyProhibited(platform::CountryFile const & mwm)
{
- return ShouldRemoveSpeedcamWhileMapGeneration(mwm) || IsMwmContained(mwm, kCountryWarnList);
+ return IsMwmContained(mwm, kSpeedCamerasPartlyProhibitedCountries);
}
} // namespace routing
diff --git a/routing/speed_camera_prohibition.hpp b/routing/speed_camera_prohibition.hpp
index 297b628310..f9c16b1e4f 100644
--- a/routing/speed_camera_prohibition.hpp
+++ b/routing/speed_camera_prohibition.hpp
@@ -5,8 +5,8 @@
namespace routing
{
/// \returns true if any information about speed cameras is prohibited in |mwm|.
-bool ShouldRemoveSpeedcamWhileMapGeneration(platform::CountryFile const & mwm);
+bool AreSpeedCamerasProhibited(platform::CountryFile const & mwm);
/// \returns true if any information about speed cameras is prohibited or partly prohibited in |mwm|.
-bool ShouldWarnAboutSpeedcam(platform::CountryFile const & mwm);
+bool AreSpeedCamerasPartlyProhibited(platform::CountryFile const & mwm);
} // namespace routing