Exemplo n.º 1
0
BOOL RealtimeAltRoutes_Route_Request(int iTripId, const RoadMapPosition *from_pos, const RoadMapPosition *to_pos, int max_routes, BOOL showListFirst){
	static NavigateRouteCallbacks cb = {
		RealtimeAltRoutes_OnRouteRC,
		RealtimeAltRoutes_OnRouteResults,
      RealtimeAltRoutes_OnRouteSegments,
      navigate_main_update_route,
      navigate_main_on_instrumented_segment,
      navigate_main_on_suggest_reroute,
      navigate_main_on_segment_ver_mismatch
	};
   RoadMapGpsPosition position;
   PluginLine fromLine;
   int fromPoint;
   cancelled = FALSE;

   gShowListFirst = showListFirst;
   if (navigate_main_get_follow_gps()){
      if (RealtimeAltRoutes_GetOrigin (&position, &fromLine, &fromPoint)){
         from_pos = (RoadMapPosition*)&position;
      }else{
         fromLine.line_id = -1;
         fromPoint = -1;
         if (roadmap_gps_have_reception()){
            from_pos = roadmap_trip_get_position ("GPS");
         }
      }
   }else{
      fromLine.line_id = -1;
      fromPoint = -1;
   }

   roadmap_analytics_log_event(ANALYTICS_EVENT_ALT_ROUTES, NULL, NULL);

   CalculatingAltRoutes = TRUE;
   //roadmap_main_set_periodic( 50000, route_request_timeout );

   navigate_main_prepare_for_request();
   navigate_route_request (&fromLine,
                           fromPoint,
                           NULL,
                           from_pos,
                           to_pos,
                           NULL,
                           NULL,
                           NULL,
                           NULL,
                           ROADMAP_SOCIAL_DESTINATION_MODE_DISABLED,
                           ROADMAP_SOCIAL_DESTINATION_MODE_DISABLED,
                           0,
                           iTripId,
                           max_routes,
                           &cb);
   return TRUE;
}
Exemplo n.º 2
0
BOOL RealtimeAltRoutes_Route_Request(int iTripId, const RoadMapPosition *from_pos, const RoadMapPosition *to_pos){
   gTripId = 0;
   navigate_route_request (NULL, 
                           -1,
                           NULL,
                           from_pos,
                           to_pos,
                           NULL,
                           0,
                           iTripId,
                           MAX_ROUTES,
                           RealtimeAltRoutes_OnRouteResults,
                           RealtimeAltRoutes_OnRouteSegments,
                           navigate_main_update_route);
   return TRUE;
}
Exemplo n.º 3
0
BOOL RealtimeAltRoutes_TripRoute_Request(int iTripId, const RoadMapPosition *from_pos, const RoadMapPosition *to_pos, int max_routes){
   static NavigateRouteCallbacks cb = {
      RealtimeAltRoutes_OnTripRouteRC,
      RealtimeAltRoutes_OnTripRouteResults,
      RealtimeAltRoutes_OnRouteSegments,
      navigate_main_update_route,
      navigate_main_on_instrumented_segment,
      navigate_main_on_suggest_reroute,
      navigate_main_on_segment_ver_mismatch
   };

   RoadMapGpsPosition position;
   PluginLine fromLine;
   int fromPoint;

   if (RealtimeAltRoutes_GetOrigin (&position, &fromLine, &fromPoint)){
      from_pos = (RoadMapPosition*)&position;
   }else{
      fromLine.line_id = -1;
      fromPoint = -1;
      if (roadmap_gps_have_reception()){
         from_pos = roadmap_trip_get_position ("GPS");
      }
   }
   navigate_main_prepare_for_request();
   navigate_route_request (&fromLine,
                           fromPoint,
                           NULL,
                           from_pos,
                           to_pos,
                           NULL,
                           NULL,
                           NULL,
                           NULL,
                           ROADMAP_SOCIAL_DESTINATION_MODE_DISABLED,
                           ROADMAP_SOCIAL_DESTINATION_MODE_DISABLED,
                           0,
                           iTripId,
                           max_routes,
                           &cb);
   return TRUE;
}