Format comment style voice hints
This commit is contained in:
parent
e34e6a4cb0
commit
ea564006e9
5 changed files with 97 additions and 19 deletions
|
|
@ -51,6 +51,14 @@ describe('voice hints', () => {
|
|||
expect(gpx).toEqual(brouterGpx);
|
||||
});
|
||||
|
||||
test('4-comment', () => {
|
||||
let brouterGpx = read('4-comment.gpx');
|
||||
brouterGpx = brouterGpx.replace(/;\s*([-0-9]+.[0-9]+?)0+;/g, (match, p1) => `;${p1.padStart(10)};`); // remove trailing zeros
|
||||
|
||||
const gpx = BR.Gpx.format(geoJson, 4);
|
||||
expect(gpx).toEqual(brouterGpx);
|
||||
});
|
||||
|
||||
test('5-gpsies', () => {
|
||||
const brouterGpx = read('5-gpsies.gpx');
|
||||
const gpx = BR.Gpx.format(geoJson, 5);
|
||||
|
|
|
|||
26
tests/format/data/4-comment.gpx
Normal file
26
tests/format/data/4-comment.gpx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- track-length = 319 filtered ascend = 2 plain-ascend = -1 cost=533 energy=.0kwh time=44s -->
|
||||
<!-- $transport-mode$bike$ -->
|
||||
<!-- cmd idx lon lat d2next geometry -->
|
||||
<!-- $turn-instruction-start$
|
||||
$turn$ TR; 1; 8.468340; 49.488794; 140; 6(90)6 (0)6 (-89)2$
|
||||
$turn$ TL; 5; 8.469971; 49.488151; 90; 6(-89)6 (0)6 (89)6$
|
||||
$turn-instruction-end$ -->
|
||||
<gpx
|
||||
xmlns="http://www.topografix.com/GPX/1/1"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
|
||||
creator="BRouter-1.6.1" version="1.1">
|
||||
<trk>
|
||||
<name>4-comment</name>
|
||||
<trkseg>
|
||||
<trkpt lon="8.467714" lat="49.488115"><ele>101.5</ele></trkpt>
|
||||
<trkpt lon="8.468340" lat="49.488794"><ele>101.5</ele></trkpt>
|
||||
<trkpt lon="8.468586" lat="49.488698"><ele>101.5</ele></trkpt>
|
||||
<trkpt lon="8.468743" lat="49.488636"><ele>101.5</ele></trkpt>
|
||||
<trkpt lon="8.469161" lat="49.488473"><ele>101.75</ele></trkpt>
|
||||
<trkpt lon="8.469971" lat="49.488151"><ele>103.5</ele></trkpt>
|
||||
<trkpt lon="8.470610" lat="49.488842"><ele>99.75</ele></trkpt>
|
||||
</trkseg>
|
||||
</trk>
|
||||
</gpx>
|
||||
|
|
@ -13,8 +13,8 @@
|
|||
"total-energy": "4412",
|
||||
"cost": "533",
|
||||
"voicehints": [
|
||||
[1,5,0,140.0,24.90994644165039],
|
||||
[5,2,0,90.0,9.614852905273438]
|
||||
[1,5,0,140.0,24.90994644165039," 6(90)6 (0)6 (-89)2"],
|
||||
[5,2,0,90.0,9.614852905273438," 6(-89)6 (0)6 (89)6"]
|
||||
],
|
||||
"messages": [
|
||||
["Longitude", "Latitude", "Elevation", "Distance", "CostPerKm", "ElevCost", "TurnCost", "NodeCost", "InitialCost", "WayTags", "NodeTags"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue