Make edge metrics strongly typed (#6421)
This change takes the existing typedefs for weight, duration and distance, and makes them proper types, using the existing Alias functionality. Primarily this is to prevent bugs where the metrics are switched, but it also adds additional documentation. For example, it now makes it clear (despite the naming of variables) that most of the trip algorithm is running on the duration metric. I've not made any changes to the casts performed between metrics and numeric types, they now just more explicit.
This commit is contained in:
@@ -217,8 +217,8 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
|
||||
const auto haversine_distance = util::coordinate_calculation::greatCircleDistance(
|
||||
prev_coordinate, current_coordinate);
|
||||
// assumes minumum of 4 m/s
|
||||
const EdgeWeight weight_upper_bound =
|
||||
((haversine_distance + max_distance_delta) / 4.) * facade.GetWeightMultiplier();
|
||||
const EdgeWeight weight_upper_bound = to_alias<EdgeWeight>(
|
||||
((haversine_distance + max_distance_delta) / 4.) * facade.GetWeightMultiplier());
|
||||
|
||||
// compute d_t for this timestamp and the next one
|
||||
for (const auto s : util::irange<std::size_t>(0UL, prev_viterbi.size()))
|
||||
|
||||
Reference in New Issue
Block a user