fix bike speed on ped streets. cleanup of speed code
This commit is contained in:
parent
86128892d7
commit
599c026407
@ -190,23 +190,27 @@ public:
|
|||||||
//Is the highway tag listed as usable way?
|
//Is the highway tag listed as usable way?
|
||||||
if(("track" == highway && ("yes" == access || "yes" == accessTag)) || ("track" != highway && (0 < settings[highway] || "yes" == accessTag || "designated" == accessTag) )) {
|
if(("track" == highway && ("yes" == access || "yes" == accessTag)) || ("track" != highway && (0 < settings[highway] || "yes" == accessTag || "designated" == accessTag) )) {
|
||||||
if(!w.isDurationSet) {
|
if(!w.isDurationSet) {
|
||||||
if(0 < settings[highway]) {
|
int speed;
|
||||||
if(0 < maxspeed)
|
|
||||||
if(settings.takeMinimumOfSpeeds)
|
if( accessTag=="yes" || accessTag=="designated" )
|
||||||
w.speed = std::min(settings[highway], maxspeed);
|
speed = std::max( settings.defaultSpeed, settings[highway] );
|
||||||
else
|
else if( settings[highway]>0 )
|
||||||
w.speed = maxspeed;
|
speed = settings[highway];
|
||||||
else
|
else {
|
||||||
w.speed = settings[highway];
|
speed = settings.defaultSpeed;
|
||||||
} else {
|
|
||||||
if(0 < maxspeed)
|
|
||||||
if(settings.takeMinimumOfSpeeds)
|
|
||||||
w.speed = std::min(settings.defaultSpeed, maxspeed);
|
|
||||||
else w.speed = maxspeed;
|
|
||||||
else
|
|
||||||
w.speed = settings.defaultSpeed;
|
|
||||||
highway = "default";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !settings[highway]>0 )
|
||||||
|
highway = "default";
|
||||||
|
|
||||||
|
if( maxspeed>0 ) {
|
||||||
|
if( settings.takeMinimumOfSpeeds )
|
||||||
|
w.speed = std::min( speed, maxspeed );
|
||||||
|
else
|
||||||
|
w.speed = maxspeed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
w.speed = speed;
|
||||||
}
|
}
|
||||||
w.useful = true;
|
w.useful = true;
|
||||||
|
|
||||||
|
|||||||
86
features/maxspeed.feature
Normal file
86
features/maxspeed.feature
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
@routing @maxspeed
|
||||||
|
Feature: Speed limits
|
||||||
|
Note:
|
||||||
|
60km/h = 100m/6s
|
||||||
|
30km/h = 100m/12s
|
||||||
|
15km/h = 100m/24s
|
||||||
|
10km/h = 100m/48s
|
||||||
|
5km/h = 100m/72s
|
||||||
|
|
||||||
|
Scenario: Obey speedlimits
|
||||||
|
Given the speedprofile "car"
|
||||||
|
And the speedprofile settings
|
||||||
|
| primary | 60 |
|
||||||
|
And a grid size of 100 meters
|
||||||
|
And the node map
|
||||||
|
| a | b |
|
||||||
|
| c | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | maxspeed |
|
||||||
|
| ab | primary | |
|
||||||
|
| cd | primary | 30 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 6s |
|
||||||
|
| c | d | cd | 12s |
|
||||||
|
|
||||||
|
Scenario: Go faster than speedprofile when takeMinimumOfSpeeds=no
|
||||||
|
Given the speedprofile "car"
|
||||||
|
And the speedprofile settings
|
||||||
|
| residential | 15 |
|
||||||
|
| takeMinimumOfSpeeds | no |
|
||||||
|
And a grid size of 100 meters
|
||||||
|
And the node map
|
||||||
|
| a | b |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | maxspeed |
|
||||||
|
| ab | residential | 30 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 12s |
|
||||||
|
|
||||||
|
Scenario: Bicycles can't go faster just because maxspeed is high
|
||||||
|
Given the speedprofile "bicycle"
|
||||||
|
And the speedprofile settings
|
||||||
|
| primary | 15 |
|
||||||
|
And a grid size of 100 meters
|
||||||
|
|
||||||
|
And the node map
|
||||||
|
| a | b |
|
||||||
|
| c | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | maxspeed |
|
||||||
|
| ab | primary | |
|
||||||
|
| cd | primary | 60 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 24s |
|
||||||
|
| c | d | cd | 24s |
|
||||||
|
|
||||||
|
Scenario: Bicycles should also obey maxspeed
|
||||||
|
Given the speedprofile "bicycle"
|
||||||
|
And the speedprofile settings
|
||||||
|
| primary | 15 |
|
||||||
|
And a grid size of 100 meters
|
||||||
|
|
||||||
|
And the node map
|
||||||
|
| a | b |
|
||||||
|
| c | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | maxspeed |
|
||||||
|
| ab | primary | |
|
||||||
|
| cd | primary | 10 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 24s |
|
||||||
|
| c | d | cd | 48s |
|
||||||
|
|
||||||
|
|
||||||
@ -6,6 +6,23 @@ Feature: Estimation of travel time
|
|||||||
|
|
||||||
Background: Use specific speeds
|
Background: Use specific speeds
|
||||||
Given the speedprofile "bicycle"
|
Given the speedprofile "bicycle"
|
||||||
|
And the speedprofile settings
|
||||||
|
| defaultSpeed | 15 |
|
||||||
|
| primary | 15 |
|
||||||
|
| footway | 5 |
|
||||||
|
|
||||||
|
Scenario: Time of travelling 100 meters
|
||||||
|
Given a grid size of 100 meters
|
||||||
|
Given the node map
|
||||||
|
| a | b |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway |
|
||||||
|
| ab | primary |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 24s |
|
||||||
|
|
||||||
Scenario: Basic travel time, 1m scale
|
Scenario: Basic travel time, 1m scale
|
||||||
Given a grid size of 1 meters
|
Given a grid size of 1 meters
|
||||||
@ -176,3 +193,17 @@ Feature: Estimation of travel time
|
|||||||
| 4 | 3 | ab | 24s |
|
| 4 | 3 | ab | 24s |
|
||||||
| 4 | 2 | ab | 48s |
|
| 4 | 2 | ab | 48s |
|
||||||
| 4 | 1 | ab | 72s |
|
| 4 | 1 | ab | 72s |
|
||||||
|
|
||||||
|
@bike_speed
|
||||||
|
Scenario: Time of travel when bicycle=yes
|
||||||
|
Given the node map
|
||||||
|
| a | b |
|
||||||
|
| c | d |
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | highway | bicycle |
|
||||||
|
| ab | footway | yes |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| from | to | route | time |
|
||||||
|
| a | b | ab | 24s |
|
||||||
@ -1,23 +1,24 @@
|
|||||||
[car]
|
[car]
|
||||||
accessTag = motorcar
|
accessTag = motorcar
|
||||||
defaultSpeed = 50
|
defaultSpeed = 60
|
||||||
obeyOneways = yes
|
obeyOneways = yes
|
||||||
useRestrictions = yes
|
useRestrictions = yes
|
||||||
barrier = bollard
|
barrier = bollard
|
||||||
|
takeMinimumOfSpeeds = yes
|
||||||
|
|
||||||
motorway = 100
|
motorway = 110
|
||||||
motorway_link = 90
|
motorway_link = 90
|
||||||
trunk = 90
|
trunk = 90
|
||||||
trunk_link = 70
|
trunk_link = 70
|
||||||
primary = 70
|
primary = 70
|
||||||
primary_link = 60
|
primary_link = 60
|
||||||
secondary = 60
|
secondary = 60
|
||||||
secondary_link = 50
|
secondary_link = 50
|
||||||
tertiary = 50
|
tertiary = 50
|
||||||
tertiary_link = 40
|
tertiary_link = 40
|
||||||
road = 40
|
road = 40
|
||||||
residential = 40
|
residential = 40
|
||||||
unclassified = 30
|
unclassified = 30
|
||||||
service = 20
|
service = 20
|
||||||
living_street = 10
|
living_street = 10
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user