You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RoutingCost and its subclasses RoutingCostDistance and RoutingCostTravelTime currently cannot be subclassed in Python. I implemented custom module for this, but it would be nicer to have the functionality included in the standard library. I included my Boost.Python code for RoutingCostDistance below, but unfortunately I do not have time to convert it to proper pull request.
from .custom_routing_cost import RoutingCostDistance
class BuslaneRoutingCost(RoutingCostDistance):
def __init__(self, laneChangeCost, minLaneChangeLength=0.0):
super(BuslaneRoutingCost, self).__init__(laneChangeCost, minLaneChangeLength)
def getCostSucceeding(self, trafficRules, src, dst):
cost = super().getCostSucceeding(trafficRules, src, dst)
if ('subtype' in src.attributes and src.attributes['subtype'] == 'bus_lane') or \
('subtype' in dst.attributes and dst.attributes['subtype'] == 'bus_lane'):
# double the cost for bus lanes to not drive into bus stops
return cost * 2;
else:
return cost
The text was updated successfully, but these errors were encountered:
RoutingCost and its subclasses RoutingCostDistance and RoutingCostTravelTime currently cannot be subclassed in Python. I implemented custom module for this, but it would be nicer to have the functionality included in the standard library. I included my Boost.Python code for RoutingCostDistance below, but unfortunately I do not have time to convert it to proper pull request.
custom_routing_cost.cpp:
Example usage in Python:
The text was updated successfully, but these errors were encountered: