\breaf This class is responsible for the route built in the program. \note All method of this class should be called from ui thread if there's no a special note near a method.
| 41 | /// \note All method of this class should be called from ui thread if there's no |
| 42 | /// a special note near a method. |
| 43 | class RoutingSession |
| 44 | : public traffic::TrafficObserver |
| 45 | , public traffic::TrafficCache |
| 46 | { |
| 47 | friend struct UnitClass_AsyncGuiThreadTestWithRoutingSession_TestFollowRoutePercentTest; |
| 48 | |
| 49 | public: |
| 50 | RoutingSession(); |
| 51 | |
| 52 | void Init(PointCheckCallback const & pointCheckCallback); |
| 53 | |
| 54 | void SetRouter(std::unique_ptr<IRouter> && router, std::unique_ptr<AbsentRegionsFinder> && finder); |
| 55 | |
| 56 | /// @param[in] checkpoints in mercator |
| 57 | /// @param[in] timeoutSec timeout in seconds, if zero then there is no timeout |
| 58 | void BuildRoute(Checkpoints const & checkpoints, uint32_t timeoutSec); |
| 59 | void RebuildRoute(m2::PointD const & startPoint, ReadyCallback const & readyCallback, |
| 60 | NeedMoreMapsCallback const & needMoreMapsCallback, RemoveRouteCallback const & removeRouteCallback, |
| 61 | uint32_t timeoutSec, SessionState routeRebuildingState, bool adjustToPrevRoute); |
| 62 | |
| 63 | m2::PointD GetStartPoint() const; |
| 64 | m2::PointD GetEndPoint() const; |
| 65 | |
| 66 | bool IsActive() const; |
| 67 | bool IsNavigable() const; |
| 68 | bool IsBuilt() const; |
| 69 | /// \returns true if a new route is in process of building rebuilding or |
| 70 | /// if a route is being rebuilt in case the user left the route, and false otherwise. |
| 71 | bool IsBuilding() const; |
| 72 | bool IsBuildingOnly() const; |
| 73 | bool IsRebuildingOnly() const; |
| 74 | bool IsFinished() const; |
| 75 | bool IsNoFollowing() const; |
| 76 | bool IsOnRoute() const; |
| 77 | bool IsFollowing() const; |
| 78 | void Reset(); |
| 79 | |
| 80 | void SetState(SessionState state); |
| 81 | |
| 82 | /// \returns true if altitude information along |m_route| is available and |
| 83 | /// false otherwise. |
| 84 | bool HasRouteAltitude() const; |
| 85 | bool IsRouteId(uint64_t routeId) const; |
| 86 | bool IsRouteValid() const; |
| 87 | |
| 88 | /// \brief copies distance from route beginning to ends of route segments in meters and |
| 89 | /// route altitude information to |routeSegDistanceM| and |routeAltitudes|. |
| 90 | /// \returns true if there is valid route information. If the route is not valid returns false. |
| 91 | bool GetRouteAltitudesAndDistancesM(std::vector<double> & routeSegDistanceM, |
| 92 | geometry::Altitudes & routeAltitudesM) const; |
| 93 | |
| 94 | /// \brief returns points of route junctions. |
| 95 | /// \returns true if there is valid route information. If the route is not valid returns false. |
| 96 | bool GetRouteJunctionPoints(std::vector<geometry::PointWithAltitude> & routeJunctionPoints) const; |
| 97 | |
| 98 | SessionState OnLocationPositionChanged(location::GpsInfo const & info); |
| 99 | void GetRouteFollowingInfo(FollowingInfo & info) const; |
| 100 | double GetDistanceToNextTurn() const; |