Waypoint

public final class Waypoint extends Object

An immutable waypoint class, used to specify navigation destinations. It may be constructed from a latitude/longitude pair, or a Google Place ID.

Nested Class Summary

class Waypoint.InvalidSegmentHeadingException An exception thrown when trying to create a Waypoint with an invalid segment heading. 
class Waypoint.UnsupportedPlaceIdException An exception thrown when trying to create a Waypoint from an unsupported Place ID. 

Public Constructor Summary

Waypoint(com.google.android.apps.gmm.map.model.directions.Waypoint gmmWaypoint)

Public Method Summary

boolean
equals(Object o)
Tests if this Waypoint is equal to another.
static Waypoint
fromLatLng(double latitude, double longitude, String title, boolean preferSameSideOfRoad)
Creates a Waypoint from a latitude/longitude pair and same side of road preference.
static Waypoint
fromLatLng(double latitude, double longitude, String title)
Creates a Waypoint from a latitude/longitude pair.
static Waypoint
fromLatLng(double latitude, double longitude, String title, int preferredSegmentHeading)
Creates a Waypoint from a latitude/longitude pair and same side of road preference.
static Waypoint
fromPlaceId(String placeIdString, String title)
Creates a Waypoint from a Google Place ID.
com.google.android.apps.gmm.map.model.directions.Waypoint
String
getPlaceId()
Returns the place id of the waypoint.
LatLng
getPosition()
Returns the lat/lng of the waypoint.
String
getTitle()
Returns the title of the Waypoint.
int
static ImmutableList<Waypoint>
toGmmWaypointList(List<Waypoint> waypointList)

Inherited Method Summary

Public Constructors

public Waypoint (com.google.android.apps.gmm.map.model.directions.Waypoint gmmWaypoint)

Parameters
gmmWaypoint

Public Methods

public boolean equals (Object o)

Tests if this Waypoint is equal to another.

The Waypoints are considered equal if they both represent the same destination. (All attributes set on the Waypoint must be equivalent.)

Parameters
o

public static Waypoint fromLatLng (double latitude, double longitude, String title, boolean preferSameSideOfRoad)

Creates a Waypoint from a latitude/longitude pair and same side of road preference.

Parameters
latitude the latitude at which to place the waypoint. This will be clamped to between -90 degrees and +90 degrees inclusive.
longitude the longitude at which to place the waypoint. This will be normalized to be within -180 degrees inclusive and +180 degrees exclusive.
title the text to display for the waypoint in the notification tray.
preferSameSideOfRoad whether it is preferred to route the driver to the same side of the road. The route will arrive on the preferred side of the road unless there is a significant delay caused by a road closure or slow-moving traffic.
Returns
  • a Waypoint at the specified lat/lng.

public static Waypoint fromLatLng (double latitude, double longitude, String title)

Creates a Waypoint from a latitude/longitude pair.

Parameters
latitude the latitude at which to place the waypoint. This will be clamped to between -90 degrees and +90 degrees inclusive.
longitude the longitude at which to place the waypoint. This will be normalized to be within -180 degrees inclusive and +180 degrees exclusive.
title the text to display for the waypoint in the notification tray.
Returns
  • a Waypoint at the specified lat/lng.

public static Waypoint fromLatLng (double latitude, double longitude, String title, int preferredSegmentHeading)

Creates a Waypoint from a latitude/longitude pair and same side of road preference.

Parameters
latitude the latitude at which to place the waypoint. This will be clamped to between -90 degrees and +90 degrees inclusive.
longitude the longitude at which to place the waypoint. This will be normalized to be within -180 degrees inclusive and +180 degrees exclusive.
title the text to display for the waypoint in the notification tray
preferredSegmentHeading an angle used to express the direction of traffic on the side of the road that the vehicle should arrive on. Consequently, it is not useful for one-way streets. Units expressed in degrees [0, 360], where 0 means North.
Returns
  • a Waypoint at the specified lat/lng.
Throws
Waypoint.InvalidSegmentHeadingException if given an invalid segment heading.

public static Waypoint fromPlaceId (String placeIdString, String title)

Creates a Waypoint from a Google Place ID.

Parameters
placeIdString the ID of the place used for this waypoint
title the text to display for the waypoint in the notification tray
Returns
  • a Waypoint at the specified place
Throws
Waypoint.UnsupportedPlaceIdException if given an unsupported place ID

public com.google.android.apps.gmm.map.model.directions.Waypoint getGmmWaypoint ()

public String getPlaceId ()

Returns the place id of the waypoint.

public LatLng getPosition ()

Returns the lat/lng of the waypoint.

public String getTitle ()

Returns the title of the Waypoint. The title is the text that is displayed for the Waypoint in the notification tray.

Returns
  • the title of the waypoint

public int hashCode ()

public static ImmutableList<Waypoint> toGmmWaypointList (List<Waypoint> waypointList)

Parameters
waypointList