manually applied transit demo patch

This commit is contained in:
Norbert Renner 2016-05-20 19:46:32 +02:00
parent 5a486fb417
commit 3fd8fdb469
5 changed files with 69 additions and 18 deletions

View file

@ -9,23 +9,15 @@
// online service (brouter.de) configuration // online service (brouter.de) configuration
BR.conf.profiles = [ BR.conf.profiles = [
'../im/bike',
'../im/foot',
'../im/like-bike',
'../im/like-foot',
'trekking', 'trekking',
'fastbike', 'fastbike',
'car-test',
'safety',
'shortest', 'shortest',
'trekking-ignore-cr',
'trekking-steep',
'trekking-noferries',
'trekking-nosteps',
'moped', 'moped',
'rail', 'car-test'
'river',
'vm-forum-liegerad-schnell',
'vm-forum-velomobil-schnell',
'fastbike-lowtraffic',
'fastbike-asia-pacific',
'hiking-beta'
]; ];
BR.conf.host = 'http://h2096617.stratoserver.net:443'; BR.conf.host = 'http://h2096617.stratoserver.net:443';
@ -36,6 +28,10 @@
// desktop configuration // desktop configuration
BR.conf.profiles = [ BR.conf.profiles = [
'../im/bike',
'../im/foot',
'../im/like-bike',
'../im/like-foot',
'trekking', 'trekking',
'fastbike', 'fastbike',
'shortest', 'shortest',

3
dist/brouter-web.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

48
js/control/Iternity.js Normal file
View file

@ -0,0 +1,48 @@
BR.Iternity = BR.Control.extend({
options: {
heading: 'Iternity'
},
onAdd: function (map) {
var container = BR.Control.prototype.onAdd.call(this, map);
this.update();
return container;
},
update: function (polyline, segments) {
var i, j, iter, html = '';
html += '<small><pre>';
for (i = 0; segments && i < segments.length; i++)
{
iter = segments[i].feature.iternity;
for (j = 0; iter && j < iter.length; j++)
{
html += iter[j] + '\n';
}
}
html += '</pre></small>';
this._content.innerHTML = html;
},
calcStats: function(polyline, segments) {
var stats = {
trackLength: 0,
filteredAscend: 0,
plainAscend: 0,
cost: 0
};
var i, props;
for (i = 0; segments && i < segments.length; i++) {
props = segments[i].feature.properties;
stats.trackLength += +props['track-length'];
stats.filteredAscend += +props['filtered ascend'];
stats.plainAscend += +props['plain-ascend'];
stats.cost += +props['cost'];
}
return stats;
}
});

View file

@ -119,6 +119,7 @@
routingOptions, routingOptions,
nogos, nogos,
stats, stats,
iternity,
elevation, elevation,
download, download,
profile, profile,
@ -187,7 +188,8 @@
nogos = new BR.NogoAreas(); nogos = new BR.NogoAreas();
nogos.on('update', updateRoute); nogos.on('update', updateRoute);
stats = new BR.TrackStats(); // stats = new BR.TrackStats();
iternity = new BR.Iternity();
download = new BR.Download(); download = new BR.Download();
elevation = new BR.Elevation(); elevation = new BR.Elevation();
profile = new BR.Profile(); profile = new BR.Profile();
@ -273,7 +275,8 @@
urls = {}; urls = {};
elevation.update(track, segmentsLayer); elevation.update(track, segmentsLayer);
stats.update(track, segments); // stats.update(track, segments);
iternity.update(track, segments);
trackMessages.update(track, segments); trackMessages.update(track, segments);
if (latLngs.length > 1) { if (latLngs.length > 1) {
@ -286,12 +289,15 @@
download.update(urls); download.update(urls);
}; };
/*
map.addControl(new BR.Control({ map.addControl(new BR.Control({
heading: '', heading: '',
divId: 'header' divId: 'header'
})); }));
*/
routingOptions.addTo(map); routingOptions.addTo(map);
stats.addTo(map); // stats.addTo(map);
iternity.addTo(map);
download.addTo(map); download.addTo(map);
elevation.addTo(map); elevation.addTo(map);
map.addControl(new BR.Tabs({ map.addControl(new BR.Tabs({