New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
turn restrictions on/off in lua profiles #580
Conversation
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe delete this INFO
example of turn restrictions causing an odd route for bikes: http://www.ibikecph.dk/#!/x58er.7hk3f/x589s.7higf |
maybe the bike profile still needs to respect some restrictions, like no_entry? |
defining a lua_restriction_function() could be optional, like the lua_turn_penalty() is handled in the turn penalties branch. |
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be handled in the XML parser as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought xml was deprecated. btw none of the cuke tests use it.
added support for xml. note: it lead to various refactoring of the parsers, including moving duplicated code to the base. an added benefit of proper xml support is that we can avoid the osmosis roundtrip to pbf, which makes cuke tests about 2x faster (each time the osm data needs to be reprocessed). the commit doesn't change cuke test from pbf to xml yet, but i tried it, and it works fine. |
#include "ScriptingEnvironment.h" | ||
|
||
template<class ExternalMemoryT, typename NodeT, typename RestrictionT, typename WayT> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the reason for making this a template class? it's never instantiated with different types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No apparent reason. At least none that survived the test of time.
|
||
if(!parser->Init()) | ||
|
||
if(!parser->ReadHeader()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use curly braces
but also other suggested code cleanuup, like adding curly brackets to oneline ifs. |
The code gives a number of warnings when compiling, but I'll fix that when merging manually. |
Merged manually. |
thanks for merging. use_turn_restrictions = false if you want to activate them, simply remove the line, or set the flag to true. |
does the wiki document the master branch or the develop branch? i'm wondering if i should document the flag yet? |
Go on and add it. It is about time to make the next merge into master. Am 23.02.2013 um 08:14 schrieb Emil Tin notifications@github.com:
|
in fact the lua profiles are not documented yet anywhere, right? |
implements a simple way to turn restrictions on/off in the lua profile, by setting a global:
this is useful in foot and bike profiles, when you don't want to restrict any turns.
based on earlier pull request from @lonvia: #479
implements it in the pbfparser only. should the xmlparser be supported too?