remove workaround, reduce memory consumption in lcs computation

This commit is contained in:
Moritz Kobitzsch 2017-10-11 11:07:43 +02:00
parent 74e1d1c27a
commit fd52c80573
3 changed files with 320 additions and 314 deletions

View File

@ -17,27 +17,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | only_right_turn @ (has_pygmies > 10 p) |
| restriction | bj | aj | j | only_right_turn @ (has_pygmies > 10 p) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
| b | c | bj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Restriction would be on, but the restriction was badly tagged
@ -48,29 +48,29 @@ Feature: Car - Turn restrictions
Given the node map
"""
n
a
p |
\ |
j
| \
s m
c m
"""
And the ways
| nodes |
| nj |
| js |
| aj |
| jc |
| pjm |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | nj | pjm | j | no_left_turn @ (Mo-Fr 07:00-10:30) |
| restriction | js | pjm | j | no_right_turn @ (Mo-Fr 07:00-10:30) |
| restriction | aj | pjm | j | no_left_turn @ (Mo-Fr 07:00-10:30) |
| restriction | jc | pjm | j | no_right_turn @ (Mo-Fr 07:00-10:30) |
When I route I should get
| from | to | route |
| n | m | nj,pjm,pjm |
| s | m | js,pjm,pjm |
| a | m | aj,pjm,pjm |
| c | m | jc,pjm,pjm |
@no_turning @conditionals
Scenario: Car - Restriction With Compressed Geometry
@ -149,29 +149,29 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | no |
| jp | no |
| aj | no |
| jc | no |
| bj | no |
| jd | no |
And the relations
| type | way:from | way:to | node:via | restriction:conditional | except |
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 08:00-12:00) | motorcar |
| restriction | jp | nj | j | only_left_turn @ (Mo-Su 08:00-12:00) | bus |
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 08:00-12:00) | motorcar |
| restriction | jd | aj | j | only_left_turn @ (Mo-Su 08:00-12:00) | bus |
When I route I should get
| from | to | route | # |
| e | s | ej,js,js | |
| e | n | ej,nj,nj | restriction does not apply to cars |
| e | p | ej,jp,jp | |
| p | s | jp,nj,nj,js,js | restriction excepting busses still applies to cars |
| b | c | bj,jc,jc | |
| b | a | bj,aj,aj | restriction does not apply to cars |
| b | d | bj,jd,jd | |
| d | c | jd,aj,aj,jc,jc | restriction excepting busses still applies to cars |
@no_turning @conditionals
Scenario: Car - only_right_turn
@ -181,27 +181,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,nj,nj,jp,jp |
| b | c | bj,aj,aj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,aj,aj,jd,jd |
@no_turning @conditionals
Scenario: Car - No right turn
@ -211,27 +211,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
When I route I should get
| from | to | route | # |
| e | s | ej,js,js | normal turn |
| e | n | ej,js,js,nj,nj | avoids right turn |
| e | p | ej,jp,jp | normal maneuver |
| b | c | bj,jc,jc | normal turn |
| b | a | bj,jc,jc,aj,aj | avoids right turn |
| b | d | bj,jd,jd | normal maneuver |
@only_turning @conditionals
Scenario: Car - only_left_turn
@ -241,27 +241,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,js,js,jp,jp |
| b | c | bj,jc,jc |
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jc,jc,jd,jd |
@no_turning @conditionals
Scenario: Car - No left turn
@ -271,27 +271,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
| b | c | bj,aj,aj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction is off
@ -301,27 +301,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
| b | c | bj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction is on
@ -331,27 +331,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,jp,jp |
| b | c | bj,jc,jc |
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows
@ -362,28 +362,28 @@ Feature: Car - Turn restrictions
Given the node map
"""
n
a
p |
\ |
j
| \
s m
c m
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| aj | no |
| jc | no |
| jp | yes |
| mj | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
When I route I should get
| from | to | route |
| n | p | nj,js,js,jp,jp |
| a | p | aj,jc,jc,jp,jp |
| m | p | mj,jp,jp |
@no_turning @conditionals
@ -394,27 +394,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
| restriction | bj | aj | j | only_right_turn @ (Mo-Su 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,nj,nj,jp,jp |
| b | c | bj,aj,aj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,aj,aj,jd,jd |
@no_turning @conditionals
Scenario: Car - No right turn
@ -424,27 +424,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
| restriction | bj | aj | j | no_right_turn @ (Mo-Fr 07:00-13:00) |
When I route I should get
| from | to | route | # |
| e | s | ej,js,js | normal turn |
| e | n | ej,js,js,nj,nj | avoids right turn |
| e | p | ej,jp,jp | normal maneuver |
| b | c | bj,jc,jc | normal turn |
| b | a | bj,jc,jc,aj,aj | avoids right turn |
| b | d | bj,jd,jd | normal maneuver |
@only_turning @conditionals
Scenario: Car - only_left_turn
@ -454,27 +454,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
| restriction | bj | jc | j | only_left_turn @ (Mo-Fr 07:00-16:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,js,js,jp,jp |
| b | c | bj,jc,jc |
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jc,jc,jd,jd |
@no_turning @conditionals
Scenario: Car - No left turn
@ -484,27 +484,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | js | j | no_left_turn @ (Mo-Su 00:00-23:59) |
| restriction | bj | jc | j | no_left_turn @ (Mo-Su 00:00-23:59) |
When I route I should get
| from | to | route |
| e | s | ej,nj,nj,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
| b | c | bj,aj,aj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction is off
@ -514,27 +514,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493719200"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
| restriction | bj | aj | j | no_right_turn @ (Mo-Su 16:00-20:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,nj,nj |
| e | p | ej,jp,jp |
| b | c | bj,jc,jc |
| b | a | bj,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction is on
@ -544,27 +544,27 @@ Feature: Car - Turn restrictions
Given the customize extra arguments "--time-zone-file=test/data/tz/{timezone_names}/guinea.geojson --parse-conditionals-from-now=1493805600"
Given the node map
"""
n
p j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| ej | yes |
| jp | yes |
| aj | no |
| jc | no |
| bj | yes |
| jd | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | ej | nj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
| restriction | jb | aj | j | no_right_turn @ (Mo-Fr 07:00-14:00) |
When I route I should get
| from | to | route |
| e | s | ej,js,js |
| e | n | ej,js,js,nj,nj |
| e | p | ej,jp,jp |
| b | c | bj,jc,jc |
| b | a | bj,jc,jc,aj,aj |
| b | d | bj,jd,jd |
@no_turning @conditionals
Scenario: Car - Conditional restriction with multiple time windows
@ -575,28 +575,28 @@ Feature: Car - Turn restrictions
Given the node map
"""
n
a
p |
\ |
j
| \
s m
c m
"""
And the ways
| nodes | oneway |
| nj | no |
| js | no |
| aj | no |
| jc | no |
| jp | yes |
| mj | yes |
And the relations
| type | way:from | way:to | node:via | restriction:conditional |
| restriction | nj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
| restriction | aj | jp | j | no_right_turn @ (Mo-Fr 07:00-11:00,16:00-18:30) |
When I route I should get
| from | to | route |
| n | p | nj,js,js,jp,jp |
| a | p | aj,jc,jc,jp,jp |
| m | p | mj,jp,jp |
@restriction-way

