Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulPickhardt committed Aug 20, 2024
1 parent e48ccef commit 5e66db8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/routing/models/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,15 @@ class Route {
last == null ? null : vincenty.distance(LatLng(last.lat, last.lon), LatLng(endpoint.lat, endpoint.lon));

// The distance to the first waypoints needs to be added to the signal group distances to calculate correct distances on route.
for (var i = 0; i < signalGroupsDistancesOnRoute.length; i++) {
signalGroupsDistancesOnRoute[i] += distToFirst ?? 0;
}
if (distToFirst != null) {
for (var i = 0; i < signalGroupsDistancesOnRoute.length; i++) {
signalGroupsDistancesOnRoute[i] += distToFirst;
}

// Also add the start distance for crossing distances on route.
for (var i = 0; i < crossingsDistancesOnRoute.length; i++) {
crossingsDistancesOnRoute[i] += distToFirst ?? 0;
// Also add the start distance for crossing distances on route.
for (var i = 0; i < crossingsDistancesOnRoute.length; i++) {
crossingsDistancesOnRoute[i] += distToFirst;
}
}

return Route(
Expand Down

0 comments on commit 5e66db8

Please sign in to comment.