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:
DirectionsResultReturns the renderer's current set of directions. |
getMap |
getMap()Parameters: None
Return Value:
MapReturns the map on which the DirectionsResult is rendered. |
getPanel |
getPanel()Parameters: None
Return Value:
NodeReturns the panel <div> in which the DirectionsResult is rendered. |
getRouteIndex |
getRouteIndex()Parameters: None
Return Value:
numberReturns 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:
Return Value: None
This method renders the directions in a <div>. Pass null to remove the content from the panel. |
setRouteIndex |
setRouteIndex(routeIndex)Parameters:
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. |