refs #56 factorize osrm router stuff

Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
Julien Veyssier 2019-06-11 01:26:54 +02:00
Родитель 8de49feb0f
Коммит 9d01f8d27d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4141FEE162030638
2 изменённых файлов: 21 добавлений и 49 удалений

Просмотреть файл

@ -792,55 +792,27 @@
router: L.Routing.graphHopper(apikey, options)
};
}
else if (type === 'osrmBike') {
this.routers.osrmBike = {
name: name,
router: L.Routing.osrmv1({
serviceUrl: url,
//profile: 'driving',
//profile: 'car',
profile: 'bicycle',
//profile: 'foot',
suppressDemoServerWarning: true,
// this makes OSRM use our local translations
// otherwise it uses osrm-text-instructions which requires to import another lib
stepToText: function(e) {
}
})
else if (type === 'osrmBike' || type === 'osrmCar' || type === 'osrmFoot') {
var options = {
serviceUrl: url,
suppressDemoServerWarning: true,
// this makes OSRM use our local translations
// otherwise it uses osrm-text-instructions which requires to import another lib
stepToText: function(e) {
}
};
}
else if (type === 'osrmCar') {
this.routers.osrmCar = {
if (type === 'osrmCar') {
options.profile = 'car';
}
else if (type === 'osrmBike') {
options.profile = 'bicycle';
}
else if (type === 'osrmFoot') {
options.profile = 'foot';
}
this.routers[type] = {
name: name,
router: L.Routing.osrmv1({
serviceUrl: url,
//profile: 'driving',
profile: 'car',
//profile: 'bicycle',
//profile: 'foot',
suppressDemoServerWarning: true,
// this makes OSRM use our local translations
// otherwise it uses osrm-text-instructions which requires to import another lib
stepToText: function(e) {
}
})
};
}
else if (type === 'osrmFoot') {
this.routers.osrmFoot = {
name: name,
router: L.Routing.osrmv1({
serviceUrl: url,
//profile: 'driving',
//profile: 'car',
//profile: 'bicycle',
profile: 'foot',
suppressDemoServerWarning: true,
// this makes OSRM use our local translations
// otherwise it uses osrm-text-instructions which requires to import another lib
stepToText: function(e) {
}
})
router: L.Routing.osrmv1(options)
};
}
else if (type === 'mapbox') {

Просмотреть файл

@ -31,9 +31,9 @@ if (!isset($_['osrmDEMO']) || $_['osrmDEMO'] === '1') {
<label><?php p($l->t('A GraphHopper server URL looks like this : https://my.graphhopper.server.org:8989/route')); ?></label>
<br />
<div id="graphhopper">
<label for="graphhopperURL"><?php p($l->t('GraphHopper server URL')); ?></label><br/>
<label for="graphhopperURL"><?php p($l->t('GraphHopper server URL (will use main graphhopper server if empty)')); ?></label><br/>
<input id="graphhopperURL" type="text" value="<?php if (isset($_['graphhopperURL'])) p($_['graphhopperURL']); ?>"/><br/>
<label for="graphhopperAPIKEY"><?php p($l->t('GraphHopper API key')); ?></label><br/>
<label for="graphhopperAPIKEY"><?php p($l->t('GraphHopper API key (mandatory if main server used)')); ?></label><br/>
<input id="graphhopperAPIKEY" type="text" value="<?php if (isset($_['graphhopperAPIKEY'])) p($_['graphhopperAPIKEY']); ?>"/>
</div><br/>