Skip to content

Commit

Permalink
Extract TurnWeighting#calcTurnMillis
Browse files Browse the repository at this point in the history
  • Loading branch information
easbar committed Dec 20, 2019
1 parent f62e003 commit ba2d181
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public long calcMillis(EdgeIteratorState edgeState, boolean reverse, int prevOrN
// should we also separate weighting vs. time for turn? E.g. a fast but dangerous turn - is this common?
// todo: why no first/last orig edge here as in calcWeight ?
final int origEdgeId = edgeState.getEdge();
long turnCostsInSeconds = (long) (reverse
? calcTurnWeight(origEdgeId, edgeState.getBaseNode(), prevOrNextEdgeId)
: calcTurnWeight(prevOrNextEdgeId, edgeState.getBaseNode(), origEdgeId));
return millis + 1000 * turnCostsInSeconds;
long turnCostMillis = reverse
? calcTurnMillis(origEdgeId, edgeState.getBaseNode(), prevOrNextEdgeId)
: calcTurnMillis(prevOrNextEdgeId, edgeState.getBaseNode(), origEdgeId);
return millis + turnCostMillis;
}

/**
Expand All @@ -122,6 +122,10 @@ public double calcTurnWeight(int edgeFrom, int nodeVia, int edgeTo) {
return tCost;
}

public long calcTurnMillis(int inEdge, int viaNode, int outEdge) {
return (long) (1000 * calcTurnWeight(inEdge, viaNode, outEdge));
}

@Override
public FlagEncoder getFlagEncoder() {
return superWeighting.getFlagEncoder();
Expand Down

0 comments on commit ba2d181

Please sign in to comment.