ค่ากําหนดสําหรับแวะพัก

ในบางสถานที่ คนขับไม่สามารถจอดรถได้อย่างปลอดภัย (เช่น พื้นที่สูง เรือข้ามฟาก สถานที่ใต้ดิน และพื้นที่อื่นๆ ที่มีการจำกัด การเข้าถึง) ฟีเจอร์แวะพักจะย้ายจุดอ้างอิงไปยังสถานที่ใกล้เคียงหาก ตำแหน่งไม่เหมาะสำหรับยานพาหนะที่จะหยุด เมื่อตั้งค่า vehicleStopoverเป็น YES ระบบจะย้ายจุดอ้างอิงโดยอัตโนมัติเมื่อ คำนวณเส้นทาง หากมีตำแหน่งอื่น

วิธีการทำงาน

คุณตั้งค่ากำหนดสำหรับการแวะพักเมื่อสร้างจุดอ้างอิงสำหรับการหยุดนั้น โดยกำหนดค่ากำหนดสำหรับจุดพักบน GMSNavigationMutableWaypoint ดังที่แสดงในตัวอย่างต่อไปนี้

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){...}];