View File

@ -11,27 +11,27 @@ Feature: Car - Turn restrictions
Scenario: Car - No left turn
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | wj | j | no_left_turn |
| restriction | cj | dj | j | no_left_turn |
When I route I should get
| from | to | route |
| s | w | |
| s | n | sj,nj,nj |
| s | e | sj,ej,ej |
| c | d | |
| c | a | cj,aj,aj |
| c | b | cj,bj,bj |
@no_turning
Scenario: Car - No straight on
@ -67,253 +67,259 @@ Feature: Car - Turn restrictions
Scenario: Car - No right turn
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | ej | j | no_right_turn |
| restriction | cj | bj | j | no_right_turn |
When I route I should get
| from | to | route |
| s | w | sj,wj,wj |
| s | n | sj,nj,nj |
| s | e | |
| c | d | cj,dj,dj |
| c | a | cj,aj,aj |
| c | b | |
@no_turning
Scenario: Car - No u-turn
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | wj | j | no_u_turn |
| restriction | cj | dj | j | no_u_turn |
When I route I should get
| from | to | route |
| s | w | |
| s | n | sj,nj,nj |
| s | e | sj,ej,ej |
| c | d | |
| c | a | cj,aj,aj |
| c | b | cj,bj,bj |
@no_turning
Scenario: Car - Handle any no_* relation
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | wj | j | no_weird_zigzags |
| restriction | cj | dj | j | no_weird_zigzags |
When I route I should get
| from | to | route |
| s | w | |
| s | n | sj,nj,nj |
| s | e | sj,ej,ej |
| c | d | |
| c | a | cj,aj,aj |
| c | b | cj,bj,bj |
@only_turning
Scenario: Car - Only left turn
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | wj | j | only_left_turn |
| restriction | cj | dj | j | only_left_turn |
When I route I should get
| from | to | route |
| c | a | |
| c | b | |
| c | d | cj,dj,dj |
Scenario: Car - Only right turn, invalid
Given the node map
"""
n
w j e r
s
a
d j b r
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| re | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
| rb | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | er | j | only_right_on |
| restriction | cj | br | j | only_right_on |
When I route I should get
| from | to | route |
| s | r | sj,ej,re,re |
| c | r | cj,bj,rb,rb |
@only_turning
Scenario: Car - Only right turn
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | ej | j | only_right_turn |
| restriction | cj | bj | j | only_right_turn |
When I route I should get
| from | to | route |
| s | w | |
| s | n | |
| s | e | sj,ej,ej |
| c | d | |
| c | a | |
| c | b | cj,bj,bj |
@only_turning
Scenario: Car - Only straight on
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | nj | j | only_straight_on |
| restriction | cj | aj | j | only_straight_on |
When I route I should get
| from | to | route |
| s | w | |
| s | n | sj,nj,nj |
| s | e | |
| c | d | |
| c | a | cj,aj,aj |
| c | b | |
@no_turning
Scenario: Car - Handle any only_* restriction
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | nj | j | only_weird_zigzags |
| restriction | cj | aj | j | only_weird_zigzags |
When I route I should get
| from | to | route |
| s | w | |
| s | n | sj,nj,nj |
| s | e | |
| c | d | |
| c | a | cj,aj,aj |
| c | b | |
@specific
Scenario: Car - :hgv-qualified on a standard turn restriction
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction:hgv |
| restriction | sj | nj | j | no_straight_on |
| restriction | cj | aj | j | no_straight_on |
When I route I should get
| from | to | route |
| s | w | sj,wj,wj |
| s | n | sj,nj,nj |
| s | e | sj,ej,ej |
| c | d | cj,dj,dj |
| c | a | cj,aj,aj |
| c | b | cj,bj,bj |
@specific
Scenario: Car - :motorcar-qualified on a standard turn restriction
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction:motorcar |
| restriction | sj | nj | j | no_straight_on |
| restriction | cj | aj | j | no_straight_on |
When I route I should get
| from | to | route |
| s | w | sj,wj,wj |
| s | n | |
| s | e | sj,ej,ej |
| c | d | cj,dj,dj |
| c | a | |
| c | b | cj,bj,bj |
@except
Scenario: Car - Except tag and on no_ restrictions
@ -484,27 +490,27 @@ Feature: Car - Turn restrictions
Scenario: Car - Ignore unrecognized restriction
Given the node map
"""
n
w j e
s
a
d j b
c
"""
And the ways
| nodes | oneway |
| sj | yes |
| nj | -1 |
| wj | -1 |
| ej | -1 |
| cj | yes |
| aj | -1 |
| dj | -1 |
| bj | -1 |
And the relations
| type | way:from | way:to | node:via | restriction |
| restriction | sj | wj | j | yield |
| restriction | cj | dj | j | yield |
When I route I should get
| from | to | route |
| s | w | sj,wj,wj |
| s | n | sj,nj,nj |
| s | e | sj,ej,ej |
| c | d | cj,dj,dj |
| c | a | cj,aj,aj |
| c | b | cj,bj,bj |
@restriction @compression
Scenario: Restriction On Compressed Geometry

View File

@ -32,38 +32,42 @@ inline std::string longest_common_substring(const std::string &lhs, const std::s
return "";
// array for dynamic programming
std::vector<std::vector<std::uint32_t>> dp(lhs.size(),
std::vector<std::uint32_t>(rhs.size(), 0));
std::vector<std::uint32_t> dp_previous(rhs.size(), 0), dp_current(rhs.size(), 0);
// to remember the best location
std::uint32_t best = 0;
std::uint32_t best_pos = 0;
using std::swap;
for (std::uint32_t i = 0; i < lhs.size(); ++i)
{
for (std::uint32_t j = 0; j < rhs.size(); ++j)
{
if (lhs[i] == rhs[j])
{
dp[i][j] = (i == 0 || j == 0) ? 1 : (dp[i - 1][j - 1] + 1);
if (dp[i][j] > best)
dp_current[j] = (j == 0) ? 1 : (dp_previous[j - 1] + 1);
if (dp_current[j] > best)
{
best = dp[i][j];
best = dp_current[j];
best_pos = i + 1;
}
}
}
swap(dp_previous, dp_current);
}
// the best position marks the end of the string
return lhs.substr(best_pos - best, best);
}
// TODO US-ASCII support only, no UTF-8 support
// While UTF-8 might work in some cases, we do not guarantee full functionality
inline auto decompose(const std::string &lhs, const std::string &rhs)
{
auto const lcs = longest_common_substring(lhs, rhs);
// trim spaces, transform to lower
const auto trim = [](auto str) {
// we compare suffixes based on this value, it might break UTF chars, but as long as we are
// consistent in handling, we do not create bad results
boost::to_lower(str);
auto front = str.find_first_not_of(" ");
@ -136,10 +140,6 @@ inline bool requiresNameAnnounced(const std::string &from_name,
decompose(first, second);
const auto checkTable = [&](const std::string &str) {
// workaround for cucumber tests:
if (str.length() == 1 && (first.length() == 2 || second.length() == 2))
return false;
return str.empty() || suffix_table.isSuffix(str);
};