Bicycles allowed on oneways except motorways. Implements changes from
pull request (issue 54)
This commit is contained in:
parent
f5226b2228
commit
90502a0c15
@ -98,7 +98,6 @@ public:
|
|||||||
std::string highway( w.keyVals.Find("highway") );
|
std::string highway( w.keyVals.Find("highway") );
|
||||||
std::string name( w.keyVals.Find("name") );
|
std::string name( w.keyVals.Find("name") );
|
||||||
std::string ref( w.keyVals.Find("ref"));
|
std::string ref( w.keyVals.Find("ref"));
|
||||||
std::string oneway( w.keyVals.Find("oneway"));
|
|
||||||
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( atoi(w.keyVals.Find("maxspeed").c_str()) );
|
int maxspeed( atoi(w.keyVals.Find("maxspeed").c_str()) );
|
||||||
@ -106,6 +105,9 @@ public:
|
|||||||
std::string accessTag( w.keyVals.Find(settings.accessTag) );
|
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 onewayClass( w.keyVals.Find("oneway:"+settings.accessTag));
|
||||||
|
std::string cycleway( w.keyVals.Find("cycleway"));
|
||||||
|
|
||||||
//Save the name of the way if it has one, ref has precedence over name tag.
|
//Save the name of the way if it has one, ref has precedence over name tag.
|
||||||
if ( 0 < ref.length() )
|
if ( 0 < ref.length() )
|
||||||
@ -156,24 +158,29 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Let's process oneway property, if speed profile obeys to it
|
if( settings.obeyOneways ) {
|
||||||
if(oneway != "no" && oneway != "false" && oneway != "0" && settings.obeyOneways) {
|
if( oneway == "no" || oneway == "0" || oneway == "false" || onewayClass == "no" || onewayClass == "0" || onewayClass == "false" || ((settings.accessTag == "bicycle") && (cycleway == "opposite" || cycleway == "opposite_track" || cycleway == "opposite_lane")) ) {
|
||||||
//if oneway tag is in forward direction or if actually roundabout
|
w.direction = _Way::bidirectional;
|
||||||
if(junction == "roundabout" || oneway == "yes" || oneway == "true" || oneway == "1") {
|
} else if( oneway == "-1") {
|
||||||
|
w.direction = _Way::opposite;
|
||||||
|
std::reverse( w.path.begin(), w.path.end() );
|
||||||
|
}
|
||||||
|
else if( oneway == "yes" || oneway == "1" || oneway == "true" || onewayClass == "yes" || onewayClass == "1" || onewayClass == "true" || junction == "roundabout" || highway == "motorway_link" || highway == "motorway" ) {
|
||||||
w.direction = _Way::oneway;
|
w.direction = _Way::oneway;
|
||||||
} else {
|
} else {
|
||||||
if( oneway == "-1")
|
w.direction = _Way::bidirectional;
|
||||||
w.direction = _Way::opposite;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
w.direction = _Way::bidirectional;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( w.useful && w.access && (1 < w.path.size()) ) { //Only true if the way is specified by the speed profile
|
if ( w.useful && w.access && (1 < w.path.size()) ) { //Only true if the way is specified by the speed profile
|
||||||
//TODO: type is not set, perhaps use a bimap'ed speed profile to do set the type correctly?
|
//TODO: type is not set, perhaps use a bimap'ed speed profile to do set the type correctly?
|
||||||
w.type = settings.GetHighwayTypeID(highway);
|
w.type = settings.GetHighwayTypeID(highway);
|
||||||
if(0 > w.type) {
|
if(0 > w.type) {
|
||||||
ERR("Resolved highway " << highway << " to " << w.type);
|
ERR("Resolved highway " << highway << " to " << w.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the unique identifier for the street name
|
//Get the unique identifier for the street name
|
||||||
const StringMap::const_iterator strit = stringMap->find(w.name);
|
const StringMap::const_iterator strit = stringMap->find(w.name);
|
||||||
|
Loading…
Reference in New Issue
Block a user