Fixing direction of edges.
This commit is contained in:
parent
164e1be018
commit
3ea1461839
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdge> & inputEdges, std::vector<NodeID> & bn, std::vector<NodeID> & tl, std::vector<_Restriction> & irs, std::vector<NodeInfo> & nI, boost::property_tree::ptree speedProfile, std::string & srtm) : inputNodeInfoList(nI), numberOfTurnRestrictions(irs.size()), trafficSignalPenalty(0) {
|
EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdge> & inputEdges, std::vector<NodeID> & bn, std::vector<NodeID> & tl, std::vector<_Restriction> & irs, std::vector<NodeInfo> & nI, boost::property_tree::ptree speedProfile, std::string & srtm) : inputNodeInfoList(nI), numberOfTurnRestrictions(irs.size()), trafficSignalPenalty(0) {
|
||||||
INFO("Nodes size: " << inputNodeInfoList.size());
|
|
||||||
BOOST_FOREACH(_Restriction & restriction, irs) {
|
BOOST_FOREACH(_Restriction & restriction, irs) {
|
||||||
std::pair<NodeID, NodeID> restrictionSource = std::make_pair(restriction.fromNode, restriction.viaNode);
|
std::pair<NodeID, NodeID> restrictionSource = std::make_pair(restriction.fromNode, restriction.viaNode);
|
||||||
unsigned index;
|
unsigned index;
|
||||||
@ -67,17 +66,26 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
|
|||||||
INFO("traffic signal penalty: " << trafficSignalPenalty);
|
INFO("traffic signal penalty: " << trafficSignalPenalty);
|
||||||
|
|
||||||
BOOST_FOREACH(NodeID id, bn)
|
BOOST_FOREACH(NodeID id, bn)
|
||||||
_barrierNodes[id] = true;
|
_barrierNodes[id] = true;
|
||||||
BOOST_FOREACH(NodeID id, tl)
|
BOOST_FOREACH(NodeID id, tl)
|
||||||
_trafficLights[id] = true;
|
_trafficLights[id] = true;
|
||||||
|
|
||||||
std::vector< _NodeBasedEdge > edges;
|
std::vector< _NodeBasedEdge > edges;
|
||||||
edges.reserve( 2 * inputEdges.size() );
|
edges.reserve( 2 * inputEdges.size() );
|
||||||
for ( std::vector< NodeBasedEdge >::const_iterator i = inputEdges.begin(), e = inputEdges.end(); i != e; ++i ) {
|
for ( std::vector< NodeBasedEdge >::const_iterator i = inputEdges.begin(); i != inputEdges.end(); ++i ) {
|
||||||
_NodeBasedEdge edge;
|
|
||||||
edge.source = i->source();
|
|
||||||
edge.target = i->target();
|
|
||||||
|
|
||||||
|
_NodeBasedEdge edge;
|
||||||
|
if(!i->isForward()) {
|
||||||
|
edge.source = i->target();
|
||||||
|
edge.target = i->source();
|
||||||
|
edge.data.backward = i->isForward();
|
||||||
|
edge.data.forward = i->isBackward();
|
||||||
|
} else {
|
||||||
|
edge.source = i->source();
|
||||||
|
edge.target = i->target();
|
||||||
|
edge.data.forward = i->isForward();
|
||||||
|
edge.data.backward = i->isBackward();
|
||||||
|
}
|
||||||
if(edge.source == edge.target)
|
if(edge.source == edge.target)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -88,8 +96,6 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
|
|||||||
edge.data.ignoreInGrid = i->ignoreInGrid();
|
edge.data.ignoreInGrid = i->ignoreInGrid();
|
||||||
edge.data.nameID = i->name();
|
edge.data.nameID = i->name();
|
||||||
edge.data.type = i->type();
|
edge.data.type = i->type();
|
||||||
edge.data.forward = i->isForward();
|
|
||||||
edge.data.backward = i->isBackward();
|
|
||||||
edge.data.edgeBasedNodeID = edges.size();
|
edge.data.edgeBasedNodeID = edges.size();
|
||||||
edges.push_back( edge );
|
edges.push_back( edge );
|
||||||
if( edge.data.backward ) {
|
if( edge.data.backward ) {
|
||||||
@ -267,7 +273,7 @@ short EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const N
|
|||||||
if( (!data1.roundabout) && data2.roundabout)
|
if( (!data1.roundabout) && data2.roundabout)
|
||||||
return TurnInstructions.EnterRoundAbout;
|
return TurnInstructions.EnterRoundAbout;
|
||||||
//We are leaving the roundabout
|
//We are leaving the roundabout
|
||||||
if(data1.roundabout && (!data2.roundabout) )
|
else if(data1.roundabout && (!data2.roundabout) )
|
||||||
return TurnInstructions.LeaveRoundAbout;
|
return TurnInstructions.LeaveRoundAbout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector<EdgeT>& edgeL
|
|||||||
std::vector<ImportEdge>::iterator newEnd = std::remove_if(edgeList.begin(), edgeList.end(), _ExcessRemover<EdgeT>());
|
std::vector<ImportEdge>::iterator newEnd = std::remove_if(edgeList.begin(), edgeList.end(), _ExcessRemover<EdgeT>());
|
||||||
ext2IntNodeMap.clear();
|
ext2IntNodeMap.clear();
|
||||||
std::vector<ImportEdge>(edgeList.begin(), newEnd).swap(edgeList); //remove excess candidates.
|
std::vector<ImportEdge>(edgeList.begin(), newEnd).swap(edgeList); //remove excess candidates.
|
||||||
INFO("Graph loaded ok");
|
INFO("Graph loaded ok and has " << edgeList.size() << " edges");
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
template<typename EdgeT>
|
template<typename EdgeT>
|
||||||
|
Loading…
Reference in New Issue
Block a user