diff --git a/DataStructures/ExtractorCallBacks.h b/DataStructures/ExtractorCallBacks.h index 6578fc8e2..b91f8122b 100644 --- a/DataStructures/ExtractorCallBacks.h +++ b/DataStructures/ExtractorCallBacks.h @@ -144,6 +144,7 @@ public: std::string onewayClass( w.keyVals.Find("oneway:"+settings.accessTag)); std::string cycleway( w.keyVals.Find("cycleway")); std::string duration ( w.keyVals.Find("duration")); + std::string service (w.keyVals.Find("service")); //Save the name of the way if it has one, ref has precedence over name tag. if ( 0 < ref.length() ) @@ -200,9 +201,18 @@ public: //Okay, do we have access to that way? if(0 < access.size()) { //fastest way to check for non-empty string //If access is forbidden, we don't want to route there. - if(access == "private" || access == "no" || access == "agricultural" || access == "forestry" || access == "delivery") { //Todo: this is still hard coded + if(access == "no" || access == "agricultural" || access == "forestry" || access == "delivery") { //Todo: this is still hard coded w.access = false; } + if(settings.accessRestrictionKeys.find(access) != settings.accessRestrictionKeys.end()) { + w.isAccessRestricted = true; + } + } + + if(0 < service.size()) { + if(settings.accessRestrictedService.find(service) != settings.accessRestrictedService.end()) { + w.isAccessRestricted = true; + } } if("no" == accessTag) { @@ -262,7 +272,7 @@ public: } for(vector< NodeID >::size_type n = 0; n < w.path.size()-1; ++n) { - externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID, w.roundabout, highway == settings.excludeFromGrid || "pier" == highway, w.isDurationSet)); + externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID, w.roundabout, highway == settings.excludeFromGrid || "pier" == highway, w.isDurationSet, w.isAccessRestricted)); externalMemory->usedNodeIDs.push_back(w.path[n]); } externalMemory->usedNodeIDs.push_back(w.path[w.path.size()-1]); diff --git a/DataStructures/ExtractorStructs.h b/DataStructures/ExtractorStructs.h index 0b0318c69..ad0b1f411 100644 --- a/DataStructures/ExtractorStructs.h +++ b/DataStructures/ExtractorStructs.h @@ -92,6 +92,7 @@ struct _Way { access = true; roundabout = false; isDurationSet = false; + isAccessRestricted = false; } enum { @@ -106,6 +107,7 @@ struct _Way { bool access; bool roundabout; bool isDurationSet; + bool isAccessRestricted; std::vector< NodeID > path; HashTable keyVals; }; @@ -142,7 +144,7 @@ struct _Edge { _Edge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false) {}; _Edge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false) { } _Edge(NodeID s, NodeID t, short tp, short d, double sp): start(s), target(t), type(tp), direction(d), speed(sp), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false) { } - _Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing, bool ids): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids) { + _Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar) { assert(0 <= type); } NodeID start; @@ -154,6 +156,7 @@ struct _Edge { bool isRoundabout; bool ignoreInGrid; bool isDurationSet; + bool isAccessRestricted; _Coordinate startCoord; _Coordinate targetCoord; @@ -292,6 +295,8 @@ struct Settings { int defaultSpeed; bool takeMinimumOfSpeeds; std::string excludeFromGrid; + boost::unordered_map accessRestrictedService; + boost::unordered_map accessRestrictionKeys; }; struct Cmp : public std::binary_function { diff --git a/Plugins/ViaRoutePlugin.h b/Plugins/ViaRoutePlugin.h index bc5d48301..a512d6fcd 100644 --- a/Plugins/ViaRoutePlugin.h +++ b/Plugins/ViaRoutePlugin.h @@ -88,6 +88,7 @@ public: // } std::vector textCoord; for(unsigned i = 0; i < routeParameters.viaPoints.size(); ++i) { + textCoord.resize(0); stringSplit (routeParameters.viaPoints[i], ',', textCoord); if(textCoord.size() != 2) { reply = http::Reply::stockReply(http::Reply::badRequest);