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.Builder A Builder class to construct instances of Waypoint. 
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

static Waypoint.Builder
builder()
Returns a new Builder instance that allows building new Waypoint objects.
boolean
equals(Object o)
Tests if this Waypoint is equal to another.
static Waypoint
fromLatLng(double latitude, double longitude, String title)
This method is deprecated. use builder() instead.
static Waypoint
fromLatLng(double latitude, double longitude, String title, int preferredSegmentHeading)
This method is deprecated. use builder() instead.
static Waypoint
fromLatLng(double latitude, double longitude, String title, boolean preferSameSideOfRoad)
This method is deprecated. use builder() instead.
static Waypoint
fromPlaceId(String placeIdString, String title)
This method is deprecated. use builder() instead.
String
getPlaceId()
Returns the place id of the waypoint.
LatLng
getPosition()
Returns the lat/lng position of the waypoint if it has been set, otherwise it returns null.
boolean
getPreferSameSideOfRoad()
Returns whether it is preferred to route the driver to the same side of the road.
int
getPreferredHeading()
Returns an angle used to express the direction of traffic on the side of the road that the vehicle should arrive on.
String
getTitle()
Returns the title of the Waypoint.
boolean
getVehicleStopover()
Indicates whether the waypoint can be relocated to a nearby place if its location is not suitable for a vehicle to make a stop.
int
static Waypoint.Builder
toBuilder(Waypoint waypoint)
Creates a new Builder instance based on an existing Waypoint object.
String

Inherited Method Summary

Public Constructors

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

Parameters
gmmWaypoint

Public Methods

public static Waypoint.Builder builder ()

Returns a new Builder instance that allows building new Waypoint objects.

Returns
  • a new Builder instance.

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)

This method is deprecated.
use builder() instead.

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)

This method is deprecated.
use builder() instead.

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 fromLatLng (double latitude, double longitude, String title, boolean preferSameSideOfRoad)

This method is deprecated.
use builder() instead.

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 fromPlaceId (String placeIdString, String title)

This method is deprecated.
use builder() instead.

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 String getPlaceId ()

Returns the place id of the waypoint.

public LatLng getPosition ()

Returns the lat/lng position of the waypoint if it has been set, otherwise it returns null.

public boolean getPreferSameSideOfRoad ()

Returns whether it is preferred to route the driver to the same side of the road.

Returns
  • a boolean indicating whether the same side of the road is preferred.

public int getPreferredHeading ()

Returns an angle used to express the direction of traffic on the side of the road that the vehicle should arrive on.

Returns
  • the value of the angle expressed in degrees [0, 360], where 0 means North. Returns a negative value if the angle is unset.

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 boolean getVehicleStopover ()

Indicates whether the waypoint can be relocated to a nearby place if its location is not suitable for a vehicle to make a stop. Elevated areas, ferries, underground locations and areas of limited access will be relocated to a nearby safe location.

Returns
  • a boolean indicating whether vehicleStopover has been enabled.

public int hashCode ()

public static Waypoint.Builder toBuilder (Waypoint waypoint)

Creates a new Builder instance based on an existing Waypoint object.

Parameters
waypoint the Waypoint object whose attributes will be used to populate the attributes of a new Builder instance.
Returns
  • a new Waypoint.Builder instance containing the attributes of the waypoint passed.

public String toString ()