diff --git a/Extractor/PBFParser.cpp b/Extractor/PBFParser.cpp index 222475db6..299275b12 100644 --- a/Extractor/PBFParser.cpp +++ b/Extractor/PBFParser.cpp @@ -20,7 +20,7 @@ #include "PBFParser.h" -PBFParser::PBFParser(const char * fileName) : externalMemory(NULL){ +PBFParser::PBFParser(const char * fileName) : externalMemory(NULL), use_turn_restrictions(true) { GOOGLE_PROTOBUF_VERIFY_VERSION; //TODO: What is the bottleneck here? Filling the queue or reading the stuff from disk? //NOTE: With Lua scripting, it is parsing the stuff. I/O is virtually for free. @@ -43,7 +43,13 @@ void PBFParser::RegisterCallbacks(ExtractorCallbacks * em) { void PBFParser::RegisterScriptingEnvironment(ScriptingEnvironment & _se) { scriptingEnvironment = _se; - + + if(0 != luaL_dostring( scriptingEnvironment.getLuaStateForThreadID(0), "return use_turn_restrictions\n")) { + ERR(lua_tostring(scriptingEnvironment.getLuaStateForThreadID(0),-1)<< " occured in scripting block"); + } + use_turn_restrictions = lua_toboolean(scriptingEnvironment.getLuaStateForThreadID(0), -1); + INFO("Use turn restrictions:" << use_turn_restrictions); + if(lua_function_exists(scriptingEnvironment.getLuaStateForThreadID(0), "get_exceptions" )) { //get list of turn restriction exceptions try { @@ -241,6 +247,9 @@ inline void PBFParser::parseNode(_ThreadData * ) { inline void PBFParser::parseRelation(_ThreadData * threadData) { //TODO: leave early, if relation is not a restriction //TODO: reuse rawRestriction container + if( use_turn_restrictions==false ) + return; + const OSMPBF::PrimitiveGroup& group = threadData->PBFprimitiveBlock.primitivegroup( threadData->currentGroupID ); for(int i = 0; i < group.relations_size(); ++i ) { std::string exception_of_restriction_tag; diff --git a/Extractor/PBFParser.h b/Extractor/PBFParser.h index d3da02706..e00d64fbc 100644 --- a/Extractor/PBFParser.h +++ b/Extractor/PBFParser.h @@ -106,7 +106,8 @@ private: /* ThreadData Queue */ boost::shared_ptr > threadDataQueue; ScriptingEnvironment scriptingEnvironment; - + + bool use_turn_restrictions; std::vector restriction_exceptions_vector; }; diff --git a/profiles/bicycle.lua b/profiles/bicycle.lua index c5c2f64fb..2f476e307 100644 --- a/profiles/bicycle.lua +++ b/profiles/bicycle.lua @@ -64,6 +64,7 @@ man_made_speeds = { route_speeds = { ["ferry"] = 5 } + take_minimum_of_speeds = true obey_oneway = true obey_bollards = false @@ -71,6 +72,7 @@ use_restrictions = true ignore_areas = true -- future feature traffic_signal_penalty = 2 u_turn_penalty = 20 +use_turn_restrictions = true -- End of globals diff --git a/profiles/car.lua b/profiles/car.lua index 095806590..d2fa5cea3 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -39,6 +39,7 @@ use_restrictions = true ignore_areas = true -- future feature traffic_signal_penalty = 2 u_turn_penalty = 20 +use_turn_restrictions = true -- End of globals