Commit 91ba055d authored by Volker Krause's avatar Volker Krause
Browse files

Attach the dangling path polygon remainder to the last path section

This can happen on longer paths with distance-based splitting due to
accumulating errors, which then would results in small gaps to the actual
destination.
parent 4ccb9ee3
......@@ -998,7 +998,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 903,
"distance": 946,
"from": {
"latitude": 43.61103439331055,
"locality": "Toulouse",
......@@ -1421,6 +1421,26 @@
[
1.449293,
43.605075
],
[
1.449445,
43.604922
],
[
1.449511,
43.604856
],
[
1.449511,
43.604856
],
[
1.449574,
43.604794
],
[
1.4496145,
43.6047494
]
],
"type": "LineString"
......
......@@ -486,6 +486,10 @@
2.375607,
48.844946
],
[
2.3772637747,
48.8440520493
],
[
2.3772637747,
48.8440520493
......@@ -1185,6 +1189,10 @@
2.378791,
48.843228
],
[
2.3772637747,
48.8440520493
],
[
2.3772637747,
48.8440520493
......@@ -1844,6 +1852,10 @@
2.375607,
48.844946
],
[
2.3772637747,
48.8440520493
],
[
2.3772637747,
48.8440520493
......@@ -1873,7 +1885,7 @@
{
"co2Emission": 0,
"disruptionEffect": "NormalService",
"distance": 510,
"distance": 511,
"from": {
"latitude": 49.00423812866211,
"locality": "Le Mesnil-Amelot",
......@@ -1982,6 +1994,10 @@
[
2.564656983,
49.0033055366
],
[
2.564653,
49.003387
]
],
"type": "LineString"
......@@ -2163,6 +2179,10 @@
2.375607,
48.844946
],
[
2.3772637747,
48.8440520493
],
[
2.3772637747,
48.8440520493
......
......@@ -234,6 +234,13 @@ static Path parsePathFromLength(const QPolygonF &pathLineString, const QJsonArra
pathSections.push_back(std::move(pathSec));
}
// if there's a trailing polygon end, attached that to the last section
if (prevPolyIdx + 1 < pathLineString.size()) {
auto poly = pathSections.back().path();
std::copy(pathLineString.begin() + prevPolyIdx + 1, pathLineString.end(), std::back_inserter(poly));
pathSections.back().setPath(std::move(poly));
}
Path path;
path.setSections(std::move(pathSections));
return path;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment