Class AbstractWeighting
java.lang.Object
com.graphhopper.routing.weighting.AbstractWeighting
- All Implemented Interfaces:
Weighting
- Direct Known Subclasses:
CustomWeighting,FastestWeighting
- Author:
- Peter Karich
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BooleanEncodedValueprotected final DecimalEncodedValueFields inherited from interface com.graphhopper.routing.weighting.Weighting
INFINITE_U_TURN_COSTS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractWeighting(BooleanEncodedValue accessEnc, DecimalEncodedValue speedEnc, TurnCostProvider turnCostProvider) -
Method Summary
Modifier and TypeMethodDescriptionlongcalcEdgeMillis(EdgeIteratorState edgeState, boolean reverse) This method calculates the time taken (in milliseconds) to travel along the specified edgeState.longcalcTurnMillis(int inEdge, int viaNode, int outEdge) doublecalcTurnWeight(int inEdge, int viaNode, int outEdge) booleanThis method can be used to check whether or not this weighting returns turn costs (or if they are all zero).toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.graphhopper.routing.weighting.Weighting
calcEdgeWeight, calcMinWeightPerDistance, getName
-
Field Details
-
accessEnc
-
speedEnc
-
-
Constructor Details
-
AbstractWeighting
protected AbstractWeighting(BooleanEncodedValue accessEnc, DecimalEncodedValue speedEnc, TurnCostProvider turnCostProvider)
-
-
Method Details
-
calcEdgeMillis
Description copied from interface:WeightingThis method calculates the time taken (in milliseconds) to travel along the specified edgeState. It is typically used for post-processing and on only a few thousand edges.- Specified by:
calcEdgeMillisin interfaceWeighting
-
calcTurnWeight
public double calcTurnWeight(int inEdge, int viaNode, int outEdge) - Specified by:
calcTurnWeightin interfaceWeighting
-
calcTurnMillis
public long calcTurnMillis(int inEdge, int viaNode, int outEdge) - Specified by:
calcTurnMillisin interfaceWeighting
-
hasTurnCosts
public boolean hasTurnCosts()Description copied from interface:WeightingThis method can be used to check whether or not this weighting returns turn costs (or if they are all zero). This is sometimes needed to do safety checks as not all graph algorithms can be run edge-based and might yield wrong results when turn costs are applied while running node-based.- Specified by:
hasTurnCostsin interfaceWeighting
-
toString
-