#include <NIVissimDisturbance.h>

Definition at line 49 of file NIVissimDisturbance.h.
Public Member Functions | |
| bool | addToNode (NBNode *node, NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec) |
| bool | clustered () const |
| void | computeBounding () |
| bool | crosses (const AbstractPoly &poly, SUMOReal offset=0) const |
| const Boundary & | getBoundary () const |
| NBConnection | getConnection (NBNode *node, int aedgeid) |
| int | getDisturbanceID () const |
| int | getEdgeID () const |
| void | inCluster (int id) |
| NIVissimDisturbance (int id, const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by, SUMOReal timegap, SUMOReal waygap, SUMOReal vmax) | |
| virtual | ~NIVissimDisturbance () |
Static Public Member Functions | |
| static void | clearDict () |
| static void | closeLoading () |
| static void | dict_SetDisturbances () |
| static NIVissimDisturbance * | dictionary (int id) |
| static bool | dictionary (int id, NIVissimDisturbance *o) |
| static bool | dictionary (int id, const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by, SUMOReal timegap, SUMOReal waygap, SUMOReal vmax) |
| static IntVector | getWithin (const AbstractPoly &poly) |
| static void | reportRefused () |
Protected Types | |
| typedef std::set < NIVissimBoundedClusterObject * > | ContType |
Protected Attributes | |
| Boundary * | myBoundary |
| int | myClusterID |
Private Types | |
| typedef std::map< int, NIVissimDisturbance * > | DictType |
Private Attributes | |
| NIVissimExtendedEdgePoint | myDisturbance |
| NIVissimExtendedEdgePoint | myEdge |
| int | myID |
| std::string | myName |
| int | myNode |
| SUMOReal | myTimeGap |
| SUMOReal | myVMax |
| SUMOReal | myWayGap |
Static Private Attributes | |
| static DictType | myDict |
| static int | myRunningID = 100000000 |
| static int | refusedProhibits = 0 |
typedef std::set<NIVissimBoundedClusterObject*> NIVissimBoundedClusterObject::ContType [protected, inherited] |
Definition at line 59 of file NIVissimBoundedClusterObject.h.
typedef std::map<int, NIVissimDisturbance*> NIVissimDisturbance::DictType [private] |
Definition at line 88 of file NIVissimDisturbance.h.
| NIVissimDisturbance::NIVissimDisturbance | ( | int | id, | |
| const std::string & | name, | |||
| const NIVissimExtendedEdgePoint & | edge, | |||
| const NIVissimExtendedEdgePoint & | by, | |||
| SUMOReal | timegap, | |||
| SUMOReal | waygap, | |||
| SUMOReal | vmax | |||
| ) |
Definition at line 64 of file NIVissimDisturbance.cpp.
Referenced by dictionary().
00070 : myID(id), myNode(-1), myName(name), myEdge(edge), myDisturbance(by), 00071 myTimeGap(timegap), myWayGap(waygap), myVMax(vmax) {}
| NIVissimDisturbance::~NIVissimDisturbance | ( | ) | [virtual] |
| bool NIVissimDisturbance::addToNode | ( | NBNode * | node, | |
| NBDistrictCont & | dc, | |||
| NBNodeCont & | nc, | |||
| NBEdgeCont & | ec | |||
| ) |
Definition at line 143 of file NIVissimDisturbance.cpp.
References NBNode::addSortedLinkFoes(), NBConnection::check(), NIVissimAbstractEdge::crossesEdgeAtPoint(), NIVissimEdge::dictionary(), NIVissimConnection::dictionary(), NBEdge::getConnectedEdges(), getConnection(), NIVissimExtendedEdgePoint::getEdgeID(), NIVissimConnection::getFromEdgeID(), NBEdge::getFromNode(), NBEdge::getID(), NIVissimAbstractEdge::getID(), NIVissimExtendedEdgePoint::getPosition(), NIVissimConnection::getToEdgeID(), NBEdge::getToNode(), myDisturbance, myEdge, myNode, refusedProhibits, NBEdgeCont::retrieve(), NBNodeCont::retrieve(), NBEdgeCont::retrievePossiblySplitted(), NBEdgeCont::splitAt(), and WRITE_WARNING.
Referenced by NIVissimNodeCluster::dict_addDisturbances().
00144 { 00145 myNode = 0; 00146 NIVissimConnection *pc = 00147 NIVissimConnection::dictionary(myEdge.getEdgeID()); 00148 NIVissimConnection *bc = 00149 NIVissimConnection::dictionary(myDisturbance.getEdgeID()); 00150 if (pc==0 && bc==0) { 00151 // This has not been tested completely, yet 00152 // Both competing abstract edges are normal edges 00153 // We have to find a crossing point, build a node here, 00154 // split both edges and add the connections 00155 NIVissimEdge *e1 = NIVissimEdge::dictionary(myEdge.getEdgeID()); 00156 NIVissimEdge *e2 = NIVissimEdge::dictionary(myDisturbance.getEdgeID()); 00157 WRITE_WARNING("Ugly split to prohibit '" + toString<int>(e1->getID())+ "' by '" + toString<int>(e2->getID())+ "'."); 00158 Position2D pos = e1->crossesEdgeAtPoint(e2); 00159 std::string id1 = toString<int>(e1->getID()) + "x" + toString<int>(e2->getID()); 00160 std::string id2 = toString<int>(e2->getID()) + "x" + toString<int>(e1->getID()); 00161 NBNode *node1 = nc.retrieve(id1); 00162 NBNode *node2 = nc.retrieve(id2); 00163 NBNode *node = 0; 00164 assert(node1==0||node2==0); 00165 if (node1==0&&node2==0) { 00166 refusedProhibits++; 00167 return false; 00168 /* node = new NBNode(id1, pos.x(), pos.y(), "priority"); 00169 if(!myNodeCont.insert(node)) { 00170 "nope, NIVissimDisturbance" << endl; 00171 throw 1; 00172 }*/ 00173 } else { 00174 node = node1==0 ? node2 : node1; 00175 } 00176 ec.splitAt(dc, 00177 ec.retrievePossiblySplitted( 00178 toString<int>(e1->getID()), myEdge.getPosition()), 00179 node); 00180 ec.splitAt(dc, 00181 ec.retrievePossiblySplitted( 00182 toString<int>(e2->getID()), myDisturbance.getPosition()), 00183 node); 00184 // !!! in some cases, one of the edges is not being build because it's too short 00185 // !!! what to do in these cases? 00186 NBEdge *mayDriveFrom = ec.retrieve(toString<int>(e1->getID()) + "[0]"); 00187 NBEdge *mayDriveTo = ec.retrieve(toString<int>(e1->getID()) + "[1]"); 00188 NBEdge *mustStopFrom = ec.retrieve(toString<int>(e2->getID()) + "[0]"); 00189 NBEdge *mustStopTo = ec.retrieve(toString<int>(e2->getID()) + "[1]"); 00190 if (mayDriveFrom!=0&&mayDriveTo!=0&&mustStopFrom!=0&&mustStopTo!=0) { 00191 node->addSortedLinkFoes( 00192 NBConnection(mayDriveFrom, mayDriveTo), 00193 NBConnection(mayDriveFrom, mayDriveTo)); 00194 } else { 00195 refusedProhibits++; 00196 return false; 00197 // !!! warning 00198 } 00199 // } 00200 } else if (pc!=0 && bc==0) { 00201 // The prohibited abstract edge is a connection, the other 00202 // is not; 00203 // The connection will be prohibitesd by all connections 00204 // outgoing from the "real" edge 00205 00206 NBEdge *e = ec.retrievePossiblySplitted(toString<int>(myDisturbance.getEdgeID()), myDisturbance.getPosition()); 00207 if (e==0) { 00208 WRITE_WARNING("Could not prohibit '"+ toString<int>(myEdge.getEdgeID()) + "' by '" + toString<int>(myDisturbance.getEdgeID())+ "'. Have not found disturbance."); 00209 refusedProhibits++; 00210 return false; 00211 } 00212 if (e->getFromNode()==e->getToNode()) { 00213 WRITE_WARNING("Could not prohibit '"+ toString<int>(myEdge.getEdgeID()) + "' by '" + toString<int>(myDisturbance.getEdgeID())+ "'. Disturbance connects same node."); 00214 refusedProhibits++; 00215 // What to do with dummy edges? 00216 return false; 00217 } 00218 // get the begin of the prohibited connection 00219 std::string id_pcoe = toString<int>(pc->getFromEdgeID()); 00220 std::string id_pcie = toString<int>(pc->getToEdgeID()); 00221 NBEdge *pcoe = ec.retrievePossiblySplitted(id_pcoe, id_pcie, true); 00222 NBEdge *pcie = ec.retrievePossiblySplitted(id_pcie, id_pcoe, false); 00223 // check whether it's ending node is the node the prohibited 00224 // edge end at 00225 if (pcoe!=0&&pcie!=0&&pcoe->getToNode()==e->getToNode()) { 00226 // if so, simply prohibit the connections 00227 NBNode *node = e->getToNode(); 00228 const EdgeVector &connected = e->getConnectedEdges(); 00229 for (EdgeVector::const_iterator i=connected.begin(); i!=connected.end(); i++) { 00230 node->addSortedLinkFoes( 00231 NBConnection(e, *i), 00232 NBConnection(pcoe, pcie)); 00233 } 00234 } else { 00235 WRITE_WARNING("Would have to split edge '" + e->getID() + "' to build a prohibition"); 00236 refusedProhibits++; 00237 // quite ugly - why was it not build? 00238 return false; 00239 /* 00240 std::string nid1 = e->getID() + "[0]"; 00241 std::string nid2 = e->getID() + "[1]"; 00242 00243 if(ec.splitAt(e, node)) { 00244 node->addSortedLinkFoes( 00245 NBConnection( 00246 ec.retrieve(nid1), 00247 ec.retrieve(nid2) 00248 ), 00249 getConnection(node, myEdge.getEdgeID()) 00250 ); 00251 } 00252 */ 00253 } 00254 } else if (bc!=0 && pc==0) { 00255 // The prohibiting abstract edge is a connection, the other 00256 // is not; 00257 // We have to split the other one and add the prohibition 00258 // description 00259 00260 NBEdge *e = ec.retrievePossiblySplitted( 00261 toString<int>(myEdge.getEdgeID()), myEdge.getPosition()); 00262 if (e==0) { 00263 WRITE_WARNING("Could not prohibit '" + toString<int>(myEdge.getEdgeID()) + "' - it was not built."); 00264 return false; 00265 } 00266 std::string nid1 = e->getID() + "[0]"; 00267 std::string nid2 = e->getID() + "[1]"; 00268 if (e->getFromNode()==e->getToNode()) { 00269 WRITE_WARNING("Could not prohibit '" + toString<int>(myEdge.getEdgeID()) + "' by '" + toString<int>(myDisturbance.getEdgeID())+ "'."); 00270 refusedProhibits++; 00271 // What to do with dummy edges? 00272 return false; 00273 } 00274 // get the begin of the prohibiting connection 00275 std::string id_bcoe = toString<int>(bc->getFromEdgeID()); 00276 std::string id_bcie = toString<int>(bc->getToEdgeID()); 00277 NBEdge *bcoe = ec.retrievePossiblySplitted(id_bcoe, id_bcie, true); 00278 NBEdge *bcie = ec.retrievePossiblySplitted(id_bcie, id_bcoe, false); 00279 // check whether it's ending node is the node the prohibited 00280 // edge end at 00281 if (bcoe!=0&&bcie!=0&&bcoe->getToNode()==e->getToNode()) { 00282 // if so, simply prohibit the connections 00283 NBNode *node = e->getToNode(); 00284 const EdgeVector &connected = e->getConnectedEdges(); 00285 for (EdgeVector::const_iterator i=connected.begin(); i!=connected.end(); i++) { 00286 node->addSortedLinkFoes( 00287 NBConnection(bcoe, bcie), 00288 NBConnection(e, *i)); 00289 } 00290 } else { 00291 WRITE_WARNING("Would have to split edge '" + e->getID() + "' to build a prohibition"); 00292 refusedProhibits++; 00293 return false; 00294 /* 00295 // quite ugly - why was it not build? 00296 if(ec.splitAt(e, node)) { 00297 node->addSortedLinkFoes( 00298 getConnection(node, myDisturbance.getEdgeID()), 00299 NBConnection( 00300 ec.retrieve(nid1), 00301 ec.retrieve(nid2) 00302 ) 00303 ); 00304 } 00305 */ 00306 } 00307 } else { 00308 // both the prohibiting and the prohibited abstract edges 00309 // are connections 00310 // We can retrieve the conected edges and add the desription 00311 NBConnection conn1 = getConnection(node, myDisturbance.getEdgeID()); 00312 NBConnection conn2 = getConnection(node, myEdge.getEdgeID()); 00313 if (!conn1.check(ec)||!conn2.check(ec)) { 00314 refusedProhibits++; 00315 return false; 00316 } 00317 node->addSortedLinkFoes(conn1, conn2); 00318 } 00319 return true; 00320 }
| void NIVissimDisturbance::clearDict | ( | ) | [static] |
Definition at line 344 of file NIVissimDisturbance.cpp.
References myDict.
Referenced by NIImporter_Vissim::~NIImporter_Vissim().
00344 { 00345 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00346 delete(*i).second; 00347 } 00348 myDict.clear(); 00349 }
| void NIVissimBoundedClusterObject::closeLoading | ( | ) | [static, inherited] |
Definition at line 73 of file NIVissimBoundedClusterObject.cpp.
References NIVissimBoundedClusterObject::myDict.
Referenced by NIImporter_Vissim::postLoadBuild().
00073 { 00074 for (ContType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00075 (*i)->computeBounding(); 00076 } 00077 }
| bool NIVissimBoundedClusterObject::clustered | ( | ) | const [inherited] |
Definition at line 67 of file NIVissimBoundedClusterObject.cpp.
References NIVissimBoundedClusterObject::myClusterID.
Referenced by NIVissimConnection::buildNodeClusters().
00067 { 00068 return myClusterID>0; 00069 }
| void NIVissimDisturbance::computeBounding | ( | ) | [virtual] |
Implements NIVissimBoundedClusterObject.
Definition at line 127 of file NIVissimDisturbance.cpp.
References Boundary::add(), NIVissimAbstractEdge::dictionary(), NIVissimExtendedEdgePoint::getEdgeID(), NIVissimExtendedEdgePoint::getGeomPosition(), NIVissimBoundedClusterObject::myBoundary, myDisturbance, myEdge, Boundary::xmax(), and Boundary::xmin().
00127 { 00128 assert(myBoundary==0); 00129 Boundary *bound = new Boundary(); 00130 if (NIVissimAbstractEdge::dictionary(myEdge.getEdgeID())!=0) { 00131 bound->add(myEdge.getGeomPosition()); 00132 } 00133 if (NIVissimAbstractEdge::dictionary(myDisturbance.getEdgeID())!=0) { 00134 bound->add(myDisturbance.getGeomPosition()); 00135 } 00136 myBoundary = bound; 00137 assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin()); 00138 }
| bool NIVissimBoundedClusterObject::crosses | ( | const AbstractPoly & | poly, | |
| SUMOReal | offset = 0 | |||
| ) | const [inherited] |
Definition at line 53 of file NIVissimBoundedClusterObject.cpp.
References NIVissimBoundedClusterObject::myBoundary, Boundary::overlapsWith(), Boundary::xmax(), and Boundary::xmin().
00054 { 00055 assert(myBoundary!=0&&myBoundary->xmax()>=myBoundary->xmin()); 00056 return myBoundary->overlapsWith(poly, offset); 00057 }
| void NIVissimDisturbance::dict_SetDisturbances | ( | ) | [static] |
Definition at line 353 of file NIVissimDisturbance.cpp.
References NIVissimAbstractEdge::dictionary(), NIVissimExtendedEdgePoint::getEdgeID(), myDict, myDisturbance, and myEdge.
Referenced by NIImporter_Vissim::postLoadBuild().
00353 { 00354 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00355 NIVissimDisturbance *d = (*i).second; 00356 NIVissimAbstractEdge::dictionary(d->myEdge.getEdgeID())->addDisturbance((*i).first); 00357 NIVissimAbstractEdge::dictionary(d->myDisturbance.getEdgeID())->addDisturbance((*i).first); 00358 } 00359 /* for(DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00360 delete (*i).second; 00361 } 00362 */ 00363 }
| NIVissimDisturbance * NIVissimDisturbance::dictionary | ( | int | id | ) | [static] |
Definition at line 106 of file NIVissimDisturbance.cpp.
References myDict.
00106 { 00107 DictType::iterator i=myDict.find(id); 00108 if (i==myDict.end()) { 00109 return 0; 00110 } 00111 return (*i).second; 00112 }
| bool NIVissimDisturbance::dictionary | ( | int | id, | |
| NIVissimDisturbance * | o | |||
| ) | [static] |
| bool NIVissimDisturbance::dictionary | ( | int | id, | |
| const std::string & | name, | |||
| const NIVissimExtendedEdgePoint & | edge, | |||
| const NIVissimExtendedEdgePoint & | by, | |||
| SUMOReal | timegap, | |||
| SUMOReal | waygap, | |||
| SUMOReal | vmax | |||
| ) | [static] |
Definition at line 79 of file NIVissimDisturbance.cpp.
References myRunningID, and NIVissimDisturbance().
Referenced by NIVissimNodeCluster::dict_addDisturbances(), NIVissimConnectionCluster::getDisturbanceParticipators(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parseNumbered(), and NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePositionDescribed().
00083 { 00084 int nid = myRunningID++; 00085 NIVissimDisturbance *o = 00086 new NIVissimDisturbance(nid, name, edge, by, timegap, waygap, vmax); 00087 if (!dictionary(nid, o)) { 00088 delete o; 00089 } 00090 return true; 00091 }
| const Boundary & NIVissimBoundedClusterObject::getBoundary | ( | ) | const [inherited] |
Definition at line 81 of file NIVissimBoundedClusterObject.cpp.
References NIVissimBoundedClusterObject::myBoundary.
Referenced by NIVissimConnectionCluster::liesOnSameEdgesEnd().
00081 { 00082 return *myBoundary; 00083 }
| NBConnection NIVissimDisturbance::getConnection | ( | NBNode * | node, | |
| int | aedgeid | |||
| ) |
Definition at line 324 of file NIVissimDisturbance.cpp.
References NIVissimConnection::dictionary(), NIVissimEdge::dictionary(), NIVissimExtendedEdgePoint::getEdgeID(), NIVissimConnection::getFromEdgeID(), NBNode::getPossiblySplittedIncoming(), NBNode::getPossiblySplittedOutgoing(), NIVissimConnection::getToEdgeID(), myEdge, and WRITE_WARNING.
Referenced by addToNode().
00324 { 00325 if (NIVissimEdge::dictionary(myEdge.getEdgeID())==0) { 00326 NIVissimConnection *c = NIVissimConnection::dictionary(aedgeid); 00327 NBEdge *from = 00328 node->getPossiblySplittedIncoming(toString<int>(c->getFromEdgeID())); 00329 NBEdge *to = 00330 node->getPossiblySplittedOutgoing(toString<int>(c->getToEdgeID())); 00331 00332 // source is a connection 00333 return NBConnection(toString<int>(c->getFromEdgeID()), from, 00334 toString<int>(c->getToEdgeID()), to); 00335 } else { 00336 WRITE_WARNING("NIVissimDisturbance: no connection"); 00337 return NBConnection(0, 0); 00338 // throw 1; // !!! what to do? 00339 } 00340 00341 }
| int NIVissimDisturbance::getDisturbanceID | ( | ) | const [inline] |
Definition at line 63 of file NIVissimDisturbance.h.
References NIVissimExtendedEdgePoint::getEdgeID(), and myDisturbance.
Referenced by NIVissimConnectionCluster::getDisturbanceParticipators().
00063 { 00064 return myDisturbance.getEdgeID(); 00065 }
| int NIVissimDisturbance::getEdgeID | ( | ) | const [inline] |
Definition at line 60 of file NIVissimDisturbance.h.
References NIVissimExtendedEdgePoint::getEdgeID(), and myEdge.
Referenced by NIVissimConnectionCluster::getDisturbanceParticipators().
| IntVector NIVissimDisturbance::getWithin | ( | const AbstractPoly & | poly | ) | [static] |
Definition at line 115 of file NIVissimDisturbance.cpp.
References myDict.
Referenced by NIVissimConnectionCluster::buildNodeClusters().
00115 { 00116 IntVector ret; 00117 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00118 if ((*i).second->crosses(poly)) { 00119 ret.push_back((*i).second->myID); 00120 } 00121 } 00122 return ret; 00123 }
| void NIVissimBoundedClusterObject::inCluster | ( | int | id | ) | [inherited] |
Definition at line 61 of file NIVissimBoundedClusterObject.cpp.
References NIVissimBoundedClusterObject::myClusterID.
00061 { 00062 myClusterID = id; 00063 }
| void NIVissimDisturbance::reportRefused | ( | ) | [static] |
Definition at line 367 of file NIVissimDisturbance.cpp.
References myDict, refusedProhibits, and WRITE_WARNING.
Referenced by NIVissimNodeCluster::dict_addDisturbances().
00367 { 00368 if (refusedProhibits>0) { 00369 WRITE_WARNING("Could not build " + toString<size_t>(refusedProhibits)+ " of " + toString<size_t>(myDict.size())+ " disturbances."); 00370 } 00371 }
Boundary* NIVissimBoundedClusterObject::myBoundary [protected, inherited] |
Definition at line 61 of file NIVissimBoundedClusterObject.h.
Referenced by NIVissimConnection::buildNodeClusters(), computeBounding(), NIVissimConnection::computeBounding(), NIVissimBoundedClusterObject::crosses(), NIVissimBoundedClusterObject::getBoundary(), NIVissimConnection::getBoundingBox(), and NIVissimBoundedClusterObject::~NIVissimBoundedClusterObject().
int NIVissimBoundedClusterObject::myClusterID [protected, inherited] |
Definition at line 62 of file NIVissimBoundedClusterObject.h.
Referenced by NIVissimBoundedClusterObject::clustered(), and NIVissimBoundedClusterObject::inCluster().
NIVissimDisturbance::DictType NIVissimDisturbance::myDict [static, private] |
Reimplemented from NIVissimBoundedClusterObject.
Definition at line 89 of file NIVissimDisturbance.h.
Referenced by clearDict(), dict_SetDisturbances(), dictionary(), getWithin(), and reportRefused().
Definition at line 85 of file NIVissimDisturbance.h.
Referenced by addToNode(), computeBounding(), dict_SetDisturbances(), and getDisturbanceID().
Definition at line 84 of file NIVissimDisturbance.h.
Referenced by addToNode(), computeBounding(), dict_SetDisturbances(), getConnection(), and getEdgeID().
int NIVissimDisturbance::myID [private] |
Definition at line 81 of file NIVissimDisturbance.h.
std::string NIVissimDisturbance::myName [private] |
Definition at line 83 of file NIVissimDisturbance.h.
int NIVissimDisturbance::myNode [private] |
int NIVissimDisturbance::myRunningID = 100000000 [static, private] |
SUMOReal NIVissimDisturbance::myTimeGap [private] |
Definition at line 86 of file NIVissimDisturbance.h.
SUMOReal NIVissimDisturbance::myVMax [private] |
Definition at line 86 of file NIVissimDisturbance.h.
SUMOReal NIVissimDisturbance::myWayGap [private] |
Definition at line 86 of file NIVissimDisturbance.h.
int NIVissimDisturbance::refusedProhibits = 0 [static, private] |
Definition at line 91 of file NIVissimDisturbance.h.
Referenced by addToNode(), and reportRefused().
1.5.6