google.maps.DirectionsRenderer class
Renders directions obtained from the DirectionsService.
This class extends MVCObject.
Constructor
DirectionsRenderer([opts])
Parameters:
- opts: DirectionsRendererOptions optional
Creates the renderer with the given options. Directions can be rendered on a map (as visual overlays) or additionally on a
Methods
getDirections()
Parameters: None
Return Value: DirectionsResult
Returns the renderer's current set of directions.
getMap()
Parameters: None
Return Value: Map
Returns the map on which the DirectionsResult is rendered.
getPanel()
Parameters: None
Return Value: Node
Returns the panel
getRouteIndex()
Parameters: None
Return Value: number
Returns the current (zero-based) route index in use by this DirectionsRenderer object.
setDirections(directions)
Parameters:
- directions: DirectionsResult
Return Value: None
Set the renderer to use the result from the DirectionsService. Setting a valid set of directions in this manner will display the directions on the renderer's designated map and panel.
setMap(map)
Parameters:
- map: Map
Return Value: None
This method specifies the map on which directions will be rendered. Pass null to remove the directions from the map.
setOptions(options)
Parameters:
- options: DirectionsRendererOptions
Return Value: None
Change the options settings of this DirectionsRenderer after initialization.
setPanel(panel)
Parameters:
- panel: Node
Return Value: None
This method renders the directions in a
setRouteIndex(routeIndex)
Parameters:
- routeIndex: number
Return Value: None
Set the (zero-based) index of the route in the DirectionsResult object to render. By default, the first route in the array will be rendered.
Events
function()
Arguments: None
This event is fired when the rendered directions change, either when a new DirectionsResult is set or when the user finishes dragging a change to the directions path.