Enum Mode
Tryb
Wyliczenie określające środek transportu do wyznaczania trasy.
Aby wywołać wyliczenie, musisz wywołać jego klasę nadrzędną, nazwę i właściwość. Na przykład:
Maps.Mode.DRIVING
.
Właściwości
Właściwość | Typ | Opis |
DRIVING | Enum | Trasa dojazdu przebiegami przez drogi. |
WALKING | Enum | Trasy piesze i chodniki (jeśli są dostępne). |
BICYCLING | Enum | Trasa rowerowa prowadząca przez ścieżki rowerowe i preferowane ulice (tam, gdzie są dostępne). |
TRANSIT | Enum | Wskazówki dojazdu transportem publicznym (jeśli są dostępne). Ten tryb wymaga skonfigurowania
o godzinie wyjazdu lub przyjazdu,
// Log all available data for a public-transit trip.
var directions = Maps.newDirectionFinder()
.setOrigin('The Cloisters, New York, NY')
.setDestination('JFK airport, New York, NY')
.setMode(Maps.DirectionFinder.Mode.TRANSIT)
.setDepart(new Date())
.getDirections();
var route = directions.routes[0];
Logger.log(route);
|
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-08-21 UTC.
[null,null,["Ostatnia aktualizacja: 2024-08-21 UTC."],[[["`Maps.Mode` is an enum used to specify the mode of transportation for directions."],["The available modes are `DRIVING`, `WALKING`, `BICYCLING`, and `TRANSIT`."],["`TRANSIT` mode requires specifying either departure or arrival time."],["Each mode utilizes specific routes like roads, pedestrian paths, bicycle paths, or public transit routes as appropriate."]]],["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"]]