/**
* BeNomad BeMap JavaScript API - Routing, EVSE Routing.
*/
/**
* @classdesc
* Base class for EVSE Routing calculation.
* @public
* @constructor
* @abstract
* @param {bemap.Context} context BeMap-JS-API Context. Mandatory.
* @param {object} options see below the available values.
*/
bemap.EvseRouting = function(context, options) {
bemap.Routing.call(this, context, options);
/**
* ID of geometry.
* @type {String}
* @protected
*/
this.geometryId = 'evseRouting';
};
bemap.inherits(bemap.EvseRouting, bemap.Routing);
/**
* Execute the EVSE Routing calculation.
* @public
* @param {object} options See below the available values.
* @param {object} options.geoserver Geoserver name will be used for this computation.
* @return {bemap.Isochrone} this
*/
bemap.EvseRouting.prototype.compute = function(options) {
this.reset();
if (this.destinations && this.destinations.length < 2) {
console.error("Minimum of 2 destionations are required!");
return;
}
var opts = options || {};
var i = 0;
var first = true;
var url = this.ctx.getBaseUrl() + 'bnd';
var data = 'version=1.0.0&action=routing&mode=MODE_VIAS&format=json&transportType=CAR&speedType=ETA';
data += '&options=OPTIMIZED_ROUTE_FOR_CHARGING_STATION,EVENT,EVT_DUPLICATE_FILTER,EVT_CHARGING_STATION,EVT_POLYLINE';
data += '&cf=5,80';
data += '&cfCnnTypeIdFilters=8,9,10,11,12';
//data += '&evf=0.75,0.012,0.693,22,1468,100,300,2.1,-2,20,22,31';
if (this.ctx.isAuthInPost()) {
data += '&' + this.ctx.getAuthUrlParams();
} else {
url += '?' + this.ctx.getAuthUrlParams();
}
data += this.buildRequest(opts);
return this.execute(url, data, opts);
};