Add some documentation to the restriction parser
This commit is contained in:
parent
c25d14e454
commit
006bcc0fc8
@ -79,9 +79,6 @@ struct TurnRestriction
|
||||
|
||||
struct InputRestrictionContainer
|
||||
{
|
||||
// EdgeID fromWay;
|
||||
// EdgeID toWay;
|
||||
// NodeID via_node;
|
||||
TurnRestriction restriction;
|
||||
|
||||
InputRestrictionContainer(EdgeID fromWay, EdgeID toWay, EdgeID vw)
|
||||
|
@ -102,6 +102,13 @@ void RestrictionParser::ReadRestrictionExceptions(lua_State *lua_state)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to parse an relation as turn restriction. This can fail for a number of
|
||||
* reasons, this the return type is a mapbox::util::optional<>.
|
||||
*
|
||||
* Some restrictions can also be ignored: See the ```get_exceptions``` function
|
||||
* in the corresponding profile.
|
||||
*/
|
||||
mapbox::util::optional<InputRestrictionContainer>
|
||||
RestrictionParser::TryParse(const osmium::Relation &relation) const
|
||||
{
|
||||
|
@ -41,6 +41,24 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
struct lua_State;
|
||||
class ScriptingEnvironment;
|
||||
|
||||
/**
|
||||
* Parses the relations that represents turn restrictions.
|
||||
*
|
||||
* Currently only restrictions where the via objects is a node are supported.
|
||||
* from via to
|
||||
* ------->(x)-------->
|
||||
*
|
||||
* While this class does not directly invoke any lua code _per relation_ it does
|
||||
* load configuration values from the profile, that are saved in variables.
|
||||
* Namely ```use_turn_restrictions``` and ```get_exceptions```.
|
||||
*
|
||||
* The restriction is represented by the osm id of the from way, the osm id of the
|
||||
* to way and the osm id of the via node. This representation must be post-processed
|
||||
* in the extractor to work with the edge-based data-model of OSRM:
|
||||
* Since the from and to way share the via-way as node a turn will have the following form:
|
||||
* ...----(a)-----(via)------(b)----...
|
||||
* So it can be represented by the tripe (a, via, b).
|
||||
*/
|
||||
class RestrictionParser
|
||||
{
|
||||
public:
|
||||
@ -53,7 +71,6 @@ class RestrictionParser
|
||||
void ReadRestrictionExceptions(lua_State *lua_state);
|
||||
bool ShouldIgnoreRestriction(const std::string &except_tag_string) const;
|
||||
|
||||
// lua_State *lua_state;
|
||||
std::vector<std::string> restriction_exceptions;
|
||||
bool use_turn_restrictions;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user