Skip to content

Commit

Permalink
Merge pull request #1202 from Project-OSRM/fix_1192
Browse files Browse the repository at this point in the history
Fix and close #1192
  • Loading branch information
DennisOSRM committed Sep 29, 2014
2 parents fd747c7 + af02fc6 commit 6175faa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Extractor/ExtractorCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ bool ExtractorCallbacks::ProcessRestriction(const InputRestrictionContainer &res
/** warning: caller needs to take care of synchronization! */
void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
{
if (((0 >= parsed_way.forward_speed) ||
(TRAVEL_MODE_INACCESSIBLE == parsed_way.forward_travel_mode)) &&
if (((0 >= parsed_way.forward_speed) ||
(TRAVEL_MODE_INACCESSIBLE == parsed_way.forward_travel_mode)) &&
((0 >= parsed_way.backward_speed) ||
(TRAVEL_MODE_INACCESSIBLE == parsed_way.backward_travel_mode)) &&
(0 >= parsed_way.duration))
Expand All @@ -89,6 +89,7 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
// TODO: iterate all way segments and set duration corresponding to the length of each
// segment
parsed_way.forward_speed = parsed_way.duration / (parsed_way.path.size() - 1);
parsed_way.backward_speed = parsed_way.duration / (parsed_way.path.size() - 1);
}

if (std::numeric_limits<double>::epsilon() >= std::abs(-1. - parsed_way.forward_speed))
Expand Down Expand Up @@ -155,6 +156,7 @@ void ExtractorCallbacks::ProcessWay(ExtractionWay &parsed_way)
{ // Only true if the way should be split
BOOST_ASSERT(parsed_way.backward_travel_mode>0);
std::reverse(parsed_way.path.begin(), parsed_way.path.end());

for (std::vector<NodeID>::size_type n = 0; n < parsed_way.path.size() - 1; ++n)
{
external_memory.all_edges_list.push_back(
Expand Down
19 changes: 19 additions & 0 deletions features/car/ferry.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,22 @@ Feature: Car - Handle ferry routes
| c | e | cde | 2 |
| c | f | cde,efg | 2,1 |
| c | g | cde,efg | 2,1 |

Scenario: Car - Properly handle durations
Given the node map
| a | b | c | | |
| | | d | | |
| | | e | f | g |

And the ways
| nodes | highway | route | duration |
| abc | primary | | |
| cde | | ferry | 00:01:00 |
| efg | primary | | |

When I route I should get
| from | to | route | modes | speed |
| a | g | abc,cde,efg | 1,2,1 | 24 km/h |
| b | f | abc,cde,efg | 1,2,1 | 19 km/h |
| c | e | cde | 2 | 12 km/h |
| e | c | cde | 2 | 12 km/h |

0 comments on commit 6175faa

Please sign in to comment.