Certain type of edges, i.e. ferries, are now properly ignored from
nearest neighbor lookup. Fixes ticket 59.
This commit is contained in:
@@ -118,6 +118,18 @@ public:
|
||||
w.roundabout = true;
|
||||
}
|
||||
|
||||
//Is the route tag listed as usable way in the profile?
|
||||
if(settings[route] > 0 || settings[man_made] > 0) {
|
||||
w.useful = true;
|
||||
w.speed = settings[route];
|
||||
w.direction = _Way::bidirectional;
|
||||
if(0 < settings[route])
|
||||
highway = route;
|
||||
else if (0 < settings[man_made]) {
|
||||
highway = man_made;
|
||||
}
|
||||
}
|
||||
|
||||
//Is the highway tag listed as usable way?
|
||||
if(0 < settings[highway] || "yes" == accessTag || "designated" == accessTag) {
|
||||
|
||||
@@ -154,22 +166,14 @@ public:
|
||||
w.direction = _Way::opposite;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Is the route tag listed as usable way in the profile?
|
||||
if(settings[route] > 0 || settings[man_made] > 0) {
|
||||
w.useful = true;
|
||||
w.speed = settings[route];
|
||||
w.direction = _Way::bidirectional;
|
||||
if(0 < settings[route])
|
||||
highway = route;
|
||||
else if (0 < settings[man_made]) {
|
||||
highway = man_made;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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?
|
||||
w.type = settings.GetHighwayTypeID(highway);
|
||||
if(0 > w.type) {
|
||||
ERR("Resolved highway " << highway << " to " << w.type);
|
||||
}
|
||||
|
||||
//Get the unique identifier for the street name
|
||||
const StringMap::const_iterator strit = stringMap->find(w.name);
|
||||
@@ -195,7 +199,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));
|
||||
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));
|
||||
externalMemory->usedNodeIDs.push_back(w.path[n]);
|
||||
}
|
||||
externalMemory->usedNodeIDs.push_back(w.path[w.path.size()-1]);
|
||||
|
||||
@@ -36,7 +36,7 @@ struct _PathData {
|
||||
};
|
||||
|
||||
typedef boost::unordered_map<std::string, NodeID > StringMap;
|
||||
typedef boost::unordered_map<std::string, std::pair<int, int> > StringToIntPairMap;
|
||||
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) {}
|
||||
@@ -134,10 +134,12 @@ struct _Relation {
|
||||
};
|
||||
|
||||
struct _Edge {
|
||||
_Edge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0), isRoundabout(false) {};
|
||||
_Edge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0), isRoundabout(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) { }
|
||||
_Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra) { }
|
||||
_Edge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(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) { }
|
||||
_Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra, bool iing): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing) {
|
||||
assert(0 <= type);
|
||||
}
|
||||
NodeID start;
|
||||
NodeID target;
|
||||
short type;
|
||||
@@ -145,6 +147,7 @@ struct _Edge {
|
||||
double speed;
|
||||
unsigned nameID;
|
||||
bool isRoundabout;
|
||||
bool ignoreInGrid;
|
||||
|
||||
_Coordinate startCoord;
|
||||
_Coordinate targetCoord;
|
||||
@@ -265,10 +268,11 @@ struct Settings {
|
||||
}
|
||||
int GetHighwayTypeID(const std::string & param) const {
|
||||
if(param == excludeFromGrid) {
|
||||
return INT_MAX;
|
||||
return SHRT_MAX;
|
||||
}
|
||||
assert(param != "ferry");
|
||||
if(speedProfile.find(param) == speedProfile.end()) {
|
||||
DEBUG("There is a bug with highway \"" << param << "\"");
|
||||
ERR("There is a bug with highway \"" << param << "\"");
|
||||
return -1;
|
||||
} else {
|
||||
return speedProfile.at(param).second;
|
||||
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
|
||||
/** Default constructor. target and weight are set to 0.*/
|
||||
NodeBasedEdge() :
|
||||
_source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _type(0), _roundabout(false) { assert(false); } //shall not be used.
|
||||
_source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _type(0), _roundabout(false), _ignoreInGrid(false) { assert(false); } //shall not be used.
|
||||
|
||||
explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, short ty, bool ra) :
|
||||
_source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _type(ty), _roundabout(ra) { assert(ty >= 0); }
|
||||
explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, short ty, bool ra, bool ig) :
|
||||
_source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _type(ty), _roundabout(ra), _ignoreInGrid(ig) { if(ty < 0) {ERR("Type: " << ty);}; }
|
||||
|
||||
NodeID target() const {return _target; }
|
||||
NodeID source() const {return _source; }
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
bool isForward() const { return forward; }
|
||||
bool isLocatable() const { return _type != 14; }
|
||||
bool isRoundabout() const { return _roundabout; }
|
||||
bool ignoreInGrid() const { return _ignoreInGrid; }
|
||||
|
||||
NodeID _source;
|
||||
NodeID _target;
|
||||
@@ -66,6 +67,7 @@ public:
|
||||
bool backward;
|
||||
short _type;
|
||||
bool _roundabout;
|
||||
bool _ignoreInGrid;
|
||||
};
|
||||
|
||||
class EdgeBasedEdge {
|
||||
|
||||
@@ -85,12 +85,13 @@ public:
|
||||
ramInFile.close();
|
||||
}
|
||||
|
||||
template<typename EdgeT, typename NodeInfoT>
|
||||
void ConstructGrid(std::vector<EdgeT> & edgeList, std::vector<NodeInfoT> * int2ExtNodeMap, char * ramIndexOut, char * fileIndexOut) {
|
||||
template<typename EdgeT>
|
||||
void ConstructGrid(std::vector<EdgeT> & edgeList, char * ramIndexOut, char * fileIndexOut) {
|
||||
Percent p(edgeList.size());
|
||||
BOOST_FOREACH(EdgeT & edge, edgeList) {
|
||||
p.printIncrement();
|
||||
|
||||
if(edge.ignoreInGrid)
|
||||
continue;
|
||||
int slat = 100000*lat2y(edge.lat1/100000.);
|
||||
int slon = edge.lon1;
|
||||
int tlat = 100000*lat2y(edge.lat2/100000.);
|
||||
|
||||
Reference in New Issue
Block a user