Skip to content

Commit

Permalink
Fixes issue #101. Target nodes close to bollards were neglected.
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisOSRM committed Feb 7, 2012
1 parent 9da8733 commit 5136853
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Contractor/EdgeBasedGraphFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5136853

Please sign in to comment.