Minor change: Removing dead code

This commit is contained in:
DennisOSRM 2011-12-13 10:12:41 +01:00
parent 8e9461ea6a
commit 85f9b398da
2 changed files with 32 additions and 22 deletions

View File

@ -88,8 +88,14 @@ void EdgeBasedGraphFactory::GetEdgeBasedEdges( std::vector< EdgeBasedEdge >& out
} }
void EdgeBasedGraphFactory::GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nodes) { void EdgeBasedGraphFactory::GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nodes) {
for(unsigned i = 0; i < edgeBasedNodes.size(); ++i) BOOST_FOREACH(EdgeBasedNode & node, edgeBasedNodes){
nodes.push_back(edgeBasedNodes[i]); assert(node.lat1 != INT_MAX);
assert(node.lat2 != INT_MAX);
assert(node.lon1 != INT_MAX);
assert(node.lon2 != INT_MAX);
nodes.push_back(node);
}
} }
void EdgeBasedGraphFactory::Run() { void EdgeBasedGraphFactory::Run() {
@ -133,8 +139,21 @@ void EdgeBasedGraphFactory::Run() {
currentNode.lon1 = inputNodeInfoList[u].lon; currentNode.lon1 = inputNodeInfoList[u].lon;
currentNode.lat2 = inputNodeInfoList[v].lat; currentNode.lat2 = inputNodeInfoList[v].lat;
currentNode.lon2 = inputNodeInfoList[v].lon; currentNode.lon2 = inputNodeInfoList[v].lon;
currentNode.id = _nodeBasedGraph->GetEdgeData(e1).edgeBasedNodeID;; currentNode.id = _nodeBasedGraph->GetEdgeData(e1).edgeBasedNodeID;
short startHeight = srtmLookup.height(currentNode.lon1/100000.,currentNode.lat1/100000. );
short targetHeight = srtmLookup.height(currentNode.lon2/100000.,currentNode.lat2/100000. );
short heightDiff = startHeight - targetHeight;
double increase = (heightDiff/ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2));
if(heightDiff != 0)
INFO("Increase at dead-end street: " << heightDiff << ", edge length: " << ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2) << ", percentage: " << increase );
//incorporate height diff;
//todo: get some exponential function to converge to one for n->\infty
currentNode.weight = _nodeBasedGraph->GetEdgeData(e1).distance; currentNode.weight = _nodeBasedGraph->GetEdgeData(e1).distance;
// if(increase > 0)
// currentNode.weight *= (1.+increase);
edgeBasedNodes.push_back(currentNode); edgeBasedNodes.push_back(currentNode);
} }
for(_NodeBasedDynamicGraph::EdgeIterator e2 = _nodeBasedGraph->BeginEdges(v); e2 < _nodeBasedGraph->EndEdges(v); ++e2) { for(_NodeBasedDynamicGraph::EdgeIterator e2 = _nodeBasedGraph->BeginEdges(v); e2 < _nodeBasedGraph->EndEdges(v); ++e2) {
@ -176,9 +195,9 @@ void EdgeBasedGraphFactory::Run() {
} }
//incorporate turn costs, this is just a simple model and can (read: must) be extended //incorporate turn costs, this is just a simple model and can (read: must) be extended
double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]); // double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]);
unsigned distance = (int)( _nodeBasedGraph->GetEdgeData(e1).distance *(1+std::abs((angle-180.)/180.))); unsigned distance = _nodeBasedGraph->GetEdgeData(e1).distance;//(int)( _nodeBasedGraph->GetEdgeData(e1).distance *(1+std::abs((angle-180.)/180.)));
unsigned nameID = _nodeBasedGraph->GetEdgeData(e2).nameID; unsigned nameID = _nodeBasedGraph->GetEdgeData(e2).nameID;
short turnInstruction = AnalyzeTurn(u, v, w); short turnInstruction = AnalyzeTurn(u, v, w);
@ -188,14 +207,19 @@ void EdgeBasedGraphFactory::Run() {
if(_nodeBasedGraph->GetEdgeData(e1).type != 14 ) { if(_nodeBasedGraph->GetEdgeData(e1).type != 14 ) {
EdgeBasedNode currentNode; EdgeBasedNode currentNode;
currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).nameID; currentNode.nameID = _nodeBasedGraph->GetEdgeData(e1).nameID;
currentNode.lat1 = inputNodeInfoList[u].lat; currentNode.lat1 = inputNodeInfoList[u].lat;
currentNode.lon1 = inputNodeInfoList[u].lon; currentNode.lon1 = inputNodeInfoList[u].lon;
currentNode.lat2 = inputNodeInfoList[v].lat; currentNode.lat2 = inputNodeInfoList[v].lat;
currentNode.lon2 = inputNodeInfoList[v].lon; currentNode.lon2 = inputNodeInfoList[v].lon;
currentNode.id = edgeBasedSource; currentNode.id = edgeBasedSource;
currentNode.weight = _nodeBasedGraph->GetEdgeData(e1).distance; short startHeight = srtmLookup.height(currentNode.lon1/100000.,currentNode.lat1/100000. );
short targetHeight = srtmLookup.height(currentNode.lon2/100000.,currentNode.lat2/100000. );
short heightDiff = startHeight - targetHeight;
double increase = (heightDiff/ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2));
if(heightDiff != 0)
INFO("Increase at turn: " << heightDiff << ", edge length: " << ApproximateDistance(currentNode.lat1, currentNode.lon1, currentNode.lat2, currentNode.lon2) << ", percentage: " << increase ); //incorporate height diff;
currentNode.weight = distance;
edgeBasedNodes.push_back(currentNode); edgeBasedNodes.push_back(currentNode);
} }
} else { } else {
@ -251,7 +275,7 @@ short EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const N
} }
unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const { unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
return edgeBasedEdges.size(); return _nodeBasedGraph->GetNumberOfEdges();
} }
EdgeBasedGraphFactory::~EdgeBasedGraphFactory() { EdgeBasedGraphFactory::~EdgeBasedGraphFactory() {

View File

@ -75,20 +75,6 @@ public:
InitializeThreadLocalStorageIfNecessary(); InitializeThreadLocalStorageIfNecessary();
NodeID middle = ( NodeID ) UINT_MAX; NodeID middle = ( NodeID ) UINT_MAX;
/* bool stOnSameEdge = false;
//Handling the special case that origin and destination are on same edge and that the order is correct.
if(phantomNodes.PhantomsAreOnSameNodeBasedEdge()){
if(phantomNodes.startPhantom.isBidirected() && phantomNodes.targetPhantom.isBidirected()) {
int weight = std::abs(phantomNodes.startPhantom.weight1 - phantomNodes.targetPhantom.weight1);
return weight;
} else if(phantomNodes.startPhantom.weight1 <= phantomNodes.targetPhantom.weight1){
int weight = std::abs(phantomNodes.startPhantom.weight1 - phantomNodes.targetPhantom.weight1);
return weight;
} else {
stOnSameEdge = true;
}
}
*/
//insert start and/or target node of start edge //insert start and/or target node of start edge
_forwardHeap->Insert(phantomNodes.startPhantom.edgeBasedNode, -phantomNodes.startPhantom.weight1, phantomNodes.startPhantom.edgeBasedNode); _forwardHeap->Insert(phantomNodes.startPhantom.edgeBasedNode, -phantomNodes.startPhantom.weight1, phantomNodes.startPhantom.edgeBasedNode);
// INFO("a) forw insert " << phantomNodes.startPhantom.edgeBasedNode << ", weight: " << -phantomNodes.startPhantom.weight1); // INFO("a) forw insert " << phantomNodes.startPhantom.edgeBasedNode << ", weight: " << -phantomNodes.startPhantom.weight1);