Class: MapRouting

cercalia.MapRouting


Useful class to interact with routing, map and menus.

new cercalia.MapRouting()

src/cercalia/maprouting.js, line 26
Fires:

Extends

Methods

addMarkerStep(marker, opt_position, opt_draggedPoint)

src/cercalia/maprouting.js, line 517
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 800

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(callbackFn)

src/cercalia/maprouting.js, line 746
Name Type Description
callbackFn function

Callback function.

changed() inherited

src/ol/observable.js, line 58

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

cleanRoute()

src/cercalia/maprouting.js, line 1168

Delete route from map and its markers.

disableAutoZoom(autoZoomDisabled)

src/cercalia/maprouting.js, line 957

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 401

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 391

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 533
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 1388
Returns:
Routing service

getWKT(){string|null}

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

invert()

src/cercalia/maprouting.js, line 1261

Invert origin and destination.

isActive(){boolean}

src/cercalia/maprouting.js, line 1207

Return if MapRouting is active

Returns:
`truè if map routing is actived.

isLogistics(){boolean}

src/cercalia/maprouting.js, line 1380
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 649

Clear route features from map.

removeMarkers()

src/cercalia/maprouting.js, line 617

Clear route markers from map.

removeStepIndex(index)

src/cercalia/maprouting.js, line 425
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.

setCustomCallbackFunction(func)

src/cercalia/maprouting.js, line 948

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.

setDraggable(draggable)

src/cercalia/maprouting.js, line 239

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 883

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)

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

Step type. Values origin, destination, step.

position cercalia.LonLat

Position

formattedAddress string

Formatted address.

setVisibleArrows(show)

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

true to show arrows. Else false.

setWeight(weight){boolean}

src/cercalia/maprouting.js, line 860

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 918
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