access=destination and similar tags get parsed by extractor
This commit is contained in:
parent
1a224e2adc
commit
bd2c99d9ec
@ -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]);
|
||||
|
@ -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<std::string, std::string> 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<std::string, bool> accessRestrictedService;
|
||||
boost::unordered_map<std::string, bool> accessRestrictionKeys;
|
||||
};
|
||||
|
||||
struct Cmp : public std::binary_function<NodeID, NodeID, bool> {
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
// }
|
||||
std::vector<std::string> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user