Class AvoidEdgesWeighting
java.lang.Object
com.graphhopper.routing.weighting.AbstractAdjustedWeighting
com.graphhopper.routing.weighting.AvoidEdgesWeighting
- All Implemented Interfaces:
Weighting
Increases the weight for a certain set of edges by a given factor and thus makes them less likely to be part of
a shortest path
- Author:
- Robin Boldt
-
Field Summary
FieldsFields inherited from class com.graphhopper.routing.weighting.AbstractAdjustedWeighting
superWeighting
Fields inherited from interface com.graphhopper.routing.weighting.Weighting
INFINITE_U_TURN_COSTS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
calcEdgeWeight
(EdgeIteratorState edgeState, boolean reverse) This method calculates the weight of a givenEdgeIteratorState
.getName()
setAvoidedEdges
(com.carrotsearch.hppc.IntSet avoidedEdges) setEdgePenaltyFactor
(double edgePenaltyFactor) Methods inherited from class com.graphhopper.routing.weighting.AbstractAdjustedWeighting
calcEdgeMillis, calcMinWeightPerDistance, calcTurnMillis, calcTurnWeight, hasTurnCosts, toString
-
Field Details
-
avoidedEdges
protected com.carrotsearch.hppc.IntSet avoidedEdges
-
-
Constructor Details
-
AvoidEdgesWeighting
-
-
Method Details
-
setEdgePenaltyFactor
-
setAvoidedEdges
-
calcEdgeWeight
Description copied from interface:Weighting
This method calculates the weight of a givenEdgeIteratorState
. E.g. a high value indicates that the edge should be avoided during shortest path search. Make sure that this method is very fast and optimized as this is called potentially millions of times for one route or a lot more for nearly any preprocessing phase.- Specified by:
calcEdgeWeight
in interfaceWeighting
- Overrides:
calcEdgeWeight
in classAbstractAdjustedWeighting
- Parameters:
edgeState
- the edge for which the weight should be calculatedreverse
- if the specified edge is specified in reverse direction e.g. from the reverse case of a bidirectional search.- Returns:
- the calculated weight with the specified velocity has to be in the range of 0 and +Infinity. Make sure your method does not return NaN which can e.g. occur for 0/0.
-
getName
-