google-maps-documentation

DirectionsRenderer class

google.maps.DirectionsRenderer class

Renders directions obtained from the DirectionsService.

This class extends MVCObject.

Constructor
DirectionsRenderer
DirectionsRenderer([opts])
Parameters: 
Creates the renderer with the given options. Directions can be rendered on a map (as visual overlays) or additionally on a <div> panel (as textual instructions).
Methods
getDirections
getDirections()
Parameters:  None
Return Value:  DirectionsResult
Returns the renderer's current set of directions.
getMap
getMap()
Parameters:  None
Return Value:  Map
Returns the map on which the DirectionsResult is rendered.
getPanel
getPanel()
Parameters:  None
Return Value:  Node
Returns the panel <div> in which the DirectionsResult is rendered.
getRouteIndex
getRouteIndex()
Parameters:  None
Return Value:  number
Returns the current (zero-based) route index in use by this DirectionsRenderer object.
setDirections
setDirections(directions)
Parameters: 
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
setMap(map)
Parameters: 
Return Value:  None
This method specifies the map on which directions will be rendered. Pass null to remove the directions from the map.
setOptions
setOptions(options)
Parameters: 
Return Value:  None
Change the options settings of this DirectionsRenderer after initialization.
setPanel
setPanel(panel)
Parameters: 
  • panelNode
Return Value:  None
This method renders the directions in a <div>. Pass null to remove the content from the panel.
setRouteIndex
setRouteIndex(routeIndex)
Parameters: 
  • routeIndexnumber
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
directions_changed
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.