Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Libraries
KPublicTransport
Commits
c03b683e
Commit
c03b683e
authored
Nov 14, 2021
by
Volker Krause
Browse files
Don't truncate path line segment lengths to integers
For very detailed paths this can accumulated to relevant errors.
parent
46418498
Pipeline
#97454
passed with stage
in 2 minutes and 18 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/data/efa/trip-response-compact-by.json
View file @
c03b683e
...
...
@@ -65,7 +65,6 @@
},
{
"disruptionEffect"
:
"NormalService"
,
"scheduledPlatform"
:
"1"
,
"expectedDepartureTime"
:
"2019-11-11T21:33:00"
,
"scheduledDepartureTime"
:
"2019-11-11T21:33:00"
,
"scheduledPlatform"
:
"1"
,
...
...
@@ -127,7 +126,7 @@
],
"mode"
:
"PublicTransport"
,
"notes"
:
[
"Some construction works. More info on some website."
"Some construction works. More info on some website."
],
"path"
:
{
"sections"
:
[
...
...
@@ -182,7 +181,7 @@
},
{
"disruptionEffect"
:
"NormalService"
,
"distance"
:
415
6
,
"distance"
:
415
8
,
"from"
:
{
"identifier"
:
{
"ifopt"
:
"de:09564:510:11:U1_2"
,
...
...
autotests/data/efa/trip-response-full-indoor-path-vgn.json
View file @
c03b683e
...
...
@@ -3,7 +3,7 @@
"sections"
:
[
{
"disruptionEffect"
:
"NormalService"
,
"distance"
:
3
06
,
"distance"
:
3
17
,
"expectedArrivalPlatform"
:
""
,
"expectedArrivalTime"
:
"2020-04-27T22:13:00"
,
"expectedDeparturePlatform"
:
""
,
...
...
autotests/data/efa/trip-response-full-vgn.json
View file @
c03b683e
...
...
@@ -76,7 +76,7 @@
},
{
"disruptionEffect"
:
"NormalService"
,
"distance"
:
1766
5
,
"distance"
:
1766
7
,
"expectedArrivalPlatform"
:
""
,
"expectedArrivalTime"
:
"2019-11-11T22:09:00"
,
"expectedDeparturePlatform"
:
""
,
...
...
autotests/data/hafas/canceled-journey-with-path.out.json
View file @
c03b683e
...
...
@@ -3,7 +3,7 @@
"sections"
:
[
{
"disruptionEffect"
:
"NoService"
,
"distance"
:
163
559
,
"distance"
:
163
708
,
"from"
:
{
"identifier"
:
{
"unit-test"
:
"8011113"
...
...
autotests/data/navitia/journey-bss-path-no-instr-start-coord.out.json
View file @
c03b683e
...
...
@@ -4,7 +4,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
35
0
,
"distance"
:
35
9
,
"from"
:
{
"latitude"
:
43.61124801635742
,
"locality"
:
"Toulouse"
,
...
...
@@ -414,7 +414,7 @@
{
"co2Emission"
:
2
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
77
2
,
"distance"
:
77
3
,
"from"
:
{
"latitude"
:
43.61016845703125
,
"locality"
:
"Toulouse"
,
...
...
@@ -491,7 +491,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
6
7
,
"distance"
:
6
8
,
"from"
:
{
"latitude"
:
43.60560607910156
,
"locality"
:
"Toulouse"
,
...
...
@@ -653,7 +653,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
14
2
,
"distance"
:
14
8
,
"from"
:
{
"latitude"
:
43.61124801635742
,
"locality"
:
"Toulouse"
,
...
...
@@ -1001,7 +1001,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
9
4
6
,
"distance"
:
96
7
,
"from"
:
{
"identifier"
:
{
"osm"
:
"n890433076"
...
...
@@ -1521,7 +1521,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
7
3
,
"distance"
:
7
4
,
"from"
:
{
"latitude"
:
43.604793548583984
,
"locality"
:
"Toulouse"
,
...
...
autotests/data/navitia/journey-response.out.json
View file @
c03b683e
...
...
@@ -57,7 +57,7 @@
{
"co2Emission"
:
147
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
238
39
,
"distance"
:
238
41
,
"from"
:
{
"latitude"
:
49.00468826293945
,
"locality"
:
"Le Mesnil-Amelot"
,
...
...
@@ -281,7 +281,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
6
2
1
,
"distance"
:
6
3
1
,
"from"
:
{
"latitude"
:
48.844139099121094
,
"locality"
:
"Paris"
,
...
...
@@ -572,7 +572,7 @@
{
"co2Emission"
:
162
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
2612
2
,
"distance"
:
2612
7
,
"from"
:
{
"latitude"
:
49.00468826293945
,
"locality"
:
"Le Mesnil-Amelot"
,
...
...
@@ -833,7 +833,7 @@
{
"co2Emission"
:
581
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
44
74
,
"distance"
:
44
80
,
"from"
:
{
"latitude"
:
48.87947463989258
,
"locality"
:
"Paris"
,
...
...
@@ -1120,7 +1120,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
45
1
,
"distance"
:
45
3
,
"from"
:
{
"latitude"
:
48.842533111572266
,
"locality"
:
"Paris"
,
...
...
@@ -1275,7 +1275,7 @@
{
"co2Emission"
:
191
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
3092
2
,
"distance"
:
3092
9
,
"from"
:
{
"latitude"
:
49.00468826293945
,
"locality"
:
"Le Mesnil-Amelot"
,
...
...
@@ -1592,7 +1592,7 @@
{
"co2Emission"
:
370
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
285
2
,
"distance"
:
285
5
,
"from"
:
{
"latitude"
:
48.83872985839844
,
"locality"
:
"Paris"
,
...
...
@@ -1739,7 +1739,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
36
2
,
"distance"
:
36
6
,
"from"
:
{
"latitude"
:
48.845741271972656
,
"locality"
:
"Paris"
,
...
...
@@ -1885,7 +1885,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
51
1
,
"distance"
:
51
4
,
"from"
:
{
"latitude"
:
49.00423812866211
,
"locality"
:
"Le Mesnil-Amelot"
,
...
...
@@ -2022,7 +2022,7 @@
{
"co2Emission"
:
3171
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
2444
5
,
"distance"
:
2444
6
,
"from"
:
{
"latitude"
:
49.003387451171875
,
"locality"
:
"Tremblay-en-France"
,
...
...
@@ -2098,7 +2098,7 @@
{
"co2Emission"
:
0
,
"disruptionEffect"
:
"NormalService"
,
"distance"
:
33
4
,
"distance"
:
33
7
,
"from"
:
{
"latitude"
:
48.845794677734375
,
"locality"
:
"Paris"
,
...
...
autotests/data/otp/no-entur-navigation-guides.out.json
View file @
c03b683e
...
...
@@ -230,7 +230,7 @@
},
{
"disruptionEffect"
:
"NormalService"
,
"distance"
:
5990
,
"distance"
:
6089
,
"expectedArrivalTime"
:
"2021-10-07T17:49:16+02:00"
,
"expectedDepartureTime"
:
"2021-10-07T17:37:16+02:00"
,
"from"
:
{
...
...
autotests/efaparsertest.cpp
View file @
c03b683e
...
...
@@ -4,6 +4,8 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include
"testhelpers.h"
#include
"backends/efacompactparser.h"
#include
"backends/efaxmlparser.h"
...
...
@@ -207,11 +209,8 @@ private Q_SLOTS:
const
auto
ref
=
QJsonDocument
::
fromJson
(
readFile
(
refFileName
)).
array
();
if
(
jsonRes
!=
ref
)
{
qDebug
().
noquote
()
<<
QJsonDocument
(
jsonRes
).
toJson
();
}
QVERIFY
(
!
jsonRes
.
empty
());
Q
COMPARE
(
jsonRes
,
ref
);
Q
VERIFY
(
Test
::
compareJson
(
refFileName
,
jsonRes
,
ref
)
)
;
QVERIFY
(
!
parser
.
requestContext
().
isEmpty
());
QCOMPARE
(
parser
.
requestContext
().
sessionId
,
QLatin1String
(
"123456789"
));
...
...
@@ -241,11 +240,8 @@ private Q_SLOTS:
const
auto
ref
=
QJsonDocument
::
fromJson
(
readFile
(
refFileName
)).
array
();
if
(
jsonRes
!=
ref
)
{
qDebug
().
noquote
()
<<
QJsonDocument
(
jsonRes
).
toJson
();
}
QVERIFY
(
!
jsonRes
.
empty
());
Q
COMPARE
(
jsonRes
,
ref
);
Q
VERIFY
(
Test
::
compareJson
(
refFileName
,
jsonRes
,
ref
)
)
;
QVERIFY
(
!
parser
.
requestContext
().
isEmpty
());
QCOMPARE
(
parser
.
requestContext
().
sessionId
,
QLatin1String
(
"123456789"
));
...
...
src/lib/datatypes/path.cpp
View file @
c03b683e
...
...
@@ -36,7 +36,7 @@ int PathSection::distance() const
return
0
;
}
in
t
dist
=
0
;
floa
t
dist
=
0
;
for
(
auto
it
=
d
->
path
.
begin
();
it
!=
std
::
prev
(
d
->
path
.
end
());
++
it
)
{
const
auto
nextIt
=
std
::
next
(
it
);
dist
+=
Location
::
distance
((
*
it
).
y
(),
(
*
it
).
x
(),
(
*
nextIt
).
y
(),
(
*
nextIt
).
x
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment