Class: MapRouting

cercalia.MapRouting


Useful class to interact with routing, map and menus.

new cercalia.MapRouting(opt_options)

src/cercalia/maprouting.js, line 27
Name Type Description
options

Options

Type Description
Fires:

Extends

Classes

Event

Methods

addMarkerStep(marker, opt_position, opt_draggedPoint)

src/cercalia/maprouting.js, line 585
Name Type Description
marker cercalia.Marker

Marker

position number

Step position

draggedPoint boolean

true if is a dragged point.

calculateOptimizedRoute()

src/cercalia/maprouting.js, line 912

Force to calculate route although origin and destination have not been reported, but one of both.
This method is useful when the 'reorder' option is activated including to 'originisdepot' or 'destinationisdepot'

calculateReport()

src/cercalia/maprouting.js, line 840

Calculate report. Origin and destination must be set previously.

changed() inherited

src/ol/observable.js, line 58

Increases the revision counter and dispatches a 'change' event.

cleanRoute()

src/cercalia/maprouting.js, line 1387

Delete route from map and its markers.

disableAutoZoom(autoZoomDisabled)

src/cercalia/maprouting.js, line 1125

Disable auto zoom (center to features) after draw route feature.

Name Type Description
autoZoomDisabled boolean

true disables center to features after calculated route. false active restores default behaviour.

disableRightClickMenu()

src/cercalia/maprouting.js, line 469

Disable right click context menu. It is enabled by default.

dispatchEvent(event) inherited

src/ol/observable.js, line 75

Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

Name Type Description
event Object | ol.events.Event | string

Event object.

enableRightClickMenu()

src/cercalia/maprouting.js, line 459

Enable right click context menu. It is enabled by default.

get(key){*} inherited

src/ol/object.js, line 101

Gets a value.

Name Type Description
key string

Key name.

Returns:
Value.

getFeatures(){}

src/cercalia/maprouting.js, line 601
Returns:
Array feature.

getKeys(){} inherited

src/ol/object.js, line 115

Get a list of object property names.

Returns:
List of property names.

getProperties(){} inherited

src/ol/object.js, line 125

Get an object of all property names and values.

Returns:
Object.

getRevision(){number} inherited

src/ol/observable.js, line 84

Get the version number for this object. Each time the object is modified, its version number will be incremented.

Returns:
Revision.

getRoutingService(){cercalia.service.Routing}

src/cercalia/maprouting.js, line 1607
Returns:
Routing service

getWKT(){string|null}

src/cercalia/maprouting.js, line 1443
Returns:
WKT.

invert()

src/cercalia/maprouting.js, line 1480

Invert origin and destination.

isActive(){boolean}

src/cercalia/maprouting.js, line 1426

Return if MapRouting is active

