Skip to content

Commit

Permalink
Ignore custom cost fields in CAR routing
Browse files Browse the repository at this point in the history
This ignores custom costs (e.g. from elevation data) for the CAR street mode. Custom speeds for cars are handled separately.
  • Loading branch information
ansoncfit committed Jan 24, 2024
1 parent a907c29 commit d5722b6
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ public MultistageTraversalTimeCalculator (TraversalTimeCalculator base, List<Cos
public int traversalTimeSeconds (EdgeStore.Edge currentEdge, StreetMode streetMode, ProfileRequest req) {
final int baseTraversalTimeSeconds = base.traversalTimeSeconds(currentEdge, streetMode, req);
int t = baseTraversalTimeSeconds;
for (CostField costField : costFields) {
t += costField.additionalTraversalTimeSeconds(currentEdge, baseTraversalTimeSeconds);
}
if (t < 1) {
LOG.warn("Cost was negative or zero. Clamping to 1 second.");
t = 1;
if (!streetMode.equals(StreetMode.CAR)) {
for (CostField costField : costFields) {
t += costField.additionalTraversalTimeSeconds(currentEdge, baseTraversalTimeSeconds);
}
if (t < 1) {
LOG.warn("Cost was negative or zero. Clamping to 1 second.");
t = 1;
}
}
return t;
}
Expand Down

0 comments on commit d5722b6

Please sign in to comment.