Preferenza scali

In alcuni luoghi, i conducenti non possono fermarsi in sicurezza (ad esempio, in zone sopraelevate, traghetti, luoghi sotterranei e altre aree con accesso limitato). La funzionalità Sosta sposta il waypoint in un luogo vicino se la sua posizione non è adatta a una sosta del veicolo. Quando imposti vehicleStopover su YES, il waypoint viene riposizionato automaticamente quando viene calcolato il percorso, se è disponibile una posizione alternativa.

Come funziona

Imposti la preferenza per una sosta quando crei il waypoint per quella sosta. Per farlo, imposta la preferenza per uno scalo su un GMSNavigationMutableWaypoint come mostrato nell'esempio seguente:

Swift

CLLocationCoordinate2D location = CLLocationCoordinate2D(47.67, -122.20);
GMSNavigationMutableWaypoint *waypoint =
    GMSNavigationMutableWaypoint(withLocation: location,
                                        title: @"waypoint from location");
waypoint.vehicleStopover = YES;
mapView.navigator?.setDestinations([waypoint], routingOptions: routingOptions, callback: {...})

Objective-C

CLLocationCoordinate2D location = CLLocationCoordinate2DMake(47.67, -122.20);
GMSNavigationMutableWaypoint *waypoint =
    [[GMSNavigationMutableWaypoint alloc] initWithLocation:location
                                                     title:@"waypoint from location"];
waypoint.vehicleStopover = YES;
[_mapView.navigator setDestinations:@[waypoint1]
                     routingOptions:routingOptions
                           callback:^(GMSRouteStatus routeStatus){...}];