Merge branch 'master' of https://DennisOSRM@github.com/DennisOSRM/Project-OSRM.git
This commit is contained in:
commit
2901e6891c
@ -148,12 +148,9 @@ public:
|
|||||||
std::string junction( w.keyVals.Find("junction") );
|
std::string junction( w.keyVals.Find("junction") );
|
||||||
std::string route( w.keyVals.Find("route") );
|
std::string route( w.keyVals.Find("route") );
|
||||||
int maxspeed( parseMaxspeed(w.keyVals.Find("maxspeed")) );
|
int maxspeed( parseMaxspeed(w.keyVals.Find("maxspeed")) );
|
||||||
std::string access( w.keyVals.Find("access") );
|
|
||||||
std::string accessTag( w.keyVals.Find(settings.accessTag) );
|
|
||||||
std::string man_made( w.keyVals.Find("man_made") );
|
std::string man_made( w.keyVals.Find("man_made") );
|
||||||
std::string barrier( w.keyVals.Find("barrier") );
|
std::string barrier( w.keyVals.Find("barrier") );
|
||||||
std::string oneway( w.keyVals.Find("oneway"));
|
std::string oneway( w.keyVals.Find("oneway"));
|
||||||
std::string onewayClass( w.keyVals.Find("oneway:"+settings.accessTag));
|
|
||||||
std::string cycleway( w.keyVals.Find("cycleway"));
|
std::string cycleway( w.keyVals.Find("cycleway"));
|
||||||
std::string duration ( w.keyVals.Find("duration"));
|
std::string duration ( w.keyVals.Find("duration"));
|
||||||
std::string service (w.keyVals.Find("service"));
|
std::string service (w.keyVals.Find("service"));
|
||||||
@ -191,8 +188,28 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//determine the access value
|
||||||
|
std::string access;
|
||||||
|
std::string onewayClass;
|
||||||
|
std::string accessTag;
|
||||||
|
BOOST_FOREACH(std::string & s, settings.accessTags) {
|
||||||
|
access = std::string(w.keyVals.Find(s));
|
||||||
|
if(0 < access.size()) {
|
||||||
|
accessTag = s;
|
||||||
|
onewayClass = std::string(w.keyVals.Find("oneway:"+access));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(0 < access.size()) {
|
||||||
|
// handle ways with default access = no
|
||||||
|
if(settings.accessForbiddenDefault.find(access) != settings.accessForbiddenDefault.end()) {
|
||||||
|
access = std::string("no");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Is the highway tag listed as usable way?
|
//Is the highway tag listed as usable way?
|
||||||
if(("track" == highway && ("yes" == access || "yes" == accessTag)) || ("track" != highway && (0 < settings[highway] || "yes" == accessTag || "designated" == accessTag) )) {
|
if(0 < settings[highway] || "yes" == access || "designated" == access) {
|
||||||
if(!w.isDurationSet) {
|
if(!w.isDurationSet) {
|
||||||
if(0 < settings[highway]) {
|
if(0 < settings[highway]) {
|
||||||
if(0 < maxspeed)
|
if(0 < maxspeed)
|
||||||
@ -217,7 +234,7 @@ public:
|
|||||||
//Okay, do we have access to that way?
|
//Okay, do we have access to that way?
|
||||||
if(0 < access.size()) { //fastest way to check for non-empty string
|
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 is forbidden, we don't want to route there.
|
||||||
if(access == "no" || access == "agricultural" || access == "forestry" || access == "delivery") { //Todo: this is still hard coded
|
if(settings.accessForbiddenKeys.find(access) != settings.accessForbiddenKeys.end()) {
|
||||||
w.access = false;
|
w.access = false;
|
||||||
}
|
}
|
||||||
if(settings.accessRestrictionKeys.find(access) != settings.accessRestrictionKeys.end()) {
|
if(settings.accessRestrictionKeys.find(access) != settings.accessRestrictionKeys.end()) {
|
||||||
@ -231,7 +248,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if("no" == accessTag) {
|
if("no" == access) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +261,7 @@ public:
|
|||||||
w.direction = _Way::opposite;
|
w.direction = _Way::opposite;
|
||||||
} else if( oneway == "no" || oneway == "0" || oneway == "false" ) {
|
} else if( oneway == "no" || oneway == "0" || oneway == "false" ) {
|
||||||
w.direction = _Way::bidirectional;
|
w.direction = _Way::bidirectional;
|
||||||
} else if( settings.accessTag == "bicycle" && (cycleway == "opposite" || cycleway == "opposite_track" || cycleway == "opposite_lane") ) {
|
} else if( accessTag == "bicycle" && (cycleway == "opposite" || cycleway == "opposite_track" || cycleway == "opposite_lane") ) {
|
||||||
w.direction = _Way::bidirectional;
|
w.direction = _Way::bidirectional;
|
||||||
} else if( oneway == "-1") {
|
} else if( oneway == "-1") {
|
||||||
w.direction = _Way::opposite;
|
w.direction = _Way::opposite;
|
||||||
|
@ -270,7 +270,7 @@ struct CmpWayByID : public std::binary_function<_WayIDStartAndEndEdge, _WayIDSta
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
Settings() : obeyBollards(true), obeyOneways(true), useRestrictions(true), ignoreAreas(false), accessTag("motorcar"), defaultSpeed(30), takeMinimumOfSpeeds(false), excludeFromGrid("ferry") {}
|
Settings() : obeyBollards(true), obeyOneways(true), useRestrictions(true), ignoreAreas(false), defaultSpeed(30), takeMinimumOfSpeeds(false), excludeFromGrid("ferry") {}
|
||||||
StringToIntPairMap speedProfile;
|
StringToIntPairMap speedProfile;
|
||||||
int operator[](const std::string & param) const {
|
int operator[](const std::string & param) const {
|
||||||
if(speedProfile.find(param) == speedProfile.end())
|
if(speedProfile.find(param) == speedProfile.end())
|
||||||
@ -294,12 +294,14 @@ struct Settings {
|
|||||||
bool obeyOneways;
|
bool obeyOneways;
|
||||||
bool useRestrictions;
|
bool useRestrictions;
|
||||||
bool ignoreAreas;
|
bool ignoreAreas;
|
||||||
std::string accessTag;
|
std::vector<std::string> accessTags;
|
||||||
int defaultSpeed;
|
int defaultSpeed;
|
||||||
bool takeMinimumOfSpeeds;
|
bool takeMinimumOfSpeeds;
|
||||||
std::string excludeFromGrid;
|
std::string excludeFromGrid;
|
||||||
boost::unordered_map<std::string, bool> accessRestrictedService;
|
boost::unordered_map<std::string, bool> accessRestrictedService;
|
||||||
boost::unordered_map<std::string, bool> accessRestrictionKeys;
|
boost::unordered_map<std::string, bool> accessRestrictionKeys;
|
||||||
|
boost::unordered_map<std::string, bool> accessForbiddenKeys;
|
||||||
|
boost::unordered_map<std::string, bool> accessForbiddenDefault;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Cmp : public std::binary_function<NodeID, NodeID, bool> {
|
struct Cmp : public std::binary_function<NodeID, NodeID, bool> {
|
||||||
|
@ -137,8 +137,10 @@ int main (int argc, char *argv[]) {
|
|||||||
} else if(name == "useRestrictions") {
|
} else if(name == "useRestrictions") {
|
||||||
if(value == "no")
|
if(value == "no")
|
||||||
settings.useRestrictions = false;
|
settings.useRestrictions = false;
|
||||||
} else if(name == "accessTag") {
|
} else if(name == "accessTags") {
|
||||||
settings.accessTag = value;
|
std::vector<std::string> tokens;
|
||||||
|
stringSplit(value, ',', tokens);
|
||||||
|
settings.accessTags = tokens;
|
||||||
} else if(name == "excludeFromGrid") {
|
} else if(name == "excludeFromGrid") {
|
||||||
settings.excludeFromGrid = value;
|
settings.excludeFromGrid = value;
|
||||||
} else if(name == "defaultSpeed") {
|
} else if(name == "defaultSpeed") {
|
||||||
@ -166,6 +168,24 @@ int main (int argc, char *argv[]) {
|
|||||||
INFO("adding " << s << " to accessRestrictionKeys");
|
INFO("adding " << s << " to accessRestrictionKeys");
|
||||||
settings.accessRestrictionKeys.insert(std::make_pair(s, true));
|
settings.accessRestrictionKeys.insert(std::make_pair(s, true));
|
||||||
}
|
}
|
||||||
|
} else if( name == "accessForbiddenKeys") {
|
||||||
|
//split value at commas
|
||||||
|
std::vector<std::string> tokens;
|
||||||
|
stringSplit(value, ',', tokens);
|
||||||
|
//put each value into map
|
||||||
|
BOOST_FOREACH(std::string & s, tokens) {
|
||||||
|
INFO("adding " << s << " to accessForbiddenKeys");
|
||||||
|
settings.accessForbiddenKeys.insert(std::make_pair(s, true));
|
||||||
|
}
|
||||||
|
} else if( name == "accessForbiddenDefault") {
|
||||||
|
//split value at commas
|
||||||
|
std::vector<std::string> tokens;
|
||||||
|
stringSplit(value, ',', tokens);
|
||||||
|
//put each value into map
|
||||||
|
BOOST_FOREACH(std::string & s, tokens) {
|
||||||
|
INFO("adding " << s << " to accessForbiddenDefault");
|
||||||
|
settings.accessForbiddenDefault.insert(std::make_pair(s, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
settings.speedProfile[name] = std::make_pair(std::atoi(value.c_str()), settings.speedProfile.size() );
|
settings.speedProfile[name] = std::make_pair(std::atoi(value.c_str()), settings.speedProfile.size() );
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
obeyOneways = yes
|
obeyOneways = yes
|
||||||
useRestrictions = yes
|
useRestrictions = yes
|
||||||
ignoreAreas = yes
|
ignoreAreas = yes
|
||||||
accessTag = motorcar
|
accessTags = motorcar,motor_vehicle,vehicle,access
|
||||||
excludeFromGrid = ferry
|
excludeFromGrid = ferry
|
||||||
defaultSpeed = 50
|
defaultSpeed = 50
|
||||||
trafficSignalPenalty = 5
|
trafficSignalPenalty = 5
|
||||||
@ -28,6 +28,8 @@
|
|||||||
uturnPenalty = 20
|
uturnPenalty = 20
|
||||||
accessRestrictedService = parking_aisle
|
accessRestrictedService = parking_aisle
|
||||||
accessRestrictionKeys = destination,private,delivery
|
accessRestrictionKeys = destination,private,delivery
|
||||||
|
accessForbiddenKeys = no,private,agricultural,forestery
|
||||||
|
accessForbiddenDefault = track
|
||||||
[bike]
|
[bike]
|
||||||
trunk = 16
|
trunk = 16
|
||||||
trunk_link = 16
|
trunk_link = 16
|
||||||
@ -48,10 +50,12 @@
|
|||||||
pier = 5
|
pier = 5
|
||||||
obeyOneways = yes
|
obeyOneways = yes
|
||||||
useRestrictions = no
|
useRestrictions = no
|
||||||
accessTag = bicycle
|
accessTags = bicycle,vehicle,access
|
||||||
excludeFromGrid = ferry
|
excludeFromGrid = ferry
|
||||||
defaultSpeed = 5
|
defaultSpeed = 5
|
||||||
trafficSignalPenalty = 5
|
trafficSignalPenalty = 5
|
||||||
obeyBollards = no
|
obeyBollards = no
|
||||||
takeMinimumOfSpeeds = yes
|
takeMinimumOfSpeeds = yes
|
||||||
uturnPenalty = 20
|
uturnPenalty = 20
|
||||||
|
accessRestrictionKeys = destination,private,delivery
|
||||||
|
accessForbiddenKeys = no,private,agricultural,forestery
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[bicycle]
|
[bicycle]
|
||||||
accessTag = bicycle
|
accessTags = bicycle,vehicle,access
|
||||||
defaultSpeed = 17
|
defaultSpeed = 17
|
||||||
obeyOneways = yes
|
obeyOneways = yes
|
||||||
useRestrictions = yes
|
useRestrictions = yes
|
||||||
@ -25,4 +25,7 @@
|
|||||||
ferry = 5
|
ferry = 5
|
||||||
|
|
||||||
excludeFromGrid = ferry
|
excludeFromGrid = ferry
|
||||||
trafficSignalPenalty = 10
|
trafficSignalPenalty = 10
|
||||||
|
|
||||||
|
accessRestrictionKeys = destination,private,delivery
|
||||||
|
accessForbiddenKeys = no,private,agricultural,forestery
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[car]
|
[car]
|
||||||
accessTag = motorcar
|
accessTag = motorcar,motor_vehicle,vehicle,access
|
||||||
defaultSpeed = 50
|
defaultSpeed = 50
|
||||||
obeyOneways = yes
|
obeyOneways = yes
|
||||||
useRestrictions = yes
|
useRestrictions = yes
|
||||||
@ -21,3 +21,6 @@
|
|||||||
service = 20
|
service = 20
|
||||||
living_street = 10
|
living_street = 10
|
||||||
|
|
||||||
|
accessRestrictionKeys = destination,private,delivery
|
||||||
|
accessForbiddenKeys = no,private,agricultural,forestery
|
||||||
|
accessForbiddenDefault = track
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[ebike]
|
[ebike]
|
||||||
accessTag = bicycle
|
accessTags = bicycle,vehicle,access
|
||||||
obeyOneways = yes
|
obeyOneways = yes
|
||||||
defaultSpeed = 25
|
defaultSpeed = 25
|
||||||
useRestrictions = no
|
useRestrictions = no
|
||||||
@ -24,3 +24,6 @@ footway = 5
|
|||||||
ferry = 5
|
ferry = 5
|
||||||
|
|
||||||
excludeFromGrid = ferry
|
excludeFromGrid = ferry
|
||||||
|
|
||||||
|
accessRestrictionKeys = destination,private,delivery
|
||||||
|
accessForbiddenKeys = no,private,agricultural,forestery
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[foot]
|
[foot]
|
||||||
accessTag = foot
|
accessTags = foot,access
|
||||||
defaultSpeed = 5
|
defaultSpeed = 5
|
||||||
obeyOneways = no
|
obeyOneways = no
|
||||||
useRestrictions = no
|
useRestrictions = no
|
||||||
@ -26,3 +26,6 @@
|
|||||||
ferry = 5
|
ferry = 5
|
||||||
|
|
||||||
excludeFromGrid = ferry
|
excludeFromGrid = ferry
|
||||||
|
|
||||||
|
accessRestrictionKeys = destination,private,delivery
|
||||||
|
accessForbiddenKeys = no,private,agricultural,forestery
|
||||||
|
Loading…
Reference in New Issue
Block a user