From 40424da3b7e7ce4224f18dbe5cdd9c84eecd7b40 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Sun, 28 Apr 2013 11:03:14 +0200 Subject: [PATCH] remove contraFlow flag --- Contractor/EdgeBasedGraphFactory.cpp | 8 ++------ Contractor/EdgeBasedGraphFactory.h | 3 +-- DataStructures/ImportEdge.h | 8 +++----- Extractor/ExtractionContainers.cpp | 1 - Extractor/ExtractorStructs.h | 11 +++++------ Util/GraphLoader.h | 5 ++--- features/support/route.rb | 4 +--- 7 files changed, 14 insertions(+), 26 deletions(-) diff --git a/Contractor/EdgeBasedGraphFactory.cpp b/Contractor/EdgeBasedGraphFactory.cpp index ec3a5cd48..9814a844e 100644 --- a/Contractor/EdgeBasedGraphFactory.cpp +++ b/Contractor/EdgeBasedGraphFactory.cpp @@ -72,7 +72,6 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vectorname(); edge.data.isAccessRestricted = i->isAccessRestricted(); edge.data.edgeBasedNodeID = edges.size(); - edge.data.contraFlow = i->isContraFlow(); edge.data.mode = i->mode(); edges.push_back( edge ); if( edge.data.backward ) { @@ -273,9 +272,8 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename, lua_State distance += speedProfile.trafficSignalPenalty; } unsigned penalty = 0; - bool contraflow; - TurnInstruction turnInstruction = AnalyzeTurn(u, v, w, contraflow, penalty, myLuaState); + TurnInstruction turnInstruction = AnalyzeTurn(u, v, w, penalty, myLuaState); if(turnInstruction == TurnInstructions.UTurn) distance += speedProfile.uTurnPenalty; // if(!edgeData1.isAccessRestricted && edgeData2.isAccessRestricted) { @@ -326,7 +324,7 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename, lua_State INFO("Generated " << edgeBasedNodes.size() << " edge based nodes"); } -TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, bool& contraflow, unsigned& penalty, lua_State *myLuaState) const { +TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, unsigned& penalty, lua_State *myLuaState) const { const double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]); if( speedProfile.has_turn_penalty_function ) { @@ -351,8 +349,6 @@ TurnInstruction EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID _NodeBasedDynamicGraph::EdgeData & data1 = _nodeBasedGraph->GetEdgeData(edge1); _NodeBasedDynamicGraph::EdgeData & data2 = _nodeBasedGraph->GetEdgeData(edge2); - contraflow = data2.contraFlow; - //roundabouts need to be handled explicitely if(data1.roundabout && data2.roundabout) { //Is a turn possible? If yes, we stay on the roundabout! diff --git a/Contractor/EdgeBasedGraphFactory.h b/Contractor/EdgeBasedGraphFactory.h index ba3f340d2..a8f3e4db1 100644 --- a/Contractor/EdgeBasedGraphFactory.h +++ b/Contractor/EdgeBasedGraphFactory.h @@ -98,7 +98,6 @@ private: bool backward:1; bool roundabout:1; bool ignoreInGrid:1; - bool contraFlow:1; TravelMode mode; }; @@ -149,7 +148,7 @@ public: void GetEdgeBasedEdges( DeallocatingVector< EdgeBasedEdge >& edges ); void GetEdgeBasedNodes( DeallocatingVector< EdgeBasedNode> & nodes); void GetOriginalEdgeData( std::vector< OriginalEdgeData> & originalEdgeData); - TurnInstruction AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, bool& contraflow, unsigned& penalty, lua_State *myLuaState) const; + TurnInstruction AnalyzeTurn(const NodeID u, const NodeID v, const NodeID w, unsigned& penalty, lua_State *myLuaState) const; unsigned GetNumberOfNodes() const; }; diff --git a/DataStructures/ImportEdge.h b/DataStructures/ImportEdge.h index ab461b65b..772037a0c 100644 --- a/DataStructures/ImportEdge.h +++ b/DataStructures/ImportEdge.h @@ -42,8 +42,8 @@ public: return (source() < e.source()); } - explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, bool ra, bool ig, bool ar, bool cf, TravelMode mode) : - _source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _roundabout(ra), _ignoreInGrid(ig), _accessRestricted(ar), _contraFlow(cf), _mode(mode) {} + explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, bool ra, bool ig, bool ar, TravelMode mode) : + _source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _roundabout(ra), _ignoreInGrid(ig), _accessRestricted(ar), _mode(mode) {} NodeID target() const {return _target; } NodeID source() const {return _source; } @@ -55,7 +55,6 @@ public: bool isRoundabout() const { return _roundabout; } bool ignoreInGrid() const { return _ignoreInGrid; } bool isAccessRestricted() const { return _accessRestricted; } - bool isContraFlow() const { return _contraFlow; } TravelMode mode() const { return _mode; } NodeID _source; @@ -67,13 +66,12 @@ public: bool _roundabout; bool _ignoreInGrid; bool _accessRestricted; - bool _contraFlow; TravelMode _mode; private: /** Default constructor. target and weight are set to 0.*/ NodeBasedEdge() : - _source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _roundabout(false), _ignoreInGrid(false), _accessRestricted(false), _contraFlow(false), _mode(0) { assert(false); } //shall not be used. + _source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _roundabout(false), _ignoreInGrid(false), _accessRestricted(false), _mode(0) { assert(false); } //shall not be used. }; diff --git a/Extractor/ExtractionContainers.cpp b/Extractor/ExtractionContainers.cpp index 022ca9049..4fa222dea 100644 --- a/Extractor/ExtractionContainers.cpp +++ b/Extractor/ExtractionContainers.cpp @@ -254,7 +254,6 @@ void ExtractionContainers::PrepareData(const std::string & outputFileName, const fout.write((char*)&edgeIT->isRoundabout, sizeof(bool)); fout.write((char*)&edgeIT->ignoreInGrid, sizeof(bool)); fout.write((char*)&edgeIT->isAccessRestricted, sizeof(bool)); - fout.write((char*)&edgeIT->isContraFlow, sizeof(bool)); fout.write((char*)&edgeIT->mode, sizeof(unsigned char)); } ++usedEdgeCounter; diff --git a/Extractor/ExtractorStructs.h b/Extractor/ExtractorStructs.h index 29f1e9215..84a69a74d 100644 --- a/Extractor/ExtractorStructs.h +++ b/Extractor/ExtractorStructs.h @@ -92,11 +92,11 @@ struct ExtractorRelation { }; struct InternalExtractorEdge { - InternalExtractorEdge() : start(0), target(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false), mode(0) {}; - InternalExtractorEdge(NodeID s, NodeID t) : start(s), target(t), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) {} - InternalExtractorEdge(NodeID s, NodeID t, short d, double sp): start(s), target(t), direction(d), speed(sp), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), isContraFlow(false) {} - InternalExtractorEdge(NodeID s, NodeID t, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar, TravelMode _mode): start(s), target(t), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), isContraFlow(false), mode(_mode) {} - InternalExtractorEdge(NodeID s, NodeID t, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar, bool icf, TravelMode _mode) : start(s), target(t), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), isContraFlow(false), mode(_mode) {} + InternalExtractorEdge() : start(0), target(0), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false), mode(0) {}; + InternalExtractorEdge(NodeID s, NodeID t) : start(s), target(t), direction(0), speed(0), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false) {} + InternalExtractorEdge(NodeID s, NodeID t, short d, double sp): start(s), target(t), direction(d), speed(sp), nameID(0), isRoundabout(false), ignoreInGrid(false), isDurationSet(false), isAccessRestricted(false) {} + InternalExtractorEdge(NodeID s, NodeID t, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar, TravelMode _mode): start(s), target(t), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), mode(_mode) {} + InternalExtractorEdge(NodeID s, NodeID t, short d, double sp, unsigned nid, bool isra, bool iing, bool ids, bool iar, bool icf, TravelMode _mode) : start(s), target(t), direction(d), speed(sp), nameID(nid), isRoundabout(isra), ignoreInGrid(iing), isDurationSet(ids), isAccessRestricted(iar), mode(_mode) {} NodeID start; NodeID target; short direction; @@ -106,7 +106,6 @@ struct InternalExtractorEdge { bool ignoreInGrid; bool isDurationSet; bool isAccessRestricted; - bool isContraFlow; TravelMode mode; _Coordinate startCoord; diff --git a/Util/GraphLoader.h b/Util/GraphLoader.h index 292c9ea2d..a29711e8e 100644 --- a/Util/GraphLoader.h +++ b/Util/GraphLoader.h @@ -100,7 +100,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector& edgeL EdgeWeight weight; NodeID nameID; int length; - bool isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow; + bool isRoundabout, ignoreInGrid, isAccessRestricted; TravelMode mode; for (EdgeID i=0; i& edgeL in.read((char*)&isRoundabout, sizeof(bool)); in.read((char*)&ignoreInGrid, sizeof(bool)); in.read((char*)&isAccessRestricted, sizeof(bool)); - in.read((char*)&isContraFlow, sizeof(bool)); in.read((char*)&mode, sizeof(TravelMode)); GUARANTEE(length > 0, "loaded null length edge" ); @@ -152,7 +151,7 @@ NodeID readBinaryOSRMGraphFromStream(std::istream &in, std::vector& edgeL } INFO( "inputEdge" ); - EdgeT inputEdge(source, target, nameID, weight, forward, backward, isRoundabout, ignoreInGrid, isAccessRestricted, isContraFlow, mode ); + EdgeT inputEdge(source, target, nameID, weight, forward, backward, isRoundabout, ignoreInGrid, isAccessRestricted, mode ); edgeList.push_back(inputEdge); } std::sort(edgeList.begin(), edgeList.end()); diff --git a/features/support/route.rb b/features/support/route.rb index 86ea263fd..7cf721ce4 100644 --- a/features/support/route.rb +++ b/features/support/route.rb @@ -118,9 +118,7 @@ def turn_list instructions 12 => :leave_roundabout, 13 => :stay_roundabout, 14 => :start_end_of_street, - 15 => :destination, - 16 => :enter_contraflow, - 17 => :leave_contraflow + 15 => :destination } instructions. map { |r| types[r[0].to_i].to_s }.