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

@ -11,6 +11,6 @@
"leaflet-gpx": "mpetazzoni/leaflet-gpx",
"leaflet-search": "*",
"leaflet-plugins": "*",
"leaflet-routing": "Turistforeningen/leaflet-routing#gh-pages"
"leaflet-routing": "nrenner/leaflet-routing#reroute"
}
}

View file

@ -1,13 +1,13 @@
{
"name": "leaflet-routing",
"homepage": "https://github.com/Turistforeningen/leaflet-routing",
"_release": "9d66697f2a",
"homepage": "https://github.com/nrenner/leaflet-routing",
"_release": "ac4d02c54b",
"_resolution": {
"type": "branch",
"branch": "gh-pages",
"commit": "9d66697f2a0e547b61a48c7a5358f5f0bba280fe"
"branch": "reroute",
"commit": "ac4d02c54b06da9d1e21fe77ba5a0c553095d15e"
},
"_source": "git://github.com/Turistforeningen/leaflet-routing.git",
"_target": "gh-pages",
"_originalSource": "Turistforeningen/leaflet-routing"
"_source": "git://github.com/nrenner/leaflet-routing.git",
"_target": "reroute",
"_originalSource": "nrenner/leaflet-routing"
}

View file

@ -39,6 +39,11 @@ routing.routing(true);
routing.snapping(true);
```
### Recalculate the complete route by routing each segment
```javascript
routing.routeAllSegments(callback);
```
### Get first waypoint
```javascript

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
*