#include <NIVissimEdge.h>

Definition at line 60 of file NIVissimEdge.h.
Public Member Functions | |
| void | addDisturbance (int disturbance) |
| void | addIncomingConnection (int id) |
| Adds a connection where this edge is the destination. | |
| void | addOutgoingConnection (int id) |
| Adds a connection where this edge is the source. | |
| void | addToConnectionCluster (NIVissimConnectionCluster *c) |
| bool | addToTreatAsSame (NIVissimEdge *e) |
| void | buildGeom () |
| void | checkDistrictConnectionExistanceAt (SUMOReal pos) |
| SUMOReal | crossesAtPoint (const Position2D &p1, const Position2D &p2) const |
| bool | crossesEdge (NIVissimAbstractEdge *c) const |
| Position2D | crossesEdgeAtPoint (NIVissimAbstractEdge *c) const |
| Position2D | getBegin2D () const |
| NIVissimEdge * | getBestIncoming () const throw () |
| NIVissimEdge * | getBestOutgoing () const throw () |
| NIVissimConnection * | getConnectionTo (NIVissimEdge *e) |
| const IntVector & | getDisturbances () const |
| Position2D | getEnd2D () const |
| Returns the end position of the edge. | |
| const Position2DVector & | getGeometry () const |
| Position2D | getGeomPosition (SUMOReal pos) const |
| int | getID () const |
| SUMOReal | getLength () const |
| Returns the length of the node. | |
| NBNode * | getNodeAt (const Position2D &p, NBNode *other=0) |
| Returns the node at the given position As this may be ambigous, a second node not to return may be supplied. | |
| const std::vector < NIVissimEdge * > & | getToTreatAsSame () const |
| bool | hasNodeCluster () const |
| void | mergedInto (NIVissimConnectionCluster *old, NIVissimConnectionCluster *act) |
| NIVissimEdge (int id, const std::string &name, const std::string &type, int noLanes, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, const Position2DVector &geom, const NIVissimClosedLanesVector &clv) | |
| Constructor. | |
| bool | overlapsWith (const AbstractPoly &p, SUMOReal offset=0.0) const |
| void | removeFromConnectionCluster (NIVissimConnectionCluster *c) |
| void | setNodeCluster (int nodeid) |
| void | setSpeed (size_t lane, int speedDist) |
| void | splitAssigning () |
| bool | wasWithinAJunction () const throw () |
| Returns whether this edge was found to be within a junction. | |
| ~NIVissimEdge () | |
| Destructor. | |
Static Public Member Functions | |
| static void | buildConnectionClusters () throw () |
| Clusters connections of each edge. | |
| static void | clearDict () |
| static void | dict_buildNBEdges (NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, SUMOReal offset) |
| Builds NBEdges from the VissimEdges within the dictionary. | |
| static void | dict_checkEdges2Join () |
| static void | dict_propagateSpeeds () |
| static bool | dictionary (int id, NIVissimAbstractEdge *e) |
| static NIVissimEdge * | dictionary (int id) |
| Returns the named edge from the dictionary. | |
| static bool | dictionary (int id, NIVissimEdge *o) |
| Adds the edge to the dictionary. | |
| static bool | dictionary (int id, const std::string &name, const std::string &type, int noLanes, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, const Position2DVector &geom, const NIVissimClosedLanesVector &clv) |
| Adds the described item to the dictionary Builds the edge first. | |
| static IntVector | getWithin (const AbstractPoly &p, SUMOReal offset=0.0) |
| static void | reportUnsetSpeeds () throw () |
| Writes edges with unset speeds to the warnings message log instance. | |
| static void | splitAndAssignToNodes () |
Protected Attributes | |
| IntVector | myDisturbances |
| Position2DVector | myGeom |
| int | myID |
| int | myNode |
Private Types | |
| typedef std::vector < NIVissimConnectionCluster * > | ConnectionClusters |
| The definition for a container for connection clusters. | |
| typedef std::map< int, NIVissimEdge * > | DictType |
| Definition of the dictionary type. | |
Private Member Functions | |
| void | buildNBEdge (NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, SUMOReal sameNodesOffset) throw (ProcessError) |
| Builds the NBEdge from this VissimEdge. | |
| void | checkUnconnectedLaneSpeeds () |
| std::pair < NIVissimConnectionCluster *, NBNode * > | getFromNode (NBNodeCont &nc, ConnectionClusters &clusters) |
| Returns the origin node. | |
| std::vector< NIVissimConnection * > | getOutgoingConnected (int lane) const |
| SUMOReal | getRealSpeed (int distNo) |
| std::pair < NIVissimConnectionCluster *, NBNode * > | getToNode (NBNodeCont &nc, ConnectionClusters &clusters) |
| Returns the destination node. | |
| void | propagateOwn () |
| void | propagateSpeed (SUMOReal speed, IntVector forLanes) |
| std::pair< NBNode *, NBNode * > | remapOneOfNodes (NBNodeCont &nc, NIVissimDistrictConnection *d, NBNode *fromNode, NBNode *toNode) |
| std::pair< NBNode *, NBNode * > | resolveSameNode (NBNodeCont &nc, SUMOReal offset, NBNode *prevFrom, NBNode *prevTo) |
| Tries to resolve the problem that the same node has been returned as origin and destination node. | |
| void | setDistrictSpeed () |
Static Private Member Functions | |
| static NBNode * | getNodeSecure (int nodeid, const Position2D &pos, const std::string &possibleName) |
Private Attributes | |
| bool | myAmWithinJunction |
| Information whether this edge was not build due to being within a junction. | |
| NIVissimClosedLanesVector | myClosedLanes |
| List of lanes closed on this edge. | |
| ConnectionClusters | myConnectionClusters |
| List of connection clusters along this edge. | |
| DoubleVector | myDistrictConnections |
| IntVector | myIncomingConnections |
| List of connections incoming to this edge. | |
| std::vector< SUMOReal > | myLaneSpeeds |
| std::string | myName |
| The name of the edge. | |
| unsigned int | myNoLanes |
| The number of lanes the edge has. | |
| IntVector | myOutgoingConnections |
| List of connections outgoing from this edge. | |
| IntVector | myPatchedSpeeds |
| std::vector< NIVissimEdge * > | myToTreatAsSame |
| std::string | myType |
| The tape of the edge. | |
| SUMOReal | myZuschlag1 |
| Additional load values for this edge. | |
| SUMOReal | myZuschlag2 |
Static Private Attributes | |
| static DictType | myDict |
| The dictionary. | |
| static std::vector< std::string > | myLanesWithMissingSpeeds |
| static int | myMaxID = 0 |
| The current maximum id; needed for further id assignment. | |
Friends | |
| class | NIVissimNodeDef_Edges |
| class | NIVissimNodeDef_Poly |
Data Structures | |
| class | connection_cluster_position_sorter |
| class | connection_position_sorter |
typedef std::vector<NIVissimConnectionCluster*> NIVissimEdge::ConnectionClusters [private] |
The definition for a container for connection clusters.
Definition at line 169 of file NIVissimEdge.h.
typedef std::map<int, NIVissimEdge*> NIVissimEdge::DictType [private] |
Definition of the dictionary type.
Reimplemented from NIVissimAbstractEdge.
Definition at line 295 of file NIVissimEdge.h.
| NIVissimEdge::NIVissimEdge | ( | int | id, | |
| const std::string & | name, | |||
| const std::string & | type, | |||
| int | noLanes, | |||
| SUMOReal | zuschlag1, | |||
| SUMOReal | zuschlag2, | |||
| SUMOReal | length, | |||
| const Position2DVector & | geom, | |||
| const NIVissimClosedLanesVector & | clv | |||
| ) |
Constructor.
Definition at line 116 of file NIVissimEdge.cpp.
References NIVissimAbstractEdge::myID, myLaneSpeeds, and myMaxID.
Referenced by dictionary().
00121 : NIVissimAbstractEdge(id, geom), 00122 myName(name), myType(type), myNoLanes(noLanes), 00123 myZuschlag1(zuschlag1), myZuschlag2(zuschlag2), 00124 myClosedLanes(clv), myAmWithinJunction(false) { //, mySpeed(-1) 00125 assert(noLanes>=0); 00126 if (myMaxID<myID) { 00127 myMaxID = myID; 00128 } 00129 for (int i=0; i<noLanes; i++) { 00130 myLaneSpeeds.push_back(-1); 00131 } 00132 }
| NIVissimEdge::~NIVissimEdge | ( | ) |
Destructor.
Definition at line 135 of file NIVissimEdge.cpp.
References myClosedLanes.
00135 { 00136 for (NIVissimClosedLanesVector::iterator i=myClosedLanes.begin(); i!=myClosedLanes.end(); i++) { 00137 delete(*i); 00138 } 00139 myClosedLanes.clear(); 00140 }
| void NIVissimAbstractEdge::addDisturbance | ( | int | disturbance | ) | [inherited] |
Definition at line 192 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myDisturbances.
00192 { 00193 myDisturbances.push_back(disturbance); 00194 }
| void NIVissimEdge::addIncomingConnection | ( | int | id | ) |
Adds a connection where this edge is the destination.
Definition at line 785 of file NIVissimEdge.cpp.
References myIncomingConnections.
00785 { 00786 myIncomingConnections.push_back(id); 00787 }
| void NIVissimEdge::addOutgoingConnection | ( | int | id | ) |
Adds a connection where this edge is the source.
Definition at line 791 of file NIVissimEdge.cpp.
References myOutgoingConnections.
00791 { 00792 myOutgoingConnections.push_back(id); 00793 }
| void NIVissimEdge::addToConnectionCluster | ( | NIVissimConnectionCluster * | c | ) |
Definition at line 823 of file NIVissimEdge.cpp.
References myConnectionClusters.
Referenced by NIVissimConnectionCluster::recheckEdges().
00823 { 00824 ConnectionClusters::iterator i= 00825 find(myConnectionClusters.begin(), myConnectionClusters.end(), c); 00826 if (i==myConnectionClusters.end()) { 00827 myConnectionClusters.push_back(c); 00828 } 00829 }
| bool NIVissimEdge::addToTreatAsSame | ( | NIVissimEdge * | e | ) |
Definition at line 929 of file NIVissimEdge.cpp.
References addToTreatAsSame(), and myToTreatAsSame.
Referenced by addToTreatAsSame(), and dict_checkEdges2Join().
00929 { 00930 if (e==this) { 00931 return false; 00932 } 00933 // check whether this edge already knows about the other 00934 if (find(myToTreatAsSame.begin(), myToTreatAsSame.end(), e)==myToTreatAsSame.end()) { 00935 myToTreatAsSame.push_back(e); 00936 return true; 00937 } else { 00938 return false; // !!! check this 00939 } 00940 // 00941 std::vector<NIVissimEdge*>::iterator i; 00942 // add to all other that shall be treated as same 00943 bool changed = true; 00944 while (changed) { 00945 changed = false; 00946 for (i=myToTreatAsSame.begin(); !changed&&i!=myToTreatAsSame.end(); i++) { 00947 changed |= (*i)->addToTreatAsSame(e); 00948 } 00949 for (i=myToTreatAsSame.begin(); !changed&&i!=myToTreatAsSame.end(); i++) { 00950 changed |= e->addToTreatAsSame(*i); 00951 } 00952 } 00953 }
| void NIVissimEdge::buildConnectionClusters | ( | ) | throw () [static] |
Clusters connections of each edge.
For every edge stored in this container, its connections are collected and joined into "clusters" if they have the same "direction" (incoming/outgoing) and are not further than 10m away from each other.
Definition at line 183 of file NIVissimEdge.cpp.
References NIVissimConnection::dictionary(), myConnectionClusters, myDict, myIncomingConnections, myOutgoingConnections, VectorHelper< T >::removeDouble(), and SUMOReal.
Referenced by NIImporter_Vissim::postLoadBuild().
00183 { 00184 const SUMOReal MAX_CLUSTER_DISTANCE = 10; 00185 // build clusters for all edges made up from not previously assigne 00186 // connections 00187 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00188 int edgeid = (*i).first; 00189 NIVissimEdge *edge = (*i).second; 00190 // get all connectors using this edge 00191 IntVector connectors = edge->myIncomingConnections; 00192 copy(edge->myOutgoingConnections.begin(), edge->myOutgoingConnections.end(), back_inserter(connectors)); 00193 if (connectors.size()==0) { 00194 continue; 00195 } 00196 // sort the connectors by the place on the edge 00197 sort(connectors.begin(), connectors.end(), connection_position_sorter(edgeid)); 00198 // try to cluster the connections participating within the current edge 00199 IntVector currentCluster; 00200 IntVector::iterator j=connectors.begin(); 00201 bool outgoing = NIVissimConnection::dictionary(*j)->getFromEdgeID()==(*i).first; 00202 SUMOReal position = outgoing 00203 ? NIVissimConnection::dictionary(*j)->getFromPosition() 00204 : NIVissimConnection::dictionary(*j)->getToPosition(); 00205 00206 // skip connections already in a cluster 00207 // !!! (?) 00208 while (j!=connectors.end()&&NIVissimConnection::dictionary(*j)->hasNodeCluster()) { 00209 ++j; 00210 } 00211 if (j==connectors.end()) { 00212 continue; 00213 } 00214 currentCluster.push_back(*j); 00215 do { 00216 if (j+1!=connectors.end()&&!NIVissimConnection::dictionary(*j)->hasNodeCluster()) { 00217 bool n_outgoing = NIVissimConnection::dictionary(*(j+1))->getFromEdgeID()==edgeid; 00218 SUMOReal n_position = n_outgoing 00219 ? NIVissimConnection::dictionary(*(j+1))->getFromPosition() 00220 : NIVissimConnection::dictionary(*(j+1))->getToPosition(); 00221 if (n_outgoing==outgoing && fabs(n_position-position)<MAX_CLUSTER_DISTANCE) { 00222 // ok, in same cluster as prior 00223 currentCluster.push_back(*(j+1)); 00224 } else { 00225 // start new cluster 00226 VectorHelper<int>::removeDouble(currentCluster); 00227 edge->myConnectionClusters.push_back(new NIVissimConnectionCluster(currentCluster, -1, edgeid)); 00228 currentCluster.clear(); 00229 currentCluster.push_back(*(j+1)); 00230 } 00231 outgoing = n_outgoing; 00232 position = n_position; 00233 } 00234 j++; 00235 } while (j!=connectors.end()); 00236 // add last connection 00237 if (currentCluster.size()>0) { 00238 VectorHelper<int>::removeDouble(currentCluster); 00239 edge->myConnectionClusters.push_back(new NIVissimConnectionCluster(currentCluster, -1, edgeid)); 00240 } 00241 } 00242 }
| void NIVissimEdge::buildGeom | ( | ) | [virtual] |
| void NIVissimEdge::buildNBEdge | ( | NBDistrictCont & | dc, | |
| NBNodeCont & | nc, | |||
| NBEdgeCont & | ec, | |||
| SUMOReal | sameNodesOffset | |||
| ) | throw (ProcessError) [private] |
Builds the NBEdge from this VissimEdge.
| [in] | dc | The district container used if this edge must be split |
| [in] | nc | The node container used for (optionally) building this edge's nodes |
| [in] | ec | The edge control to add this edge to |
| [in] | sameNodesOffset | Offset used to discriminate nodes |
| ProcessError | If one of the built nodes or edges could not be added to the according container |
Definition at line 425 of file NIVissimEdge.cpp.
References OptionsCont::getFloat(), getFromNode(), NBEdge::getID(), NBNode::getID(), OptionsCont::getOptions(), NBNode::getPosition(), getToNode(), MsgHandler::getWarningInstance(), MsgHandler::inform(), NBEdge::LANESPREAD_CENTER, myAmWithinJunction, myConnectionClusters, myDistrictConnections, NIVissimAbstractEdge::myGeom, NIVissimAbstractEdge::myID, myLaneSpeeds, myLanesWithMissingSpeeds, myNoLanes, myType, NBNode::NODETYPE_NOJUNCTION, resolveSameNode(), NBEdge::setLaneSpeed(), SUMOReal, and toString().
Referenced by dict_buildNBEdges().
00426 { 00427 // build the edge 00428 std::pair<NIVissimConnectionCluster*, NBNode *> fromInf, toInf; 00429 NBNode *fromNode, *toNode; 00430 fromNode = toNode = 0; 00431 sort(myConnectionClusters.begin(), myConnectionClusters.end(), connection_cluster_position_sorter(myID)); 00432 sort(myDistrictConnections.begin(), myDistrictConnections.end()); 00433 ConnectionClusters tmpClusters = myConnectionClusters; 00434 if (tmpClusters.size()!=0) { 00435 sort(tmpClusters.begin(), tmpClusters.end(), connection_cluster_position_sorter(myID)); 00436 // get or build the from-node 00437 // A node may have to be build when the edge starts or ends at 00438 // a parking place or something like this 00439 fromInf = getFromNode(nc, tmpClusters); 00440 fromNode = fromInf.second; 00441 // get or build the to-node 00442 //if(tmpClusters.size()>0) { 00443 toInf = getToNode(nc, tmpClusters); 00444 toNode = toInf.second; 00445 if (fromInf.first!=0&&toNode!=0&&fromInf.first->around(toNode->getPosition())) { 00446 MsgHandler::getWarningInstance()->inform("Will not build edge '" + toString(myID) + "'."); 00447 myAmWithinJunction = true; 00448 return; 00449 } 00450 //} 00451 // if both nodes are the same, resolve the problem otherwise 00452 if (fromNode==toNode) { 00453 std::pair<NBNode*, NBNode*> tmp = resolveSameNode(nc, sameNodesOffset, fromNode, toNode); 00454 if (fromNode!=tmp.first) { 00455 fromInf.first = 0; 00456 } 00457 if (toNode!=tmp.second) { 00458 toInf.first = 0; 00459 } 00460 fromNode = tmp.first; 00461 toNode = tmp.second; 00462 } 00463 } 00464 00465 // 00466 if (fromNode==0) { 00467 fromInf.first = 0; 00468 Position2D pos = myGeom[0]; 00469 fromNode = new NBNode(toString<int>(myID) + "-SourceNode", pos, NBNode::NODETYPE_NOJUNCTION); 00470 if (!nc.insert(fromNode)) { 00471 throw ProcessError("Could not insert node '" + fromNode->getID() + "' to nodes container."); 00472 } 00473 } 00474 if (toNode==0) { 00475 toInf.first = 0; 00476 Position2D pos = myGeom[-1]; 00477 toNode = new NBNode(toString<int>(myID) + "-DestinationNode", pos, NBNode::NODETYPE_NOJUNCTION); 00478 if (!nc.insert(toNode)) { 00479 throw ProcessError("Could not insert node '" + toNode->getID() + "' to nodes container."); 00480 } 00481 } 00482 00483 // build the edge 00484 SUMOReal avgSpeed = 0; 00485 int i; 00486 for (i=0; i<(int) myNoLanes; i++) { 00487 if (myLaneSpeeds.size()<=(size_t) i||myLaneSpeeds[i]==-1) { 00488 myLanesWithMissingSpeeds.push_back(toString(myID) + "_" + toString(i)); 00489 avgSpeed += OptionsCont::getOptions().getFloat("vissim.default-speed"); 00490 } else { 00491 avgSpeed += myLaneSpeeds[i]; 00492 } 00493 } 00494 avgSpeed /= (SUMOReal) myLaneSpeeds.size(); 00495 avgSpeed *= OptionsCont::getOptions().getFloat("vissim.speed-norm"); 00496 00497 if (fromNode==toNode) { 00498 MsgHandler::getWarningInstance()->inform("Could not build edge '" + toString(myID) + "'; would connect same node."); 00499 return; 00500 } 00501 00502 NBEdge *buildEdge = new NBEdge( 00503 toString<int>(myID), fromNode, toNode, myType, 00504 avgSpeed/(SUMOReal) 3.6, myNoLanes, -1, myGeom, 00505 NBEdge::LANESPREAD_CENTER, true); 00506 for (i=0; i<(int) myNoLanes; i++) { 00507 if ((int) myLaneSpeeds.size()<=i||myLaneSpeeds[i]==-1) { 00508 buildEdge->setLaneSpeed(i, OptionsCont::getOptions().getFloat("vissim.default-speed")/(SUMOReal) 3.6); 00509 } else { 00510 buildEdge->setLaneSpeed(i, myLaneSpeeds[i]/(SUMOReal) 3.6); 00511 } 00512 } 00513 ec.insert(buildEdge); 00514 // check whether the edge contains any other clusters 00515 if (tmpClusters.size()>0) { 00516 bool cont = true; 00517 for (ConnectionClusters::iterator j = tmpClusters.begin(); cont && j!=tmpClusters.end(); ++j) { 00518 // split the edge at the previously build node 00519 std::string nextID = buildEdge->getID() + "[1]"; 00520 cont = ec.splitAt(dc, buildEdge, (*j)->getNBNode()); 00521 // !!! what to do if the edge could not be split? 00522 buildEdge = ec.retrieve(nextID); 00523 } 00524 } 00525 }
| void NIVissimEdge::checkDistrictConnectionExistanceAt | ( | SUMOReal | pos | ) |
Definition at line 851 of file NIVissimEdge.cpp.
References myDistrictConnections.
Referenced by NIVissimDistrictConnection::checkEdgeEnd().
00851 { 00852 if (find(myDistrictConnections.begin(), myDistrictConnections.end(), pos)==myDistrictConnections.end()) { 00853 myDistrictConnections.push_back(pos); 00854 /* int id = NIVissimConnection::getMaxID() + 1; 00855 IntVector currentCluster; 00856 currentCluster.push_back(id); 00857 myConnectionClusters.push_back( 00858 new NIVissimConnectionCluster(currentCluster, -1, myID));*/ 00859 } 00860 }
| void NIVissimEdge::checkUnconnectedLaneSpeeds | ( | ) | [private] |
Definition at line 280 of file NIVissimEdge.cpp.
References dictionary(), getOutgoingConnected(), NIVissimConnection::getToEdgeID(), NIVissimConnection::getToLanes(), myLaneSpeeds, propagateSpeed(), and SUMOReal.
Referenced by dict_propagateSpeeds().
00280 { 00281 for (int i=0; i<(int) myLaneSpeeds.size(); i++) { 00282 if (myLaneSpeeds[i]==-1) { 00283 SUMOReal speed = -1; 00284 int j1 = i - 1; // !!! recheck - j1 may become negative? 00285 int j2 = i; 00286 while (j2!=(int) myLaneSpeeds.size()&&myLaneSpeeds[j2]==-1) { 00287 j2++; 00288 } 00289 if (j1<0) { 00290 if (j2<(int) myLaneSpeeds.size()) { 00291 speed = myLaneSpeeds[j2]; 00292 } 00293 } else { 00294 if (j2>=(int) myLaneSpeeds.size()) { 00295 speed = myLaneSpeeds[j1]; 00296 } else { 00297 speed = (myLaneSpeeds[j1] + myLaneSpeeds[j2]) / (SUMOReal) 2.0; 00298 } 00299 } 00300 if (speed==-1) { 00301 continue; 00302 } 00303 myLaneSpeeds[i] = speed; 00304 std::vector<NIVissimConnection*> connected = getOutgoingConnected(i); 00305 for (std::vector<NIVissimConnection*>::iterator j=connected.begin(); j!=connected.end(); j++) { 00306 NIVissimConnection *c = *j; 00307 NIVissimEdge *e = NIVissimEdge::dictionary(c->getToEdgeID()); 00308 // propagate 00309 e->propagateSpeed(/*dc, */speed, c->getToLanes()); 00310 } 00311 } 00312 } 00313 }
| void NIVissimAbstractEdge::clearDict | ( | ) | [static, inherited] |
Definition at line 177 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myDict.
Referenced by NIImporter_Vissim::~NIImporter_Vissim().
00177 { 00178 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00179 delete(*i).second; 00180 } 00181 myDict.clear(); 00182 }
| SUMOReal NIVissimAbstractEdge::crossesAtPoint | ( | const Position2D & | p1, | |
| const Position2D & | p2 | |||
| ) | const [inherited] |
Definition at line 135 of file NIVissimAbstractEdge.cpp.
References Position2DVector::getBegin(), Position2DVector::getEnd(), GeomHelper::intersection_position(), NIVissimAbstractEdge::myGeom, and GeomHelper::nearest_position_on_line_to_point().
00136 { 00137 // !!! not needed 00138 Position2D p = GeomHelper::intersection_position( 00139 myGeom.getBegin(), myGeom.getEnd(), p1, p2); 00140 return GeomHelper::nearest_position_on_line_to_point( 00141 myGeom.getBegin(), myGeom.getEnd(), p); 00142 }
| bool NIVissimAbstractEdge::crossesEdge | ( | NIVissimAbstractEdge * | c | ) | const [inherited] |
Definition at line 123 of file NIVissimAbstractEdge.cpp.
References Position2DVector::intersects(), and NIVissimAbstractEdge::myGeom.
Referenced by NIVissimNodeCluster::buildNBNode().
00123 { 00124 return myGeom.intersects(c->myGeom); 00125 }
| Position2D NIVissimAbstractEdge::crossesEdgeAtPoint | ( | NIVissimAbstractEdge * | c | ) | const [inherited] |
Definition at line 129 of file NIVissimAbstractEdge.cpp.
References Position2DVector::intersectsAtPoint(), and NIVissimAbstractEdge::myGeom.
Referenced by NIVissimDisturbance::addToNode(), and NIVissimNodeCluster::buildNBNode().
00129 { 00130 return myGeom.intersectsAtPoint(c->myGeom); 00131 }
| void NIVissimEdge::dict_buildNBEdges | ( | NBDistrictCont & | dc, | |
| NBNodeCont & | nc, | |||
| NBEdgeCont & | ec, | |||
| SUMOReal | offset | |||
| ) | [static] |
Builds NBEdges from the VissimEdges within the dictionary.
Definition at line 246 of file NIVissimEdge.cpp.
References buildNBEdge(), and myDict.
Referenced by NIImporter_Vissim::postLoadBuild().
00247 { 00248 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00249 NIVissimEdge *edge = (*i).second; 00250 edge->buildNBEdge(dc, nc, ec, offset); 00251 } 00252 }
| void NIVissimEdge::dict_checkEdges2Join | ( | ) | [static] |
Definition at line 873 of file NIVissimEdge.cpp.
References addToTreatAsSame(), Line2D::atan2DegreeAngle(), Position2D::distanceTo(), Position2DVector::getBegin(), getConnectionTo(), Position2DVector::getEnd(), NIVissimConnection::getFromEdgeID(), NIVissimConnection::getFromPosition(), NIVissimAbstractEdge::getGeometry(), NIVissimAbstractEdge::getID(), Position2DVector::length(), myDict, and Line2D::p2().
Referenced by NIImporter_Vissim::postLoadBuild().
00873 { 00874 // go through the edges 00875 for (DictType::iterator i1=myDict.begin(); i1!=myDict.end(); i1++) { 00876 // retrieve needed values from the first edge 00877 NIVissimEdge *e1 = (*i1).second; 00878 const Position2DVector &g1 = e1->getGeometry(); 00879 // check all other edges 00880 DictType::iterator i2=i1; 00881 i2++; 00882 for (; i2!=myDict.end(); i2++) { 00883 // retrieve needed values from the second edge 00884 NIVissimEdge *e2 = (*i2).second; 00885 const Position2DVector &g2 = e2->getGeometry(); 00886 // get the connection description 00887 NIVissimConnection *c = e1->getConnectionTo(e2); 00888 if (c==0) { 00889 c = e2->getConnectionTo(e1); 00890 } 00891 // the edge must not be a direct contiuation of the other 00892 if (c!=0) { 00893 if ((c->getFromEdgeID()==e1->getID()&&fabs(c->getFromPosition()-e1->getGeometry().length())<5) 00894 || 00895 (c->getFromEdgeID()==e2->getID()&&fabs(c->getFromPosition()-e2->getGeometry().length())<5)) { 00896 00897 continue; 00898 } 00899 } 00900 // only parallel edges which do end at the same node 00901 // should be joined 00902 // retrieve the "approximating" lines first 00903 Line2D l1 = Line2D(g1.getBegin(), g1.getEnd()); 00904 Line2D l2 = Line2D(g2.getBegin(), g2.getEnd()); 00905 // check for parallelity 00906 // !!! the usage of an explicite value is not very fine 00907 if (fabs(l1.atan2DegreeAngle()-l2.atan2DegreeAngle())>2.0) { 00908 // continue if the lines are not parallel 00909 continue; 00910 } 00911 00912 // check whether the same node is approached 00913 // (the distance between the ends should not be too large) 00914 // !!! the usage of an explicite value is not very fine 00915 if (l1.p2().distanceTo(l2.p2())>10) { 00916 // continue if the lines do not end at the same length 00917 continue; 00918 } 00919 // ok, seem to be different lanes for the same edge 00920 // mark as possibly joined later 00921 e1->addToTreatAsSame(e2); 00922 e2->addToTreatAsSame(e1); 00923 } 00924 } 00925 }
| void NIVissimEdge::dict_propagateSpeeds | ( | ) | [static] |
Definition at line 256 of file NIVissimEdge.cpp.
References checkUnconnectedLaneSpeeds(), myDict, propagateOwn(), propagateSpeed(), and setDistrictSpeed().
Referenced by NIImporter_Vissim::postLoadBuild().
00256 { 00257 DictType::iterator i; 00258 for (i=myDict.begin(); i!=myDict.end(); i++) { 00259 NIVissimEdge *edge = (*i).second; 00260 edge->setDistrictSpeed(/* dc */); 00261 } 00262 for (i=myDict.begin(); i!=myDict.end(); i++) { 00263 NIVissimEdge *edge = (*i).second; 00264 edge->propagateSpeed(/* dc */ -1, IntVector()); 00265 } 00266 for (int j=0; j<3; j++) { 00267 for (i=myDict.begin(); i!=myDict.end(); i++) { 00268 NIVissimEdge *edge = (*i).second; 00269 edge->propagateOwn(/* dc */); 00270 } 00271 for (i=myDict.begin(); i!=myDict.end(); i++) { 00272 NIVissimEdge *edge = (*i).second; 00273 edge->checkUnconnectedLaneSpeeds(/* dc */); 00274 } 00275 } 00276 }
| bool NIVissimAbstractEdge::dictionary | ( | int | id, | |
| NIVissimAbstractEdge * | e | |||
| ) | [static, inherited] |
Definition at line 69 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myDict.
Referenced by NIVissimNodeCluster::buildNBNode(), NIVissimDisturbance::computeBounding(), NIVissimDisturbance::dict_SetDisturbances(), NIVissimExtendedEdgePoint::getGeomPosition(), NIVissimTL::NIVissimTLSignal::getPosition(), and NIVissimAbstractEdge::NIVissimAbstractEdge().
00069 { 00070 DictType::iterator i=myDict.find(id); 00071 if (i==myDict.end()) { 00072 myDict[id] = e; 00073 return true; 00074 } 00075 return false; 00076 }
| NIVissimEdge * NIVissimEdge::dictionary | ( | int | id | ) | [static] |
Returns the named edge from the dictionary.
Reimplemented from NIVissimAbstractEdge.
Definition at line 173 of file NIVissimEdge.cpp.
References myDict.
00173 { 00174 DictType::iterator i=myDict.find(id); 00175 if (i==myDict.end()) { 00176 return 0; 00177 } 00178 return (*i).second; 00179 }
| bool NIVissimEdge::dictionary | ( | int | id, | |
| NIVissimEdge * | o | |||
| ) | [static] |
| bool NIVissimEdge::dictionary | ( | int | id, | |
| const std::string & | name, | |||
| const std::string & | type, | |||
| int | noLanes, | |||
| SUMOReal | zuschlag1, | |||
| SUMOReal | zuschlag2, | |||
| SUMOReal | length, | |||
| const Position2DVector & | geom, | |||
| const NIVissimClosedLanesVector & | clv | |||
| ) | [static] |
Adds the described item to the dictionary Builds the edge first.
Definition at line 144 of file NIVissimEdge.cpp.
References NIVissimEdge().
Referenced by NIVissimConnectionCluster::add(), NIVissimDisturbance::addToNode(), NIVissimConnection::buildEdgeConnections(), NIVissimDistrictConnection::checkEdgeEnd(), checkUnconnectedLaneSpeeds(), NIVissimConnection::dict_assignToEdges(), NIVissimConnectionCluster::extendByToTreatAsSame(), NIVissimDistrictConnection::geomPosition(), getBestIncoming(), getBestOutgoing(), NIVissimDisturbance::getConnection(), getOutgoingConnected(), NIVissimConnectionCluster::getPositionForEdge(), NIVissimConnectionCluster::isWeakDistrictConnRealisation(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), propagateOwn(), propagateSpeed(), NIVissimConnectionCluster::recheckEdges(), NIVissimNodeDef_Poly::searchAndSetConnections(), NIVissimNodeDef_Edges::searchAndSetConnections(), and setDistrictSpeed().
00148 { 00149 NIVissimEdge *o = new NIVissimEdge(id, name, type, noLanes, zuschlag1, 00150 zuschlag2, length, geom, clv); 00151 if (!dictionary(id, o)) { 00152 delete o; 00153 return false; 00154 } 00155 return true; 00156 }
| Position2D NIVissimEdge::getBegin2D | ( | ) | const |
Returns the begin position of the edge
Definition at line 833 of file NIVissimEdge.cpp.
References NIVissimAbstractEdge::myGeom.
00833 { 00834 return myGeom[0]; 00835 }
| NIVissimEdge * NIVissimEdge::getBestIncoming | ( | ) | const throw () |
Definition at line 998 of file NIVissimEdge.cpp.
References dictionary(), NIVissimConnection::dictionary(), NIVissimConnection::getFromEdgeID(), and myIncomingConnections.
Referenced by NIVissimConnection::buildEdgeConnections().
00998 { 00999 for (IntVector::const_iterator i=myIncomingConnections.begin(); i!=myIncomingConnections.end(); ++i) { 01000 NIVissimConnection *c = NIVissimConnection::dictionary(*i); 01001 return NIVissimEdge::dictionary(c->getFromEdgeID()); 01002 } 01003 return 0; 01004 }
| NIVissimEdge * NIVissimEdge::getBestOutgoing | ( | ) | const throw () |
Definition at line 1008 of file NIVissimEdge.cpp.
References dictionary(), NIVissimConnection::dictionary(), NIVissimConnection::getToEdgeID(), and myOutgoingConnections.
Referenced by NIVissimConnection::buildEdgeConnections().
01008 { 01009 for (IntVector::const_iterator i=myOutgoingConnections.begin(); i!=myOutgoingConnections.end(); ++i) { 01010 NIVissimConnection *c = NIVissimConnection::dictionary(*i); 01011 return NIVissimEdge::dictionary(c->getToEdgeID()); 01012 } 01013 return 0; 01014 }
| NIVissimConnection * NIVissimEdge::getConnectionTo | ( | NIVissimEdge * | e | ) |
Definition at line 956 of file NIVissimEdge.cpp.
References NIVissimConnection::dictionary(), NIVissimConnection::getFromEdgeID(), NIVissimAbstractEdge::getID(), NIVissimConnection::getToEdgeID(), myIncomingConnections, and myOutgoingConnections.
Referenced by dict_checkEdges2Join().
00956 { 00957 IntVector::iterator i; 00958 for (i=myIncomingConnections.begin(); i!=myIncomingConnections.end(); i++) { 00959 NIVissimConnection *c = NIVissimConnection::dictionary(*i); 00960 if (c->getFromEdgeID()==e->getID()) { 00961 return c; 00962 } 00963 } 00964 for (i=myOutgoingConnections.begin(); i!=myOutgoingConnections.end(); i++) { 00965 NIVissimConnection *c = NIVissimConnection::dictionary(*i); 00966 if (c->getToEdgeID()==e->getID()) { 00967 return c; 00968 } 00969 } 00970 return 0; 00971 }
| const IntVector & NIVissimAbstractEdge::getDisturbances | ( | ) | const [inherited] |
Definition at line 198 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myDisturbances.
Referenced by NIVissimConnectionCluster::getDisturbanceParticipators().
00198 { 00199 return myDisturbances; 00200 }
| Position2D NIVissimEdge::getEnd2D | ( | ) | const |
Returns the end position of the edge.
Definition at line 839 of file NIVissimEdge.cpp.
References NIVissimAbstractEdge::myGeom.
00839 { 00840 return myGeom[-1]; 00841 }
| std::pair< NIVissimConnectionCluster *, NBNode * > NIVissimEdge::getFromNode | ( | NBNodeCont & | nc, | |
| ConnectionClusters & | clusters | |||
| ) | [private] |
Returns the origin node.
Definition at line 583 of file NIVissimEdge.cpp.
References NIVissimConnectionCluster::around(), Position2DVector::getBegin(), NIVissimConnectionCluster::getNBNode(), NBNodeCont::insert(), myDistrictConnections, NIVissimAbstractEdge::myGeom, NIVissimAbstractEdge::myID, NBNode::NODETYPE_NOJUNCTION, and SUMOReal.
Referenced by buildNBEdge().
00583 { 00584 const SUMOReal MAX_DISTANCE = 10.; 00585 assert(clusters.size()>=1); 00586 const Position2D &beg = myGeom.getBegin(); 00587 NIVissimConnectionCluster *c = *(clusters.begin()); 00588 // check whether the edge starts within a already build node 00589 if (c->around(beg, MAX_DISTANCE)) { 00590 clusters.erase(clusters.begin()); 00591 return std::pair<NIVissimConnectionCluster*, NBNode*> 00592 (c, c->getNBNode()); 00593 } 00594 // check for a parking place at the begin 00595 if (myDistrictConnections.size()>0) { 00596 SUMOReal pos = *(myDistrictConnections.begin()); 00597 if (pos<10) { 00598 NBNode *node = new NBNode(toString<int>(myID) + "-begin", beg, NBNode::NODETYPE_NOJUNCTION); 00599 if (!nc.insert(node)) { 00600 throw 1; 00601 } 00602 while (myDistrictConnections.size()>0&&*(myDistrictConnections.begin())<10) { 00603 myDistrictConnections.erase(myDistrictConnections.begin()); 00604 } 00605 return std::pair<NIVissimConnectionCluster*, NBNode*>(0, node); 00606 } 00607 } 00608 // build a new node for the edge's begin otherwise 00609 NBNode *node = new NBNode(toString<int>(myID) + "-begin", beg, NBNode::NODETYPE_NOJUNCTION); 00610 if (!nc.insert(node)) { 00611 throw 1; 00612 } 00613 return std::pair<NIVissimConnectionCluster*, NBNode*>(0, node); 00614 }
| const Position2DVector & NIVissimAbstractEdge::getGeometry | ( | ) | const [inherited] |
Definition at line 186 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myGeom.
Referenced by dict_checkEdges2Join(), NIVissimConnectionCluster::getIncomingContinuation(), NIVissimConnectionCluster::getIncomingContinuationGeometry(), NIVissimConnectionCluster::getOutgoingContinuation(), NIVissimConnectionCluster::getOutgoingContinuationGeometry(), NIVissimConnectionCluster::isWeakDistrictConnRealisation(), NIVissimConnectionCluster::liesOnSameEdgesEnd(), NIVissimConnectionCluster::same_direction_sorter::operator()(), and NIVissimConnectionCluster::recomputeBoundary().
00186 { 00187 return myGeom; 00188 }
| Position2D NIVissimAbstractEdge::getGeomPosition | ( | SUMOReal | pos | ) | const [inherited] |
Definition at line 91 of file NIVissimAbstractEdge.cpp.
References GeomHelper::extrapolate_second(), Position2DVector::length(), NIVissimAbstractEdge::myGeom, Position2DVector::pop_back(), Position2DVector::positionAtLengthPosition(), Position2DVector::push_back(), and SUMOReal.
Referenced by NIVissimDistrictConnection::geomPosition().
00091 { 00092 if (myGeom.length()>pos) { 00093 return myGeom.positionAtLengthPosition(pos); 00094 } else if (myGeom.length()==pos) { 00095 return myGeom[-1]; 00096 } else { 00097 Position2DVector g(myGeom); 00098 SUMOReal amount = pos - myGeom.length(); 00099 Position2D ne = GeomHelper::extrapolate_second(g[-2], g[-1], amount*2); 00100 g.pop_back(); 00101 g.push_back(ne); 00102 return g.positionAtLengthPosition(pos); 00103 } 00104 }
| int NIVissimAbstractEdge::getID | ( | ) | const [inherited] |
Definition at line 172 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myID.
Referenced by NIVissimDisturbance::addToNode(), NIVissimConnection::buildEdgeConnections(), dict_checkEdges2Join(), getConnectionTo(), NIVissimConnectionCluster::getIncomingContinuation(), NIVissimConnectionCluster::getIncomingContinuationGeometry(), NIVissimConnectionCluster::getOutgoingContinuation(), NIVissimConnectionCluster::getOutgoingContinuationGeometry(), and NIVissimConnectionCluster::removeConnections().
00172 { 00173 return myID; 00174 }
| SUMOReal NIVissimEdge::getLength | ( | ) | const |
Returns the length of the node.
Definition at line 845 of file NIVissimEdge.cpp.
References Position2DVector::length(), and NIVissimAbstractEdge::myGeom.
Referenced by setDistrictSpeed().
| NBNode* NIVissimEdge::getNodeAt | ( | const Position2D & | p, | |
| NBNode * | other = 0 | |||
| ) |
Returns the node at the given position As this may be ambigous, a second node not to return may be supplied.
| static NBNode* NIVissimEdge::getNodeSecure | ( | int | nodeid, | |
| const Position2D & | pos, | |||
| const std::string & | possibleName | |||
| ) | [static, private] |
| std::vector< NIVissimConnection * > NIVissimEdge::getOutgoingConnected | ( | int | lane | ) | const [private] |
Definition at line 408 of file NIVissimEdge.cpp.
References dictionary(), NIVissimConnection::dictionary(), NIVissimConnection::getFromLanes(), NIVissimConnection::getToEdgeID(), and myOutgoingConnections.
Referenced by checkUnconnectedLaneSpeeds(), propagateOwn(), propagateSpeed(), and setDistrictSpeed().
00408 { 00409 std::vector<NIVissimConnection*> ret; 00410 for (IntVector::const_iterator i=myOutgoingConnections.begin(); i!=myOutgoingConnections.end(); i++) { 00411 NIVissimConnection *c = NIVissimConnection::dictionary(*i); 00412 const IntVector &lanes = c->getFromLanes(); 00413 if (find(lanes.begin(), lanes.end(), lane)!=lanes.end()) { 00414 NIVissimEdge *e = NIVissimEdge::dictionary(c->getToEdgeID()); 00415 if (e!=0) { 00416 ret.push_back(c); 00417 } 00418 } 00419 } 00420 return ret; 00421 }
| SUMOReal NIVissimEdge::getRealSpeed | ( | int | distNo | ) | [private] |
Definition at line 529 of file NIVissimEdge.cpp.
References NBDistribution::dictionary(), SUMOReal, and WRITE_WARNING.
Referenced by propagateSpeed().
00529 { 00530 std::string id = toString<int>(distNo); 00531 Distribution *dist = NBDistribution::dictionary("speed", id); 00532 if (dist==0) { 00533 WRITE_WARNING("The referenced speed distribution '" + id + "' is not known."); 00534 return -1; 00535 } 00536 assert(dist!=0); 00537 SUMOReal speed = dist->getMax(); 00538 if (speed<0||speed>1000) { 00539 WRITE_WARNING("What about distribution '" + toString<int>(distNo) + "' "); 00540 } 00541 return speed; 00542 }
| std::pair< NIVissimConnectionCluster *, NBNode * > NIVissimEdge::getToNode | ( | NBNodeCont & | nc, | |
| ConnectionClusters & | clusters | |||
| ) | [private] |
Returns the destination node.
Definition at line 618 of file NIVissimEdge.cpp.
References Position2DVector::getEnd(), NBNodeCont::insert(), Position2DVector::length(), myDistrictConnections, NIVissimAbstractEdge::myGeom, NIVissimAbstractEdge::myID, NBNode::NODETYPE_NOJUNCTION, and SUMOReal.
Referenced by buildNBEdge().
00618 { 00619 const Position2D &end = myGeom.getEnd(); 00620 if (clusters.size()>0) { 00621 const SUMOReal MAX_DISTANCE = 10.; 00622 assert(clusters.size()>=1); 00623 NIVissimConnectionCluster *c = *(clusters.end()-1); 00624 // check whether the edge ends within a already build node 00625 if (c->around(end, MAX_DISTANCE)) { 00626 clusters.erase(clusters.end()-1); 00627 return std::pair<NIVissimConnectionCluster*, NBNode *>(c, c->getNBNode()); 00628 } 00629 } 00630 // check for a parking place at the end 00631 if (myDistrictConnections.size()>0) { 00632 SUMOReal pos = *(myDistrictConnections.end()-1); 00633 if (pos>myGeom.length()-10) { 00634 NBNode *node = new NBNode(toString<int>(myID) + "-end", end, NBNode::NODETYPE_NOJUNCTION); 00635 if (!nc.insert(node)) { 00636 throw 1; 00637 } 00638 while (myDistrictConnections.size()>0&&*(myDistrictConnections.end()-1)<myGeom.length()-10) { 00639 myDistrictConnections.erase(myDistrictConnections.end()-1); 00640 } 00641 return std::pair<NIVissimConnectionCluster*, NBNode*>(0, node); 00642 } 00643 } 00644 00645 // build a new node for the edge's end otherwise 00646 NBNode *node = new NBNode(toString<int>(myID) + "-end", end, NBNode::NODETYPE_NOJUNCTION); 00647 if (!nc.insert(node)) { 00648 throw 1; 00649 } 00650 return std::pair<NIVissimConnectionCluster*, NBNode *>(0, node); 00651 /* 00652 if (clusters.size()>0) { 00653 NIVissimConnectionCluster *c = *(clusters.end()-1); 00654 clusters.erase(clusters.end()-1); 00655 return std::pair<NIVissimConnectionCluster*, NBNode*>(c, c->getNBNode()); 00656 } else { 00657 // !!! dummy edge?! 00658 return std::pair<NIVissimConnectionCluster*, NBNode*>(0, (*(myConnectionClusters.begin()))->getNBNode()); 00659 } 00660 */ 00661 }
| const std::vector< NIVissimEdge * > & NIVissimEdge::getToTreatAsSame | ( | ) | const |
Definition at line 975 of file NIVissimEdge.cpp.
References myToTreatAsSame.
Referenced by NIVissimConnectionCluster::extendByToTreatAsSame().
00975 { 00976 return myToTreatAsSame; 00977 }
| IntVector NIVissimAbstractEdge::getWithin | ( | const AbstractPoly & | p, | |
| SUMOReal | offset = 0.0 | |||
| ) | [static, inherited] |
Definition at line 147 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myDict, NIVissimAbstractEdge::myID, and NIVissimAbstractEdge::overlapsWith().
Referenced by NIVissimNodeDef_Poly::searchAndSetConnections().
00147 { 00148 IntVector ret; 00149 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00150 NIVissimAbstractEdge *e = (*i).second; 00151 if (e->overlapsWith(p, offset)) { 00152 ret.push_back(e->myID); 00153 } 00154 } 00155 return ret; 00156 }
| bool NIVissimAbstractEdge::hasNodeCluster | ( | ) | const [inherited] |
Definition at line 166 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myNode.
00166 { 00167 return myNode!=-1; 00168 }
| void NIVissimEdge::mergedInto | ( | NIVissimConnectionCluster * | old, | |
| NIVissimConnectionCluster * | act | |||
| ) |
Definition at line 798 of file NIVissimEdge.cpp.
References myConnectionClusters.
00799 { 00800 ConnectionClusters::iterator i= 00801 find(myConnectionClusters.begin(), myConnectionClusters.end(), old); 00802 if (i!=myConnectionClusters.end()) { 00803 myConnectionClusters.erase(i); 00804 } 00805 i = find(myConnectionClusters.begin(), myConnectionClusters.end(), act); 00806 if (i==myConnectionClusters.end()) { 00807 myConnectionClusters.push_back(act); 00808 } 00809 }
| bool NIVissimAbstractEdge::overlapsWith | ( | const AbstractPoly & | p, | |
| SUMOReal | offset = 0.0 | |||
| ) | const [inherited] |
Definition at line 160 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myGeom, and Position2DVector::overlapsWith().
Referenced by NIVissimAbstractEdge::getWithin().
00160 { 00161 return myGeom.overlapsWith(p, offset); 00162 }
| void NIVissimEdge::propagateOwn | ( | ) | [private] |
Definition at line 317 of file NIVissimEdge.cpp.
References dictionary(), getOutgoingConnected(), NIVissimConnection::getToEdgeID(), NIVissimConnection::getToLanes(), myLaneSpeeds, and propagateSpeed().
Referenced by dict_propagateSpeeds().
00317 { 00318 for (int i=0; i<(int) myLaneSpeeds.size(); i++) { 00319 if (myLaneSpeeds[i]==-1) { 00320 continue; 00321 } 00322 std::vector<NIVissimConnection*> connected = getOutgoingConnected(i); 00323 for (std::vector<NIVissimConnection*>::iterator j=connected.begin(); j!=connected.end(); j++) { 00324 NIVissimConnection *c = *j; 00325 NIVissimEdge *e = NIVissimEdge::dictionary(c->getToEdgeID()); 00326 // propagate 00327 e->propagateSpeed(/*dc, */myLaneSpeeds[i], c->getToLanes()); 00328 } 00329 } 00330 }
| void NIVissimEdge::propagateSpeed | ( | SUMOReal | speed, | |
| IntVector | forLanes | |||
| ) | [private] |
Definition at line 334 of file NIVissimEdge.cpp.
References dictionary(), getOutgoingConnected(), getRealSpeed(), NIVissimConnection::getToEdgeID(), NIVissimConnection::getToLanes(), myLaneSpeeds, myNoLanes, myPatchedSpeeds, and propagateSpeed().
Referenced by checkUnconnectedLaneSpeeds(), dict_propagateSpeeds(), propagateOwn(), propagateSpeed(), and setDistrictSpeed().
00334 { 00335 // if no lane is given, all set be set 00336 if (forLanes.size()==0) { 00337 for (size_t i=0; i<myNoLanes; i++) { 00338 forLanes.push_back((int) i); 00339 } 00340 } 00341 // for the case of a first call 00342 // go through the lanes 00343 for (IntVector::const_iterator i=forLanes.begin(); i<forLanes.end(); i++) { 00344 // check whether a speed was set before 00345 if (myLaneSpeeds[*i]!=-1) { 00346 // do not reset it from incoming 00347 continue; 00348 } 00349 // check whether the lane has a new speed to set 00350 if ((int) myPatchedSpeeds.size()>*i&&myPatchedSpeeds[*i]!=-1) { 00351 // use it 00352 speed = getRealSpeed(/*dc, */myPatchedSpeeds[*i]); 00353 } 00354 // check whether a speed is given 00355 if (speed==-1) { 00356 // do nothing if not 00357 continue; 00358 } 00359 // set the lane's speed to the given 00360 myLaneSpeeds[*i] = speed; 00361 // propagate the speed further 00362 // get the list of connected edges 00363 std::vector<NIVissimConnection*> connected = getOutgoingConnected(*i); 00364 // go throught the list 00365 for (std::vector<NIVissimConnection*>::iterator j=connected.begin(); j!=connected.end(); j++) { 00366 NIVissimConnection *c = *j; 00367 NIVissimEdge *e = NIVissimEdge::dictionary(c->getToEdgeID()); 00368 // propagate 00369 e->propagateSpeed(/*dc, */speed, c->getToLanes()); 00370 } 00371 } 00372 }
| std::pair< NBNode *, NBNode * > NIVissimEdge::remapOneOfNodes | ( | NBNodeCont & | nc, | |
| NIVissimDistrictConnection * | d, | |||
| NBNode * | fromNode, | |||
| NBNode * | toNode | |||
| ) | [private] |
Definition at line 665 of file NIVissimEdge.cpp.
References Position2D::distanceTo(), NBNodeCont::erase(), NIVissimDistrictConnection::geomPosition(), NIVissimDistrictConnection::getID(), NBNode::getPosition(), NBNodeCont::insert(), and NBNode::NODETYPE_NOJUNCTION.
00667 { 00668 std::string nid = "ParkingPlace" + toString<int>(d->getID()); 00669 if (d->geomPosition().distanceTo(fromNode->getPosition()) 00670 < 00671 d->geomPosition().distanceTo(toNode->getPosition())) { 00672 00673 NBNode *newNode = new NBNode(nid, 00674 fromNode->getPosition(), 00675 NBNode::NODETYPE_NOJUNCTION); 00676 nc.erase(fromNode); 00677 nc.insert(newNode); 00678 return std::pair<NBNode*, NBNode*>(newNode, toNode); 00679 } else { 00680 NBNode *newNode = new NBNode(nid, 00681 toNode->getPosition(), 00682 NBNode::NODETYPE_NOJUNCTION); 00683 nc.erase(toNode); 00684 nc.insert(newNode); 00685 return std::pair<NBNode*, NBNode*>(fromNode, newNode); 00686 } 00687 }
| void NIVissimEdge::removeFromConnectionCluster | ( | NIVissimConnectionCluster * | c | ) |
Definition at line 814 of file NIVissimEdge.cpp.
References myConnectionClusters.
Referenced by NIVissimConnectionCluster::recheckEdges().
00814 { 00815 ConnectionClusters::iterator i= 00816 find(myConnectionClusters.begin(), myConnectionClusters.end(), c); 00817 assert(i!=myConnectionClusters.end()); 00818 myConnectionClusters.erase(i); 00819 }
| void NIVissimEdge::reportUnsetSpeeds | ( | ) | throw () [static] |
Writes edges with unset speeds to the warnings message log instance.
Vissim has no direct speed definition of edges; still, we try to propagate speed changes along the streets. If a lane is not covered by such, its id is put into the static container "myLanesWithMissingSpeeds". If the option "vissim.report-unset-speeds" is set, all lane ids stored within this container are written.
Definition at line 981 of file NIVissimEdge.cpp.
References MsgHandler::getWarningInstance(), MsgHandler::inform(), and myLanesWithMissingSpeeds.
Referenced by NIImporter_Vissim::postLoadBuild().
00981 { 00982 if (myLanesWithMissingSpeeds.size()==0) { 00983 return; 00984 } 00985 std::ostringstream str; 00986 str << "The following lanes have no explicite speed information:\n "; 00987 for (std::vector<std::string>::iterator i=myLanesWithMissingSpeeds.begin(); i!=myLanesWithMissingSpeeds.end(); ++i) { 00988 if (i!=myLanesWithMissingSpeeds.begin()) { 00989 str << ", "; 00990 } 00991 str << *i; 00992 } 00993 MsgHandler::getWarningInstance()->inform(str.str()); 00994 }
| std::pair< NBNode *, NBNode * > NIVissimEdge::resolveSameNode | ( | NBNodeCont & | nc, | |
| SUMOReal | offset, | |||
| NBNode * | prevFrom, | |||
| NBNode * | prevTo | |||
| ) | [private] |
Tries to resolve the problem that the same node has been returned as origin and destination node.
Definition at line 692 of file NIVissimEdge.cpp.
References NIVissimConnectionCluster::around(), NIVissimDistrictConnection::dict_findForEdge(), NIVissimDistrictConnection::geomPosition(), Position2DVector::getBegin(), Position2DVector::getEnd(), NIVissimDistrictConnection::getID(), NIVissimDistrictConnection::getPosition(), NBNodeCont::insert(), Position2DVector::length(), myConnectionClusters, NIVissimAbstractEdge::myGeom, NIVissimAbstractEdge::myID, NBNode::NODETYPE_NOJUNCTION, NBNodeCont::retrieve(), and SUMOReal.
Referenced by buildNBEdge().
00693 { 00694 // check whether the edge is connected to a district 00695 // use it if so 00696 NIVissimDistrictConnection *d = 00697 NIVissimDistrictConnection::dict_findForEdge(myID); 00698 if (d!=0) { 00699 Position2D pos = d->geomPosition(); 00700 SUMOReal position = d->getPosition(); 00701 // the district is at the begin of the edge 00702 if (myGeom.length()-position>position) { 00703 std::string nid = "ParkingPlace" + toString<int>(d->getID()); 00704 NBNode *node = nc.retrieve(nid); 00705 if (node==0) { 00706 node = new NBNode(nid, 00707 pos, NBNode::NODETYPE_NOJUNCTION); 00708 if (!nc.insert(node)) { 00709 throw 1; 00710 } 00711 } 00712 return std::pair<NBNode*, NBNode*>(node, prevTo); 00713 } 00714 // the district is at the end of the edge 00715 else { 00716 std::string nid = "ParkingPlace" + toString<int>(d->getID()); 00717 NBNode *node = nc.retrieve(nid); 00718 if (node==0) { 00719 node = new NBNode(nid, 00720 pos, NBNode::NODETYPE_NOJUNCTION); 00721 if (!nc.insert(node)) { 00722 throw 1; 00723 } 00724 } 00725 assert(node!=0); 00726 return std::pair<NBNode*, NBNode*>(prevFrom, node); 00727 } 00728 } 00729 // otherwise, check whether the edge is some kind of 00730 // a dead end... 00731 // check which end is nearer to the node centre 00732 if (myConnectionClusters.size()==1) { 00733 NBNode *node = prevFrom; // it is the same as getToNode() 00734 00735 NIVissimConnectionCluster *c = *(myConnectionClusters.begin()); 00736 // no end node given 00737 if (c->around(myGeom.getBegin(), offset) && !c->around(myGeom.getEnd(), offset)) { 00738 NBNode *end = new NBNode( 00739 toString<int>(myID) + "-End", 00740 myGeom.getEnd(), 00741 NBNode::NODETYPE_NOJUNCTION); 00742 if (!nc.insert(end)) { 00743 throw 1; 00744 } 00745 return std::pair<NBNode*, NBNode*>(node, end); 00746 } 00747 00748 // no begin node given 00749 if (!c->around(myGeom.getBegin(), offset) && c->around(myGeom.getEnd(), offset)) { 00750 NBNode *beg = new NBNode( 00751 toString<int>(myID) + "-Begin", 00752 myGeom.getBegin(), 00753 NBNode::NODETYPE_NOJUNCTION); 00754 if (!nc.insert(beg)) { 00755 std::cout << "nope, NIVissimDisturbance" << std::endl; 00756 throw 1; 00757 } 00758 return std::pair<NBNode*, NBNode*>(beg, node); 00759 } 00760 00761 // "dummy edge" - both points lie within the same cluster 00762 if (c->around(myGeom.getBegin()) && c->around(myGeom.getEnd())) { 00763 return std::pair<NBNode*, NBNode*>(node, node); 00764 } 00765 } 00766 // what to do in other cases? 00767 // It simply is a dummy edge.... 00768 return std::pair<NBNode*, NBNode*>(prevFrom, prevTo); 00769 }
| void NIVissimEdge::setDistrictSpeed | ( | ) | [private] |
Definition at line 377 of file NIVissimEdge.cpp.
References NIVissimDistrictConnection::dict_findForEdge(), dictionary(), getLength(), NIVissimDistrictConnection::getMeanSpeed(), getOutgoingConnected(), NIVissimConnection::getToEdgeID(), NIVissimConnection::getToLanes(), myDistrictConnections, NIVissimAbstractEdge::myID, myLaneSpeeds, myNoLanes, propagateSpeed(), and SUMOReal.
Referenced by dict_propagateSpeeds().
00377 { 00378 if (myDistrictConnections.size()>0) { 00379 SUMOReal pos = *(myDistrictConnections.begin()); 00380 if (pos<getLength()-pos) { 00381 NIVissimDistrictConnection *d = 00382 NIVissimDistrictConnection::dict_findForEdge(myID); 00383 if (d!=0) { 00384 SUMOReal speed = d->getMeanSpeed(/*dc*/); 00385 if (speed==-1) { 00386 return; 00387 } 00388 for (unsigned int i=0; i<myNoLanes; i++) { 00389 myLaneSpeeds[i] = speed; 00390 // propagate the speed further 00391 // get the list of connected edges 00392 std::vector<NIVissimConnection*> connected = getOutgoingConnected(i); 00393 // go throught the list 00394 for (std::vector<NIVissimConnection*>::iterator j=connected.begin(); j!=connected.end(); j++) { 00395 NIVissimConnection *c = *j; 00396 NIVissimEdge *e = NIVissimEdge::dictionary(c->getToEdgeID()); 00397 // propagate 00398 e->propagateSpeed(/*dc, */speed, c->getToLanes()); 00399 } 00400 } 00401 } 00402 } 00403 } 00404 }
| void NIVissimEdge::setNodeCluster | ( | int | nodeid | ) | [virtual] |
Implements NIVissimAbstractEdge.
Definition at line 775 of file NIVissimEdge.cpp.
References NIVissimAbstractEdge::myNode.
00775 { 00776 myNode = nodeid; 00777 }
| void NIVissimEdge::setSpeed | ( | size_t | lane, | |
| int | speedDist | |||
| ) |
Definition at line 864 of file NIVissimEdge.cpp.
References myPatchedSpeeds.
00864 { 00865 while (myPatchedSpeeds.size()<=lane) { 00866 myPatchedSpeeds.push_back(-1); 00867 } 00868 myPatchedSpeeds[lane] = speedDist; 00869 }
| void NIVissimAbstractEdge::splitAndAssignToNodes | ( | ) | [static, inherited] |
Definition at line 108 of file NIVissimAbstractEdge.cpp.
References NIVissimAbstractEdge::myDict, and NIVissimAbstractEdge::splitAssigning().
00108 { 00109 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); i++) { 00110 NIVissimAbstractEdge *e = (*i).second; 00111 e->splitAssigning(); 00112 } 00113 }
| void NIVissimAbstractEdge::splitAssigning | ( | ) | [inherited] |
Definition at line 116 of file NIVissimAbstractEdge.cpp.
Referenced by NIVissimAbstractEdge::splitAndAssignToNodes().
| bool NIVissimEdge::wasWithinAJunction | ( | ) | const throw () [inline] |
Returns whether this edge was found to be within a junction.
Definition at line 112 of file NIVissimEdge.h.
References myAmWithinJunction.
Referenced by NIVissimConnection::buildEdgeConnections().
00112 { 00113 return myAmWithinJunction; 00114 }
friend class NIVissimNodeDef_Edges [friend] |
Definition at line 119 of file NIVissimEdge.h.
friend class NIVissimNodeDef_Poly [friend] |
Definition at line 120 of file NIVissimEdge.h.
bool NIVissimEdge::myAmWithinJunction [private] |
Information whether this edge was not build due to being within a junction.
Definition at line 291 of file NIVissimEdge.h.
Referenced by buildNBEdge(), and wasWithinAJunction().
List of lanes closed on this edge.
Definition at line 271 of file NIVissimEdge.h.
Referenced by ~NIVissimEdge().
List of connection clusters along this edge.
Definition at line 274 of file NIVissimEdge.h.
Referenced by addToConnectionCluster(), buildConnectionClusters(), buildNBEdge(), mergedInto(), removeFromConnectionCluster(), resolveSameNode(), NIVissimNodeDef_Poly::searchAndSetConnections(), and NIVissimNodeDef_Edges::searchAndSetConnections().
NIVissimEdge::DictType NIVissimEdge::myDict [static, private] |
The dictionary.
Reimplemented from NIVissimAbstractEdge.
Definition at line 298 of file NIVissimEdge.h.
Referenced by buildConnectionClusters(), dict_buildNBEdges(), dict_checkEdges2Join(), dict_propagateSpeeds(), and dictionary().
Definition at line 282 of file NIVissimEdge.h.
Referenced by buildNBEdge(), checkDistrictConnectionExistanceAt(), getFromNode(), getToNode(), and setDistrictSpeed().
IntVector NIVissimAbstractEdge::myDisturbances [protected, inherited] |
Definition at line 76 of file NIVissimAbstractEdge.h.
Referenced by NIVissimAbstractEdge::addDisturbance(), and NIVissimAbstractEdge::getDisturbances().
Position2DVector NIVissimAbstractEdge::myGeom [protected, inherited] |
Definition at line 75 of file NIVissimAbstractEdge.h.
Referenced by NIVissimConnection::buildGeom(), buildNBEdge(), NIVissimAbstractEdge::crossesAtPoint(), NIVissimAbstractEdge::crossesEdge(), NIVissimAbstractEdge::crossesEdgeAtPoint(), getBegin2D(), getEnd2D(), getFromNode(), NIVissimAbstractEdge::getGeometry(), NIVissimAbstractEdge::getGeomPosition(), getLength(), getToNode(), NIVissimAbstractEdge::NIVissimAbstractEdge(), NIVissimAbstractEdge::overlapsWith(), and resolveSameNode().
int NIVissimAbstractEdge::myID [protected, inherited] |
Definition at line 74 of file NIVissimAbstractEdge.h.
Referenced by buildNBEdge(), getFromNode(), NIVissimAbstractEdge::getID(), getToNode(), NIVissimAbstractEdge::getWithin(), NIVissimEdge(), resolveSameNode(), and setDistrictSpeed().
IntVector NIVissimEdge::myIncomingConnections [private] |
List of connections incoming to this edge.
Definition at line 277 of file NIVissimEdge.h.
Referenced by addIncomingConnection(), buildConnectionClusters(), getBestIncoming(), and getConnectionTo().
std::vector<SUMOReal> NIVissimEdge::myLaneSpeeds [private] |
Definition at line 286 of file NIVissimEdge.h.
Referenced by buildNBEdge(), checkUnconnectedLaneSpeeds(), NIVissimEdge(), propagateOwn(), propagateSpeed(), and setDistrictSpeed().
std::vector< std::string > NIVissimEdge::myLanesWithMissingSpeeds [static, private] |
Definition at line 303 of file NIVissimEdge.h.
Referenced by buildNBEdge(), and reportUnsetSpeeds().
int NIVissimEdge::myMaxID = 0 [static, private] |
The current maximum id; needed for further id assignment.
Definition at line 301 of file NIVissimEdge.h.
Referenced by NIVissimEdge().
std::string NIVissimEdge::myName [private] |
int NIVissimAbstractEdge::myNode [protected, inherited] |
Definition at line 77 of file NIVissimAbstractEdge.h.
Referenced by NIVissimAbstractEdge::hasNodeCluster(), setNodeCluster(), and NIVissimConnection::setNodeCluster().
unsigned int NIVissimEdge::myNoLanes [private] |
The number of lanes the edge has.
Definition at line 265 of file NIVissimEdge.h.
Referenced by buildNBEdge(), propagateSpeed(), and setDistrictSpeed().
IntVector NIVissimEdge::myOutgoingConnections [private] |
List of connections outgoing from this edge.
Definition at line 280 of file NIVissimEdge.h.
Referenced by addOutgoingConnection(), buildConnectionClusters(), getBestOutgoing(), getConnectionTo(), and getOutgoingConnected().
IntVector NIVissimEdge::myPatchedSpeeds [private] |
std::vector<NIVissimEdge*> NIVissimEdge::myToTreatAsSame [private] |
Definition at line 288 of file NIVissimEdge.h.
Referenced by addToTreatAsSame(), and getToTreatAsSame().
std::string NIVissimEdge::myType [private] |
SUMOReal NIVissimEdge::myZuschlag1 [private] |
SUMOReal NIVissimEdge::myZuschlag2 [private] |
Definition at line 268 of file NIVissimEdge.h.
1.5.6