diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index c80a8f206a..598c828380 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -235,7 +235,6 @@ using namespace osm_auth_ios; case ParsedMapApi::ParsingResult::Route: { auto const parsedData = f.GetParsedRoutingData(); - MWMRouter.type = routerType(parsedData.m_type); auto const points = parsedData.m_points; if (points.size() == 2) { @@ -245,7 +244,9 @@ using namespace osm_auth_ios; auto p2 = [[MWMRoutePoint alloc] initWithURLSchemeRoutePoint:points.back() type:MWMRoutePointTypeFinish intermediateIndex:0]; - [MWMRouter buildFromPoint:p1 toPoint:p2 bestRouter:NO]; + [MWMRouter buildApiRouteWithType:routerType(parsedData.m_type) + startPoint:p1 + finishPoint:p2]; } else { diff --git a/iphone/Maps/Core/Routing/MWMRouter.h b/iphone/Maps/Core/Routing/MWMRouter.h index 9ca9136dc7..fd9749fb3e 100644 --- a/iphone/Maps/Core/Routing/MWMRouter.h +++ b/iphone/Maps/Core/Routing/MWMRouter.h @@ -41,9 +41,9 @@ typedef void (^MWMImageHeightBlock)(UIImage *, NSString *); + (void)buildFromPoint:(MWMRoutePoint *)start bestRouter:(BOOL)bestRouter; + (void)buildToPoint:(MWMRoutePoint *)finish bestRouter:(BOOL)bestRouter; -+ (void)buildFromPoint:(MWMRoutePoint *)startPoint - toPoint:(MWMRoutePoint *)finishPoint - bestRouter:(BOOL)bestRouter; ++ (void)buildApiRouteWithType:(MWMRouterType)type + startPoint:(MWMRoutePoint *)startPoint + finishPoint:(MWMRoutePoint *)finishPoint; + (void)rebuildWithBestRouter:(BOOL)bestRouter; + (BOOL)hasRouteAltitude; diff --git a/iphone/Maps/Core/Routing/MWMRouter.mm b/iphone/Maps/Core/Routing/MWMRouter.mm index b10f7049e2..e96f157fee 100644 --- a/iphone/Maps/Core/Routing/MWMRouter.mm +++ b/iphone/Maps/Core/Routing/MWMRouter.mm @@ -350,19 +350,22 @@ void logPointEvent(MWMRoutePoint * point, NSString * eventType) [self rebuildWithBestRouter:bestRouter]; } -+ (void)buildFromPoint:(MWMRoutePoint *)startPoint - toPoint:(MWMRoutePoint *)finishPoint - bestRouter:(BOOL)bestRouter ++ (void)buildApiRouteWithType:(MWMRouterType)type + startPoint:(MWMRoutePoint *)startPoint + finishPoint:(MWMRoutePoint *)finishPoint { if (!startPoint || !finishPoint) return; - [MWMRouter router].isAPICall = YES; + [MWMRouter setType:type]; + + auto router = [MWMRouter router]; + router.isAPICall = YES; [self addPoint:startPoint]; [self addPoint:finishPoint]; - [MWMRouter router].isAPICall = NO; + router.isAPICall = NO; - [self rebuildWithBestRouter:bestRouter]; + [self rebuildWithBestRouter:NO]; } + (void)rebuildWithBestRouter:(BOOL)bestRouter