TrafficControl class
A control to display the traffic information of the map.
- Extends
Constructors
Traffic |
Constructs a TrafficControl |
Properties
is |
Current control state (is traffic information displayed?) Sets the control state |
Methods
get |
Get the TrafficControlOptions |
on |
Initialization method for the control which is called when added to the map. |
on |
Method that is called when the control is removed from the map. Should perform any necessary cleanup for the control. |
update |
Updates the button state according to current traffic state |
Inherited Methods
build |
Build the outermost container for the control, applies styling including any listeners for auto styling. |
Constructor Details
TrafficControl(TrafficControlOptions)
Constructs a TrafficControl
new TrafficControl(options?: TrafficControlOptions)
Parameters
- options
- TrafficControlOptions
The options for the control.
Property Details
isActive
Current control state (is traffic information displayed?) Sets the control state
boolean isActive
Property Value
boolean
Method Details
getOptions()
Get the TrafficControlOptions
function getOptions(): TrafficControlOptions
Returns
onAdd(Map)
Initialization method for the control which is called when added to the map.
function onAdd(map: Map): HTMLElement
Parameters
- map
- Map
The map that the control will be added to.
Returns
HTMLElement
An HTMLElement to be placed on the map for the control.
onRemove()
Method that is called when the control is removed from the map. Should perform any necessary cleanup for the control.
function onRemove()
updateButtonState()
Updates the button state according to current traffic state
function updateButtonState()
Inherited Method Details
buildContainer<K>(Map, ControlStyle, string, K)
Build the outermost container for the control, applies styling including any listeners for auto styling.
function buildContainer<K>(map: Map, style: ControlStyle, ariaLabel?: string, tagName?: K): HTMLElementTagNameMap[K]
Parameters
- map
- Map
- style
- ControlStyle
- ariaLabel
-
string
- tagName
-
K
Returns
HTMLElementTagNameMap[K]
Inherited From ControlBase.buildContainer