Entering and leaving roundabouts is getting handled.
This commit is contained in:
parent
8c0db16b13
commit
070050a48e
@ -138,7 +138,6 @@ public:
|
|||||||
const NodeID target = edges[i].target;
|
const NodeID target = edges[i].target;
|
||||||
const NodeID via = edges[i].data.via;
|
const NodeID via = edges[i].data.via;
|
||||||
const short turnType = edges[i].data.turnInstruction;
|
const short turnType = edges[i].data.turnInstruction;
|
||||||
assert(turnType == 0 || turnType == 1);
|
|
||||||
//remove eigenloops
|
//remove eigenloops
|
||||||
if ( source == target ) {
|
if ( source == target ) {
|
||||||
i++;
|
i++;
|
||||||
|
@ -50,6 +50,7 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdg
|
|||||||
edge.data.distance = (std::max)((int)i->weight(), 1 );
|
edge.data.distance = (std::max)((int)i->weight(), 1 );
|
||||||
assert( edge.data.distance > 0 );
|
assert( edge.data.distance > 0 );
|
||||||
edge.data.shortcut = false;
|
edge.data.shortcut = false;
|
||||||
|
edge.data.roundabout = i->isRoundabout();
|
||||||
edge.data.middleName.nameID = i->name();
|
edge.data.middleName.nameID = i->name();
|
||||||
edge.data.type = i->type();
|
edge.data.type = i->type();
|
||||||
edge.data.forward = i->isForward();
|
edge.data.forward = i->isForward();
|
||||||
@ -186,10 +187,28 @@ short EdgeBasedGraphFactory::AnalyzeTurn(const NodeID u, const NodeID v, const N
|
|||||||
_NodeBasedDynamicGraph::EdgeData data1 = _nodeBasedGraph->GetEdgeData(edge1);
|
_NodeBasedDynamicGraph::EdgeData data1 = _nodeBasedGraph->GetEdgeData(edge1);
|
||||||
_NodeBasedDynamicGraph::EdgeData data2 = _nodeBasedGraph->GetEdgeData(edge2);
|
_NodeBasedDynamicGraph::EdgeData data2 = _nodeBasedGraph->GetEdgeData(edge2);
|
||||||
|
|
||||||
if(data1.middleName.nameID == data2.middleName.nameID) {
|
double angle = GetAngleBetweenTwoEdges(inputNodeInfoList[u], inputNodeInfoList[v], inputNodeInfoList[w]);
|
||||||
|
|
||||||
|
if(data1.middleName.nameID == data2.middleName.nameID)
|
||||||
|
return TurnInstructions.NoTurn;
|
||||||
|
|
||||||
|
//Is turn on roundabout?
|
||||||
|
if(data1.roundabout || data2.roundabout) {
|
||||||
|
//We are entering the roundabout
|
||||||
|
if(!data1.roundabout && data2.roundabout)
|
||||||
|
return TurnInstructions.EnterRoundAbout;
|
||||||
|
//We are leaving the roundabout
|
||||||
|
if(data1.roundabout && !data2.roundabout)
|
||||||
|
return TurnInstructions.LeaveRoundAbout;
|
||||||
|
//Is a turn possible? If yes, we stay on the roundabout!
|
||||||
|
if(_nodeBasedGraph->EndEdges(v) - _nodeBasedGraph->BeginEdges(v) > 1)
|
||||||
|
return TurnInstructions.StayOnRoundAbout;
|
||||||
|
//No turn possible.
|
||||||
return TurnInstructions.NoTurn;
|
return TurnInstructions.NoTurn;
|
||||||
}
|
}
|
||||||
return TurnInstructions.GoStraight;
|
|
||||||
|
|
||||||
|
return TurnInstructions.GetTurnDirectionOfInstruction(angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
|
unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
|
||||||
@ -199,3 +218,17 @@ unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
|
|||||||
EdgeBasedGraphFactory::~EdgeBasedGraphFactory() {
|
EdgeBasedGraphFactory::~EdgeBasedGraphFactory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/
|
||||||
|
template<class CoordinateT>
|
||||||
|
double EdgeBasedGraphFactory::GetAngleBetweenTwoEdges(const CoordinateT& A, const CoordinateT& C, const CoordinateT& B) const {
|
||||||
|
const int v1x = A.lon - C.lon;
|
||||||
|
const int v1y = A.lat - C.lat;
|
||||||
|
const int v2x = B.lon - C.lon;
|
||||||
|
const int v2y = B.lat - C.lat;
|
||||||
|
|
||||||
|
double angle = (atan2((double)v2y,v2x) - atan2((double)v1y,v1x) )*180/M_PI;
|
||||||
|
while(angle < 0)
|
||||||
|
angle += 360;
|
||||||
|
|
||||||
|
return angle;
|
||||||
|
}
|
||||||
|
@ -49,6 +49,7 @@ private:
|
|||||||
bool shortcut;
|
bool shortcut;
|
||||||
bool forward;
|
bool forward;
|
||||||
bool backward;
|
bool backward;
|
||||||
|
bool roundabout;
|
||||||
short type;
|
short type;
|
||||||
_MiddleName middleName;
|
_MiddleName middleName;
|
||||||
} data;
|
} data;
|
||||||
@ -94,6 +95,8 @@ private:
|
|||||||
std::vector<_EdgeBasedEdge> edgeBasedEdges;
|
std::vector<_EdgeBasedEdge> edgeBasedEdges;
|
||||||
std::vector<EdgeBasedNode> edgeBasedNodes;
|
std::vector<EdgeBasedNode> edgeBasedNodes;
|
||||||
|
|
||||||
|
template<class CoordinateT>
|
||||||
|
double GetAngleBetweenTwoEdges(const CoordinateT& A, const CoordinateT& C, const CoordinateT& B) const;
|
||||||
public:
|
public:
|
||||||
template< class InputEdgeT >
|
template< class InputEdgeT >
|
||||||
explicit EdgeBasedGraphFactory(int nodes, std::vector<InputEdgeT> & inputEdges, std::vector<_Restriction> & inputRestrictions, std::vector<NodeInfo> & nI);
|
explicit EdgeBasedGraphFactory(int nodes, std::vector<InputEdgeT> & inputEdges, std::vector<_Restriction> & inputRestrictions, std::vector<NodeInfo> & nI);
|
||||||
|
@ -134,6 +134,9 @@ public:
|
|||||||
else if("no" == accessClass)
|
else if("no" == accessClass)
|
||||||
w.access = false;
|
w.access = false;
|
||||||
|
|
||||||
|
if(junction == "roundabout") {
|
||||||
|
w.roundabout = true;
|
||||||
|
}
|
||||||
//Let's process oneway property, if speed profile obeys to it
|
//Let's process oneway property, if speed profile obeys to it
|
||||||
if(oneway != "no" && oneway != "false" && oneway != "0" && settings.obeyOneways) {
|
if(oneway != "no" && oneway != "false" && oneway != "0" && settings.obeyOneways) {
|
||||||
//if oneway tag is in forward direction or if actually roundabout
|
//if oneway tag is in forward direction or if actually roundabout
|
||||||
@ -175,7 +178,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(vector< NodeID >::size_type n = 0; n < w.path.size()-1; ++n) {
|
for(vector< NodeID >::size_type n = 0; n < w.path.size()-1; ++n) {
|
||||||
externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID));
|
externalMemory->allEdges.push_back(_Edge(w.path[n], w.path[n+1], w.type, w.direction, w.speed, w.nameID, w.roundabout));
|
||||||
externalMemory->usedNodeIDs.push_back(w.path[n]);
|
externalMemory->usedNodeIDs.push_back(w.path[n]);
|
||||||
}
|
}
|
||||||
externalMemory->usedNodeIDs.push_back(w.path[w.path.size()-1]);
|
externalMemory->usedNodeIDs.push_back(w.path[w.path.size()-1]);
|
||||||
|
@ -79,6 +79,7 @@ struct _Way {
|
|||||||
type = -1;
|
type = -1;
|
||||||
useful = false;
|
useful = false;
|
||||||
access = true;
|
access = true;
|
||||||
|
roundabout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -89,8 +90,9 @@ struct _Way {
|
|||||||
std::string name;
|
std::string name;
|
||||||
double speed;
|
double speed;
|
||||||
short type;
|
short type;
|
||||||
bool useful:1;
|
bool useful;
|
||||||
bool access:1;
|
bool access;
|
||||||
|
bool roundabout;
|
||||||
std::vector< NodeID > path;
|
std::vector< NodeID > path;
|
||||||
HashTable<std::string, std::string> keyVals;
|
HashTable<std::string, std::string> keyVals;
|
||||||
};
|
};
|
||||||
@ -124,16 +126,17 @@ struct _Relation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct _Edge {
|
struct _Edge {
|
||||||
_Edge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0) {};
|
_Edge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0), isRoundabout(false) {};
|
||||||
_Edge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0) { }
|
_Edge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0), isRoundabout(false) { }
|
||||||
_Edge(NodeID s, NodeID t, short tp, short d, double sp): start(s), target(t), type(tp), direction(d), speed(sp), nameID(0) { }
|
_Edge(NodeID s, NodeID t, short tp, short d, double sp): start(s), target(t), type(tp), direction(d), speed(sp), nameID(0), isRoundabout(false) { }
|
||||||
_Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid) { }
|
_Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid, bool isra): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid), isRoundabout(isra) { }
|
||||||
NodeID start;
|
NodeID start;
|
||||||
NodeID target;
|
NodeID target;
|
||||||
short type;
|
short type;
|
||||||
short direction;
|
short direction;
|
||||||
double speed;
|
double speed;
|
||||||
unsigned nameID;
|
unsigned nameID;
|
||||||
|
bool isRoundabout;
|
||||||
|
|
||||||
_Coordinate startCoord;
|
_Coordinate startCoord;
|
||||||
_Coordinate targetCoord;
|
_Coordinate targetCoord;
|
||||||
|
@ -42,10 +42,10 @@ public:
|
|||||||
|
|
||||||
/** Default constructor. target and weight are set to 0.*/
|
/** Default constructor. target and weight are set to 0.*/
|
||||||
NodeBasedEdge() :
|
NodeBasedEdge() :
|
||||||
_source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _type(0) { assert(false); } //shall not be used.
|
_source(0), _target(0), _name(0), _weight(0), forward(0), backward(0), _type(0), _roundabout(false) { assert(false); } //shall not be used.
|
||||||
|
|
||||||
explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, short ty) :
|
explicit NodeBasedEdge(NodeID s, NodeID t, NodeID n, EdgeWeight w, bool f, bool b, short ty, bool ra) :
|
||||||
_source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _type(ty) { assert(ty >= 0); }
|
_source(s), _target(t), _name(n), _weight(w), forward(f), backward(b), _type(ty), _roundabout(ra) { assert(ty >= 0); }
|
||||||
|
|
||||||
NodeID target() const {return _target; }
|
NodeID target() const {return _target; }
|
||||||
NodeID source() const {return _source; }
|
NodeID source() const {return _source; }
|
||||||
@ -56,6 +56,7 @@ public:
|
|||||||
bool isBackward() const { return backward; }
|
bool isBackward() const { return backward; }
|
||||||
bool isForward() const { return forward; }
|
bool isForward() const { return forward; }
|
||||||
bool isLocatable() const { return _type != 14; }
|
bool isLocatable() const { return _type != 14; }
|
||||||
|
bool isRoundabout() const { return _roundabout; }
|
||||||
|
|
||||||
NodeID _source;
|
NodeID _source;
|
||||||
NodeID _target;
|
NodeID _target;
|
||||||
@ -64,6 +65,7 @@ public:
|
|||||||
bool forward;
|
bool forward;
|
||||||
bool backward;
|
bool backward;
|
||||||
short _type;
|
short _type;
|
||||||
|
bool _roundabout;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EdgeBasedEdge {
|
class EdgeBasedEdge {
|
||||||
|
@ -37,8 +37,11 @@ struct TurnInstructionsClass {
|
|||||||
const static short TurnSlightLeft = 8;
|
const static short TurnSlightLeft = 8;
|
||||||
const static short ReachViaPoint = 9;
|
const static short ReachViaPoint = 9;
|
||||||
const static short HeadOn = 10;
|
const static short HeadOn = 10;
|
||||||
|
const static short EnterRoundAbout = 11;
|
||||||
|
const static short LeaveRoundAbout = 12;
|
||||||
|
const static short StayOnRoundAbout = 13;
|
||||||
|
|
||||||
std::string TurnStrings[11];
|
std::string TurnStrings[14];
|
||||||
|
|
||||||
//This is a hack until c++0x is available enough to use initializer lists.
|
//This is a hack until c++0x is available enough to use initializer lists.
|
||||||
TurnInstructionsClass(){
|
TurnInstructionsClass(){
|
||||||
@ -53,7 +56,84 @@ struct TurnInstructionsClass {
|
|||||||
TurnStrings [8] = "Turn slight left";
|
TurnStrings [8] = "Turn slight left";
|
||||||
TurnStrings [9] = "Reach via point";
|
TurnStrings [9] = "Reach via point";
|
||||||
TurnStrings[10] = "Head";
|
TurnStrings[10] = "Head";
|
||||||
|
TurnStrings[11] = "Enter round-about";
|
||||||
|
TurnStrings[12] = "Leave round-about";
|
||||||
|
TurnStrings[13] = "Stay on round-about";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline double GetTurnDirectionOfInstruction( const double angle ) {
|
||||||
|
if(angle >= 23 && angle < 67) {
|
||||||
|
return TurnSharpRight;
|
||||||
|
}
|
||||||
|
if (angle >= 67 && angle < 113) {
|
||||||
|
return TurnRight;
|
||||||
|
}
|
||||||
|
if (angle >= 113 && angle < 158) {
|
||||||
|
return TurnSlightRight;
|
||||||
|
}
|
||||||
|
if (angle >= 158 && angle < 202) {
|
||||||
|
return GoStraight;
|
||||||
|
}
|
||||||
|
if (angle >= 202 && angle < 248) {
|
||||||
|
return TurnSlightLeft;
|
||||||
|
}
|
||||||
|
if (angle >= 248 && angle < 292) {
|
||||||
|
return TurnLeft;
|
||||||
|
}
|
||||||
|
if (angle >= 292 && angle < 336) {
|
||||||
|
return TurnSharpLeft;
|
||||||
|
}
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool TurnIsNecessary ( const short turnInstruction ) {
|
||||||
|
if(NoTurn == turnInstruction || StayOnRoundAbout == turnInstruction)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static inline void getDirectionOfInstruction(double angle, DirectionOfInstruction & dirInst) {
|
||||||
|
// if(angle >= 23 && angle < 67) {
|
||||||
|
// dirInst.direction = "southeast";
|
||||||
|
// dirInst.shortDirection = "SE";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if(angle >= 67 && angle < 113) {
|
||||||
|
// dirInst.direction = "south";
|
||||||
|
// dirInst.shortDirection = "S";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if(angle >= 113 && angle < 158) {
|
||||||
|
// dirInst.direction = "southwest";
|
||||||
|
// dirInst.shortDirection = "SW";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if(angle >= 158 && angle < 202) {
|
||||||
|
// dirInst.direction = "west";
|
||||||
|
// dirInst.shortDirection = "W";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if(angle >= 202 && angle < 248) {
|
||||||
|
// dirInst.direction = "northwest";
|
||||||
|
// dirInst.shortDirection = "NW";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if(angle >= 248 && angle < 292) {
|
||||||
|
// dirInst.direction = "north";
|
||||||
|
// dirInst.shortDirection = "N";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if(angle >= 292 && angle < 336) {
|
||||||
|
// dirInst.direction = "northeast";
|
||||||
|
// dirInst.shortDirection = "NE";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// dirInst.direction = "East";
|
||||||
|
// dirInst.shortDirection = "E";
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static TurnInstructionsClass TurnInstructions;
|
static TurnInstructionsClass TurnInstructions;
|
||||||
|
@ -34,22 +34,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
#include "../Plugins/RawRouteData.h"
|
#include "../Plugins/RawRouteData.h"
|
||||||
|
|
||||||
static double areaThresholds[19] = { 5000, 5000, 5000, 5000, 5000, 2500, 2000, 1500, 800, 400, 250, 150, 100, 75, 25, 20, 10, 5, 0 };
|
|
||||||
|
|
||||||
/* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/
|
|
||||||
static double GetAngleBetweenTwoEdges(const _Coordinate& A, const _Coordinate& C, const _Coordinate& B) {
|
|
||||||
int v1x = A.lon - C.lon;
|
|
||||||
int v1y = A.lat - C.lat;
|
|
||||||
int v2x = B.lon - C.lon;
|
|
||||||
int v2y = B.lat - C.lat;
|
|
||||||
|
|
||||||
double angle = (atan2((double)v2y,v2x) - atan2((double)v1y,v1x) )*180/M_PI;
|
|
||||||
while(angle < 0)
|
|
||||||
angle += 360;
|
|
||||||
|
|
||||||
return angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct _RouteSummary {
|
struct _RouteSummary {
|
||||||
std::string lengthString;
|
std::string lengthString;
|
||||||
std::string durationString;
|
std::string durationString;
|
||||||
|
@ -38,7 +38,7 @@ void DescriptionFactory::SetEndSegment(const PhantomNode & _targetPhantom) {
|
|||||||
pathDescription.push_back(SegmentInformation(_targetPhantom.location, _targetPhantom.nodeBasedEdgeNameID, 0, _targetPhantom.weight1, 0, true) );
|
pathDescription.push_back(SegmentInformation(_targetPhantom.location, _targetPhantom.nodeBasedEdgeNameID, 0, _targetPhantom.weight1, 0, true) );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DescriptionFactory::AppendSegment(const _Coordinate & coordinate, const _PathData & data ) {
|
void DescriptionFactory::AppendSegment(const _Coordinate & coordinate, const _PathData & data ) {
|
||||||
pathDescription.push_back(SegmentInformation(coordinate, data.nameID, 0, data.durationOfSegment, data.turnInstruction) );
|
pathDescription.push_back(SegmentInformation(coordinate, data.nameID, 0, data.durationOfSegment, data.turnInstruction) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,87 +50,10 @@ public:
|
|||||||
void AppendEncodedPolylineString(std::string & output, bool isEncoded);
|
void AppendEncodedPolylineString(std::string & output, bool isEncoded);
|
||||||
unsigned Run(const unsigned zoomLevel);
|
unsigned Run(const unsigned zoomLevel);
|
||||||
|
|
||||||
// static inline void getDirectionOfInstruction(double angle, DirectionOfInstruction & dirInst) {
|
};
|
||||||
// if(angle >= 23 && angle < 67) {
|
|
||||||
// dirInst.direction = "southeast";
|
#endif /* DESCRIPTIONFACTORY_H_ */
|
||||||
// dirInst.shortDirection = "SE";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if(angle >= 67 && angle < 113) {
|
|
||||||
// dirInst.direction = "south";
|
|
||||||
// dirInst.shortDirection = "S";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if(angle >= 113 && angle < 158) {
|
|
||||||
// dirInst.direction = "southwest";
|
|
||||||
// dirInst.shortDirection = "SW";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if(angle >= 158 && angle < 202) {
|
|
||||||
// dirInst.direction = "west";
|
|
||||||
// dirInst.shortDirection = "W";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if(angle >= 202 && angle < 248) {
|
|
||||||
// dirInst.direction = "northwest";
|
|
||||||
// dirInst.shortDirection = "NW";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if(angle >= 248 && angle < 292) {
|
|
||||||
// dirInst.direction = "north";
|
|
||||||
// dirInst.shortDirection = "N";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if(angle >= 292 && angle < 336) {
|
|
||||||
// dirInst.direction = "northeast";
|
|
||||||
// dirInst.shortDirection = "NE";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// dirInst.direction = "East";
|
|
||||||
// dirInst.shortDirection = "E";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// static inline void getTurnDirectionOfInstruction(double angle, std::string & output) {
|
|
||||||
// if(angle >= 23 && angle < 67) {
|
|
||||||
// output = "Turn sharp right";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (angle >= 67 && angle < 113) {
|
|
||||||
// output = "Turn right";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (angle >= 113 && angle < 158) {
|
|
||||||
// output = "Bear right";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (angle >= 158 && angle < 202) {
|
|
||||||
// output = "Continue";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (angle >= 202 && angle < 248) {
|
|
||||||
// output = "Bear left";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (angle >= 248 && angle < 292) {
|
|
||||||
// output = "Turn left";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (angle >= 292 && angle < 336) {
|
|
||||||
// output = "Turn sharp left";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// output = "U-Turn";
|
|
||||||
// // cout << "angle " << angle << "-> " << output << endl;
|
|
||||||
// }
|
|
||||||
//private:
|
//private:
|
||||||
// void appendInstructionNameToString(const std::string & nameOfStreet, const std::string & instructionOrDirection, std::string &output, bool firstAdvice = false) {
|
// void appendInstructionNameToString(const std::string & nameOfStreet, const std::string & instructionOrDirection, std::string &output, bool firstAdvice = false) {
|
||||||
// output += "[";
|
// output += "[";
|
||||||
@ -173,6 +96,3 @@ public:
|
|||||||
// }
|
// }
|
||||||
// output += "]";
|
// output += "]";
|
||||||
// }
|
// }
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* DESCRIPTIONFACTORY_H_ */
|
|
||||||
|
@ -100,10 +100,11 @@ public:
|
|||||||
std::string tmpDist, tmpLength, tmp;
|
std::string tmpDist, tmpLength, tmp;
|
||||||
//Fetch data from Factory and generate a string from it.
|
//Fetch data from Factory and generate a string from it.
|
||||||
BOOST_FOREACH(SegmentInformation segment, descriptionFactory.pathDescription) {
|
BOOST_FOREACH(SegmentInformation segment, descriptionFactory.pathDescription) {
|
||||||
if(0 != segment.turnInstruction) {
|
if(TurnInstructions.TurnIsNecessary( segment.turnInstruction) ) {
|
||||||
if(0 != prefixSumOfNecessarySegments)
|
if(0 != prefixSumOfNecessarySegments)
|
||||||
reply.content += ",";
|
reply.content += ",";
|
||||||
reply.content += "[\"";
|
reply.content += "[\"";
|
||||||
|
INFO("INstruction: " << segment.turnInstruction);
|
||||||
reply.content += TurnInstructions.TurnStrings[segment.turnInstruction];
|
reply.content += TurnInstructions.TurnStrings[segment.turnInstruction];
|
||||||
reply.content += "\",\"";
|
reply.content += "\",\"";
|
||||||
reply.content += sEngine.GetEscapedNameForNameID(segment.nameID);
|
reply.content += sEngine.GetEscapedNameForNameID(segment.nameID);
|
||||||
|
@ -142,18 +142,21 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
}
|
}
|
||||||
|
|
||||||
edgeList.reserve(m);
|
edgeList.reserve(m);
|
||||||
|
EdgeWeight weight;
|
||||||
|
short type;
|
||||||
|
NodeID nameID;
|
||||||
|
int length;
|
||||||
|
bool isRoundabout;
|
||||||
|
|
||||||
for (EdgeID i=0; i<m; i++) {
|
for (EdgeID i=0; i<m; i++) {
|
||||||
EdgeWeight weight;
|
in.read((char*)&source, sizeof(unsigned));
|
||||||
short type;
|
in.read((char*)&target, sizeof(unsigned));
|
||||||
NodeID nameID;
|
in.read((char*)&length, sizeof(int));
|
||||||
int length;
|
in.read((char*)&dir, sizeof(short));
|
||||||
in.read((char*)&source, sizeof(unsigned));
|
in.read((char*)&weight, sizeof(int));
|
||||||
in.read((char*)&target, sizeof(unsigned));
|
in.read((char*)&type, sizeof(short));
|
||||||
in.read((char*)&length, sizeof(int));
|
in.read((char*)&nameID, sizeof(unsigned));
|
||||||
in.read((char*)&dir, sizeof(short));
|
in.read((char*)&isRoundabout, sizeof(bool));
|
||||||
in.read((char*)&weight, sizeof(int));
|
|
||||||
in.read((char*)&type, sizeof(short));
|
|
||||||
in.read((char*)&nameID ,sizeof(unsigned));
|
|
||||||
|
|
||||||
assert(length > 0);
|
assert(length > 0);
|
||||||
assert(weight > 0);
|
assert(weight > 0);
|
||||||
@ -186,7 +189,7 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
|
|
||||||
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
||||||
|
|
||||||
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type );
|
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout );
|
||||||
edgeList.push_back(inputEdge);
|
edgeList.push_back(inputEdge);
|
||||||
}
|
}
|
||||||
ext2IntNodeMap.clear();
|
ext2IntNodeMap.clear();
|
||||||
|
@ -429,6 +429,7 @@ int main (int argc, char *argv[]) {
|
|||||||
short edgeType = edgeIT->type;
|
short edgeType = edgeIT->type;
|
||||||
fout.write((char*)&edgeType, sizeof(short));
|
fout.write((char*)&edgeType, sizeof(short));
|
||||||
fout.write((char*)&edgeIT->nameID, sizeof(unsigned));
|
fout.write((char*)&edgeIT->nameID, sizeof(unsigned));
|
||||||
|
fout.write((char *)&edgeIT->isRoundabout, sizeof(bool));
|
||||||
}
|
}
|
||||||
++usedEdgeCounter;
|
++usedEdgeCounter;
|
||||||
++edgeIT;
|
++edgeIT;
|
||||||
@ -443,7 +444,6 @@ int main (int argc, char *argv[]) {
|
|||||||
fout.close();
|
fout.close();
|
||||||
cout << "ok" << endl;
|
cout << "ok" << endl;
|
||||||
time = get_timestamp();
|
time = get_timestamp();
|
||||||
INFO("Written edges: " << usedEdgeCounter << " at " << positionInFile);
|
|
||||||
cout << "[extractor] writing street name index ... " << flush;
|
cout << "[extractor] writing street name index ... " << flush;
|
||||||
vector<unsigned> * nameIndex = new vector<unsigned>(externalMemory.nameVector.size()+1, 0);
|
vector<unsigned> * nameIndex = new vector<unsigned>(externalMemory.nameVector.size()+1, 0);
|
||||||
outputFileName.append(".names");
|
outputFileName.append(".names");
|
||||||
|
Loading…
Reference in New Issue
Block a user