barrier=bollard is now used. Fixes ticket #9 and saves about .5% RAM in
metropolitan areas
This commit is contained in:
@@ -39,18 +39,21 @@ typedef boost::unordered_map<std::string, NodeID > StringMap;
|
||||
typedef boost::unordered_map<std::string, std::pair<int, short> > StringToIntPairMap;
|
||||
|
||||
struct _Node : NodeInfo{
|
||||
_Node(int _lat, int _lon, unsigned int _id) : NodeInfo(_lat, _lon, _id) {}
|
||||
_Node() {}
|
||||
_Node(int _lat, int _lon, unsigned int _id, bool _bollard, bool _trafficLight) : NodeInfo(_lat, _lon, _id), bollard(_bollard), trafficLight(_trafficLight) {}
|
||||
_Node() : bollard(false), trafficLight(false) {}
|
||||
|
||||
static _Node min_value() {
|
||||
return _Node(0,0,0);
|
||||
return _Node(0,0,0, false, false);
|
||||
}
|
||||
static _Node max_value() {
|
||||
return _Node((numeric_limits<int>::max)(), (numeric_limits<int>::max)(), (numeric_limits<unsigned int>::max)());
|
||||
return _Node((numeric_limits<int>::max)(), (numeric_limits<int>::max)(), (numeric_limits<unsigned int>::max)(), false, false);
|
||||
}
|
||||
NodeID key() const {
|
||||
return id;
|
||||
}
|
||||
bool bollard;
|
||||
bool trafficLight;
|
||||
|
||||
};
|
||||
|
||||
struct _Coordinate {
|
||||
@@ -258,7 +261,7 @@ struct CmpWayByID : public std::binary_function<_WayIDStartAndEndEdge, _WayIDSta
|
||||
};
|
||||
|
||||
struct Settings {
|
||||
Settings() : obeyPollards(true), obeyOneways(true), useRestrictions(true), accessTag("motorcar"), defaultSpeed(30), excludeFromGrid("ferry") {}
|
||||
Settings() : obeyBollards(true), obeyOneways(true), useRestrictions(true), accessTag("motorcar"), defaultSpeed(30), trafficLightPenalty(0), excludeFromGrid("ferry") {}
|
||||
StringToIntPairMap speedProfile;
|
||||
int operator[](const std::string & param) const {
|
||||
if(speedProfile.find(param) == speedProfile.end())
|
||||
@@ -278,11 +281,12 @@ struct Settings {
|
||||
return speedProfile.at(param).second;
|
||||
}
|
||||
}
|
||||
bool obeyPollards;
|
||||
bool obeyBollards;
|
||||
bool obeyOneways;
|
||||
bool useRestrictions;
|
||||
std::string accessTag;
|
||||
int defaultSpeed;
|
||||
int trafficLightPenalty;
|
||||
std::string excludeFromGrid;
|
||||
};
|
||||
|
||||
|
||||
@@ -219,6 +219,13 @@ private:
|
||||
int keyValue = dense.keys_vals ( denseTagIndex+1 );
|
||||
std::string key = threadData->PBFprimitiveBlock.stringtable().s(tagValue).data();
|
||||
std::string value = threadData->PBFprimitiveBlock.stringtable().s(keyValue).data();
|
||||
|
||||
if("barrier" == key && "bollard" == value) {
|
||||
n.bollard = true;
|
||||
}
|
||||
if("highway" == key && "traffic_signals" == value) {
|
||||
n.trafficLight = true;
|
||||
}
|
||||
keyVals.Add(key, value);
|
||||
denseTagIndex += 2;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,12 @@ private:
|
||||
if ( k != NULL && value != NULL ) {
|
||||
if ( xmlStrEqual( k, ( const xmlChar* ) "highway" ) == 1 ) {
|
||||
if ( xmlStrEqual( value, ( const xmlChar* ) "traffic_signals" ) == 1 ){
|
||||
//node.trafficSignal = true;
|
||||
node.trafficLight = true;
|
||||
}
|
||||
}
|
||||
if ( xmlStrEqual( k, ( const xmlChar* ) "barrier" ) == 1 ) {
|
||||
if ( xmlStrEqual( value, ( const xmlChar* ) "bollard" ) == 1 ){
|
||||
node.bollard = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user