mode in each direction when speeds are the same
This commit is contained in:
parent
217f197190
commit
6cfe4f7ded
@ -93,10 +93,13 @@ void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
|
|||||||
if(ExtractionWay::opposite == parsed_way.direction) {
|
if(ExtractionWay::opposite == parsed_way.direction) {
|
||||||
std::reverse( parsed_way.path.begin(), parsed_way.path.end() );
|
std::reverse( parsed_way.path.begin(), parsed_way.path.end() );
|
||||||
parsed_way.direction = ExtractionWay::oneway;
|
parsed_way.direction = ExtractionWay::oneway;
|
||||||
|
std::swap( parsed_way.forward_mode, parsed_way.backward_mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool split_bidirectional_edge = (parsed_way.backward_speed > 0) && (parsed_way.speed != parsed_way.backward_speed);
|
bool split_bidirectional_edge =
|
||||||
|
((parsed_way.backward_speed > 0) && (parsed_way.speed != parsed_way.backward_speed)) ||
|
||||||
|
((ExtractionWay::bidirectional == parsed_way.direction) && (parsed_way.forward_mode != parsed_way.backward_mode));
|
||||||
|
|
||||||
for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
|
for(std::vector< NodeID >::size_type n = 0; n < parsed_way.path.size()-1; ++n) {
|
||||||
externalMemory->allEdges.push_back(
|
externalMemory->allEdges.push_back(
|
||||||
InternalExtractorEdge(parsed_way.path[n],
|
InternalExtractorEdge(parsed_way.path[n],
|
||||||
|
|||||||
@ -64,20 +64,20 @@ When /^I route I should get$/ do |table|
|
|||||||
got['distance'] = instructions ? "#{json['route_summary']['total_distance'].to_s}m" : ''
|
got['distance'] = instructions ? "#{json['route_summary']['total_distance'].to_s}m" : ''
|
||||||
end
|
end
|
||||||
if table.headers.include?('time')
|
if table.headers.include?('time')
|
||||||
raise "*** Time must be specied in seconds. (ex: 60s)" unless row['time'] =~ /\d+s/
|
raise "*** Time must be specied in seconds. (ex: 60s)" unless row['time']=='' || row['time'] =~ /\d+s/
|
||||||
got['time'] = instructions ? "#{json['route_summary']['total_time'].to_s}s" : ''
|
got['time'] = instructions ? "#{json['route_summary']['total_time'].to_s}s" : ''
|
||||||
end
|
end
|
||||||
if table.headers.include? 'bearing'
|
if table.headers.include? 'bearing'
|
||||||
got['bearing'] = bearings
|
got['bearing'] = instructions ? bearings : ''
|
||||||
end
|
end
|
||||||
if table.headers.include? 'compass'
|
if table.headers.include? 'compass'
|
||||||
got['compass'] = compasses
|
got['compass'] = instructions ? compasses : ''
|
||||||
end
|
end
|
||||||
if table.headers.include? 'turns'
|
if table.headers.include? 'turns'
|
||||||
got['turns'] = turns
|
got['turns'] = instructions ? turns : ''
|
||||||
end
|
end
|
||||||
if table.headers.include? 'modes'
|
if table.headers.include? 'modes'
|
||||||
got['modes'] = modes
|
got['modes'] = instructions ? modes : ''
|
||||||
end
|
end
|
||||||
if table.headers.include? '#' # comment column
|
if table.headers.include? '#' # comment column
|
||||||
got['#'] = row['#'] # copy value so it always match
|
got['#'] = row['#'] # copy value so it always match
|
||||||
|
|||||||
@ -6,6 +6,8 @@ Feature: Testbot - Mode flag
|
|||||||
# 2 route
|
# 2 route
|
||||||
# 3 river downstream
|
# 3 river downstream
|
||||||
# 4 river upstream
|
# 4 river upstream
|
||||||
|
# 5 steps down
|
||||||
|
# 6 steps up
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given the profile "testbot"
|
Given the profile "testbot"
|
||||||
@ -80,3 +82,31 @@ Feature: Testbot - Mode flag
|
|||||||
| from | to | route | modes |
|
| from | to | route | modes |
|
||||||
| 0 | 1 | ab | 3 |
|
| 0 | 1 | ab | 3 |
|
||||||
| 1 | 0 | ab | 4 |
|
| 1 | 0 | ab | 4 |
|
||||||
|
|
||||||
|
Scenario: Testbot - Modes in each direction (same speed in both direction)
|
||||||
|
Given the node map
|
||||||
|
| | 0 | 1 | |
|
||||||
|
| a | | | b |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| ab | steps |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | modes | time |
|
||||||
|
| 0 | 1 | ab | 5 | 60s +-1 |
|
||||||
|
| 1 | 0 | ab | 6 | 60s +-1 |
|
||||||
|
|
||||||
|
Scenario: Testbot - Modes for opposite direction
|
||||||
|
Given the node map
|
||||||
|
| | 0 | 1 | |
|
||||||
|
| a | | | b |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | oneway |
|
||||||
|
| ab | steps | -1 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | modes |
|
||||||
|
| 0 | 1 | | |
|
||||||
|
| 1 | 0 | ab | 6 |
|
||||||
|
|||||||
@ -11,11 +11,14 @@
|
|||||||
-- 2: route
|
-- 2: route
|
||||||
-- 3: river downstream
|
-- 3: river downstream
|
||||||
-- 4: river upstream
|
-- 4: river upstream
|
||||||
|
-- 5: steps down
|
||||||
|
-- 6: steps up
|
||||||
|
|
||||||
speed_profile = {
|
speed_profile = {
|
||||||
["primary"] = 36,
|
["primary"] = 36,
|
||||||
["secondary"] = 18,
|
["secondary"] = 18,
|
||||||
["tertiary"] = 12,
|
["tertiary"] = 12,
|
||||||
|
["steps"] = 6,
|
||||||
["default"] = 24
|
["default"] = 24
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +93,11 @@ function way_function (way)
|
|||||||
way.backward_mode = 4
|
way.backward_mode = 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if highway == "steps" then
|
||||||
|
way.forward_mode = 5
|
||||||
|
way.backward_mode = 6
|
||||||
|
end
|
||||||
|
|
||||||
if maxspeed_forward ~= nil and maxspeed_forward > 0 then
|
if maxspeed_forward ~= nil and maxspeed_forward > 0 then
|
||||||
speed_forw = maxspeed_forward
|
speed_forw = maxspeed_forward
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user