Class AbstractWeighting
java.lang.Object
com.graphhopper.routing.weighting.AbstractWeighting
- All Implemented Interfaces:
Weighting
- Author:
- Peter Karich
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BooleanEncodedValue
protected final DecimalEncodedValue
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractWeighting
(BooleanEncodedValue accessEnc, DecimalEncodedValue speedEnc, TurnCostProvider turnCostProvider) -
Method Summary
Modifier and TypeMethodDescriptionlong
calcEdgeMillis
(EdgeIteratorState edgeState, boolean reverse) This method calculates the time taken (in milliseconds) to travel along the specified edgeState.long
calcTurnMillis
(int inEdge, int viaNode, int outEdge) double
calcTurnWeight
(int inEdge, int viaNode, int outEdge) boolean
This 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, wait
Methods 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:Weighting
This 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:
calcEdgeMillis
in interfaceWeighting
-
calcTurnWeight
public double calcTurnWeight(int inEdge, int viaNode, int outEdge) - Specified by:
calcTurnWeight
in interfaceWeighting
-
calcTurnMillis
public long calcTurnMillis(int inEdge, int viaNode, int outEdge) - Specified by:
calcTurnMillis
in interfaceWeighting
-
hasTurnCosts
public boolean hasTurnCosts()Description copied from interface:Weighting
This 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:
hasTurnCosts
in interfaceWeighting
-
toString
-