-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add source phantom weight to first segment when merging legs #4949
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0dc3eac
Add source phantom weight to first segment when merging legs so that …
danpat e17aced
Fix forward/reverse addition. Add failing test for multiple snaps on…
danpat 30941a2
Fix forward/reverse addition. Add failing test for multiple snaps on…
danpat 0862939
Fix duration annotations when source/target are on the same edge-base…
danpat 0906868
Update comment.
danpat f44bba6
Fix a test that was incorrect now that waypoints-on-same-ebn is fixed.
danpat cc73ea0
Add changelog.
danpat 6c2ac57
Fix unit test.
danpat 1f6707a
Make test more strict.
danpat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -718,3 +718,27 @@ Feature: Basic Map Matching | |
| abe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok | | ||
| ahd | 1,0.99973,1.00027,0.99973,1.00027,0.999461 | depart,turn right,arrive | Ok | | ||
| ahe | 1,0.99973,1.00027,0.99973,1.00027,1 | depart,turn left,arrive | Ok | | ||
|
||
@match @testbot | ||
Scenario: Regression test - duration aggregation for phantom nodes | ||
Given the profile "testbot" | ||
Given a grid size of 10 meters | ||
Given the node map | ||
""" | ||
a--1-b2cd-3--e | ||
""" | ||
And the ways | ||
| nodes | | ||
| ab | | ||
| bcd | | ||
| de | | ||
Given the query options | ||
| geometries | geojson | | ||
| overview | full | | ||
| steps | true | | ||
| waypoints | 0;2 | | ||
| annotations | duration,weight | | ||
| generate_hints | false | | ||
When I match I should get | ||
| trace | geometry | a:duration | a:weight | duration | | ||
| 123 | 1.000135,1,1.000225,1,1.000315,1,1.00036,1,1.00045,1 | 1:1:0.5:1 | 1:1:0.5:1 | 3.5 | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and here add a test for a reversed trace as |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,9 +145,22 @@ inline InternalRouteResult CollapseInternalRouteResult(const InternalRouteResult | |
collapsed.target_traversed_in_reverse.back() = | ||
leggy_result.target_traversed_in_reverse[i]; | ||
// copy path segments into current leg | ||
last_segment.insert(last_segment.end(), | ||
leggy_result.unpacked_path_segments[i].begin(), | ||
leggy_result.unpacked_path_segments[i].end()); | ||
if (!leggy_result.unpacked_path_segments[i].empty()) | ||
{ | ||
auto old_size = last_segment.size(); | ||
last_segment.insert(last_segment.end(), | ||
leggy_result.unpacked_path_segments[i].begin(), | ||
leggy_result.unpacked_path_segments[i].end()); | ||
|
||
// The first segment of the unpacked path is missing the weight of the | ||
// source phantom. We need to add those values back so that the total | ||
// edge weight is correct | ||
last_segment[old_size].weight_until_turn += | ||
leggy_result.segment_end_coordinates[i].source_phantom.forward_weight; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the source phantom is traversed in reverse then the reverse weight must be used:
|
||
|
||
last_segment[old_size].duration_until_turn += | ||
leggy_result.segment_end_coordinates[i].source_phantom.forward_duration; | ||
} | ||
} | ||
} | ||
return collapsed; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
i suggest to make forward and reverse phantom node weights for
bc
segment different asa--1-b2-cd-3--e