Returns:
`truè if map routing is actived.

isLogistics(){boolean}

src/cercalia/maprouting.js, line 1599
Returns:
true if route is logistics.

on(type, listener, opt_this){ol.EventsKey|Array.<ol.EventsKey>} inherited

src/ol/observable.js, line 99

Listen for a certain type of event.

Name Type Description
type string | Array.<string>

The event type or array of event types.

listener function

The listener function.

this Object

The object to use as this in listener.

Returns:
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

once(type, listener, opt_this){ol.EventsKey|Array.<ol.EventsKey>} inherited

src/ol/observable.js, line 124

Listen once for a certain type of event.

Name Type Description
type string | Array.<string>

The event type or array of event types.

listener function

The listener function.

this Object

The object to use as this in listener.

Returns:
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.

removeFeatures()

src/cercalia/maprouting.js, line 734

Clear route features from map.

removeMarkers()

src/cercalia/maprouting.js, line 689

Clear route markers from map.

removeStepIndex(index)

src/cercalia/maprouting.js, line 493
Name Type Description
index number

Index.

set(key, value, opt_silent) inherited

src/ol/object.js, line 150

Sets a value.

Name Type Description
key string

Key name.

value *

Value.

silent boolean

Update without triggering an event.

setAddedCosts(consumption, gasType, gasPrice)

src/cercalia/maprouting.js, line 1021

Update Routing widget costs.

Name Type Description
consumption number

Consumption L/100 km. Example: 8.2.

gasType string | undefined

Gas Type. Available values: gas95|gas98|diesel|biodiosel.

gasPrice number | undefined

Gasoline price. €/L. Example: 1.51.

setCustomCallbackFunction(func)

src/cercalia/maprouting.js, line 1106

Set custom callback function. This function is called after route calculation. Setting null, it disables previous custom function.

Name Type Description
func function

Custom callback function.

setCustomReportCallbackFunction(func)

src/cercalia/maprouting.js, line 1116

Set custom callback function. This function is called after report calculation Setting null, it disables previous custom function.

Name Type Description
func function

Custom callback function.

setDraggable(draggable)

src/cercalia/maprouting.js, line 298

Set route draggable and its steps

Name Type Description
draggable boolean

Draggable

setProperties(values, opt_silent) inherited

src/ol/object.js, line 170

Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

Name Type Description
values

Values.

silent boolean

Update without triggering an event.

setReorder(reorder, opt_originIsDepot, opt_destinationIsDepot){boolean}

src/cercalia/maprouting.js, line 1037

Update route parameter option weight. Use this instead setWeight from cercalia.service.Routing.

Name Type Description
reorder boolean

Reorder

originIsDepot boolean

This parameter only works if REORDER parameter is used. Values: true: origin cannot be reordered (default).
false: origin is one more stop and can be reordered. Useful when you cannot choose the starting point of the vehicle.

destinationIsDepot boolean

This parameter only works if REORDER parameter is used. Values: true: destination cannot be reordered (default).
false: destination is one more stop and can be reordered. Useful when after attending some services you don’t have to return to a base.

Returns:
Return true if route options has been modified

setRoutingStep(stepType, position, opt_formattedAddress, showLabel)

src/cercalia/maprouting.js, line 781
Name Type Description
stepType string

Step type. Values origin, destination, step.

position cercalia.LonLat

Position

formattedAddress string

Formatted address.

showLabel boolean

Show label.

setVisibleArrows(show)

src/cercalia/maprouting.js, line 749
Name Type Description
show boolean

true to show arrows. Else false.

setWeight(weight){boolean}

src/cercalia/maprouting.js, line 1001

Update route parameter option weight. Use this instead setWeight from cercalia.service.Routing.

Name Type Description
weight string

Weight

Returns:
Return true if route options has been modified

un(type, listener, opt_this) inherited

src/ol/observable.js, line 147

Unlisten for a certain type of event.

Name Type Description
type string | Array.<string>

The event type or array of event types.

listener function

The listener function.

this Object

The object which was used as this by the listener.

unset(key, opt_silent) inherited

src/ol/object.js, line 184

Unsets a property.

Name Type Description
key string

Key name.

silent boolean

Unset without triggering an event.

updateOptions(weight, reorder, logisticsEnabled, opt_logisticsParams, opt_departuretime)

src/cercalia/maprouting.js, line 1072
Name Type Description
weight string

Weight.

reorder boolean

Optimized route.

logisticsEnabled boolean

Enable or disable logistics params.

logisticsParams

Logistics params.

Name Type Description
vaxleweight number | undefined

Maximum axle weight.

vheight number | undefined

Maximum height.

vlength number | undefined

Maximum length.

vwidth number | undefined

Maximum width.

vmaxvel number | undefined

Maximum speed.

rimp boolean | undefined

Dangerous goods.

trinfodate string | undefined

YYYYMMDD

trinfodays number | undefined

Number days to consecutives to show restrictions.

trstart number | undefined

Avoid route restrictions. In timestamp format.

departuretime string

Departure time