Document new export formats added in BRouter 1.7.0 and fix export error
BRouter 1.7.0 implemented support for three new export formats: "Cruiser", "BRouter internal" and "Locus(-new)". "Cruiser" (`turnInstructionMode=8`) and "BRouter internal" (`turnInstructionMode=9`) are not yet exposed in BRouter-Web's UI through profiles, so we do not need to implement them at the moment. Here we only document them by making them explicit unimplemented `cases` in the code. In addition, BRouter changed "locus-style" with `turnInstructionMode=2` to emit a different format for newer releases of Locus, while the old format is now referred to as "locus-old-style" from profiles with `turnInstructionMode=7`. Since BRouter-Web does not know yet about the the new id, exports will fail with "unhandled turnInstructionMode" errors. To fix the latter issue, we now map `turnInstructionMode=7` to the newly renamed `LocusOldVoiceHints()`. Note that `turnInstructionMode=2` is also currently using `LocusOldVoiceHints()`, i.e. the new format still needs an implementation. Test Plan: - `yarn test` - Check choosing "locus-old-style" now exports without an error.
This commit is contained in:
parent
eeb1c5bde3
commit
96016b7fd0
1 changed files with 9 additions and 2 deletions
|
|
@ -203,7 +203,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
class LocusVoiceHints extends WaypointVoiceHints {
|
||||
class LocusOldVoiceHints extends WaypointVoiceHints {
|
||||
_addToTransform(transform) {
|
||||
transform.gpx = function (gpx, features) {
|
||||
// hack to insert attribute after the other `xmlns`s
|
||||
|
|
@ -364,7 +364,10 @@
|
|||
BR.voiceHints = function (geoJson, turnInstructionMode, transportMode) {
|
||||
switch (turnInstructionMode) {
|
||||
case 2:
|
||||
return new LocusVoiceHints(geoJson, turnInstructionMode, transportMode);
|
||||
// TODO:
|
||||
// Use locus-old-style voice hints for now (same style as returned by BRouter 1.6.3
|
||||
// for turnInstructionMode=2), implementation for new-style locus still missing.
|
||||
return new LocusOldVoiceHints(geoJson, turnInstructionMode, transportMode);
|
||||
case 3:
|
||||
return new OsmAndVoiceHints(geoJson, turnInstructionMode, transportMode);
|
||||
case 4:
|
||||
|
|
@ -373,6 +376,10 @@
|
|||
return new GpsiesVoiceHints(geoJson, turnInstructionMode, transportMode);
|
||||
case 6:
|
||||
return new OruxVoiceHints(geoJson, turnInstructionMode, transportMode);
|
||||
case 7:
|
||||
return new LocusOldVoiceHints(geoJson, turnInstructionMode, transportMode);
|
||||
case 8: // Cruiser export, not exposed in the web UI through profiles yet
|
||||
case 9: // BRouter internal export, not exposed in the web UI through profiles yet
|
||||
default:
|
||||
console.error('unhandled turnInstructionMode: ' + turnInstructionMode);
|
||||
return new VoiceHints(geoJson, turnInstructionMode, transportMode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue