diff --git a/bower.json b/bower.json
index 260527e..0f28ce2 100644
--- a/bower.json
+++ b/bower.json
@@ -19,7 +19,8 @@
"leaflet-control-geocoder": "~1.1.0",
"Leaflet.EasyButton": "*",
"bootbox": "~4.4.0",
- "seiyria-bootstrap-slider": "~4.8.1"
+ "seiyria-bootstrap-slider": "~4.8.1",
+ "url-search-params": "~0.5.0"
},
"overrides": {
"leaflet": {
@@ -75,6 +76,9 @@
"Control.Geocoder.css",
"images/*.+(png|gif)"
]
+ },
+ "url-search-params": {
+ "main": "build/url-search-params.js"
}
},
"resolutions": {
diff --git a/config.js b/config.js
index 949f4f2..e354d84 100644
--- a/config.js
+++ b/config.js
@@ -1,23 +1,39 @@
(function() {
var hostname = window.location.hostname;
+ var params = new URLSearchParams(window.location.search.slice(1));
BR.conf = {};
+ // Switch for intermodal routing demo
+ //BR.conf.transit = true;
+ // or as query parameter (index.html?transit=true#zoom=...)
+ // (uses search/query (?) not hash (#) params, as config only executed once at load)
+ // TODO not included in permalink (better replace permalink with hash plugin)
+ BR.conf.transit = params.has('transit') && (params.get('transit') === 'true');
+
if (hostname === 'brouter.de' || hostname === 'h2096617.stratoserver.net') {
// online service (brouter.de) configuration
BR.conf.profiles = [
- '../im/bike',
- '../im/foot',
- '../im/like-bike',
- '../im/like-foot',
'trekking',
'fastbike',
+ 'car-test',
+ 'safety',
'shortest',
+ 'trekking-ignore-cr',
+ 'trekking-steep',
+ 'trekking-noferries',
+ 'trekking-nosteps',
'moped',
- 'car-test'
+ 'rail',
+ 'river',
+ 'vm-forum-liegerad-schnell',
+ 'vm-forum-velomobil-schnell',
+ 'fastbike-lowtraffic',
+ 'fastbike-asia-pacific',
+ 'hiking-beta'
];
BR.conf.host = 'http://h2096617.stratoserver.net:443';
@@ -28,10 +44,6 @@
// desktop configuration
BR.conf.profiles = [
- '../im/bike',
- '../im/foot',
- '../im/like-bike',
- '../im/like-foot',
'trekking',
'fastbike',
'shortest',
@@ -66,4 +78,22 @@
// Minimum transparency slider value on load, values between 0 and 1 (0=invisible).
// 0 = no minimum, use stored setting; 1 = always reset to full visibility on load
BR.conf.minOpacity = 0.3;
+
+
+ // transit (intermodal routing) demo config
+ if (BR.conf.transit) {
+
+ BR.conf.profiles = [
+ '../im/bike',
+ '../im/foot',
+ '../im/like-bike',
+ '../im/like-foot',
+ 'trekking',
+ 'fastbike',
+ 'shortest',
+ 'moped',
+ 'car-test'
+ ];
+
+ }
})();
diff --git a/gulpfile.js b/gulpfile.js
index 28f1a31..a4dad77 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -15,9 +15,11 @@ var inject = require('gulp-inject');
var paths = {
// see overrides in bower.json
+ scriptsConfig: mainBowerFiles('**/url-search-params/**/*.js'),
scripts: mainBowerFiles([
'**/*.js',
- '!**/*.min.js'
+ '!**/*.min.js',
+ '!**/url-search-params/**/*.js'
]).concat([
'js/Util.js',
'js/router/BRouter.js',
@@ -32,6 +34,13 @@ var paths = {
destName: 'brouter-web'
};
+// libs that require loading before config.js
+gulp.task('scripts_config', ['clean'], function() {
+ // just copy for now
+ return gulp.src(paths.scriptsConfig)
+ .pipe(gulp.dest(paths.dest));
+});
+
gulp.task('scripts', function() {
return gulp.src(paths.scripts, { base: '.' })
.pipe(sourcemaps.init())
@@ -114,4 +123,4 @@ gulp.task('inject', function () {
.pipe(gulp.dest('.'));
});
-gulp.task('default', ['clean', 'scripts', 'styles', 'images', 'fonts']);
+gulp.task('default', ['clean', 'scripts_config', 'scripts', 'styles', 'images', 'fonts']);
diff --git a/index.html b/index.html
index dd59ac5..7f8cccd 100644
--- a/index.html
+++ b/index.html
@@ -108,6 +108,7 @@
console.log('\r\n###\r\n### BRouter-Web\r\n###\r\n### Please note that the routing API used here is not public!\r\n###\r\n');
+
diff --git a/js/index.js b/js/index.js
index 53d7dbf..f26cdbe 100644
--- a/js/index.js
+++ b/js/index.js
@@ -188,8 +188,12 @@
nogos = new BR.NogoAreas();
nogos.on('update', updateRoute);
-// stats = new BR.TrackStats();
- iternity = new BR.Iternity();
+ // intermodal routing demo?
+ if (BR.conf.transit) {
+ iternity = new BR.Iternity();
+ } else {
+ stats = new BR.TrackStats();
+ }
download = new BR.Download();
elevation = new BR.Elevation();
profile = new BR.Profile();
@@ -275,8 +279,11 @@
urls = {};
elevation.update(track, segmentsLayer);
-// stats.update(track, segments);
- iternity.update(track, segments);
+ if (BR.conf.transit) {
+ iternity.update(track, segments);
+ } else {
+ stats.update(track, segments);
+ }
trackMessages.update(track, segments);
if (latLngs.length > 1) {
@@ -289,15 +296,18 @@
download.update(urls);
};
-/*
- map.addControl(new BR.Control({
- heading: '',
- divId: 'header'
- }));
-*/
+ if (!BR.conf.transit) {
+ map.addControl(new BR.Control({
+ heading: '',
+ divId: 'header'
+ }));
+ }
routingOptions.addTo(map);
-// stats.addTo(map);
- iternity.addTo(map);
+ if (BR.conf.transit) {
+ iternity.addTo(map);
+ } else {
+ stats.addTo(map);
+ }
download.addTo(map);
elevation.addTo(map);
map.addControl(new BR.Tabs({