Fixes issue #101. Target nodes close to bollards were neglected.

This commit is contained in:
DennisOSRM 2012-02-07 19:40:25 +01:00
parent 9da873330a
commit 5136853ce0

View File

@ -129,8 +129,7 @@ void EdgeBasedGraphFactory::Run() {
for(_NodeBasedDynamicGraph::EdgeIterator e1 = _nodeBasedGraph->BeginEdges(u); e1 < _nodeBasedGraph->EndEdges(u); ++e1) {
++nodeBasedEdgeCounter;
_NodeBasedDynamicGraph::NodeIterator v = _nodeBasedGraph->GetTarget(e1);
if(_bollardNodes.Find(v) == true)
continue;
//loop over all reachable edges (v,w)
bool isOnlyAllowed(false);
@ -174,8 +173,15 @@ void EdgeBasedGraphFactory::Run() {
edgeBasedNodes.push_back(currentNode);
}
if(_bollardNodes.Find(v) == true) {
numberOfSkippedTurns += _nodeBasedGraph->EndEdges(v) - _nodeBasedGraph->BeginEdges(v);
continue;
}
for(_NodeBasedDynamicGraph::EdgeIterator e2 = _nodeBasedGraph->BeginEdges(v); e2 < _nodeBasedGraph->EndEdges(v); ++e2) {
_NodeBasedDynamicGraph::NodeIterator w = _nodeBasedGraph->GetTarget(e2);
//if (u,v,w) is a forbidden turn, continue
if(isOnlyAllowed && w != onlyToNode) {
//We are at an only_-restriction but not at the right turn.
@ -224,6 +230,21 @@ void EdgeBasedGraphFactory::Run() {
EdgeBasedEdge newEdge(edgeBasedSource, edgeBasedTarget, v, nameID, distance, true, false, turnInstruction);
edgeBasedEdges.push_back(newEdge);
if(_bollardNodes.Find(w) == true){
// INFO("[" << w << "] loc: " << inputNodeInfoList[w].lat << "," << inputNodeInfoList[w].lon << ", tgt: " << edgeBasedTarget);
//if node v is a bollard, then we need to add e2 as target node to the new set of edgebased nodes.
//Otherwise it will not be possible to route to route to this node
EdgeBasedNode currentNode;
currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).nameID;
currentNode.lat1 = inputNodeInfoList[v].lat;
currentNode.lon1 = inputNodeInfoList[v].lon;
currentNode.lat2 = inputNodeInfoList[w].lat;
currentNode.lon2 = inputNodeInfoList[w].lon;
currentNode.id = edgeBasedTarget;
currentNode.ignoreInGrid = _nodeBasedGraph->GetEdgeData(e2).ignoreInGrid;
edgeBasedNodes.push_back(currentNode);
}
if(_nodeBasedGraph->GetEdgeData(e1).type != SHRT_MAX ) {
EdgeBasedNode currentNode;
currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).nameID;