Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Enum Mode
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
โหมด
Enum ที่แทนรูปแบบการเดินทางที่จะใช้เมื่อค้นหาเส้นทาง
หากต้องการเรียก enum คุณจะต้องเรียกคลาส ชื่อ และพร็อพเพอร์ตี้ระดับบนสุด เช่น
Maps.Mode.DRIVING
พร็อพเพอร์ตี้
| พร็อพเพอร์ตี้ | ประเภท | คำอธิบาย |
DRIVING | Enum | เส้นทางการขับขี่ผ่านถนน |
WALKING | Enum | เส้นทางเดินเท้า ที่ทางเท้าและทางเท้า (ถ้ามี) |
BICYCLING | Enum | เส้นทางจักรยานผ่านทางจักรยานและถนนที่ต้องการ (หากมี) |
TRANSIT | Enum | เส้นทางขนส่งสาธารณะผ่านทางเส้นทางการขนส่งสาธารณะ (หากมี) คุณต้องตั้งค่าเพื่อใช้โหมดนี้
เวลาออกเดินทางหรือถึงจุดหมาย
// Log all available data for a public-transit trip.
const directions = Maps.newDirectionFinder()
.setOrigin('The Cloisters, New York, NY')
.setDestination('JFK airport, New York, NY')
.setMode(Maps.DirectionFinder.Mode.TRANSIT)
.setDepart(new Date())
.getDirections();
const route = directions.routes[0];
Logger.log(route);
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-12-11 UTC
[null,null,["อัปเดตล่าสุด 2025-12-11 UTC"],[],["The `Mode` enum defines travel methods for finding directions. It includes `DRIVING`, `WALKING`, and `BICYCLING`, for road, pedestrian, and cycling routes respectively. `TRANSIT` offers public transit routes, requiring departure or arrival time specification. To use, reference as `Maps.Mode.PROPERTY`. An example is provided for setting a public transit route, by using `.setMode(Maps.DirectionFinder.Mode.TRANSIT)` and calling the `getDirections()` function.\n"]]