diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2015-08-13 10:36:47 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 03:01:12 +0300 |
commit | 14bd3880fed7ff3156872ef38b040fe0e04f280b (patch) | |
tree | e9203c8a1772f5330c79946a3239284e8e320c78 /routing | |
parent | ea10728f856cd9bb157e8f9d99d31b447a710edc (diff) |
Corrections after colleagues comments.
Diffstat (limited to 'routing')
-rw-r--r-- | routing/routing_session.cpp | 2 | ||||
-rw-r--r-- | routing/routing_tests/turns_sound_test.cpp | 54 | ||||
-rw-r--r-- | routing/turns_sound.cpp | 4 | ||||
-rw-r--r-- | routing/turns_sound.hpp | 8 |
4 files changed, 34 insertions, 34 deletions
diff --git a/routing/routing_session.cpp b/routing/routing_session.cpp index bb1522c5ca..d03aca3a85 100644 --- a/routing/routing_session.cpp +++ b/routing/routing_session.cpp @@ -242,7 +242,7 @@ void RoutingSession::GenerateTurnSound(vector<string> & turnNotifications) turns::TurnItem turn; m_route.GetCurrentTurn(distanceToTurnMeters, turn); - m_turnsSound.UpdateRouteFollowingInfo(turn, distanceToTurnMeters, turnNotifications); + m_turnsSound.GenerateTurnSound(turn, distanceToTurnMeters, turnNotifications); } void RoutingSession::AssignRoute(Route & route, IRouter::ResultCode e) diff --git a/routing/routing_tests/turns_sound_test.cpp b/routing/routing_tests/turns_sound_test.cpp index 236dfffd5b..21add086c7 100644 --- a/routing/routing_tests/turns_sound_test.cpp +++ b/routing/routing_tests/turns_sound_test.cpp @@ -108,11 +108,11 @@ UNIT_TEST(TurnsSoundMetersTest) // Starting nearing the turnItem. // 1000 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 1000. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 1000. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 700 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 700. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 700. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 699 meters till the turn. It's time to pronounce the first voice notification. @@ -121,42 +121,42 @@ UNIT_TEST(TurnsSoundMetersTest) // Besides that we need 5 seconds (but 100 meters maximum) for playing the notification. // So we start playing the first notification when the distance till the turn is less // then 20 seconds * 30 meters per seconds + 100 meters = 700 meters. - turnSound.UpdateRouteFollowingInfo(turnItem, 699. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 699. /* distanceToTurnMeters */, turnNotifications); vector<string> const expectedNotification1 = {{"In 600 meters. Make a right turn."}}; TEST_EQUAL(turnNotifications, expectedNotification1, ()); // 650 meters till the turn. No sound notifications is required. turnNotifications.clear(); - turnSound.UpdateRouteFollowingInfo(turnItem, 650. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 650. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); turnSound.SetSpeedMetersPerSecond(32.); // 150 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 150. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 150. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 100 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 100. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 100. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 99 meters till the turn. It's time to pronounce the second voice notification. - turnSound.UpdateRouteFollowingInfo(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); vector<string> const expectedNotification2 = {{"Make a right turn."}}; TEST_EQUAL(turnNotifications, expectedNotification2, ()); // 99 meters till the turn again. No sound notifications is required. turnNotifications.clear(); - turnSound.UpdateRouteFollowingInfo(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 50 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 50. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 50. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 0 meters till the turn. No sound notifications is required. turnNotifications.clear(); - turnSound.UpdateRouteFollowingInfo(turnItem, 0. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 0. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); TEST(turnSound.IsEnabled(), ()); @@ -190,40 +190,40 @@ UNIT_TEST(TurnsSoundMetersTwoTurnsTest) // Starting nearing the first turn. // 800 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem1, 800. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem1, 800. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 700 meters till the turn. It's time to pronounce the first voice notification. - turnSound.UpdateRouteFollowingInfo(turnItem1, 700. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem1, 700. /* distanceToTurnMeters */, turnNotifications); vector<string> const expectedNotification1 = {{"In 700 meters. Make a sharp right turn."}}; TEST_EQUAL(turnNotifications, expectedNotification1, ()); turnSound.SetSpeedMetersPerSecond(32.); // 150 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem1, 150. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem1, 150. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 99 meters till the turn. It's time to pronounce the second voice notification. - turnSound.UpdateRouteFollowingInfo(turnItem1, 99. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem1, 99. /* distanceToTurnMeters */, turnNotifications); vector<string> const expectedNotification2 = {{"Make a sharp right turn."}}; TEST_EQUAL(turnNotifications, expectedNotification2, ()); turnSound.SetSpeedMetersPerSecond(10.); // 0 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem1, 0. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem1, 0. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); TurnItem turnItem2(11 /* idx */, TurnDirection::EnterRoundAbout, 2 /* exitNum */); // Starting nearing the second turn. - turnSound.UpdateRouteFollowingInfo(turnItem2, 60. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem2, 60. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 40 meters till the second turn. It's time to pronounce the second voice notification // without the first one. - turnSound.UpdateRouteFollowingInfo(turnItem2, 40. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem2, 40. /* distanceToTurnMeters */, turnNotifications); vector<string> const expectedNotification3 = {{"Enter the roundabout."}}; TEST_EQUAL(turnNotifications, expectedNotification3, ()); @@ -253,11 +253,11 @@ UNIT_TEST(TurnsSoundFeetTest) // Starting nearing the turnItem. // 1000 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 1000. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 1000. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 700 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 700. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 700. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 699 meters till the turn. It's time to pronounce the first voice notification. @@ -266,41 +266,41 @@ UNIT_TEST(TurnsSoundFeetTest) // Besides that we need 5 seconds (but 100 meters maximum) for playing the notification. // So we start playing the first notification when the distance till the turn is less // then 20 seconds * 30 meters per seconds + 100 meters = 700 meters. - turnSound.UpdateRouteFollowingInfo(turnItem, 699. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 699. /* distanceToTurnMeters */, turnNotifications); vector<string> const expectedNotification1 = {{"In 2000 feet. Enter the roundabout."}}; TEST_EQUAL(turnNotifications, expectedNotification1, ()); // 650 meters till the turn. No sound notifications is required. turnNotifications.clear(); - turnSound.UpdateRouteFollowingInfo(turnItem, 650. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 650. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 150 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 150. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 150. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 100 meters till the turn. No sound notifications is required. - turnSound.UpdateRouteFollowingInfo(turnItem, 100. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 100. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 99 meters till the turn. It's time to pronounce the second voice notification. - turnSound.UpdateRouteFollowingInfo(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); vector<string> const expectedNotification2 = {{"Enter the roundabout."}}; TEST_EQUAL(turnNotifications, expectedNotification2, ()); // 99 meters till the turn again. No sound notifications is required. turnNotifications.clear(); - turnSound.UpdateRouteFollowingInfo(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 99. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 50 meters till the turn. No sound notifications is required. turnNotifications.clear(); - turnSound.UpdateRouteFollowingInfo(turnItem, 50. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 50. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); // 0 meters till the turn. No sound notifications is required. turnNotifications.clear(); - turnSound.UpdateRouteFollowingInfo(turnItem, 0. /* distanceToTurnMeters */, turnNotifications); + turnSound.GenerateTurnSound(turnItem, 0. /* distanceToTurnMeters */, turnNotifications); TEST(turnNotifications.empty(), ()); TEST(turnSound.IsEnabled(), ()); diff --git a/routing/turns_sound.cpp b/routing/turns_sound.cpp index abdbf8e1ba..df5283eaaf 100644 --- a/routing/turns_sound.cpp +++ b/routing/turns_sound.cpp @@ -44,8 +44,8 @@ string TurnsSound::GenerateTurnText(uint32_t distanceUnits, uint8_t exitNum, boo return m_getTtsText(notification); } -void TurnsSound::UpdateRouteFollowingInfo(TurnItem const & turn, double distanceToTurnMeters, - vector<string> & turnNotifications) +void TurnsSound::GenerateTurnSound(TurnItem const & turn, double distanceToTurnMeters, + vector<string> & turnNotifications) { turnNotifications.clear(); diff --git a/routing/turns_sound.hpp b/routing/turns_sound.hpp index 41a2c6057e..0db7f14327 100644 --- a/routing/turns_sound.hpp +++ b/routing/turns_sound.hpp @@ -71,15 +71,15 @@ public: void SetLocaleWithJson(string const & jsonBuffer) { m_getTtsText.SetLocaleWithJson(jsonBuffer); } void SetSpeedMetersPerSecond(double speed); - /// \brief UpdateRouteFollowingInfo updates information about the next turn notification. + /// \brief GenerateTurnSound updates information about the next turn notification. /// It also fills turnNotifications when it's necessary. /// If this TurnsSound wants to play a sound message once it should push one item to - /// the vector turnNotifications once when UpdateRouteFollowingInfo is called. + /// the vector turnNotifications once when GenerateTurnSound is called. /// \param turn contains information about the next turn. /// \param distanceToTurnMeters is distance to the next turn in meters. /// \param turnNotifications is a parameter to fill it if it's necessary. - void UpdateRouteFollowingInfo(TurnItem const & turn, double distanceToTurnMeters, - vector<string> & turnNotifications); + void GenerateTurnSound(TurnItem const & turn, double distanceToTurnMeters, + vector<string> & turnNotifications); /// Reset states which reflects current route position. /// The method shall be called after creating a new route or after rerouting. void Reset(); |