#include <NIVissimTL.h>
Definition at line 82 of file NIVissimTL.h.
Public Member Functions | |
| bool | addTo (NBEdgeCont &ec, NBLoadedTLDef *node) const |
| Position2D | getPosition () const |
| bool | isWithin (const Position2DVector &poly) const |
| NIVissimTLSignal (int lsaid, int id, const std::string &name, const IntVector &groupids, int edgeid, int laneno, SUMOReal position, const IntVector &assignedVehicleTypes) | |
| ~NIVissimTLSignal () | |
Static Public Member Functions | |
| static void | clearDict () |
| static NIVissimTLSignal * | dictionary (int lsaid, int id) |
| static bool | dictionary (int lsaid, int id, NIVissimTLSignal *o) |
| static SSignalDictType | getSignalsFor (int tlid) |
Protected Attributes | |
| int | myEdgeID |
| IntVector | myGroupIDs |
| int | myID |
| int | myLane |
| int | myLSA |
| std::string | myName |
| SUMOReal | myPosition |
| IntVector | myVehicleTypes |
Static Protected Attributes | |
| static SignalDictType | myDict |
| NIVissimTL::NIVissimTLSignal::NIVissimTLSignal | ( | int | lsaid, | |
| int | id, | |||
| const std::string & | name, | |||
| const IntVector & | groupids, | |||
| int | edgeid, | |||
| int | laneno, | |||
| SUMOReal | position, | |||
| const IntVector & | assignedVehicleTypes | |||
| ) |
Definition at line 62 of file NIVissimTL.cpp.
00069 : myLSA(lsaid), myID(id), myName(name), myGroupIDs(groupids), 00070 myEdgeID(edgeid), myLane(laneno), myPosition(position), 00071 myVehicleTypes(vehicleTypes) {}
| NIVissimTL::NIVissimTLSignal::~NIVissimTLSignal | ( | ) |
| bool NIVissimTL::NIVissimTLSignal::addTo | ( | NBEdgeCont & | ec, | |
| NBLoadedTLDef * | node | |||
| ) | const |
Definition at line 141 of file NIVissimTL.cpp.
References NBLoadedTLDef::addToSignalGroup(), NIVissimConnection::dictionary(), NBEdge::getConnectionsFromLane(), NIVissimConnection::getFromEdgeID(), NBEdge::getNoLanes(), NIVissimConnection::getToEdgeID(), MsgHandler::getWarningInstance(), MsgHandler::inform(), NBEdge::lanesWereAssigned(), myEdgeID, myGroupIDs, myLane, myPosition, NBEdgeCont::retrievePossiblySplitted(), NBEdge::Connection::toEdge, NBEdge::Connection::toLane, toString(), and WRITE_WARNING.
00141 { 00142 NIVissimConnection *c = NIVissimConnection::dictionary(myEdgeID); 00143 NBConnectionVector assignedConnections; 00144 if (c==0) { 00145 // What to do if on an edge? -> close all outgoing connections 00146 NBEdge *edge = ec.retrievePossiblySplitted(toString<int>(myEdgeID), myPosition); 00147 if (edge==0) { 00148 MsgHandler::getWarningInstance()->inform("Could not set tls signal at edge '" + toString(myEdgeID) + "' - the edge was not built."); 00149 return false; 00150 } 00151 // Check whether it is already known, which edges are approached 00152 // by which lanes 00153 // check whether to use the original lanes only 00154 if (edge->lanesWereAssigned()) { 00155 std::vector<NBEdge::Connection> connections = edge->getConnectionsFromLane(myLane-1); 00156 for (std::vector<NBEdge::Connection>::iterator i=connections.begin(); i!=connections.end(); i++) { 00157 const NBEdge::Connection &conn = *i; 00158 assert(myLane-1<(int)edge->getNoLanes()); 00159 assignedConnections.push_back(NBConnection(edge, myLane-1, conn.toEdge, conn.toLane)); 00160 } 00161 } else { 00162 WRITE_WARNING("Edge : Lanes were not assigned(!)"); 00163 for (unsigned int j=0; j<edge->getNoLanes(); j++) { 00164 std::vector<NBEdge::Connection> connections = edge->getConnectionsFromLane(j); 00165 for (std::vector<NBEdge::Connection>::iterator i=connections.begin(); i!=connections.end(); i++) { 00166 const NBEdge::Connection &conn = *i; 00167 assignedConnections.push_back(NBConnection(edge, j, conn.toEdge, conn.toLane)); 00168 } 00169 } 00170 } 00171 } else { 00172 // get the edges 00173 NBEdge *tmpFrom = ec.retrievePossiblySplitted( 00174 toString<int>(c->getFromEdgeID()), 00175 toString<int>(c->getToEdgeID()), 00176 true); 00177 NBEdge *tmpTo = ec.retrievePossiblySplitted( 00178 toString<int>(c->getToEdgeID()), 00179 toString<int>(c->getFromEdgeID()), 00180 false); 00181 // check whether the edges are known 00182 if (tmpFrom!=0&&tmpTo!=0) { 00183 // add connections this signal is responsible for 00184 assignedConnections.push_back(NBConnection(tmpFrom, -1, tmpTo, -1)); 00185 } else { 00186 return false; 00187 // !!! one of the edges could not be build 00188 } 00189 } 00190 // add to the group 00191 assert(myGroupIDs.size()!=0); 00192 if (myGroupIDs.size()==1) { 00193 return tl->addToSignalGroup(toString<int>(*(myGroupIDs.begin())), 00194 assignedConnections); 00195 } else { 00196 // !!! 00197 return tl->addToSignalGroup(toString<int>(*(myGroupIDs.begin())), 00198 assignedConnections); 00199 } 00200 return true; 00201 }
| void NIVissimTL::NIVissimTLSignal::clearDict | ( | ) | [static] |
Definition at line 120 of file NIVissimTL.cpp.
References myDict.
Referenced by NIImporter_Vissim::~NIImporter_Vissim().
00120 { 00121 for (SignalDictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00122 for (SSignalDictType::iterator j=(*i).second.begin(); j!=(*i).second.end(); j++) { 00123 delete(*j).second; 00124 } 00125 } 00126 myDict.clear(); 00127 }
| NIVissimTL::NIVissimTLSignal * NIVissimTL::NIVissimTLSignal::dictionary | ( | int | lsaid, | |
| int | id | |||
| ) | [static] |
Definition at line 106 of file NIVissimTL.cpp.
References myDict.
00106 { 00107 SignalDictType::iterator i = myDict.find(lsaid); 00108 if (i==myDict.end()) { 00109 return 0; 00110 } 00111 SSignalDictType::iterator j = (*i).second.find(id); 00112 if (j==(*i).second.end()) { 00113 return 0; 00114 } 00115 return (*j).second; 00116 }
| bool NIVissimTL::NIVissimTLSignal::dictionary | ( | int | lsaid, | |
| int | id, | |||
| NIVissimTL::NIVissimTLSignal * | o | |||
| ) | [static] |
Definition at line 89 of file NIVissimTL.cpp.
References myDict.
Referenced by NIVissimSingleTypeParser_Signalgeberdefinition::parse().
00090 { 00091 SignalDictType::iterator i = myDict.find(lsaid); 00092 if (i==myDict.end()) { 00093 myDict[lsaid] = SSignalDictType(); 00094 i = myDict.find(lsaid); 00095 } 00096 SSignalDictType::iterator j = (*i).second.find(id); 00097 if (j==(*i).second.end()) { 00098 myDict[lsaid][id] = o; 00099 return true; 00100 } 00101 return false; 00102 }
| Position2D NIVissimTL::NIVissimTLSignal::getPosition | ( | ) | const |
Definition at line 83 of file NIVissimTL.cpp.
References NIVissimAbstractEdge::dictionary(), myEdgeID, and myPosition.
Referenced by isWithin().
00083 { 00084 return NIVissimAbstractEdge::dictionary(myEdgeID)->getGeomPosition(myPosition); 00085 }
| NIVissimTL::SSignalDictType NIVissimTL::NIVissimTLSignal::getSignalsFor | ( | int | tlid | ) | [static] |
Definition at line 131 of file NIVissimTL.cpp.
References myDict.
Referenced by NIVissimTL::dict_SetSignals().
00131 { 00132 SignalDictType::iterator i = myDict.find(tlid); 00133 if (i==myDict.end()) { 00134 return SSignalDictType(); 00135 } 00136 return (*i).second; 00137 }
| bool NIVissimTL::NIVissimTLSignal::isWithin | ( | const Position2DVector & | poly | ) | const |
Definition at line 77 of file NIVissimTL.cpp.
References Position2DVector::around(), and getPosition().
00077 { 00078 return poly.around(getPosition()); 00079 }
NIVissimTL::SignalDictType NIVissimTL::NIVissimTLSignal::myDict [static, protected] |
Definition at line 107 of file NIVissimTL.h.
Referenced by clearDict(), dictionary(), and getSignalsFor().
int NIVissimTL::NIVissimTLSignal::myEdgeID [protected] |
IntVector NIVissimTL::NIVissimTLSignal::myGroupIDs [protected] |
int NIVissimTL::NIVissimTLSignal::myID [protected] |
Definition at line 100 of file NIVissimTL.h.
int NIVissimTL::NIVissimTLSignal::myLane [protected] |
int NIVissimTL::NIVissimTLSignal::myLSA [protected] |
Definition at line 99 of file NIVissimTL.h.
std::string NIVissimTL::NIVissimTLSignal::myName [protected] |
Definition at line 101 of file NIVissimTL.h.
SUMOReal NIVissimTL::NIVissimTLSignal::myPosition [protected] |
Definition at line 106 of file NIVissimTL.h.
1.5.6