add tunnel as a class in lua (#4812)
This commit is contained in:
		
							parent
							
								
									a7f1cd36fb
								
							
						
					
					
						commit
						72de59ac91
					
				| @ -5,6 +5,8 @@ | |||||||
|       - FIXED #4781: Fixed overflow exceptions in percent-encoding parsing |       - FIXED #4781: Fixed overflow exceptions in percent-encoding parsing | ||||||
|     - Guidance: |     - Guidance: | ||||||
|       - CHANGED #4706: Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation [#4706](https://github.com/Project-OSRM/osrm-backend/pull/4706) |       - CHANGED #4706: Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation [#4706](https://github.com/Project-OSRM/osrm-backend/pull/4706) | ||||||
|  |     - Profile: | ||||||
|  |       - ADDED: `tunnel` as a new class in car profile so that sections of the route with tunnel tags will be marked as such | ||||||
| 
 | 
 | ||||||
| # 5.14.3 | # 5.14.3 | ||||||
|   - Changes from 5.14.2: |   - Changes from 5.14.2: | ||||||
|  | |||||||
| @ -82,7 +82,7 @@ Feature: Car - Mode flag | |||||||
|             | from | to | route | turns        | classes                                      | |             | from | to | route | turns        | classes                                      | | ||||||
|             | a    | d  | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] | |             | a    | d  | ab,cd | depart,arrive| [(restricted),(motorway,restricted),()],[()] | | ||||||
| 
 | 
 | ||||||
|     Scenario: Car - We toll restricted with a class |     Scenario: Car - We tag toll with a class | ||||||
|         Given the node map |         Given the node map | ||||||
|             """ |             """ | ||||||
|             a b |             a b | ||||||
| @ -99,6 +99,26 @@ Feature: Car - Mode flag | |||||||
|             | from | to | route    | turns         | classes                          | |             | from | to | route    | turns         | classes                          | | ||||||
|             | a    | d  | ab,cd    | depart,arrive | [(toll),(motorway,toll),()],[()] | |             | a    | d  | ab,cd    | depart,arrive | [(toll),(motorway,toll),()],[()] | | ||||||
| 
 | 
 | ||||||
|  |     Scenario: Car - We tag tunnel with a class | ||||||
|  |         Background: | ||||||
|  |             Given a grid size of 200 meters | ||||||
|  | 
 | ||||||
|  |         Given the node map | ||||||
|  |             """ | ||||||
|  |             a b | ||||||
|  |               c d | ||||||
|  |             """ | ||||||
|  | 
 | ||||||
|  |         And the ways | ||||||
|  |             | nodes | tunnel               | | ||||||
|  |             | ab    | no                   | | ||||||
|  |             | bc    | yes                  | | ||||||
|  |             | cd    |                      | | ||||||
|  | 
 | ||||||
|  |         When I route I should get | ||||||
|  |             | from | to | route       | turns                                      | classes                   | | ||||||
|  |             | a    | d  | ab,bc,cd,cd | depart,new name right,new name left,arrive | [()],[(tunnel)],[()],[()] | | ||||||
|  | 
 | ||||||
|     Scenario: Car - From roundabout on toll road |     Scenario: Car - From roundabout on toll road | ||||||
|         Given the node map |         Given the node map | ||||||
|             """ |             """ | ||||||
|  | |||||||
| @ -104,7 +104,7 @@ function setup() | |||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     classes = Sequence { |     classes = Sequence { | ||||||
|         'toll', 'motorway', 'ferry', 'restricted' |         'toll', 'motorway', 'ferry', 'restricted', 'tunnel' | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     -- classes to support for exclude flags |     -- classes to support for exclude flags | ||||||
|  | |||||||
| @ -283,6 +283,12 @@ end | |||||||
| function WayHandlers.classes(profile,way,result,data) | function WayHandlers.classes(profile,way,result,data) | ||||||
|     local forward_toll, backward_toll = Tags.get_forward_backward_by_key(way, data, "toll") |     local forward_toll, backward_toll = Tags.get_forward_backward_by_key(way, data, "toll") | ||||||
|     local forward_route, backward_route = Tags.get_forward_backward_by_key(way, data, "route") |     local forward_route, backward_route = Tags.get_forward_backward_by_key(way, data, "route") | ||||||
|  |     local tunnel = way:get_value_by_key("tunnel") | ||||||
|  | 
 | ||||||
|  |     if tunnel and tunnel ~= "no" then | ||||||
|  |       result.forward_classes["tunnel"] = true | ||||||
|  |       result.backward_classes["tunnel"] = true | ||||||
|  |     end | ||||||
| 
 | 
 | ||||||
|     if forward_toll == "yes" then |     if forward_toll == "yes" then | ||||||
|         result.forward_classes["toll"] = true |         result.forward_classes["toll"] = true | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ exports.three_test_coordinates = [[7.41337, 43.72956], | |||||||
| 
 | 
 | ||||||
| exports.two_test_coordinates = exports.three_test_coordinates.slice(0, 2) | exports.two_test_coordinates = exports.three_test_coordinates.slice(0, 2) | ||||||
| 
 | 
 | ||||||
| exports.test_tile = {'at': [17059, 11948, 15], 'size': 168606}; | exports.test_tile = {'at': [17059, 11948, 15], 'size': 169239}; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // Test files generated by the routing engine; check test/data
 | // Test files generated by the routing engine; check test/data
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user