From 75bdf114be0779cf46fe2217ec1ce6ee67137f05 Mon Sep 17 00:00:00 2001 From: Denis Koronchik Date: Fri, 1 Sep 2017 17:15:12 +0300 Subject: [PATCH] Review fixes --- docs/profiles.md | 8 +++++--- include/extractor/extraction_relation.hpp | 6 ------ src/extractor/scripting_environment_lua.cpp | 4 +++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/profiles.md b/docs/profiles.md index 93aff907a..752b82d86 100644 --- a/docs/profiles.md +++ b/docs/profiles.md @@ -114,7 +114,7 @@ classes | Sequence | Determines the allowed restrictions | Sequence | Determines which turn restrictions will be used for this profile. suffix_list | Set | List of name suffixes needed for determining if "Highway 101 NW" the same road as "Highway 101 ES". -### process_node(profile, node, result) +### process_node(profile, node, result, relations) Process an OSM node to determine whether this node is a barrier or can be passed and whether passing it incurs a delay. Argument | Description @@ -122,6 +122,7 @@ Argument | Description profile | The configuration table you returned in `setup`. node | The input node to process (read-only). result | The output that you will modify. +relations| The list of relation attributes passed from `process_relation` function for this node. The following attributes can be set on `result`: @@ -130,7 +131,7 @@ Attribute | Type | Notes barrier | Boolean | Is it an impassable barrier? traffic_lights | Boolean | Is it a traffic light (incurs delay in `process_turn`)? -### process_way(profile, way, result) +### process_way(profile, way, result, relations) Given an OpenStreetMap way, the `process_way` function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash. Argument | Description @@ -138,6 +139,7 @@ Argument | Description profile | The configuration table you returned in `setup`. node | The input way to process (read-only). result | The output that you will modify. +relations| The list of relation attributes passed from `process_relation` function for this way. Importantly it will set `result.forward_mode` and `result.backward_mode` to indicate the travel mode in each direction, as well as set `result.forward_speed` and `result.backward_speed` to integer values representing the speed for traversing the way. @@ -215,7 +217,7 @@ 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 + if m:role == "north" then result[m]['direction'] = 'north' print('direction_north') end diff --git a/include/extractor/extraction_relation.hpp b/include/extractor/extraction_relation.hpp index a7566b234..88f8092d9 100644 --- a/include/extractor/extraction_relation.hpp +++ b/include/extractor/extraction_relation.hpp @@ -11,12 +11,6 @@ namespace osrm { namespace extractor { -namespace detail -{ - -inline const char *checkedString(const char *str) { return str ? str : ""; } - -} // namespace detail struct ExtractionRelation { diff --git a/src/extractor/scripting_environment_lua.cpp b/src/extractor/scripting_environment_lua.cpp index 66f6c3d0d..e4498bed0 100644 --- a/src/extractor/scripting_environment_lua.cpp +++ b/src/extractor/scripting_environment_lua.cpp @@ -319,7 +319,9 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context) "role", &RelationMemberWrap::GetRole, "item_type", - &RelationMemberWrap::GetItemType); + &RelationMemberWrap::GetItemType, + "id", + &RelationMemberWrap::GetId); /** TODO: make better solution with members iteration. * For this moment, just make vector of RelationMember wrappers