Route description are generated
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "EdgeBasedGraphFactory.h"
|
||||
#include "../DataStructures/ExtractorStructs.h"
|
||||
|
||||
template<>
|
||||
EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdge> & inputEdges, std::vector<_Restriction> & irs, std::vector<NodeInfo> & nI)
|
||||
@@ -149,15 +148,7 @@ void EdgeBasedGraphFactory::Run() {
|
||||
newEdge.data.backward = false;
|
||||
newEdge.data.via = v;
|
||||
newEdge.data.nameID = _nodeBasedGraph->GetEdgeData(e2).middleName.nameID;
|
||||
//newEdge.data.nameID2 = _nodeBasedGraph->GetEdgeData(e2).middleName.nameID;
|
||||
//Todo: turn instruction angeben
|
||||
|
||||
if(newEdge.data.nameID == _nodeBasedGraph->GetEdgeData(e1).middleName.nameID)
|
||||
newEdge.data.turnInstruction = 0;
|
||||
else {
|
||||
//TODO: Winkel berechnen und angepasste Anweisung geben.
|
||||
newEdge.data.turnInstruction = 1;
|
||||
}
|
||||
newEdge.data.turnInstruction = AnalyzeTurn(u, v, w);
|
||||
//create Edge for NearestNeighborlookup
|
||||
edgeBasedEdges.push_back(newEdge);
|
||||
EdgeBasedNode currentNode;
|
||||
@@ -188,6 +179,19 @@ void EdgeBasedGraphFactory::Run() {
|
||||
INFO("Generated " << edgeBasedNodes.size() << " edge based nodes");
|
||||
}
|
||||
|
||||
short EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w) const {
|
||||
_NodeBasedDynamicGraph::EdgeIterator edge1 = _nodeBasedGraph->FindEdge(u, v);
|
||||
_NodeBasedDynamicGraph::EdgeIterator edge2 = _nodeBasedGraph->FindEdge(v, w);
|
||||
|
||||
_NodeBasedDynamicGraph::EdgeData data1 = _nodeBasedGraph->GetEdgeData(edge1);
|
||||
_NodeBasedDynamicGraph::EdgeData data2 = _nodeBasedGraph->GetEdgeData(edge2);
|
||||
|
||||
if(data1.middleName.nameID == data2.middleName.nameID) {
|
||||
return TurnInstructions.NoTurn;
|
||||
}
|
||||
return TurnInstructions.GoStraight;
|
||||
}
|
||||
|
||||
unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
|
||||
return edgeBasedEdges.size();
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "../DataStructures/ExtractorStructs.h"
|
||||
#include "../DataStructures/ImportEdge.h"
|
||||
#include "../DataStructures/Percent.h"
|
||||
#include "../DataStructures/TurnInstructions.h"
|
||||
|
||||
class EdgeBasedGraphFactory {
|
||||
private:
|
||||
@@ -56,7 +57,6 @@ private:
|
||||
int distance;
|
||||
unsigned via;
|
||||
unsigned nameID;
|
||||
// unsigned nameID2;
|
||||
bool forward;
|
||||
bool backward;
|
||||
short turnInstruction;
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
template< class ImportEdgeT >
|
||||
void GetEdgeBasedEdges( std::vector< ImportEdgeT >& edges );
|
||||
void GetEdgeBasedNodes( std::vector< EdgeBasedNode> & nodes);
|
||||
|
||||
short AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w) const;
|
||||
unsigned GetNumberOfNodes() const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user