-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move base costing options parsing into a separate function #3125
Conversation
9a01004
to
615dfcb
Compare
@@ -294,8 +355,123 @@ void ParseSharedCostOptions(const rapidjson::Value& value, CostingOptions* pbf_c | |||
pbf_costing_options->set_shortest(rapidjson::get<bool>(value, "/shortest", false)); | |||
pbf_costing_options->set_top_speed( | |||
kVehicleSpeedRange(rapidjson::get<uint32_t>(value, "/top_speed", kMaxAssumedSpeed))); | |||
pbf_costing_options->set_closure_factor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to ParseBaseCostOptions
@@ -471,7 +458,6 @@ class PedestrianCost : public DynamicCost { | |||
c += country_crossing_cost_ * (node->type() == baldr::NodeType::kBorderControl); | |||
c += gate_cost_ * (node->type() == baldr::NodeType::kGate); | |||
c += bike_share_cost_ * (node->type() == baldr::NodeType::kBikeShare); | |||
c += toll_booth_cost_ * (node->type() == baldr::NodeType::kTollBooth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't parse tool_booth_cost
option for pedestrians, so it doesn't make sense to use it here
valhalla/sif/dynamiccost.h
Outdated
@@ -1037,13 +1026,70 @@ class DynamicCost { | |||
using cost_ptr_t = std::shared_ptr<DynamicCost>; | |||
using mode_costing_t = std::array<cost_ptr_t, static_cast<size_t>(TravelMode::kMaxTravelMode)>; | |||
|
|||
/* | |||
* Structure that stores default values for costing options that are common for most costing models. | |||
* It mostly contains options used in DynamicCost::gate_base_costs() method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/gate_base_costs/get_base_costs
@genadz sorry i havent looked at this yet. i will schedule it for over the weekend. |
thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactor @genadz! This will make working with costings much easier!
This lgtm. We should wait for @kevinkreiser 's feedback before merging it in.
no need to wait for me! judging by the magnitude of the change and the importance id just suggest that we RAD it if we havent already just to be sure. code motion copy pasting type stuff is easy to make a typo imho |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good just a RAD of each costing would be good. Although maybe we can do without that with a more mechanical test. Like a loop over all costings over all costing args? I know we have the inline costing tests but I forget if they are exhastive
I RAD tested the changes - no failures 🟢 |
Thank you! Could you merge it? |
Issue
#3102
Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?