diff --git a/map/traffic_manager.cpp b/map/traffic_manager.cpp index 280bfa7d50..01e317d0f6 100644 --- a/map/traffic_manager.cpp +++ b/map/traffic_manager.cpp @@ -322,7 +322,6 @@ void TrafficManager::OnTrafficDataResponse(traffic::TrafficInfo && info) // Note. It's necessary to multiply by two because routing and rendering use separate caches. size_t const dataSize = 2 * info.GetColoring().size() * kElementSize; - it->second.m_isLoaded = true; m_currentCacheSizeBytes += (dataSize - it->second.m_dataSize); it->second.m_dataSize = dataSize; CheckCacheSize(); @@ -354,7 +353,8 @@ void TrafficManager::CheckCacheSize() auto const it = m_mwmCache.find(mwmId); if (it->second.m_isLoaded) { - m_currentCacheSizeBytes -= it->second.m_dataSize; + // Note. It's necessary to multiply by two because routing and rendering use separate caches. + m_currentCacheSizeBytes -= 2 * it->second.m_dataSize; m_drapeEngine->ClearTrafficCache(mwmId); m_observer.OnTrafficInfoRemoved(mwmId); } diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp index 1d7d166c22..71d3a96f12 100644 --- a/routing/routing_integration_tests/routing_test_tools.cpp +++ b/routing/routing_integration_tests/routing_test_tools.cpp @@ -79,7 +79,7 @@ namespace integration unique_ptr CreateCarRouter(Index & index, storage::CountryInfoGetter const & infoGetter, - TrafficInfoGetterTest const & trafficGetter) + TrafficInfoGetterNoJam const & trafficGetter) { auto const countryFileGetter = [&infoGetter](m2::PointD const & pt) { return infoGetter.GetRegionCountryId(pt); @@ -116,7 +116,7 @@ namespace integration IRouter * GetRouter() const override { return m_carRouter.get(); } private: - TrafficInfoGetterTest m_trafficGetter; + TrafficInfoGetterNoJam m_trafficGetter; unique_ptr m_carRouter; }; diff --git a/routing/routing_integration_tests/routing_test_tools.hpp b/routing/routing_integration_tests/routing_test_tools.hpp index 29fd3711fe..6ead348743 100644 --- a/routing/routing_integration_tests/routing_test_tools.hpp +++ b/routing/routing_integration_tests/routing_test_tools.hpp @@ -76,18 +76,15 @@ void TestOnlineFetcher(ms::LatLon const & startPoint, ms::LatLon const & finalPo /// Gets OSRM router components IRouterComponents & GetOsrmComponents(); -shared_ptr GetOsrmComponents( - vector const & localFiles); +shared_ptr GetOsrmComponents(vector const & localFiles); /// Gets pedestrian router components IRouterComponents & GetPedestrianComponents(); -shared_ptr GetPedestrianComponents( - vector const & localFiles); +shared_ptr GetPedestrianComponents(vector const & localFiles); /// Gets bicycle router components. IRouterComponents & GetBicycleComponents(); -shared_ptr GetBicycleComponents( - vector const & localFiles); +shared_ptr GetBicycleComponents(vector const & localFiles); TRouteResult CalculateRoute(IRouterComponents const & routerComponents, m2::PointD const & startPoint, m2::PointD const & startDirection, @@ -119,7 +116,7 @@ class TestTurn bool const m_isValid; TestTurn() - : m_point({0., 0.}) + : m_point({0.0, 0.0}) , m_direction(TurnDirection::NoTurn) , m_roundAboutExitNum(0) , m_isValid(false) diff --git a/routing/routing_tests/applying_traffic_test.cpp b/routing/routing_tests/applying_traffic_test.cpp index f381994ea3..61fdbb2d1f 100644 --- a/routing/routing_tests/applying_traffic_test.cpp +++ b/routing/routing_tests/applying_traffic_test.cpp @@ -196,7 +196,7 @@ UNIT_CLASS_TEST(ApplyingTrafficTest, XXGraph_G0onF3andF6andG4onF8andF4) UNIT_CLASS_TEST(ApplyingTrafficTest, XXGraph_ChangingTraffic) { // No trafic at all. - SetEstimator({}); + SetEstimator({} /* coloring */); unique_ptr graph = BuildXXGraph(GetEstimator()); IndexGraphStarter starter(*graph, RoadPoint(1, 0) /* start */, RoadPoint(6, 1) /* finish */); vector const noTrafficGeom = {{2 /* x */, 0 /* y */}, {1, 1}, {2, 2}, {3, 3}}; diff --git a/routing/routing_tests/index_graph_test.cpp b/routing/routing_tests/index_graph_test.cpp index 1146f3f519..cf0423556f 100644 --- a/routing/routing_tests/index_graph_test.cpp +++ b/routing/routing_tests/index_graph_test.cpp @@ -100,7 +100,7 @@ UNIT_TEST(EdgesTest) loader->AddRoad(4 /* featureId */, true, 1.0 /* speed */, RoadGeometry::Points({{3.0, -1.0}, {3.0, 0.0}, {3.0, 1.0}})); - TrafficInfoGetterTest const trafficGetter; + TrafficInfoGetterNoJam const trafficGetter; IndexGraph graph(move(loader), CreateEstimator(trafficGetter)); vector joints; @@ -145,7 +145,7 @@ UNIT_TEST(FindPathCross) 1 /* featureId */, false, 1.0 /* speed */, RoadGeometry::Points({{0.0, -2.0}, {-1.0, 0.0}, {0.0, 0.0}, {0.0, 1.0}, {0.0, 2.0}})); - TrafficInfoGetterTest const trafficGetter; + TrafficInfoGetterNoJam const trafficGetter; IndexGraph graph(move(loader), CreateEstimator(trafficGetter)); graph.Import({MakeJoint({{0, 2}, {1, 2}})}); @@ -202,7 +202,7 @@ UNIT_TEST(FindPathManhattan) loader->AddRoad(i + kCitySize, false, 1.0 /* speed */, avenue); } - TrafficInfoGetterTest const trafficGetter; + TrafficInfoGetterNoJam const trafficGetter; IndexGraph graph(move(loader), CreateEstimator(trafficGetter)); vector joints; @@ -253,7 +253,7 @@ UNIT_TEST(RedressRace) 2 /* featureId */, false, 1.0 /* speed */, RoadGeometry::Points({{0.0, 0.0}, {1.0, 1.0}, {2.0, 1.0}, {3.0, 1.0}, {4.0, 0.0}})); - TrafficInfoGetterTest const trafficGetter; + TrafficInfoGetterNoJam const trafficGetter; IndexGraph graph(move(loader), CreateEstimator(trafficGetter)); vector joints; @@ -284,7 +284,7 @@ UNIT_TEST(RoadSpeed) loader->AddRoad(1 /* featureId */, false, 1.0 /* speed */, RoadGeometry::Points({{0.0, 0.0}, {2.0, 0.0}, {4.0, 0.0}})); - TrafficInfoGetterTest const trafficGetter; + TrafficInfoGetterNoJam const trafficGetter; IndexGraph graph(move(loader), CreateEstimator(trafficGetter)); vector joints; diff --git a/routing/routing_tests/index_graph_tools.cpp b/routing/routing_tests/index_graph_tools.cpp index 2a1cc7752b..188cd1bea8 100644 --- a/routing/routing_tests/index_graph_tools.cpp +++ b/routing/routing_tests/index_graph_tools.cpp @@ -34,7 +34,7 @@ Joint MakeJoint(vector const & points) return joint; } -shared_ptr CreateEstimator(TrafficInfoGetterTest const & trafficGetter) +shared_ptr CreateEstimator(TrafficInfoGetterNoJam const & trafficGetter) { return EdgeEstimator::CreateForCar(*make_shared()->GetVehicleModel(), trafficGetter); } diff --git a/routing/routing_tests/index_graph_tools.hpp b/routing/routing_tests/index_graph_tools.hpp index 33c2b91b47..e504a2b8b8 100644 --- a/routing/routing_tests/index_graph_tools.hpp +++ b/routing/routing_tests/index_graph_tools.hpp @@ -32,13 +32,13 @@ private: unordered_map m_roads; }; -class TrafficInfoGetterTest : public traffic::TrafficInfoGetter +class TrafficInfoGetterNoJam : public traffic::TrafficInfoGetter { public: - TrafficInfoGetterTest() {} + TrafficInfoGetterNoJam() {} // TrafficInfoGetter overrides: - shared_ptr GetTrafficInfo(MwmSet::MwmId const & mwmId) const override + shared_ptr GetTrafficInfo(MwmSet::MwmId const &) const override { return shared_ptr(); } @@ -46,7 +46,7 @@ public: routing::Joint MakeJoint(vector const & points); -shared_ptr CreateEstimator(TrafficInfoGetterTest const & trafficGette); +shared_ptr CreateEstimator(TrafficInfoGetterNoJam const & trafficGette); routing::AStarAlgorithm::Result CalculateRoute( routing::IndexGraphStarter & graph, vector & roadPoints);