switch to reroute branch until merged

This commit is contained in:
Norbert Renner 2014-02-01 18:54:11 +01:00
parent 75051d7d6c
commit 7b72ae7d20
4 changed files with 50 additions and 8 deletions

View file

@ -295,6 +295,43 @@ L.Routing = L.Control.extend({
this._routeSegment(marker, marker._routing.nextMarker, callback);
}
/**
* Recalculate the complete route by routing each segment
*
* @access public
*
* @param <Function> cb - callback function
*
* @return void
*
* @todo add propper error checking for callback
*/
,routeAllSegments: function(cb) {
var numSegments = this.getWaypoints().length - 1;
var callbackCount = 0;
var $this = this;
var callback = function(err, data) {
callbackCount++;
if (callbackCount >= numSegments) {
$this.fire('routing:routeAllSegmentsEnd');
if (cb) {
cb(err);
}
}
};
$this.fire('routing:routeAllSegmentsStart');
if (numSegments < 1) {
return callback(null, true);
}
this._eachSegment(function(m1, m2) {
this._routeSegment(m1, m2, callback);
});
}
/**
* Route segment between two markers
*