Some fixes
This commit is contained in:
		
							parent
							
								
									0dfec13c0a
								
							
						
					
					
						commit
						832cdbf566
					
				| @ -14,7 +14,6 @@ Feature: Profile API version 3 | |||||||
|             find_access_tag = require("lib/access").find_access_tag |             find_access_tag = require("lib/access").find_access_tag | ||||||
|             limit = require("lib/maxspeed").limit |             limit = require("lib/maxspeed").limit | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|             function setup() |             function setup() | ||||||
|               return { |               return { | ||||||
|                 properties = { |                 properties = { | ||||||
| @ -23,7 +22,8 @@ Feature: Profile API version 3 | |||||||
|                   continue_straight_at_waypoint   = true, |                   continue_straight_at_waypoint   = true, | ||||||
|                   weight_name                     = 'test_version2', |                   weight_name                     = 'test_version2', | ||||||
|                   weight_precision                = 2 |                   weight_precision                = 2 | ||||||
|                 } |                 }, | ||||||
|  |                 relation_types = Sequence { "route" } | ||||||
|               } |               } | ||||||
|             end |             end | ||||||
| 
 | 
 | ||||||
| @ -39,30 +39,15 @@ Feature: Profile API version 3 | |||||||
|               result.forward_speed = 36 |               result.forward_speed = 36 | ||||||
|               result.backward_speed = 36 |               result.backward_speed = 36 | ||||||
| 
 | 
 | ||||||
|               for _, r in ipairs(relations) do  |               local rel_id_list = relations:get_relations(way) | ||||||
|                 for k, v in pairs(r) do  |               for i, rel_id in ipairs(rel_id_list) do | ||||||
|                   print('data_' .. k .. '_value_' .. v) |                 local rel = relations:relation(rel_id) | ||||||
|                 end  |                 local role = rel:get_role(way) | ||||||
|  |                 print('role_' .. role) | ||||||
|               end |               end | ||||||
|               print ('process_way ' .. way:id() .. ' ' .. result.name) |               print ('process_way ' .. way:id() .. ' ' .. result.name) | ||||||
|             end |             end | ||||||
| 
 | 
 | ||||||
|             function process_relation(profile, relation, result) |  | ||||||
|               local t = relation:get_value_by_key("type") |  | ||||||
|               if t == "route" then |  | ||||||
|                 for _, m in ipairs(relation:members()) do |  | ||||||
|                   if m:role() == "north" then |  | ||||||
|                     result[m]['direction'] = 'north' |  | ||||||
|                     print('direction_north') |  | ||||||
|                   end |  | ||||||
|                 end |  | ||||||
| 
 |  | ||||||
|                 print('route_relation') |  | ||||||
|               end |  | ||||||
| 
 |  | ||||||
|               print ('process_relation ' .. relation:id()) |  | ||||||
|             end |  | ||||||
| 
 |  | ||||||
|             function process_turn (profile, turn) |             function process_turn (profile, turn) | ||||||
|               print('process_turn', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light) |               print('process_turn', turn.angle, turn.turn_type, turn.direction_modifier, turn.has_traffic_light) | ||||||
|               turn.weight = turn.angle == 0 and 0 or 4.2 |               turn.weight = turn.angle == 0 and 0 or 4.2 | ||||||
| @ -103,14 +88,11 @@ Feature: Profile API version 3 | |||||||
| 
 | 
 | ||||||
|         When I run "osrm-extract --profile {profile_file} {osm_file}" |         When I run "osrm-extract --profile {profile_file} {osm_file}" | ||||||
|         Then it should exit successfully |         Then it should exit successfully | ||||||
|         And stdout should contain "process_relation" |  | ||||||
|         And stdout should contain "route_relation" |  | ||||||
|         And stdout should contain "direction_north" |  | ||||||
|         And stdout should contain "data_direction_value_north" |  | ||||||
|         And stdout should contain "process_node" |         And stdout should contain "process_node" | ||||||
|         And stdout should contain "process_way" |         And stdout should contain "process_way" | ||||||
|         And stdout should contain "process_turn" |         And stdout should contain "process_turn" | ||||||
|         And stdout should contain "process_segment" |         And stdout should contain "process_segment" | ||||||
|  |         And stdout should contain "role_north" | ||||||
| 
 | 
 | ||||||
|         When I route I should get |         When I route I should get | ||||||
|            | from | to | route    | time  | |            | from | to | route    | time  | | ||||||
|  | |||||||
| @ -404,9 +404,9 @@ function process_way(profile, way, result, relations) | |||||||
| 
 | 
 | ||||||
|   local parsed_rel_list = {} |   local parsed_rel_list = {} | ||||||
|   local rel_id_list = relations:get_relations(way) |   local rel_id_list = relations:get_relations(way) | ||||||
|   for i, r in ipairs(rel_id_list) do |   for i, rel_id in ipairs(rel_id_list) do | ||||||
|     local rel_id = relations:relation(r) |     local rel = relations:relation(rel_id) | ||||||
|     parsed_rel_list[i] = Relations.parse_route_relation(rel_id, way) |     parsed_rel_list[i] = Relations.parse_route_relation(rel, way) | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   -- now process relations data |   -- now process relations data | ||||||
|  | |||||||
| @ -390,7 +390,6 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment, | |||||||
|     auto relation_types = scripting_environment.GetRelations(); |     auto relation_types = scripting_environment.GetRelations(); | ||||||
|     std::sort(relation_types.begin(), relation_types.end()); |     std::sort(relation_types.begin(), relation_types.end()); | ||||||
| 
 | 
 | ||||||
|     ExtractionRelationContainer relations; |  | ||||||
|     std::vector<std::string> restrictions = scripting_environment.GetRestrictions(); |     std::vector<std::string> restrictions = scripting_environment.GetRestrictions(); | ||||||
|     // setup restriction parser
 |     // setup restriction parser
 | ||||||
|     const RestrictionParser restriction_parser( |     const RestrictionParser restriction_parser( | ||||||
| @ -409,6 +408,8 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment, | |||||||
|         std::vector<InputConditionalTurnRestriction> resulting_restrictions; |         std::vector<InputConditionalTurnRestriction> resulting_restrictions; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     ExtractionRelationContainer relations; | ||||||
|  | 
 | ||||||
|     const auto buffer_reader = [](osmium::io::Reader &reader) { |     const auto buffer_reader = [](osmium::io::Reader &reader) { | ||||||
|         return tbb::filter_t<void, SharedBuffer>( |         return tbb::filter_t<void, SharedBuffer>( | ||||||
|             tbb::filter::serial_in_order, [&reader](tbb::flow_control &fc) { |             tbb::filter::serial_in_order, [&reader](tbb::flow_control &fc) { | ||||||
| @ -479,8 +480,6 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment, | |||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     tbb::filter_t<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>> buffer_relation_cache( |     tbb::filter_t<SharedBuffer, std::shared_ptr<ExtractionRelationContainer>> buffer_relation_cache( | ||||||
|         tbb::filter::parallel, [&](const SharedBuffer buffer) { |         tbb::filter::parallel, [&](const SharedBuffer buffer) { | ||||||
|             if (!buffer) |             if (!buffer) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user