new Route(options)
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object |
route control options
|
Fires:
- route:drawstart
- route:drawend
- route:compute
- export:compute
Example
var route = ol.control.Route({
"collapsed" : true
"draggable" : true,
"export" : false,
"exclusions" : {
"toll" : true,
"bridge" : false,
"tunnel" : true
},
"graphs" : ['Pieton', 'Voiture'],
"markersOpts" : {
"departure" : {
"url" : "...",
"offset" : [0,0]
},
"stages" : {
"url" : "...",
"offset" : [0,0]
},
"arrival" : {
"url" : "...",
"offset" : [0,0]
}
}
"autocompleteOptions" : {},
"routeOptions" : {}
});
// if you want to pluggued the control Export with options :
var route = new ol.control.Route({
export : {
name : "export",
format : "geojson",
title : "Exporter",
menu : false
}
});
Extends
- ol.control.Control
Members
-
collapsed
-
{Boolean} specify if Route control is collapsed (true) or not (false)
-
draggable
-
{Boolean} specify if Route control is draggable (true) or not (false)
Methods
-
getCollapsed(){Boolean}
OpenLayers/Controls/Route.js, line 207 -
Returns true if widget is collapsed (minimized), false otherwise
Returns:
- true if widget is collapsed
-
getContainer(){DOMElement}
OpenLayers/Controls/Route.js, line 361 -
Get container
-
getData(){Object}
OpenLayers/Controls/Route.js, line 290 -
Get route informations
Returns:
- route informations
-
getGeoJSON(){String}
OpenLayers/Controls/Route.js, line 268 -
Get vector layer
Returns:
- GeoJSON format layer
-
getLayer(){Object}
OpenLayers/Controls/Route.js, line 237 -
Get vector layer where geoJson route is drawn
Returns:
- ol.layer.Vector route layer
-
getStyle(){ol.style}
OpenLayers/Controls/Route.js, line 370 -
Get default style
-
init()
OpenLayers/Controls/Route.js, line 378 -
This method is public.
It allows to init the control. -
setCollapsed(collapsed)
OpenLayers/Controls/Route.js, line 216 -
Collapse or display widget main container
Name Type Description collapsed Boolean True to collapse widget, False to display it
-
setData(data)
OpenLayers/Controls/Route.js, line 318 -
Set route data
Name Type Description data Object control informations
Name Type Description transport String transport type
computation String computation type
exclusions Array list of exclusions
points Array list of points : [[lon, lat]]
results Object service response
-
setGeoJSON(geojson)
OpenLayers/Controls/Route.js, line 277 -
Set vector layer
Name Type Description geojson String GeoJSON format layer
-
setLayer(layer)
OpenLayers/Controls/Route.js, line 246 -
Set vector layer where route geometry is drawn
Name Type Description layer Object ol.layer.Vector route layer
-
setMap(map)
OpenLayers/Controls/Route.js, line 165 -
Overwrite OpenLayers setMap method
Name Type Description map ol.Map Map.