new IWRoutingControl(map, userOptions)
Creates a new routing control object.
Parameters:
Name | Type | Description |
---|---|---|
map |
IWMap | the map instance |
userOptions |
object | a set of options as defined for setOptions() |
Extends
Methods
-
addInterstationAddress(address)
-
Adds an interstation address to the end of the list.
Parameters:
Name Type Description address
IWAbstractAddress Returns:
- Type
- void
-
afterAppend()
-
Creates the GUI for this control after the specified language has been loaded.
- Overrides:
Returns:
- Type
- void
-
afterRemove()
-
Callback method. This method will be called after the element has been removed from the DOM. Overwrite this method to react on this event.
- Inherited From:
Returns:
- Type
- void
-
beforeAppend()
-
Callback method. This method will be called before the element has been added to the DOM. Overwrite this method to react on this event.
- Inherited From:
Returns:
- Type
- void
-
beforeRemove()
-
Callback method. This method will be called before the element has been removed from the DOM. Overwrite this method to react on this event.
- Inherited From:
Returns:
- Type
- void
-
changeAddressOrder()
-
Changes the address order in the routing window.
Returns:
- Type
- void
-
createDateTimeSelector()
-
Creates a group of selects for the date and time and registers their events
Returns:
- Type
- HTMLDivElement
-
destroyMapElement()
-
Releases all event listeners from the container.
- Inherited From:
Returns:
- Type
- void
-
getContainer()
-
Returns the DIV container for this map element.
- Inherited From:
Returns:
the container- Type
- HTMLDivElement
-
getDestinationAddress()
-
Returns the destination address.
- Deprecated:
-
- use IWRoutingManager.getDestinationAddress()
Returns:
- Type
- IWAbstractAddress
-
getFirstOrientation()
-
Returns the first orientation of this control.
- Inherited From:
Returns:
- Type
- IWAlignment
-
getId()
-
Returns the id for this element.
- Inherited From:
Returns:
- Type
- String
-
getInterstationAddresses()
-
Returns all the interstation addresses which are specified in the routing window.
- Deprecated:
-
- use IWRoutingManager.getItinerary()
Returns:
- Type
- Array.<IWAbstractAddress>
-
getLayerIndexOfRoutingPoints()
-
Returns the layer index of routing points (default is 100).
- Deprecated:
-
- Yes
Returns:
- Type
- number
-
getName()
-
Returns the name of this control.
- Inherited From:
Returns:
- Type
- String
-
getPadding()
-
Returns the padding for this control.
- Inherited From:
Returns:
the padding for this control- Type
- IWSize
-
getParent()
-
Returns the parent container for this element.
- Inherited From:
Returns:
parent- Type
- HTMLDivElement
-
getSecondOrientation()
-
Returns the second orientation of the control.
- Inherited From:
Returns:
- Type
- IWAlignment
-
getStartAddress()
-
Returns the start address.
- Deprecated:
-
- use IWRoutingManager.getStartAddress()
Returns:
- Type
- IWAbstractAddress
-
isControl()
-
Function for IWLayoutManager to check if this interface is implemented.
- Inherited From:
Returns:
true- Type
- boolean
-
isDisplayed()
-
Checks if the element has been added to the DOM tree.
- Inherited From:
Returns:
- Type
- boolean
-
isPrintable()
-
Returns true if the element is printable otherwise false.
- Inherited From:
Returns:
- Type
- boolean
-
isRedrawable()
-
Returns whether the control will be redrawn by the layout manager or not.
- Inherited From:
Returns:
redrawable- Type
- Boolean
-
isVisible()
-
Returns true if the container is visible, otherwise false.
- Inherited From:
Returns:
true if this container is visible- Type
- boolean
-
onClick(event)
-
Callback method for onclick events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onContextMenu(event)
-
Callback method for oncontextmenu events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onDblClick(event)
-
Callback method for ondblclick events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onMouseDown(event)
-
Callback method for onmousedown events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onMouseMove(event)
-
Callback method for onmousemove events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onMouseOut(event)
-
Callback method for onmouseout events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onMouseOver(event)
-
Callback method for onmouseover events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onMouseUp(event)
-
Callback method for onmouseup events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
onMouseWheel(event)
-
Callback method for onmousewheel events.
Parameters:
Name Type Description event
Event - Inherited From:
Returns:
- Type
- void
-
print()
-
Displays a printable version of the route description
Returns:
- Type
- void
-
removeInterstationAddress(div)
-
Removes an interstation address
Parameters:
Name Type Description div
Object the div which holds this interstation address within the DOM Returns:
- Type
- void
-
removeInterstationAddresses()
-
Removes all interstation addresses.
Returns:
- Type
- void
-
resetDestinationAddress()
-
Resets the start address.
- Deprecated:
-
- use IWRoutingManager.updateDestination(null)
Returns:
- Type
- void
-
resetStartAddress()
-
Resets the start address.
- Deprecated:
-
- use IWRoutingManager.updateStart(null)
Returns:
- Type
- void
-
setContainer(newContainer)
-
Sets the DIV container for this map element.
Parameters:
Name Type Description newContainer
HTMLDivElement - Inherited From:
Returns:
- Type
- void
-
setContainerClassname(classname)
-
Sets the classname of the container. Only use this method to modify the containers classname because it preserves the classname set by setPrintable(false).
Parameters:
Name Type Description classname
- Inherited From:
-
setDestinationAddress(address)
-
Sets the destination address.
Parameters:
Name Type Description address
IWAbstractAddress - Deprecated:
-
- use IWRoutingManager.updateDestination(address)
Returns:
- Type
- void
-
setFirstOrientation(alignment)
-
Sets the first orientation of the control. Possible values are
IWAlignment.CENTER
,IWAlignment.TOP
,IWAlignment.RIGHT
,IWAlignment.BOTTOM
andIWAlignment.LEFT
.Parameters:
Name Type Description alignment
IWAlignment the first orientation - Inherited From:
Returns:
- Type
- void
-
setId(id)
-
Sets the id for this element.
Parameters:
Name Type Description id
String - Inherited From:
Returns:
- Type
- void
-
setInterstationAddresses(addresses)
-
Sets a list of interstation addresses.
Parameters:
Name Type Description addresses
Array.<IWAbstractAddress> Returns:
- Type
- void
-
setMessageHandler(handler)
-
If an error occurs (because an address cannot be geocoded or a route cannot be calculated) the error message is shown in an alert. If you want to change this you can specify a message handler, which is called with the message text.
Parameters:
Name Type Description handler
function a function called with the message text Returns:
- Type
- void
-
setOptions(options)
-
Sets some options for the control and the rendering of the route.
These options are:- showModus: Add a GUI component to change the routing mode (fastest / shortest route); default: true
- showSpeed: Add input fields to change the speed settings; default: false
- showProfile: Add buttons to select the routing profile (fast car, slow car, pedestrian, truck etc.); default: true
- showInterstations: Add input fields for interstations; default: true
- showSwapStartDestination: Add a link to swap start and destination address; default: true
- showAlternatives: Show up to two alternative routes; default: false
- structuredAddresses: Add separate fields for street, house number, postal code and city; default: true
- highlightManeuvers: Show tooltips in the map for mouseover events on the driving directions; default: true
- country: An ISO-3166 country code (e.g. deu for Germany or fra for France) to limit address search to that country; or blank to show a selection of all available countries; default: empty
- routeFormatterClass: A function used as constructor for the route formatter, which is used to create the driving directions HTML; default: IWRouteFormatter
- canDragRouteToRecalculate: Allows the user to add via points to the route by drag and drop; default: false
- renderAttributes: An object containing rendering attributes as used by a map renderer
- buttonClass: A CSS class which is applied to all buttons; default: iwbutton
Example:var options = { showModus: true, showSpeed: true, showProfile: true, renderAttributes: { stroke: 'blue', strokeDashStyle: 'solid', strokeWidth: 5, strokeOpacity: 0.8 } }; var routingControl = new IWRoutingControl(map); routingControl.setOptions(options);
Parameters:
Name Type Description options
object an object with the options as described above Returns:
- Type
- void
-
setPadding(newPadding)
-
Sets the padding for this control. A padding defines the space between the current control element and others.
Parameters:
Name Type Description newPadding
IWSize the padding for this control - Inherited From:
Returns:
- Type
- void
-
setParent()
-
Sets the parent container for this element.
- Inherited From:
Returns:
newParent- Type
- HTMLDivElement
-
setPrintable(printable)
-
Enables or disables the element for printing.
Parameters:
Name Type Description printable
boolean - Inherited From:
Returns:
- Type
- void
-
setRedrawable(isRedrawable)
-
Defines if the control will be redrawn by the layout manager.
Parameters:
Name Type Description isRedrawable
boolean - Inherited From:
Returns:
- Type
- void
-
setRoutingMarkerIcons(start, destination, interstation)
-
Allows you to specify a set of icons. These are displayed in markers at the start, destination and all interstations of the route.
Parameters:
Name Type Description start
IWIcon the icon for the start marker destination
IWIcon the icon for the destination marker interstation
IWIcon the icon for all interstation markers - Deprecated:
-
- Yes
Returns:
- Type
- void
-
setRoutingSpriteUrl(routingSpriteUrl)
-
Sets the url of the sprite for the routing description icons.
Parameters:
Name Type Description routingSpriteUrl
String - Deprecated:
-
- Yes
-
setSecondOrientation(alignment)
-
Sets the second orientation of the control. Possible values are
IWAlignment.CENTER
,IWAlignment.TOP
,IWAlignment.RIGHT
,IWAlignment.BOTTOM
andIWAlignment.LEFT
.Parameters:
Name Type Description alignment
IWAlignment the secondary orientation - Inherited From:
Returns:
- Type
- void
-
setStartAddress(address)
-
Sets the start address for the routing action.
Parameters:
Name Type Description address
IWAbstractAddress the start address - Deprecated:
-
- use IWRoutingManager.updateStart(address)
Returns:
- Type
- void
-
setVisible(visible)
-
Sets the visibility of this control to visible or hidden.
Parameters:
Name Type Description visible
boolean - Inherited From:
Returns:
- Type
- void
-
toString()
-
Returns a string representation of this routing control.
- Overrides:
Returns:
- Type
- String
-
<inner> dropDown(menu)
-
Toggles the visibility of a menu
Parameters:
Name Type Description menu
Element Returns:
- Type
- void