#include <NBJunctionTypesMatrix.h>
Definition at line 46 of file NBJunctionTypesMatrix.h.
Public Member Functions | |
| NBNode::BasicNodeType | getType (SUMOReal speed1, SUMOReal speed2) const |
| NBJunctionTypesMatrix () | |
| ~NBJunctionTypesMatrix () | |
Private Types | |
| typedef std::map< char, NBNode::BasicNodeType > | CharToVal |
| typedef std::vector< std::pair < SUMOReal, SUMOReal > > | RangeCont |
| typedef std::vector< std::string > | StringCont |
Private Member Functions | |
| char | getNameAt (size_t pos1, size_t pos2) const |
Private Attributes | |
| CharToVal | myMap |
| RangeCont | myRanges |
| StringCont | myValues |
Data Structures | |
| class | range_finder |
typedef std::map<char, NBNode::BasicNodeType> NBJunctionTypesMatrix::CharToVal [private] |
a map of chars to ints
Definition at line 89 of file NBJunctionTypesMatrix.h.
typedef std::vector<std::pair<SUMOReal, SUMOReal> > NBJunctionTypesMatrix::RangeCont [private] |
a container type for edge priority ranges
Definition at line 83 of file NBJunctionTypesMatrix.h.
typedef std::vector<std::string> NBJunctionTypesMatrix::StringCont [private] |
A container type for the resulting junction types (cross matrix)
Definition at line 86 of file NBJunctionTypesMatrix.h.
| NBJunctionTypesMatrix::NBJunctionTypesMatrix | ( | ) |
constructor
Definition at line 46 of file NBJunctionTypesMatrix.cpp.
References myMap, myRanges, myValues, NBNode::NODETYPE_NOJUNCTION, NBNode::NODETYPE_PRIORITY_JUNCTION, NBNode::NODETYPE_RIGHT_BEFORE_LEFT, NBNode::NODETYPE_TRAFFIC_LIGHT, and SUMOReal.
00046 { 00047 myMap['t'] = NBNode::NODETYPE_TRAFFIC_LIGHT; 00048 myMap['x'] = NBNode::NODETYPE_NOJUNCTION; 00049 myMap['p'] = NBNode::NODETYPE_PRIORITY_JUNCTION; 00050 myMap['r'] = NBNode::NODETYPE_RIGHT_BEFORE_LEFT; 00051 myRanges.push_back(std::pair<SUMOReal, SUMOReal>((SUMOReal)(0./3.6), (SUMOReal)(10./3.6))); 00052 myRanges.push_back(std::pair<SUMOReal, SUMOReal>((SUMOReal)(10./3.6), (SUMOReal)(30./3.6))); 00053 myRanges.push_back(std::pair<SUMOReal, SUMOReal>((SUMOReal)(30./3.6), (SUMOReal)(50./3.6))); 00054 myRanges.push_back(std::pair<SUMOReal, SUMOReal>((SUMOReal)(50./3.6), (SUMOReal)(70./3.6))); 00055 myRanges.push_back(std::pair<SUMOReal, SUMOReal>((SUMOReal)(70./3.6), (SUMOReal)(100./3.6))); 00056 myRanges.push_back(std::pair<SUMOReal, SUMOReal>((SUMOReal)(100./3.6), (SUMOReal)(999999./3.6))); 00057 // 00001x 00058 // 13570x 00059 // 00000x 00060 myValues.push_back("rppppp"); // 000 - 010 00061 myValues.push_back(" rpppp"); // 010 - 030 00062 myValues.push_back(" rppp"); // 030 - 050 00063 myValues.push_back(" ttp"); // 050 - 070 00064 myValues.push_back(" tp"); // 070 - 100 00065 myValues.push_back(" p"); // 100 - 00066 }
| NBJunctionTypesMatrix::~NBJunctionTypesMatrix | ( | ) |
returns the one-char name of the junction type between the two given ranges
Definition at line 82 of file NBJunctionTypesMatrix.cpp.
References myValues.
Referenced by getType().
00082 { 00083 std::string str = myValues[pos1]; 00084 if (str[pos2]==' ') { 00085 return getNameAt(pos2, pos1); 00086 } 00087 return str[pos2]; 00088 }
| NBNode::BasicNodeType NBJunctionTypesMatrix::getType | ( | SUMOReal | speed1, | |
| SUMOReal | speed2 | |||
| ) | const |
returns the type of the junction on the crossing of edges of the given types
Definition at line 73 of file NBJunctionTypesMatrix.cpp.
References getNameAt(), myMap, and myRanges.
00073 { 00074 RangeCont::const_iterator p1 = find_if(myRanges.begin(), myRanges.end(), range_finder(speed1)); 00075 RangeCont::const_iterator p2 = find_if(myRanges.begin(), myRanges.end(), range_finder(speed2)); 00076 char name = getNameAt(distance(myRanges.begin(), p1), distance(myRanges.begin(), p2)); 00077 return myMap.find(name)->second; 00078 }
CharToVal NBJunctionTypesMatrix::myMap [private] |
a map of chars to their NBNode-representation
Definition at line 103 of file NBJunctionTypesMatrix.h.
Referenced by getType(), and NBJunctionTypesMatrix().
RangeCont NBJunctionTypesMatrix::myRanges [private] |
a container for edge priority ranges
Definition at line 92 of file NBJunctionTypesMatrix.h.
Referenced by getType(), and NBJunctionTypesMatrix().
StringCont NBJunctionTypesMatrix::myValues [private] |
A container for the resulting junction types (cross matrix) The informations are stored as chars: 't': Traffic Light Junction 'r': Right-before-Left Junction 'p': Priority Junction 'x': no Junction
Definition at line 100 of file NBJunctionTypesMatrix.h.
Referenced by getNameAt(), and NBJunctionTypesMatrix().
1.5.6