#include <NBEdge.h>
Definition at line 62 of file NBEdge.h.
Public Types | |
| enum | EdgeBuildingStep { INIT_REJECT_CONNECTIONS, INIT, EDGE2EDGES, LANES2EDGES, LANES2LANES_RECHECK, LANES2LANES_DONE, LANES2LANES_USER } |
| Current state of the edge within the building process. More... | |
| enum | Lane2LaneInfoType { L2L_COMPUTED, L2L_USER, L2L_VALIDATED } |
| Modes of setting connections between lanes. More... | |
| enum | LaneSpreadFunction { LANESPREAD_RIGHT, LANESPREAD_CENTER } |
| Information how the edge's lateral offset shall be computed. More... | |
Public Member Functions | |
| void | addCrossingPointsAsIncomingWithGivenOutgoing (NBEdge *o, Position2DVector &into) |
| void | allowVehicleClass (int lane, SUMOVehicleClass vclass) |
| void | append (NBEdge *continuation) |
| void | appendTurnaround (bool noTLSControlled) throw () |
| Add a connection to the previously computed turnaround, if wished. | |
| bool | computeEdge2Edges () |
| computes the edge (step1: computation of approached edges) | |
| bool | computeLanes2Edges () |
| computes the edge, step2: computation of which lanes approach the edges) | |
| void | computeTurningDirections () |
| computes which edge shall be the turn-around one, if any | |
| void | copyConnectionsFrom (NBEdge *src) |
| void | decLaneNo (unsigned int by, int dir=0) |
| void | disableConnection4TLS (int fromLane, NBEdge *toEdge, int toLane) |
| void | disallowVehicleClass (int lane, SUMOVehicleClass vclass) |
| void | dismissVehicleClassInformation () |
| bool | expandableBy (NBEdge *possContinuation) const |
| std::vector< SUMOVehicleClass > | getAllowedVehicleClasses () const |
| SUMOReal | getAngle (const NBNode &atNode) const |
| Position2DVector | getCCWBoundaryLine (const NBNode &n, SUMOReal offset) const |
| std::vector< NBEdge * > | getConnectedEdges () const throw () |
| const std::vector< NBEdge * > * | getConnectedSorted () |
| std::vector< int > | getConnectionLanes (NBEdge *currentOutgoing) const |
| returns the list of lanes that may be used to reach the given edge | |
| std::vector< Connection > & | getConnections () |
| const std::vector< Connection > & | getConnections () const |
| Position2DVector | getCWBoundaryLine (const NBNode &n, SUMOReal offset) const |
| int | getJunctionPriority (const NBNode *const node) const |
| Returns the junction priority (normalised for the node currently build). | |
| std::string | getLaneID (unsigned int lane) |
| SUMOReal | getLaneSpeed (unsigned int lane) const |
| int | getMaxConnectedLane (NBEdge *of) const |
| SUMOReal | getMaxLaneOffset () |
| Position2D | getMaxLaneOffsetPositionAt (NBNode *node, SUMOReal width) const |
| int | getMinConnectedLane (NBEdge *of) const |
| Position2D | getMinLaneOffsetPositionAt (NBNode *node, SUMOReal width) const |
| SUMOReal | getNormedAngle (const NBNode &atNode) const |
| SUMOReal | getNormedAngle () const |
| NBEdge * | getTurnDestination () const |
| const std::string & | getTypeID () const throw () |
| bool | hasRestrictions () const |
| bool | hasSignalisedConnectionTo (const NBEdge *const e) const throw () |
| void | incLaneNo (unsigned int by) |
| void | invalidateConnections (bool reallowSetting=false) |
| bool | isConnectedTo (NBEdge *e) |
| Returns the information whethe a connection to the given edge has been added (or computed). | |
| bool | isNearEnough2BeJoined2 (NBEdge *e) |
| bool | isTurningDirectionAt (const NBNode *n, const NBEdge *const edge) const throw () |
| Returns whether the given edge is the opposite direction to this edge. | |
| bool | lanesWereAssigned () const |
| void | markAsInLane2LaneState () |
| bool | mayBeTLSControlled (int fromLane, NBEdge *toEdge, int toLane) const throw () |
| void | moveOutgoingConnectionsFrom (NBEdge *e, unsigned int laneOff) |
| NBEdge (const std::string &id, NBNode *from, NBNode *to, std::string type, SUMOReal speed, unsigned int nolanes, int priority, Position2DVector geom, LaneSpreadFunction spread=LANESPREAD_RIGHT, bool tryIgnoreNodePositions=false) throw (ProcessError) | |
| Constructor. | |
| NBEdge (const std::string &id, NBNode *from, NBNode *to, std::string type, SUMOReal speed, unsigned int nolanes, int priority, LaneSpreadFunction spread=LANESPREAD_RIGHT) throw (ProcessError) | |
| Constructor. | |
| void | preferVehicleClass (int lane, SUMOVehicleClass vclass) |
| bool | recheckLanes () |
| void | reinit (NBNode *from, NBNode *to, std::string type, SUMOReal speed, unsigned int nolanes, int priority, Position2DVector geom, LaneSpreadFunction spread=LANESPREAD_RIGHT) throw (ProcessError) |
| Resets initial values. | |
| void | remapConnections (const EdgeVector &incoming) |
| Remaps the connection in a way tha allows the removal of it This edges (which is a "dummy" edge, in fact) connections are spread over the incoming non-dummy edges. | |
| void | removeFromConnections (NBEdge *which, int lane=-1) |
| void | replaceInConnections (NBEdge *which, NBEdge *by, unsigned int laneOff) |
| bool | setControllingTLInformation (int fromLane, NBEdge *toEdge, int toLane, const std::string &tlID, unsigned int tlPos) |
| Returns if the link could be set as to be controlled. | |
| void | setJunctionPriority (const NBNode *const node, int prio) |
| Sets the junction priority of the edge. | |
| void | setLaneSpeed (unsigned int lane, SUMOReal speed) |
| void | setLeftHanded () throw () |
| Marks this edge to be left-handed. | |
| void | setLoadedLength (SUMOReal val) |
| void | setTurningDestination (NBEdge *e) |
| void | setVehicleClasses (const std::vector< SUMOVehicleClass > &allowed, const std::vector< SUMOVehicleClass > &disallowed, int lane=-1) |
| void | sortOutgoingLanesConnections () |
| sorts the connections of outgoing lanes (!!! Kaskade beschreiben) | |
| NBNode * | tryGetNodeAtPosition (SUMOReal pos, SUMOReal tolerance=5.0) const |
| Returns the node at the given edges length (using an epsilon) When no node is existing at the given position, 0 is returned The epsilon is a static member of NBEdge, should be setable via program options. | |
| SUMOReal | width () const |
| void | writeLanesPlain (OutputDevice &into) |
| void | writeXMLStep1 (OutputDevice &into) |
| void | writeXMLStep2 (OutputDevice &into, bool includeInternal) |
| ~NBEdge () throw () | |
| Destructor. | |
Setting and getting connections | |
| bool | addEdge2EdgeConnection (NBEdge *dest) throw () |
| Adds a connection to another edge. | |
| bool | addLane2LaneConnection (unsigned int fromLane, NBEdge *dest, unsigned int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false) throw () |
| Adds a connection between the specified this edge's lane and an approached one. | |
| bool | addLane2LaneConnections (unsigned int fromLane, NBEdge *dest, unsigned int toLane, unsigned int no, Lane2LaneInfoType type, bool invalidatePrevious=false, bool mayDefinitelyPass=false) throw () |
| Builds no connections starting at the given lanes. | |
| std::vector< Connection > | getConnectionsFromLane (unsigned int lane) const throw () |
| Returns connections from a given lane. | |
| bool | hasConnectionTo (NBEdge *destEdge, unsigned int destLane) const throw () |
| Retrieves info about a connection to a certain lane of a certain edge. | |
| void | setConnection (unsigned int lane, NBEdge *destEdge, unsigned int destLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false) throw () |
| Adds a connection to a certain lane of a certain edge. | |
Edge geometry access and computation | |
| void | addGeometryPoint (int index, const Position2D &p) throw () |
| Adds a further geometry point. | |
| void | computeEdgeShape () throw () |
| Computes the shape of the edge (regarding the nodes' shapes. | |
| const Position2DVector & | getGeometry () const throw () |
| Returns the geometry of the edge. | |
| const Position2DVector & | getLaneShape (unsigned int i) const throw () |
| Returns the shape of the nth lane. | |
| LaneSpreadFunction | getLaneSpreadFunction () const throw () |
| Returns how this edge's lanes' lateral offset is computed. | |
| void | reshiftPosition (SUMOReal xoff, SUMOReal yoff) throw () |
| Applies an offset to the edge. | |
| void | setGeometry (const Position2DVector &g) throw () |
| (Re)sets the edge's geometry | |
| void | setLaneSpreadFunction (LaneSpreadFunction spread) throw () |
| (Re)sets how the lanes lateral offset shall be computed | |
Atomar getter methods | |
| SUMOReal | getAngle () const throw () |
| Returns the angle of the edge. | |
| NBNode *const | getFromNode () const throw () |
| Returns the origin node of the edge. | |
| const std::string & | getID () const throw () |
| Returns the id of the edge. | |
| SUMOReal | getLength () const throw () |
| Returns the computed length of the edge. | |
| unsigned int | getNoLanes () const throw () |
| Returns the number of lanes. | |
| int | getPriority () const throw () |
| Returns the priority of the edge. | |
| SUMOReal | getSpeed () const throw () |
| Returns the speed allowed on this edge. | |
| EdgeBuildingStep | getStep () const throw () |
| The building step of this edge. | |
| NBNode *const | getToNode () const throw () |
| Returns the destination node of the edge. | |
Setting/getting special types | |
| bool | isInnerEdge () const throw () |
| Returns whether this edge was marked as being within an intersection. | |
| bool | isMacroscopicConnector () throw () |
| Returns whether this edge was marked as a macroscopic connector. | |
| void | setAsMacroscopicConnector () throw () |
| Marks this edge as a macroscopic connector. | |
| void | setIsInnerEdge () throw () |
| Marks this edge being within an intersection. | |
Protected Member Functions | |
| bool | acceptBeingTurning (NBEdge *e) |
Private Member Functions | |
| Position2DVector | computeLaneShape (unsigned int lane) throw (InvalidArgument) |
| Computes the shape for the given lane. | |
| void | computeLaneShapes () throw () |
| unsigned int | computePrioritySum (std::vector< unsigned int > *priorities) |
| void | divideOnEdges (const std::vector< NBEdge * > *outgoing) |
| void | init (unsigned int noLanes, bool tryIgnoreNodePositions) throw (ProcessError) |
| Initialization routines common to all constructors. | |
| std::pair< SUMOReal, SUMOReal > | laneOffset (const Position2D &from, const Position2D &to, SUMOReal lanewidth, unsigned int lane) throw (InvalidArgument) |
| Computes the offset from the edge shape on the current segment. | |
| void | moveConnectionToLeft (unsigned int lane) |
| void | moveConnectionToRight (unsigned int lane) |
| NBEdge (const NBEdge &s) | |
| invalidated copy constructor | |
| NBEdge & | operator= (const NBEdge &s) |
| invalidated assignment operator | |
| std::vector< unsigned int > * | preparePriorities (const std::vector< NBEdge * > *outgoing) |
| bool | splitGeometry (NBEdgeCont &ec, NBNodeCont &nc) |
| void | writeLane (OutputDevice &into, NBEdge::Lane &lane, unsigned int index) const |
| void | writeSingleSucceeding (OutputDevice &into, const NBEdge::Connection &c, bool includeInternal) |
| void | writeSucceeding (OutputDevice &into, unsigned int lane, bool includeInternal) |
Private Attributes | |
| bool | myAmInnerEdge |
| Information whether this is a junction-inner edge. | |
| bool | myAmLeftHand |
| Whether this edge is a left-hand edge. | |
| bool | myAmMacroscopicConnector |
| Information whether this edge is a (macroscopic) connector. | |
| SUMOReal | myAngle |
| The angle of the edge. | |
| std::vector< Connection > | myConnections |
| List of connections to following edges. | |
| NBNode * | myFrom |
| The source and the destination node. | |
| int | myFromJunctionPriority |
| The priority normalised for the node the edge is outgoing of. | |
| Position2DVector | myGeom |
| The geometry for the edge. | |
| std::string | myID |
| The id of the edge. | |
| std::vector< Lane > | myLanes |
| Lane information. | |
| LaneSpreadFunction | myLaneSpreadFunction |
| The information about how to spread the lanes. | |
| SUMOReal | myLength |
| The length of the edge. | |
| SUMOReal | myLoadedLength |
| An optional length to use (-1 if not valid). | |
| int | myPriority |
| The priority of the edge. | |
| SUMOReal | mySpeed |
| The maximal speed. | |
| EdgeBuildingStep | myStep |
| The building step. | |
| std::vector < TLSDisabledConnection > | myTLSDisabledConnections |
| NBNode * | myTo |
| int | myToJunctionPriority |
| The priority normalised for the node the edge is incoming in. | |
| NBEdge * | myTurnDestination |
| The turn destination edge. | |
| std::string | myType |
| The type of the edge. | |
Temporary variables for turning edge computation | |
| NBEdge * | myAmTurningOf |
| Was assigned as a turning edge of this one. | |
| SUMOReal | myAmTurningWithAngle |
| Was assigned as a turn with this angle. | |
Friends | |
| class | NBEdgeCont |
| class | NBEdgeSuccessorBuilder |
Data Structures | |
| struct | Connection |
| A structure which describes a connection between edges or lanes. More... | |
| class | connections_finder |
| class | connections_fromlane_finder |
| class | connections_relative_edgelane_sorter |
| class | connections_sorter |
| class | connections_toedge_finder |
| class | connections_toedgelane_finder |
| struct | Lane |
| An (internal) definition of a single lane of an edge. More... | |
| class | MainDirections |
| class | tls_disable_finder |
| struct | TLSDisabledConnection |
| class | ToEdgeConnectionsAdder |
Current state of the edge within the building process.
As the network is build in a cascaded way, considering loaded information, a counter holding the current step is needed. This is done by using this enumeration.
Definition at line 86 of file NBEdge.h.
00086 { 00088 INIT_REJECT_CONNECTIONS, 00090 INIT, 00092 EDGE2EDGES, 00094 LANES2EDGES, 00096 LANES2LANES_RECHECK, 00098 LANES2LANES_DONE, 00100 LANES2LANES_USER 00101 };
Modes of setting connections between lanes.
| L2L_COMPUTED | The connection was computed. |
| L2L_USER | The connection was given by the user. |
| L2L_VALIDATED | The connection was computed and validated. |
Definition at line 107 of file NBEdge.h.
00107 { 00109 L2L_COMPUTED, 00111 L2L_USER, 00113 L2L_VALIDATED 00114 };
Information how the edge's lateral offset shall be computed.
In dependence to this value, lanes will be spread to the right side or to both sides from the given edge geometry (Also used when node positions are used as edge geometry).
| LANESPREAD_RIGHT | The lanes will be spread to right. |
| LANESPREAD_CENTER | The lanes will be spread to both sides. |
Definition at line 71 of file NBEdge.h.
00071 { 00073 LANESPREAD_RIGHT, 00075 LANESPREAD_CENTER 00076 };
| NBEdge::NBEdge | ( | const std::string & | id, | |
| NBNode * | from, | |||
| NBNode * | to, | |||
| std::string | type, | |||
| SUMOReal | speed, | |||
| unsigned int | nolanes, | |||
| int | priority, | |||
| LaneSpreadFunction | spread = LANESPREAD_RIGHT | |||
| ) | throw (ProcessError) |
Constructor.
Use this if no edge geometry is given.
| [in] | id | The id of the edge |
| [in] | from | The node the edge starts at |
| [in] | to | The node the edge ends at |
| [in] | type | The type of the edge (my be =="") |
| [in] | speed | The maximum velocity allowed on this edge |
| [in] | nolanes | The number of lanes this edge has |
| [in] | priority | This edge's priority |
| [in] | spread | How the lateral offset of the lanes shall be computed |
Definition at line 153 of file NBEdge.cpp.
References init().
Referenced by splitGeometry().
00155 : 00156 myStep(INIT), myID(StringUtils::convertUmlaute(id)), 00157 myType(StringUtils::convertUmlaute(type)), 00158 myFrom(from), myTo(to), myAngle(0), 00159 myPriority(priority), mySpeed(speed), 00160 myTurnDestination(0), 00161 myFromJunctionPriority(-1), myToJunctionPriority(-1), 00162 myLaneSpreadFunction(spread), 00163 myLoadedLength(-1), myAmLeftHand(false), myAmTurningWithAngle(0), myAmTurningOf(0), 00164 myAmInnerEdge(false), myAmMacroscopicConnector(false) { 00165 init(nolanes, false); 00166 }
| NBEdge::NBEdge | ( | const std::string & | id, | |
| NBNode * | from, | |||
| NBNode * | to, | |||
| std::string | type, | |||
| SUMOReal | speed, | |||
| unsigned int | nolanes, | |||
| int | priority, | |||
| Position2DVector | geom, | |||
| LaneSpreadFunction | spread = LANESPREAD_RIGHT, |
|||
| bool | tryIgnoreNodePositions = false | |||
| ) | throw (ProcessError) |
Constructor.
Use this if the edge's geometry is given.
| [in] | id | The id of the edge |
| [in] | from | The node the edge starts at |
| [in] | to | The node the edge ends at |
| [in] | type | The type of the edge (my be =="") |
| [in] | speed | The maximum velocity allowed on this edge |
| [in] | nolanes | The number of lanes this edge has |
| [in] | priority | This edge's priority |
| [in] | geom | The edge's geomatry |
| [in] | spread | How the lateral offset of the lanes shall be computed |
| [in] | tryIgnoreNodePositions | Does not add node geometries if geom.size()>=2 |
Definition at line 169 of file NBEdge.cpp.
References init().
00172 : 00173 myStep(INIT), myID(StringUtils::convertUmlaute(id)), 00174 myType(StringUtils::convertUmlaute(type)), 00175 myFrom(from), myTo(to), myAngle(0), 00176 myPriority(priority), mySpeed(speed), 00177 myTurnDestination(0), 00178 myFromJunctionPriority(-1), myToJunctionPriority(-1), 00179 myGeom(geom), myLaneSpreadFunction(spread), 00180 myLoadedLength(-1), myAmLeftHand(false), myAmTurningWithAngle(0), myAmTurningOf(0), 00181 myAmInnerEdge(false), myAmMacroscopicConnector(false) { 00182 init(nolanes, tryIgnoreNodePositions); 00183 }
| NBEdge::~NBEdge | ( | ) | throw () |
| NBEdge::NBEdge | ( | const NBEdge & | s | ) | [private] |
invalidated copy constructor
Definition at line 576 of file NBEdge.cpp.
References computeTurningDirections(), getAngle(), myAmTurningOf, myAmTurningWithAngle, NBHelpers::relAngle(), and SUMOReal.
Referenced by setTurningDestination().
00576 { 00577 if (e==myAmTurningOf) { 00578 return true; 00579 } 00580 SUMOReal angle = fabs(NBHelpers::relAngle(getAngle(), e->getAngle())); 00581 if (myAmTurningWithAngle>angle) { 00582 return false; 00583 } 00584 if (myAmTurningWithAngle==angle) { 00585 return false; // !!! ok, this happens only within a cell-network (backgrnd), we have to take a further look sometime 00586 } 00587 NBEdge *previous = myAmTurningOf; 00588 myAmTurningWithAngle = angle; 00589 myAmTurningOf = e; 00590 if (previous!=0) { 00591 previous->computeTurningDirections(); 00592 } 00593 return true; 00594 }
| void NBEdge::addCrossingPointsAsIncomingWithGivenOutgoing | ( | NBEdge * | o, | |
| Position2DVector & | into | |||
| ) |
Adds a connection to another edge.
If the given edge does not start at the node this edge ends on, false is returned.
All other cases return true. Though, a connection may not been added if this edge is in step "INIT_REJECT_CONNECTIONS". Also, this method assures that a connection to an edge is set only once, no multiple connections to next edge are stored.
After a first connection to an edge was set, the process step is set to "EDGE2EDGES".
| [in] | dest | The connection's destination edge |
Definition at line 374 of file NBEdge.cpp.
References EDGE2EDGES, INIT_REJECT_CONNECTIONS, myConnections, myStep, and myTo.
Referenced by addLane2LaneConnection(), NBEdgeCont::joinSameNodeConnectingEdges(), NIXMLConnectionsHandler::myStartElement(), and remapConnections().
00374 { 00375 if (myStep==INIT_REJECT_CONNECTIONS) { 00376 return true; 00377 } 00378 // check whether the node was merged and now a connection between 00379 // not matching edges is tried to be added 00380 // This happens f.e. within the ptv VISSIM-example "Beijing" 00381 if (dest!=0 && myTo!=dest->myFrom) { 00382 return false; 00383 } 00384 if (find_if(myConnections.begin(), myConnections.end(), connections_toedge_finder(dest))==myConnections.end()) { 00385 myConnections.push_back(Connection(-1, dest, -1)); 00386 } 00387 if (myStep<EDGE2EDGES) { 00388 myStep = EDGE2EDGES; 00389 } 00390 return true; 00391 }
| void NBEdge::addGeometryPoint | ( | int | index, | |
| const Position2D & | p | |||
| ) | throw () |
Adds a further geometry point.
Some importer do not know an edge's geometry when it is initialised. This method allows to insert further geometry points after the edge has been built.
| [in] | index | The position at which the point shall be added |
| [in] | p | The point to add |
Definition at line 358 of file NBEdge.cpp.
References Position2DVector::insertAt(), and myGeom.
Referenced by NIImporter_VISUM::parse_EdgePolys().
| bool NBEdge::addLane2LaneConnection | ( | unsigned int | fromLane, | |
| NBEdge * | dest, | |||
| unsigned int | toLane, | |||
| Lane2LaneInfoType | type, | |||
| bool | mayUseSameDestination = false, |
|||
| bool | mayDefinitelyPass = false | |||
| ) | throw () |
Adds a connection between the specified this edge's lane and an approached one.
If the given edge does not start at the node this edge ends on, false is returned.
All other cases return true. Though, a connection may not been added if this edge is in step "INIT_REJECT_CONNECTIONS". Before the lane-to-lane connection is set, a connection between edges is established using "addEdge2EdgeConnection". Then, "setConnection" is called for inserting the lane-to-lane connection.
| [in] | fromLane | The connection's starting lane (of this edge) |
| [in] | dest | The connection's destination edge |
| [in] | toLane | The connection's destination lane |
| [in] | type | The connections's type |
| [in] | mayUseSameDestination | Whether this connection may be set though connecting an already connected lane |
| [in] | mayDefinitelyPass | Whether this connection is definitely undistrubed (special case for on-ramps) |
Definition at line 395 of file NBEdge.cpp.
References addEdge2EdgeConnection(), INIT_REJECT_CONNECTIONS, myStep, myTo, and setConnection().
Referenced by addLane2LaneConnections(), NIVissimConnection::buildEdgeConnections(), NIImporter_SUMO::loadNetwork(), moveOutgoingConnectionsFrom(), NIXMLEdgesHandler::myEndElement(), NIImporter_VISUM::parse_LanesConnections(), NIXMLConnectionsHandler::parseLaneBound(), and NBEdgeCont::splitAt().
00398 { 00399 if (myStep==INIT_REJECT_CONNECTIONS) { 00400 return true; 00401 } 00402 // check whether the node was merged and now a connection between 00403 // not matching edges is tried to be added 00404 // This happens f.e. within the ptv VISSIM-example "Beijing" 00405 if (myTo!=dest->myFrom) { 00406 return false; 00407 } 00408 if (!addEdge2EdgeConnection(dest)) { 00409 return false; 00410 } 00411 setConnection(from, dest, toLane, type, mayUseSameDestination, mayDefinitelyPass); 00412 return true; 00413 }
| bool NBEdge::addLane2LaneConnections | ( | unsigned int | fromLane, | |
| NBEdge * | dest, | |||
| unsigned int | toLane, | |||
| unsigned int | no, | |||
| Lane2LaneInfoType | type, | |||
| bool | invalidatePrevious = false, |
|||
| bool | mayDefinitelyPass = false | |||
| ) | throw () |
Builds no connections starting at the given lanes.
If "invalidatePrevious" is true, a call to "invalidateConnections(true)" is done. This method loops through the given connections to set, calling "addLane2LaneConnection" for each.
| [in] | fromLane | The first of the connections' starting lanes (of this edge) |
| [in] | dest | The connections' destination edge |
| [in] | toLane | The first of the connections' destination lanes |
| [in] | no | The number of connections to set |
| [in] | type | The connections' type |
| [in] | invalidatePrevious | Whether previously set connection shall be deleted |
| [in] | mayDefinitelyPass | Whether these connections are definitely undistrubed (special case for on-ramps) |
Definition at line 417 of file NBEdge.cpp.
References addLane2LaneConnection(), and invalidateConnections().
Referenced by NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), and NBNode::computeLanes2Lanes().
00421 { 00422 if (invalidatePrevious) { 00423 invalidateConnections(true); 00424 } 00425 bool ok = true; 00426 for (unsigned int i=0; i<no&&ok; i++) { 00427 ok &= addLane2LaneConnection(fromLane+i, dest, toLane+i, type, false, mayDefinitelyPass); 00428 } 00429 return ok; 00430 }
| void NBEdge::allowVehicleClass | ( | int | lane, | |
| SUMOVehicleClass | vclass | |||
| ) |
Definition at line 1853 of file NBEdge.cpp.
References myLanes.
Referenced by NIXMLEdgesHandler::myStartElement(), and setVehicleClasses().
01853 { 01854 if (lane<0) { 01855 // if all lanes are meant... 01856 for (unsigned int i=0; i<myLanes.size(); i++) { 01857 // ... do it for each lane 01858 allowVehicleClass((int) i, vclass); 01859 } 01860 return; 01861 } 01862 assert(lane<(int) myLanes.size()); 01863 // add it only if not already done 01864 if (find(myLanes[lane].allowed.begin(), myLanes[lane].allowed.end(), vclass)==myLanes[lane].allowed.end()) { 01865 myLanes[lane].allowed.push_back(vclass); 01866 } 01867 }
| void NBEdge::append | ( | NBEdge * | continuation | ) |
Definition at line 1674 of file NBEdge.cpp.
References Position2DVector::appendWithCrossingPoint(), myConnections, myGeom, myLanes, myLength, myStep, myTo, and myTurnDestination.
Referenced by NBNodeCont::removeUnwishedNodes().
01674 { 01675 // append geometry 01676 myGeom.appendWithCrossingPoint(e->myGeom); 01677 for (unsigned int i=0; i<myLanes.size(); i++) { 01678 myLanes[i].shape.appendWithCrossingPoint(e->myLanes[i].shape); 01679 } 01680 // recompute length 01681 myLength += e->myLength; 01682 // copy the connections and the building step if given 01683 myStep = e->myStep; 01684 myConnections = e->myConnections; 01685 myTurnDestination = e->myTurnDestination; 01686 // set the node 01687 myTo = e->myTo; 01688 }
| void NBEdge::appendTurnaround | ( | bool | noTLSControlled | ) | throw () |
Add a connection to the previously computed turnaround, if wished.
If a turning direction exists (myTurnDestination!=0) and either the edge is not controlled by a tls or noTLSControlled is false, a connection to the edge stored in myTurnDestination is added (from the leftmost lane of this edge to the leftmost lane of myTurnDestination).
| [in] | noTLSControlled | Whether the turnaround shall not be connected if this edge is controlled by a tls |
Definition at line 1279 of file NBEdge.cpp.
References getNoLanes(), NBNode::isTLControlled(), L2L_VALIDATED, myLanes, myTo, myTurnDestination, and setConnection().
01279 { 01280 // do nothing if no turnaround is known 01281 if (myTurnDestination==0) { 01282 return; 01283 } 01284 // do nothing if the destination node is controlled by a tls and no turnarounds 01285 // shall be appended for such junctions 01286 if (noTLSControlled&&myTo->isTLControlled()) { 01287 return; 01288 } 01289 setConnection((unsigned int)(myLanes.size()-1), myTurnDestination, myTurnDestination->getNoLanes()-1, L2L_VALIDATED); 01290 }
| bool NBEdge::computeEdge2Edges | ( | ) |
computes the edge (step1: computation of approached edges)
Definition at line 961 of file NBEdge.cpp.
References EDGE2EDGES, NBNode::getOutgoingEdges(), myConnections, myStep, and myTo.
00961 { 00962 // return if this relationship has been build in previous steps or 00963 // during the import 00964 if (myStep>=EDGE2EDGES) { 00965 return true; 00966 } 00967 if (myConnections.size()==0) { 00968 const EdgeVector &o = myTo->getOutgoingEdges(); 00969 for (EdgeVector::const_iterator i=o.begin(); i!=o.end(); ++i) { 00970 myConnections.push_back(Connection(-1, *i, -1)); 00971 } 00972 } 00973 myStep = EDGE2EDGES; 00974 return true; 00975 }
| void NBEdge::computeEdgeShape | ( | ) | throw () |
Computes the shape of the edge (regarding the nodes' shapes.
Because an edge's shape should start/end at the boundaries of the nodes the edge starts/ends at, we have to recompute the edge's shape after we know the ones of the nodes. This is done within this method.
Definition at line 273 of file NBEdge.cpp.
References Line2D::atan2DegreeAngle(), Position2DVector::eraseAt(), Line2D::extrapolateBy(), GeomHelper::getMinAngleDiff(), Line2D::getPositionAtDistance(), NBNode::getShape(), Position2DVector::getSubpart(), Position2DVector::intersects(), Line2D::intersectsAtLengths(), Position2DVector::intersectsAtLengths(), Position2DVector::length(), VectorHelper< T >::maxValue(), VectorHelper< T >::minValue(), myFrom, myLanes, myLength, myTo, Line2D::p1(), Line2D::p2(), Position2DVector::push_back(), Position2DVector::push_front(), Position2DVector::reverse(), Position2DVector::size(), and SUMOReal.
00273 { 00274 unsigned int i; 00275 for (i=0; i<myLanes.size(); i++) { 00276 Position2DVector &shape = myLanes[i].shape; 00277 // get lane begin and end 00278 Line2D lb = Line2D(shape[0], shape[1]); 00279 Line2D le = Line2D(shape[-1], shape[-2]); 00280 lb.extrapolateBy(100.0); 00281 le.extrapolateBy(100.0); 00282 // 00283 Position2DVector old = shape; 00284 Position2D nb, ne; 00285 // lane begin 00286 if (myFrom->getShape().intersects(shape)) { 00287 // get the intersection position with the junction 00288 DoubleVector pbv = shape.intersectsAtLengths(myFrom->getShape()); 00289 if (pbv.size()>0) { 00290 SUMOReal pb = VectorHelper<SUMOReal>::maxValue(pbv); 00291 if (pb>=0&&pb<=shape.length()) { 00292 shape = shape.getSubpart(pb, shape.length()); 00293 } 00294 } 00295 } else if (myFrom->getShape().intersects(lb.p1(), lb.p2())) { 00296 DoubleVector pbv = lb.intersectsAtLengths(myFrom->getShape()); 00297 if (pbv.size()>0) { 00298 SUMOReal pb = VectorHelper<SUMOReal>::maxValue(pbv); 00299 if (pb>=0) { 00300 shape.eraseAt(0); 00301 shape.push_front(lb.getPositionAtDistance(pb)); 00302 } 00303 } 00304 } 00305 // lane end 00306 if (myTo->getShape().intersects(shape)) { 00307 // get the intersection position with the junction 00308 DoubleVector pev = shape.intersectsAtLengths(myTo->getShape()); 00309 if (pev.size()>0) { 00310 SUMOReal pe = VectorHelper<SUMOReal>::minValue(pev); 00311 if (pe>=0&&pe<=shape.length()) { 00312 shape = shape.getSubpart(0, pe); 00313 } 00314 } 00315 } else if (myTo->getShape().intersects(le.p1(), le.p2())) { 00316 DoubleVector pev = le.intersectsAtLengths(myTo->getShape()); 00317 if (pev.size()>0) { 00318 SUMOReal pe = VectorHelper<SUMOReal>::maxValue(pev); 00319 if (pe>=0) { 00320 shape.eraseAt((int) shape.size()-1); 00321 shape.push_back(le.getPositionAtDistance(pe)); 00322 } 00323 } 00324 } 00325 if (((int) shape.length())==0) { 00326 shape = old; 00327 } else { 00328 Line2D lc(shape[0], shape[-1]); 00329 Line2D lo(old[0], old[-1]); 00330 if (135<GeomHelper::getMinAngleDiff(lc.atan2DegreeAngle(), lo.atan2DegreeAngle())) { 00331 shape = shape.reverse(); 00332 } 00333 } 00334 } 00335 // recompute edge's length 00336 SUMOReal length = 0; 00337 for (i=0; i<myLanes.size(); i++) { 00338 assert(myLanes[i].shape.length()>0); 00339 length += myLanes[i].shape.length(); 00340 } 00341 myLength = length / (SUMOReal) myLanes.size(); 00342 }
| bool NBEdge::computeLanes2Edges | ( | ) |
computes the edge, step2: computation of which lanes approach the edges)
Definition at line 979 of file NBEdge.cpp.
References divideOnEdges(), EDGE2EDGES, getConnectedSorted(), LANES2EDGES, myConnections, and myStep.
00979 { 00980 // return if this relationship has been build in previous steps or 00981 // during the import 00982 if (myStep>=LANES2EDGES) { 00983 return true; 00984 } 00985 assert(myStep==EDGE2EDGES); 00986 // get list of possible outgoing edges sorted by direction clockwise 00987 // the edge in the backward direction (turnaround) is not in the list 00988 const std::vector<NBEdge*> *edges = getConnectedSorted(); 00989 if (myConnections.size()!=0&&edges->size()==0) { 00990 // dead end per definition!? 00991 myConnections.clear(); 00992 } else { 00993 // divide the lanes on reachable edges 00994 divideOnEdges(edges); 00995 } 00996 delete edges; 00997 myStep = LANES2EDGES; 00998 return true; 00999 }
| Position2DVector NBEdge::computeLaneShape | ( | unsigned int | lane | ) | throw (InvalidArgument) [private] |
Computes the shape for the given lane.
Definition at line 746 of file NBEdge.cpp.
References Line2D::atan2DegreeAngle(), Line2D::extrapolateBy(), GeomHelper::getCWAngleDiff(), getID(), MsgHandler::getWarningInstance(), MsgHandler::inform(), Line2D::intersects(), Line2D::intersectsAt(), laneOffset(), myGeom, myLanes, Position2DVector::push_back(), Position2DVector::size(), SUMO_const_laneWidthAndOffset, SUMOReal, toString(), Position2D::x(), and Position2D::y().
Referenced by computeLaneShapes().
00746 { 00747 Position2DVector shape; 00748 bool haveWarned = false; 00749 for (int i=0; i<(int) myGeom.size(); i++) { 00750 if (i==0) { 00751 Position2D from = myGeom[i]; 00752 Position2D to = myGeom[i+1]; 00753 std::pair<SUMOReal, SUMOReal> offsets = laneOffset(from, to, SUMO_const_laneWidthAndOffset, (unsigned int)(myLanes.size()-1-lane)); 00754 shape.push_back( 00755 // (methode umbenennen; was heisst hier "-") 00756 Position2D(from.x()-offsets.first, from.y()-offsets.second)); 00757 } else if (i==myGeom.size()-1) { 00758 Position2D from = myGeom[i-1]; 00759 Position2D to = myGeom[i]; 00760 std::pair<SUMOReal, SUMOReal> offsets = laneOffset(from, to, SUMO_const_laneWidthAndOffset, (unsigned int)(myLanes.size()-1-lane)); 00761 shape.push_back( 00762 // (methode umbenennen; was heisst hier "-") 00763 Position2D(to.x()-offsets.first, to.y()-offsets.second)); 00764 } else { 00765 Position2D from = myGeom[i-1]; 00766 Position2D me = myGeom[i]; 00767 Position2D to = myGeom[i+1]; 00768 std::pair<SUMOReal, SUMOReal> offsets = laneOffset(from, me, SUMO_const_laneWidthAndOffset, (unsigned int)(myLanes.size()-1-lane)); 00769 std::pair<SUMOReal, SUMOReal> offsets2 = laneOffset(me, to, SUMO_const_laneWidthAndOffset, (unsigned int)(myLanes.size()-1-lane)); 00770 Line2D l1( 00771 Position2D(from.x()-offsets.first, from.y()-offsets.second), 00772 Position2D(me.x()-offsets.first, me.y()-offsets.second)); 00773 l1.extrapolateBy(100); 00774 Line2D l2( 00775 Position2D(me.x()-offsets2.first, me.y()-offsets2.second), 00776 Position2D(to.x()-offsets2.first, to.y()-offsets2.second)); 00777 SUMOReal angle = GeomHelper::getCWAngleDiff(l1.atan2DegreeAngle(), l2.atan2DegreeAngle()); 00778 if (angle<10.||angle>350.) { 00779 shape.push_back( 00780 // (methode umbenennen; was heisst hier "-") 00781 Position2D(me.x()-offsets.first, me.y()-offsets.second)); 00782 continue; 00783 } 00784 l2.extrapolateBy(100); 00785 if (l1.intersects(l2)) { 00786 shape.push_back(l1.intersectsAt(l2)); 00787 } else { 00788 if (!haveWarned) { 00789 MsgHandler::getWarningInstance()->inform("In lane '" + getID() + "_" + toString(lane) + "': Could not build shape."); 00790 haveWarned = true; 00791 } 00792 } 00793 } 00794 } 00795 return shape; 00796 }
| void NBEdge::computeLaneShapes | ( | ) | throw () [private] |
Definition at line 728 of file NBEdge.cpp.
References computeLaneShape(), getID(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myFrom, myGeom, myLanes, and myTo.
Referenced by decLaneNo(), incLaneNo(), init(), and setGeometry().
00728 { 00729 // vissim needs this 00730 if (myFrom==myTo) { 00731 return; 00732 } 00733 // build the shape of each lane 00734 for (unsigned int i=0; i<myLanes.size(); i++) { 00735 try { 00736 myLanes[i].shape = computeLaneShape(i); 00737 } catch (InvalidArgument &e) { 00738 MsgHandler::getWarningInstance()->inform("In edge '" + getID() + "': lane shape could not been determined (" + e.what() + ")"); 00739 myLanes[i].shape = myGeom; 00740 } 00741 } 00742 }
| unsigned int NBEdge::computePrioritySum | ( | std::vector< unsigned int > * | priorities | ) | [private] |
computes teh sum of the given list's entries (sic!)
Definition at line 1269 of file NBEdge.cpp.
Referenced by divideOnEdges().
01269 { 01270 unsigned int sum = 0; 01271 for (std::vector<unsigned int>::iterator i=priorities->begin(); i!=priorities->end(); i++) { 01272 sum += (*i); 01273 } 01274 return sum; 01275 }
| void NBEdge::computeTurningDirections | ( | ) |
computes which edge shall be the turn-around one, if any
Definition at line 530 of file NBEdge.cpp.
References getAngle(), NBNode::getOutgoingEdges(), isConnectedTo(), myConnections, myTo, myTurnDestination, NBHelpers::relAngle(), setTurningDestination(), and SUMOReal.
Referenced by acceptBeingTurning().
00530 { 00531 myTurnDestination = 0; 00532 EdgeVector outgoing = myTo->getOutgoingEdges(); 00533 for (EdgeVector::iterator i=outgoing.begin(); i!=outgoing.end(); i++) { 00534 NBEdge *outedge = *i; 00535 if (myConnections.size()!=0&&!isConnectedTo(outedge)) { 00536 continue; 00537 } 00538 SUMOReal relAngle = 00539 NBHelpers::relAngle(getAngle(*myTo), outedge->getAngle(*myTo)); 00540 // do not append the turnaround 00541 if (fabs(relAngle)>160) { 00542 setTurningDestination(outedge); 00543 } 00544 } 00545 }
| void NBEdge::copyConnectionsFrom | ( | NBEdge * | src | ) |
Definition at line 1795 of file NBEdge.cpp.
References myConnections, and myStep.
Referenced by NBEdgeCont::splitAt().
01795 { 01796 myStep = src->myStep; 01797 myConnections = src->myConnections; 01798 }
| void NBEdge::decLaneNo | ( | unsigned int | by, | |
| int | dir = 0 | |||
| ) |
Definition at line 1769 of file NBEdge.cpp.
References computeLaneShapes(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), invalidateConnections(), myFrom, myLanes, myTo, and removeFromConnections().
01769 { 01770 unsigned int newLaneNo = (unsigned int) myLanes.size() - by; 01771 while (myLanes.size()>newLaneNo) { 01772 myLanes.pop_back(); 01773 } 01774 computeLaneShapes(); 01775 const EdgeVector &incs = myFrom->getIncomingEdges(); 01776 for (EdgeVector::const_iterator i=incs.begin(); i!=incs.end(); ++i) { 01777 (*i)->invalidateConnections(true); 01778 } 01779 if (dir==0) { 01780 invalidateConnections(true); 01781 } else { 01782 const EdgeVector &outs = myTo->getOutgoingEdges(); 01783 assert(outs.size()==1); 01784 NBEdge *out = outs[0]; 01785 if (dir<0) { 01786 removeFromConnections(out, 0); 01787 } else { 01788 removeFromConnections(out, (int) myLanes.size()); 01789 } 01790 } 01791 }
| void NBEdge::disableConnection4TLS | ( | int | fromLane, | |
| NBEdge * | toEdge, | |||
| int | toLane | |||
| ) |
Definition at line 1566 of file NBEdge.cpp.
References NBEdge::TLSDisabledConnection::fromLane, myTLSDisabledConnections, NBEdge::TLSDisabledConnection::to, and NBEdge::TLSDisabledConnection::toLane.
01566 { 01567 TLSDisabledConnection c; 01568 c.fromLane = fromLane; 01569 c.to = toEdge; 01570 c.toLane = toLane; 01571 myTLSDisabledConnections.push_back(c); 01572 }
| void NBEdge::disallowVehicleClass | ( | int | lane, | |
| SUMOVehicleClass | vclass | |||
| ) |
Definition at line 1871 of file NBEdge.cpp.
References myLanes.
Referenced by NIXMLEdgesHandler::myStartElement(), and setVehicleClasses().
01871 { 01872 if (lane<0) { 01873 // if all lanes are meant... 01874 for (unsigned int i=0; i<myLanes.size(); i++) { 01875 // ... do it for each lane 01876 disallowVehicleClass((int) i, vclass); 01877 } 01878 return; 01879 } 01880 assert(lane<(int) myLanes.size()); 01881 // add it only if not already done 01882 if (find(myLanes[lane].notAllowed.begin(), myLanes[lane].notAllowed.end(), vclass)==myLanes[lane].notAllowed.end()) { 01883 myLanes[lane].notAllowed.push_back(vclass); 01884 } 01885 }
| void NBEdge::dismissVehicleClassInformation | ( | ) |
Definition at line 1965 of file NBEdge.cpp.
References myLanes.
01965 { 01966 for (std::vector<Lane>::iterator i=myLanes.begin(); i!=myLanes.end(); ++i) { 01967 (*i).allowed.clear(); 01968 (*i).notAllowed.clear(); 01969 (*i).preferred.clear(); 01970 } 01971 }
| void NBEdge::divideOnEdges | ( | const std::vector< NBEdge * > * | outgoing | ) | [private] |
divides the lanes on the outgoing edges
Definition at line 1149 of file NBEdge.cpp.
References Bresenham::compute(), computePrioritySum(), NBEdge::ToEdgeConnectionsAdder::getBuiltConnections(), myAmLeftHand, myConnections, myLanes, preparePriorities(), size, and SUMOReal.
Referenced by computeLanes2Edges().
01149 { 01150 if (outgoing->size()==0) { 01151 // we have to do this, because the turnaround may have been added before 01152 myConnections.clear(); 01153 return; 01154 } 01155 // precompute priorities; needed as some kind of assumptions for 01156 // priorities of directions (see preparePriorities) 01157 std::vector<unsigned int> *priorities = preparePriorities(outgoing); 01158 01159 // compute the sum of priorities (needed for normalisation) 01160 unsigned int prioSum = computePrioritySum(priorities); 01161 // compute the resulting number of lanes that should be used to 01162 // reach the following edge 01163 unsigned int size = (unsigned int) outgoing->size(); 01164 std::vector<SUMOReal> resultingLanes; 01165 resultingLanes.reserve(size); 01166 SUMOReal sumResulting = 0; // the sum of resulting lanes 01167 SUMOReal minResulting = 10000; // the least number of lanes to reach an edge 01168 unsigned int i; 01169 for (i=0; i<size; i++) { 01170 // res will be the number of lanes which are meant to reach the 01171 // current outgoing edge 01172 SUMOReal res = 01173 (SUMOReal)(*priorities)[i] * 01174 (SUMOReal) myLanes.size() / (SUMOReal) prioSum; 01175 // do not let this number be greater than the number of available lanes 01176 if (res>myLanes.size()) { 01177 res = (SUMOReal) myLanes.size(); 01178 } 01179 // add it to the list 01180 resultingLanes.push_back(res); 01181 sumResulting += res; 01182 if (minResulting>res) { 01183 minResulting = res; 01184 } 01185 } 01186 // compute the number of virtual edges 01187 // a virtual edge is used as a replacement for a real edge from now on 01188 // it shall ollow to divide the existing lanes on this structure without 01189 // regarding the structure of outgoing edges 01190 sumResulting += minResulting / (SUMOReal) 2.; 01191 unsigned int noVirtual = (unsigned int)(sumResulting / minResulting); 01192 // compute the transition from virtual to real edges 01193 std::vector<NBEdge*> transition; 01194 transition.reserve(size); 01195 for (i=0; i<size; i++) { 01196 // tmpNo will be the number of connections from this edge 01197 // to the next edge 01198 assert(i<resultingLanes.size()); 01199 SUMOReal tmpNo = (SUMOReal) resultingLanes[i] / (SUMOReal) minResulting; 01200 for (SUMOReal j=0; j<tmpNo; j++) { 01201 assert(outgoing->size()>i); 01202 transition.push_back((*outgoing)[i]); 01203 } 01204 } 01205 01206 // assign lanes to edges 01207 // (conversion from virtual to real edges is done) 01208 ToEdgeConnectionsAdder adder(/*&myToEdges, */transition); 01209 Bresenham::compute(&adder, (SUMOReal) myLanes.size(), (SUMOReal) noVirtual); 01210 const std::map<NBEdge*, std::vector<unsigned int> > &l2eConns = adder.getBuiltConnections(); 01211 myConnections.clear(); 01212 for (std::map<NBEdge*, std::vector<unsigned int> >::const_iterator i=l2eConns.begin(); i!=l2eConns.end(); ++i) { 01213 const std::vector<unsigned int> lanes = (*i).second; 01214 for (std::vector<unsigned int>::const_iterator j=lanes.begin(); j!=lanes.end(); ++j) { 01215 if (myAmLeftHand) { 01216 myConnections.push_back(Connection(myLanes.size() - 1 - *j, (*i).first, -1)); 01217 } else { 01218 myConnections.push_back(Connection(*j, (*i).first, -1)); 01219 } 01220 } 01221 } 01222 delete priorities; 01223 }
!! if (myAllowedOnLanes!=possContinuation->myAllowedOnLanes || myNotAllowedOnLanes!=possContinuation->myNotAllowedOnLanes) { return false; }
Definition at line 1612 of file NBEdge.cpp.
References EDGE2EDGES, getConnectedEdges(), getConnectionLanes(), getPriority(), INIT, INIT_REJECT_CONNECTIONS, LANES2EDGES, LANES2LANES_DONE, LANES2LANES_RECHECK, LANES2LANES_USER, myConnections, myLanes, mySpeed, and myStep.
01612 { 01613 // ok, the number of lanes must match 01614 if (myLanes.size()!=possContinuation->myLanes.size()) { 01615 return false; 01616 } 01617 // the priority, too (?) 01618 if (getPriority()!=possContinuation->getPriority()) { 01619 return false; 01620 } 01621 // the speed allowed 01622 if (mySpeed!=possContinuation->mySpeed) { 01623 return false; 01624 } 01625 // the vehicle class constraints, too 01633 // also, check whether the connections - if any exit do allow to join 01634 // both edges 01635 // This edge must have a one-to-one connection to the following lanes 01636 switch (myStep) { 01637 case INIT_REJECT_CONNECTIONS: 01638 break; 01639 case INIT: 01640 break; 01641 case EDGE2EDGES: { 01642 // the following edge must be connected 01643 const EdgeVector &conn = getConnectedEdges(); 01644 if (find(conn.begin(), conn.end(), possContinuation) 01645 ==conn.end()) { 01646 01647 return false; 01648 } 01649 } 01650 break; 01651 case LANES2EDGES: 01652 case LANES2LANES_RECHECK: 01653 case LANES2LANES_DONE: 01654 case LANES2LANES_USER: { 01655 // the possible continuation must be connected 01656 if (find_if(myConnections.begin(), myConnections.end(), connections_toedge_finder(possContinuation))==myConnections.end()) { 01657 return false; 01658 } 01659 // all lanes must go to the possible continuation 01660 std::vector<int> conns = getConnectionLanes(possContinuation); 01661 if (conns.size()!=myLanes.size()) { 01662 return false; 01663 } 01664 } 01665 break; 01666 default: 01667 break; 01668 } 01669 return true; 01670 }
| std::vector< SUMOVehicleClass > NBEdge::getAllowedVehicleClasses | ( | ) | const |
Definition at line 1918 of file NBEdge.cpp.
References myLanes.
01918 { 01919 std::vector<SUMOVehicleClass> ret; 01920 for (std::vector<Lane>::const_iterator i=myLanes.begin(); i!=myLanes.end(); ++i) { 01921 const std::vector<SUMOVehicleClass> &allowed = (*i).allowed; 01922 for (std::vector<SUMOVehicleClass>::const_iterator j=allowed.begin(); j!=allowed.end(); ++j) { 01923 if (find(ret.begin(), ret.end(), *j)==ret.end()) { 01924 ret.push_back(*j); 01925 } 01926 } 01927 } 01928 return ret; 01929 }
| SUMOReal NBEdge::getAngle | ( | const NBNode & | atNode | ) | const |
Definition at line 549 of file NBEdge.cpp.
References Line2D::atan2DegreeAngle(), Position2DVector::getBegLine(), Position2DVector::getEndLine(), myFrom, myGeom, and myTo.
00549 { 00550 if (&atNode==myFrom) { 00551 return myGeom.getBegLine().atan2DegreeAngle(); 00552 } else { 00553 assert(&atNode==myTo); 00554 return myGeom.getEndLine().atan2DegreeAngle(); 00555 } 00556 }
| SUMOReal NBEdge::getAngle | ( | ) | const throw () [inline] |
Returns the angle of the edge.
The angle is computed within the constructor using NBHelpers::angle
Definition at line 283 of file NBEdge.h.
References myAngle.
Referenced by acceptBeingTurning(), NBNode::computeLanes2Lanes(), computeTurningDirections(), NBContHelper::edge_opposite_direction_sorter::getDiff(), NBContHelper::same_connection_edge_sorter::getMinMaxRelAngles(), getNormedAngle(), isTurningDirectionAt(), NBEdge::connections_relative_edgelane_sorter::operator()(), NBContHelper::edge_similar_direction_sorter::operator()(), NBContHelper::relative_edge_sorter::operator()(), NBNode::setPriorityJunctionPriorities(), and setTurningDestination().
00283 { 00284 return myAngle; 00285 }
| Position2DVector NBEdge::getCCWBoundaryLine | ( | const NBNode & | n, | |
| SUMOReal | offset | |||
| ) | const |
Definition at line 1591 of file NBEdge.cpp.
References Position2DVector::move2side(), myAmLeftHand, myFrom, and myLanes.
01591 { 01592 Position2DVector ret; 01593 if (myFrom==(&n)) { 01594 // outgoing 01595 ret = !myAmLeftHand ? myLanes.back().shape : myLanes[0].shape; 01596 } else { 01597 // incoming 01598 ret = !myAmLeftHand ? myLanes[0].shape.reverse() : myLanes.back().shape.reverse(); 01599 } 01600 ret.move2side(-offset); 01601 return ret; 01602 }
| std::vector< NBEdge * > NBEdge::getConnectedEdges | ( | ) | const throw () |
returns the list of outgoing edges unsorted
Definition at line 1385 of file NBEdge.cpp.
References myConnections.
Referenced by NIVissimDisturbance::addToNode(), expandableBy(), NBContHelper::same_connection_edge_sorter::getMinMaxRelAngles(), and remapConnections().
01385 { 01386 std::vector<NBEdge*> ret; 01387 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01388 if (find(ret.begin(), ret.end(), (*i).toEdge)==ret.end()) { 01389 ret.push_back((*i).toEdge); 01390 } 01391 } 01392 return ret; 01393 }
| const std::vector< NBEdge * > * NBEdge::getConnectedSorted | ( | ) |
returns the list of outgoing edges without the turnaround sorted in clockwise direction
Definition at line 1121 of file NBEdge.cpp.
References NBNode::getOutgoingEdges(), myConnections, myTo, myTurnDestination, and size.
Referenced by computeLanes2Edges(), and writeXMLStep1().
01121 { 01122 // check whether connections exist and if not, use edges from the node 01123 EdgeVector outgoing; 01124 if (myConnections.size()==0) { 01125 outgoing = myTo->getOutgoingEdges(); 01126 } else { 01127 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01128 if (find(outgoing.begin(), outgoing.end(), (*i).toEdge)==outgoing.end()) { 01129 outgoing.push_back((*i).toEdge); 01130 } 01131 } 01132 } 01133 // allocate the sorted container 01134 unsigned int size = (unsigned int) outgoing.size(); 01135 std::vector<NBEdge*> *edges = new std::vector<NBEdge*>(); 01136 edges->reserve(size); 01137 for (EdgeVector::const_iterator i=outgoing.begin(); i!=outgoing.end(); i++) { 01138 NBEdge *outedge = *i; 01139 if (outedge!=0&&outedge!=myTurnDestination) { 01140 edges->push_back(outedge); 01141 } 01142 } 01143 sort(edges->begin(), edges->end(), NBContHelper::relative_edge_sorter(this, myTo)); 01144 return edges; 01145 }
| std::vector< int > NBEdge::getConnectionLanes | ( | NBEdge * | currentOutgoing | ) | const |
returns the list of lanes that may be used to reach the given edge
Definition at line 1107 of file NBEdge.cpp.
References myConnections, and myTurnDestination.
Referenced by expandableBy().
01107 { 01108 std::vector<int> ret; 01109 if (currentOutgoing!=myTurnDestination) { 01110 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01111 if ((*i).toEdge==currentOutgoing) { 01112 ret.push_back((*i).fromLane); 01113 } 01114 } 01115 } 01116 return ret; 01117 }
| std::vector<Connection>& NBEdge::getConnections | ( | ) | [inline] |
Definition at line 622 of file NBEdge.h.
References myConnections.
00622 { 00623 return myConnections; 00624 }
| const std::vector<Connection>& NBEdge::getConnections | ( | ) | const [inline] |
Definition at line 619 of file NBEdge.h.
References myConnections.
00619 { 00620 return myConnections; 00621 }
| std::vector< NBEdge::Connection > NBEdge::getConnectionsFromLane | ( | unsigned int | lane | ) | const throw () |
Returns connections from a given lane.
| [in] | lane | The lane which connections shall be returned |
Definition at line 491 of file NBEdge.cpp.
References myConnections.
Referenced by NIVissimTL::NIVissimTLSignal::addTo(), NBTrafficLightDefinition::collectLinks(), NBOwnTLDef::collectLinks(), NBLoadedTLDef::collectLinks(), moveOutgoingConnectionsFrom(), NBOwnTLDef::myCompute(), NBEdgeCont::savePlain(), and NBRequest::writeLaneResponse().
00491 { 00492 std::vector<NBEdge::Connection> ret; 00493 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 00494 if ((*i).fromLane==lane) { 00495 ret.push_back(*i); 00496 } 00497 } 00498 return ret; 00499 }
| Position2DVector NBEdge::getCWBoundaryLine | ( | const NBNode & | n, | |
| SUMOReal | offset | |||
| ) | const |
Definition at line 1576 of file NBEdge.cpp.
References Position2DVector::move2side(), myAmLeftHand, myFrom, and myLanes.
01576 { 01577 Position2DVector ret; 01578 if (myFrom==(&n)) { 01579 // outgoing 01580 ret = !myAmLeftHand ? myLanes[0].shape : myLanes.back().shape; 01581 } else { 01582 // incoming 01583 ret = !myAmLeftHand ? myLanes.back().shape.reverse() : myLanes[0].shape.reverse(); 01584 } 01585 ret.move2side(offset); 01586 return ret; 01587 }
| NBNode* const NBEdge::getFromNode | ( | ) | const throw () [inline] |
Returns the origin node of the edge.
Definition at line 263 of file NBEdge.h.
References myFrom.
Referenced by NIVissimDisturbance::addToNode(), NBNodeCont::buildOnRamp(), NIVissimDistrictConnection::dict_BuildDistricts(), NBNodeCont::generateNodeClusters(), NBContHelper::edge_by_junction_angle_sorter::getConvAngle(), NIImporter_VISUM::getNamedEdgeContinuating(), NBNodeCont::guessRamps(), NBEdgeCont::guessRoundabouts(), NBNode::isNearDistrict(), NIImporter_VISUM::parse_Lanes(), NBNodeCont::removeIsolatedRoads(), NBEdgeCont::removeUnwishedEdges(), NBEdgeCont::savePlain(), and NIXMLEdgesHandler::setNodes().
00263 { 00264 return myFrom; 00265 }
| const Position2DVector& NBEdge::getGeometry | ( | ) | const throw () [inline] |
Returns the geometry of the edge.
Definition at line 322 of file NBEdge.h.
References myGeom.
Referenced by NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), NBNodeCont::guessRamps(), isNearEnough2BeJoined2(), NIXMLEdgesHandler::myStartElement(), NIImporter_VISUM::parse_Lanes(), and NBEdgeCont::savePlain().
00322 { 00323 return myGeom; 00324 }
| const std::string& NBEdge::getID | ( | ) | const throw () [inline] |
Returns the id of the edge.
Definition at line 239 of file NBEdge.h.
References myID.
Referenced by NIImporter_OpenDrive::addE2EConnectionsSecure(), NIVissimDisturbance::addToNode(), NIVissimConnection::buildEdgeConnections(), NIVissimEdge::buildNBEdge(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), NBTrafficLightDefinition::collectEdges(), NBOwnTLDef::collectLinks(), NBNode::computeInternalLaneShape(), computeLaneShape(), computeLaneShapes(), NBNode::eraseDummies(), NIImporter_VISUM::getNamedEdgeContinuating(), NIImporter_VISUM::getReversedContinuating(), NBNodeCont::guessRamps(), NBConnection::NBConnection(), NBRequest::NBRequest(), NBOwnTLDef::edge_by_incoming_priority_sorter::operator()(), NBContHelper::same_connection_edge_sorter::operator()(), NIImporter_VISUM::parse_Lanes(), NIImporter_VISUM::parse_LanesConnections(), NIImporter_VISUM::parse_TurnsToSignalGroups(), NIXMLConnectionsHandler::parseLaneBound(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBConnection::replaceFrom(), NBConnection::replaceTo(), NBEdgeCont::savePlain(), setControllingTLInformation(), and writeSingleSucceeding().
00239 { 00240 return myID; 00241 }
| int NBEdge::getJunctionPriority | ( | const NBNode *const | node | ) | const |
Returns the junction priority (normalised for the node currently build).
If the given node is neither the edge's start nor the edge's ending node, the behaviour is undefined.
| [in] | node | The node for which the edge's priority shall be returned |
Definition at line 510 of file NBEdge.cpp.
References myFrom, myFromJunctionPriority, and myToJunctionPriority.
Referenced by NBEdge::MainDirections::MainDirections(), NBOwnTLDef::edge_by_incoming_priority_sorter::operator()(), and NBRequest::setBlocking().
00510 { 00511 if (node==myFrom) { 00512 return myFromJunctionPriority; 00513 } else { 00514 return myToJunctionPriority; 00515 } 00516 }
| std::string NBEdge::getLaneID | ( | unsigned int | lane | ) |
| const Position2DVector & NBEdge::getLaneShape | ( | unsigned int | i | ) | const throw () |
Returns the shape of the nth lane.
Definition at line 346 of file NBEdge.cpp.
References myLanes.
Referenced by NBNode::computeInternalLaneShape().
00346 { 00347 return myLanes[i].shape; 00348 }
| SUMOReal NBEdge::getLaneSpeed | ( | unsigned int | lane | ) | const |
Definition at line 722 of file NBEdge.cpp.
References myLanes.
00722 { 00723 return myLanes[lane].speed; 00724 }
| LaneSpreadFunction NBEdge::getLaneSpreadFunction | ( | ) | const throw () [inline] |
Returns how this edge's lanes' lateral offset is computed.
Definition at line 378 of file NBEdge.h.
References myLaneSpreadFunction.
Referenced by NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), and NBEdgeCont::savePlain().
00378 { 00379 return myLaneSpreadFunction; 00380 }
| SUMOReal NBEdge::getLength | ( | ) | const throw () [inline] |
Returns the computed length of the edge.
Definition at line 291 of file NBEdge.h.
References myLength.
Referenced by NBJoinedEdgesMap::init(), NIImporter_VISUM::parse_Lanes(), and NBEdgeCont::retrievePossiblySplitted().
00291 { 00292 return myLength; 00293 }
| int NBEdge::getMaxConnectedLane | ( | NBEdge * | of | ) | const |
Definition at line 1947 of file NBEdge.cpp.
References myConnections.
01947 { 01948 int ret = -1; 01949 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01950 if ((*i).toEdge==of && (*i).toLane>ret) { 01951 ret = (*i).toLane; 01952 } 01953 } 01954 return ret; 01955 }
| SUMOReal NBEdge::getMaxLaneOffset | ( | ) |
Definition at line 1449 of file NBEdge.cpp.
References myLanes, SUMO_const_laneWidthAndOffset, and SUMOReal.
01449 { 01450 return (SUMOReal) SUMO_const_laneWidthAndOffset * myLanes.size(); 01451 }
| Position2D NBEdge::getMaxLaneOffsetPositionAt | ( | NBNode * | node, | |
| SUMOReal | width | |||
| ) | const |
Definition at line 1474 of file NBEdge.cpp.
References Position2DVector::length(), myFrom, myLanes, Position2DVector::positionAtLengthPosition(), SUMO_const_halfLaneAndOffset, SUMOReal, and GeomHelper::transfer_to_side().
01474 { 01475 const Position2DVector &shape0 = myLanes[0].shape; 01476 const Position2DVector &shapel = myLanes.back().shape; 01477 width = width < shape0.length()/(SUMOReal) 2.0 01478 ? width 01479 : shape0.length()/(SUMOReal) 2.0; 01480 if (node==myFrom) { 01481 Position2D pos = shape0.positionAtLengthPosition(width); 01482 GeomHelper::transfer_to_side(pos, shape0[0], shape0[-1], -SUMO_const_halfLaneAndOffset); 01483 return pos; 01484 } else { 01485 Position2D pos = shapel.positionAtLengthPosition(shapel.length() - width); 01486 GeomHelper::transfer_to_side(pos, shapel[-1], shapel[0], -SUMO_const_halfLaneAndOffset); 01487 return pos; 01488 } 01489 }
| int NBEdge::getMinConnectedLane | ( | NBEdge * | of | ) | const |
Definition at line 1935 of file NBEdge.cpp.
References myConnections.
01935 { 01936 int ret = -1; 01937 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01938 if ((*i).toEdge==of && (ret==-1 || (*i).toLane<ret)) { 01939 ret = (*i).toLane; 01940 } 01941 } 01942 return ret; 01943 }
| Position2D NBEdge::getMinLaneOffsetPositionAt | ( | NBNode * | node, | |
| SUMOReal | width | |||
| ) | const |
Definition at line 1455 of file NBEdge.cpp.
References Position2DVector::length(), myFrom, myLanes, Position2DVector::positionAtLengthPosition(), SUMO_const_halfLaneAndOffset, SUMOReal, and GeomHelper::transfer_to_side().
01455 { 01456 const Position2DVector &shape0 = myLanes[0].shape; 01457 const Position2DVector &shapel = myLanes.back().shape; 01458 width = width < shape0.length()/(SUMOReal) 2.0 01459 ? width 01460 : shape0.length()/(SUMOReal) 2.0; 01461 if (node==myFrom) { 01462 Position2D pos = shapel.positionAtLengthPosition(width); 01463 GeomHelper::transfer_to_side(pos, shapel[0], shapel[-1], SUMO_const_halfLaneAndOffset); 01464 return pos; 01465 } else { 01466 Position2D pos = shape0.positionAtLengthPosition(shape0.length() - width); 01467 GeomHelper::transfer_to_side(pos, shape0[-1], shape0[0], SUMO_const_halfLaneAndOffset); 01468 return pos; 01469 } 01470 }
| unsigned int NBEdge::getNoLanes | ( | ) | const throw () [inline] |
Returns the number of lanes.
Definition at line 247 of file NBEdge.h.
References myLanes.
Referenced by NIVissimTL::NIVissimTLSignal::addTo(), appendTurnaround(), NIVissimConnection::buildEdgeConnections(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), NBNodeCont::checkHighwayRampOrder(), NBTrafficLightDefinition::collectLinks(), NBOwnTLDef::collectLinks(), NBLoadedTLDef::collectLinks(), NBNode::computeInternalLaneShape(), NBNode::computeLanes2Lanes(), NBNode::ApproachingDivider::execute(), NBNodeCont::guessRamps(), NBNode::isSimpleContinuation(), NBNodeCont::mayNeedOffRamp(), NBNodeCont::mayNeedOnRamp(), moveOutgoingConnectionsFrom(), NBOwnTLDef::myCompute(), NIXMLEdgesHandler::myEndElement(), NIXMLEdgesHandler::myStartElement(), NBContHelper::edge_by_priority_sorter::operator()(), NIImporter_VISUM::parse_Lanes(), NIImporter_VISUM::parse_LanesConnections(), samePriority(), NBEdgeCont::savePlain(), NBLoadedTLDef::setTLControllingInformation(), NBEdgeCont::splitAt(), and NBNode::ApproachingDivider::spread().
00247 { 00248 return (unsigned int) myLanes.size(); 00249 }
| SUMOReal NBEdge::getNormedAngle | ( | const NBNode & | atNode | ) | const |
Definition at line 1730 of file NBEdge.cpp.
References getAngle(), and SUMOReal.
01730 { 01731 SUMOReal angle = getAngle(atNode); 01732 if (angle<0) { 01733 angle = 360 + angle; 01734 } 01735 assert(angle>=0&&angle<360); 01736 return angle; 01737 }
| SUMOReal NBEdge::getNormedAngle | ( | ) | const |
Definition at line 1741 of file NBEdge.cpp.
References myAngle, and SUMOReal.
Referenced by NBContHelper::edge_by_junction_angle_sorter::getConvAngle().
01741 { 01742 SUMOReal angle = myAngle; 01743 if (angle<0) { 01744 angle = 360 + angle; 01745 } 01746 assert(angle>=0&&angle<360); 01747 return angle; 01748 }
| int NBEdge::getPriority | ( | ) | const throw () [inline] |
Returns the priority of the edge.
Definition at line 255 of file NBEdge.h.
References myPriority.
Referenced by expandableBy(), NIXMLEdgesHandler::myStartElement(), NBContHelper::edge_by_priority_sorter::operator()(), and samePriority().
00255 { 00256 return myPriority; 00257 }
| SUMOReal NBEdge::getSpeed | ( | ) | const throw () [inline] |
Returns the speed allowed on this edge.
Definition at line 299 of file NBEdge.h.
References mySpeed.
Referenced by NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), NBNodeCont::checkHighwayRampOrder(), NBNodeCont::mayNeedOffRamp(), NBNodeCont::mayNeedOnRamp(), NIXMLEdgesHandler::myStartElement(), NBContHelper::edge_by_priority_sorter::operator()(), samePriority(), and NBEdgeCont::savePlain().
00299 { 00300 return mySpeed; 00301 }
| EdgeBuildingStep NBEdge::getStep | ( | ) | const throw () [inline] |
| NBNode* const NBEdge::getToNode | ( | ) | const throw () [inline] |
Returns the destination node of the edge.
Definition at line 271 of file NBEdge.h.
References myTo.
Referenced by NIVissimDisturbance::addToNode(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), NBLoadedTLDef::collectNodes(), NIVissimDistrictConnection::dict_BuildDistricts(), NBNodeCont::generateNodeClusters(), NBNode::getCrossingNames_dividedBySpace(), NBNode::getCrossingSourcesNames_dividedBySpace(), NIImporter_VISUM::getNamedEdgeContinuating(), NBNode::getOppositeIncoming(), NBNodeCont::guessRamps(), NBEdgeCont::guessRoundabouts(), NBNode::isNearDistrict(), NBOwnTLDef::myCompute(), NIXMLConnectionsHandler::myStartElement(), NBOwnTLDef::edge_by_incoming_priority_sorter::operator()(), NBContHelper::edge_with_destination_finder::operator()(), NIImporter_VISUM::parse_Lanes(), NIXMLConnectionsHandler::parseLaneBound(), NBNodeCont::recheckEdges(), NBNodeCont::removeIsolatedRoads(), NBEdgeCont::removeUnwishedEdges(), NBNodeCont::removeUnwishedNodes(), NBEdgeCont::savePlain(), NIXMLEdgesHandler::setNodes(), and NBNode::swapWhenReversed().
00271 { 00272 return myTo; 00273 }
| NBEdge * NBEdge::getTurnDestination | ( | ) | const |
Definition at line 1706 of file NBEdge.cpp.
References myTurnDestination.
Referenced by NBNode::computeInternalLaneShape(), NBNode::computeLanes2Lanes(), NBEdgeCont::guessRoundabouts(), moveConnectionToLeft(), moveConnectionToRight(), and writeXMLStep1().
01706 { 01707 return myTurnDestination; 01708 }
| const std::string& NBEdge::getTypeID | ( | ) | const throw () [inline] |
Definition at line 567 of file NBEdge.h.
References myType.
Referenced by NIXMLEdgesHandler::myStartElement().
00567 { 00568 return myType; 00569 }
Retrieves info about a connection to a certain lane of a certain edge.
| [in] | destEdge | The connection's destination edge |
| [in] | destLane | The connection's destination lane |
Definition at line 503 of file NBEdge.cpp.
References myConnections.
Referenced by setConnection().
00503 { 00504 return destEdge!=0&&find_if(myConnections.begin(), myConnections.end(), connections_toedgelane_finder(destEdge, destLane))!=myConnections.end(); 00505 }
| bool NBEdge::hasRestrictions | ( | ) | const |
Definition at line 913 of file NBEdge.cpp.
References myLanes.
Referenced by NBEdgeCont::savePlain().
00913 { 00914 for (std::vector<Lane>::const_iterator i=myLanes.begin(); i!=myLanes.end(); ++i) { 00915 if ((*i).allowed.size()!=0 || (*i).notAllowed.size()!=0) { 00916 return true; 00917 } 00918 } 00919 return false; 00920 }
Definition at line 1695 of file NBEdge.cpp.
References myConnections.
01695 { 01696 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01697 if ((*i).toEdge==e && (*i).tlID!="") { 01698 return true; 01699 } 01700 } 01701 return false; 01702 }
| void NBEdge::incLaneNo | ( | unsigned int | by | ) |
Definition at line 1752 of file NBEdge.cpp.
References computeLaneShapes(), NBNode::getIncomingEdges(), invalidateConnections(), myFrom, myLanes, mySpeed, and NBEdge::Lane::speed.
Referenced by NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), and NIImporter_VISUM::parse_Lanes().
01752 { 01753 unsigned int newLaneNo = (unsigned int) myLanes.size() + by; 01754 while (myLanes.size()<newLaneNo) { 01755 Lane l; 01756 l.speed = mySpeed; 01757 myLanes.push_back(l); 01758 } 01759 computeLaneShapes(); 01760 const EdgeVector &incs = myFrom->getIncomingEdges(); 01761 for (EdgeVector::const_iterator i=incs.begin(); i!=incs.end(); ++i) { 01762 (*i)->invalidateConnections(true); 01763 } 01764 invalidateConnections(true); 01765 }
| void NBEdge::init | ( | unsigned int | noLanes, | |
| bool | tryIgnoreNodePositions | |||
| ) | throw (ProcessError) [private] |
Initialization routines common to all constructors.
Checks whether the number of lanes>0, whether the junction's from- and to-nodes are given (!=0) and whether they are distict. Throws a ProcessError if any of these checks fails.
Adds the nodes positions to geometry if it shall not be ignored or if the geometry is empty.
Computes the angle and length, and adds this edge to its node as outgoing/incoming. Builds lane informations.
| [in] | noLanes | The number of lanes this edge has |
| [in] | tryIgnoreNodePositions | Does not add node geometries if geom.size()>=2 |
Definition at line 213 of file NBEdge.cpp.
References NBNode::addIncomingEdge(), NBNode::addOutgoingEdge(), NBHelpers::angle(), computeLaneShapes(), Position2D::distanceTo(), NBNode::getPosition(), myAngle, myFrom, myGeom, myID, myLanes, myLength, mySpeed, myTo, Position2DVector::push_back(), Position2DVector::push_back_noDoublePos(), Position2DVector::push_front(), Position2DVector::push_front_noDoublePos(), Position2DVector::removeDoublePoints(), Position2DVector::size(), NBEdge::Lane::speed, Position2D::x(), and Position2D::y().
Referenced by NBEdge(), and reinit().
00213 { 00214 if (noLanes==0) { 00215 throw ProcessError("Edge '" + myID + "' needs at least one lane."); 00216 } 00217 if (myFrom==0||myTo==0) { 00218 throw ProcessError("At least one of edge's '" + myID + "' nodes is not known."); 00219 } 00220 // revisit geometry 00221 // should have at least two points at the end... 00222 // and in dome cases, the node positions must be added 00223 myGeom.removeDoublePoints(); 00224 if (!tryIgnoreNodePositions||myGeom.size()<2) { 00225 if (myGeom.size()==0) { 00226 myGeom.push_back(myTo->getPosition()); 00227 myGeom.push_front(myFrom->getPosition()); 00228 } else { 00229 Position2DVector v; 00230 v = myGeom; 00231 v.push_back_noDoublePos(myTo->getPosition()); 00232 v.push_front_noDoublePos(myFrom->getPosition()); 00233 if (v.size()<2) { 00234 myGeom.push_back(myTo->getPosition()); 00235 myGeom.push_front(myFrom->getPosition()); 00236 } else { 00237 myGeom = v; 00238 } 00239 } 00240 } 00241 // 00242 myAngle = NBHelpers::angle( 00243 myFrom->getPosition().x(), myFrom->getPosition().y(), 00244 myTo->getPosition().x(), myTo->getPosition().y() 00245 ); 00246 myFrom->addOutgoingEdge(this); 00247 myTo->addIncomingEdge(this); 00248 // prepare container 00249 myLength = myFrom->getPosition().distanceTo(myTo->getPosition()); 00250 assert(myGeom.size()>=2); 00251 myLanes.clear(); 00252 for (unsigned int i=0; i<noLanes; i++) { 00253 Lane l; 00254 l.speed = mySpeed; 00255 myLanes.push_back(l); 00256 } 00257 computeLaneShapes(); 00258 }
| void NBEdge::invalidateConnections | ( | bool | reallowSetting = false |
) |
Definition at line 1431 of file NBEdge.cpp.
References INIT, INIT_REJECT_CONNECTIONS, myConnections, myStep, and myTurnDestination.
Referenced by addLane2LaneConnections(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), decLaneNo(), incLaneNo(), and NIXMLEdgesHandler::myEndElement().
01431 { 01432 myTurnDestination = 0; 01433 myConnections.clear(); 01434 if (reallowSetting) { 01435 myStep = INIT; 01436 } else { 01437 myStep = INIT_REJECT_CONNECTIONS; 01438 } 01439 }
Returns the information whethe a connection to the given edge has been added (or computed).
Definition at line 1372 of file NBEdge.cpp.
References myConnections, and myTurnDestination.
Referenced by computeTurningDirections(), and NBNode::eraseDummies().
01372 { 01373 if (e==myTurnDestination) { 01374 return true; 01375 } 01376 return 01377 find_if(myConnections.begin(), myConnections.end(), connections_toedge_finder(e)) 01378 != 01379 myConnections.end(); 01380 01381 }
| bool NBEdge::isInnerEdge | ( | ) | const throw () [inline] |
Returns whether this edge was marked as being within an intersection.
Definition at line 524 of file NBEdge.h.
References myAmInnerEdge.
00524 { 00525 return myAmInnerEdge; 00526 }
| bool NBEdge::isMacroscopicConnector | ( | ) | throw () [inline] |
Returns whether this edge was marked as a macroscopic connector.
Definition at line 509 of file NBEdge.h.
References myAmMacroscopicConnector.
Referenced by NBNodeCont::mayNeedOffRamp(), NBNodeCont::mayNeedOnRamp(), and writeXMLStep1().
00509 { 00510 return myAmMacroscopicConnector; 00511 }
Definition at line 1719 of file NBEdge.cpp.
References Position2DVector::distances(), Position2DVector::distancesExt(), getGeometry(), max, VectorHelper< T >::maxValue(), myGeom, and SUMOReal.
01719 { 01720 DoubleVector distances = myGeom.distances(e->getGeometry()); 01721 if (distances.size()==0) { 01722 distances = e->getGeometry().distancesExt(myGeom); 01723 } 01724 SUMOReal max = VectorHelper<SUMOReal>::maxValue(distances); 01725 return max<7; 01726 }
Returns whether the given edge is the opposite direction to this edge.
| [in] | n | The node at which this may be turnaround direction |
| [in] | edge | The edge which may be the turnaround direction |
Definition at line 1300 of file NBEdge.cpp.
References getAngle(), myFrom, myTo, myTurnDestination, and SUMOReal.
Referenced by NBOwnTLDef::myCompute(), NBContHelper::opposite_finder::operator()(), NBRequest::setBlocking(), and NBNode::swapWhenReversed().
01300 { 01301 // maybe it was already set as the turning direction 01302 if (edge == myTurnDestination) { 01303 return true; 01304 } else if (myTurnDestination!=0) { 01305 // otherwise - it's not if a turning direction exists 01306 return false; 01307 } 01308 // if the same nodes are connected 01309 if (myFrom==edge->myTo &&myTo==edge->myFrom) { 01310 return true; 01311 } 01312 // we have to checke whether the connection between the nodes is 01313 // geometrically similar 01314 SUMOReal thisFromAngle2 = getAngle(*n); 01315 SUMOReal otherToAngle2 = edge->getAngle(*n); 01316 if (thisFromAngle2<otherToAngle2) { 01317 std::swap(thisFromAngle2, otherToAngle2); 01318 } 01319 if (thisFromAngle2-otherToAngle2>170&&thisFromAngle2-otherToAngle2<190) { 01320 return true; 01321 } 01322 return false; 01323 }
| std::pair< SUMOReal, SUMOReal > NBEdge::laneOffset | ( | const Position2D & | from, | |
| const Position2D & | to, | |||
| SUMOReal | lanewidth, | |||
| unsigned int | lane | |||
| ) | throw (InvalidArgument) [private] |
Computes the offset from the edge shape on the current segment.
Definition at line 800 of file NBEdge.cpp.
References GeomHelper::getNormal90D_CW(), LANESPREAD_RIGHT, myAmLeftHand, myLanes, myLaneSpreadFunction, and SUMOReal.
Referenced by computeLaneShape().
00801 { 00802 std::pair<SUMOReal, SUMOReal> offsets = 00803 GeomHelper::getNormal90D_CW(from, to, lanewidth); 00804 SUMOReal xoff = offsets.first / (SUMOReal) 2.0; 00805 SUMOReal yoff = offsets.second / (SUMOReal) 2.0; 00806 if (myLaneSpreadFunction==LANESPREAD_RIGHT) { 00807 xoff += (offsets.first * (SUMOReal) lane); 00808 yoff += (offsets.second * (SUMOReal) lane); 00809 } else { 00810 xoff += (offsets.first * (SUMOReal) lane) - (offsets.first * (SUMOReal) myLanes.size() / (SUMOReal) 2.0); 00811 yoff += (offsets.second * (SUMOReal) lane) - (offsets.second * (SUMOReal) myLanes.size() / (SUMOReal) 2.0); 00812 } 00813 if (myAmLeftHand) { 00814 return std::pair<SUMOReal, SUMOReal>(-xoff, -yoff); 00815 } else { 00816 return std::pair<SUMOReal, SUMOReal>(xoff, yoff); 00817 } 00818 }
| bool NBEdge::lanesWereAssigned | ( | ) | const |
Definition at line 1443 of file NBEdge.cpp.
References LANES2LANES_DONE, LANES2LANES_USER, and myStep.
Referenced by NIVissimTL::NIVissimTLSignal::addTo().
01443 { 01444 return myStep==LANES2LANES_DONE||myStep==LANES2LANES_USER; 01445 }
| void NBEdge::markAsInLane2LaneState | ( | ) |
Definition at line 1802 of file NBEdge.cpp.
References NBNode::getOutgoingEdges(), LANES2LANES_DONE, myStep, and myTo.
01802 { 01803 assert(myTo->getOutgoingEdges().size()==0); 01804 myStep = LANES2LANES_DONE; 01805 }
Definition at line 1493 of file NBEdge.cpp.
References NBEdge::TLSDisabledConnection::fromLane, myTLSDisabledConnections, NBEdge::TLSDisabledConnection::to, and NBEdge::TLSDisabledConnection::toLane.
Referenced by NBTrafficLightDefinition::collectLinks(), NBOwnTLDef::collectLinks(), and NBOwnTLDef::myCompute().
01493 { 01494 TLSDisabledConnection tpl; 01495 tpl.fromLane = fromLane; 01496 tpl.to = toEdge; 01497 tpl.toLane = toLane; 01498 std::vector<TLSDisabledConnection>::const_iterator i = find_if(myTLSDisabledConnections.begin(), myTLSDisabledConnections.end(), tls_disable_finder(tpl)); 01499 return i==myTLSDisabledConnections.end(); 01500 }
| void NBEdge::moveConnectionToLeft | ( | unsigned int | lane | ) | [private] |
moves a connection one place to the left; Attention! no checking for field validity
Definition at line 1060 of file NBEdge.cpp.
References getTurnDestination(), L2L_VALIDATED, myAmLeftHand, myConnections, setConnection(), NBEdge::Connection::toEdge, and NBEdge::Connection::toLane.
Referenced by recheckLanes().
01060 { 01061 unsigned int index = 0; 01062 if (myAmLeftHand) { 01063 for (int i=(int) myConnections.size()-1; i>=0; --i) { 01064 if (myConnections[i].fromLane==lane&&getTurnDestination()!=myConnections[i].toEdge) { 01065 index = i; 01066 } 01067 } 01068 } else { 01069 for (unsigned int i=0; i<myConnections.size(); ++i) { 01070 if (myConnections[i].fromLane==lane) { 01071 index = i; 01072 } 01073 } 01074 } 01075 std::vector<Connection>::iterator i = myConnections.begin() + index; 01076 Connection c = *i; 01077 myConnections.erase(i); 01078 setConnection(lane+1, c.toEdge, c.toLane, L2L_VALIDATED, false); 01079 }
| void NBEdge::moveConnectionToRight | ( | unsigned int | lane | ) | [private] |
moves a connection one place to the right; Attention! no checking for field validity
Definition at line 1083 of file NBEdge.cpp.
References getTurnDestination(), L2L_VALIDATED, myAmLeftHand, myConnections, setConnection(), NBEdge::Connection::toEdge, and NBEdge::Connection::toLane.
Referenced by recheckLanes().
01083 { 01084 if (myAmLeftHand) { 01085 for (int i=(int) myConnections.size()-1; i>=0; --i) { 01086 if (myConnections[i].fromLane==lane&&getTurnDestination()!=myConnections[i].toEdge) { 01087 Connection c = myConnections[i]; 01088 myConnections.erase(myConnections.begin() + i); 01089 setConnection(lane-1, c.toEdge, c.toLane, L2L_VALIDATED, false); 01090 return; 01091 } 01092 } 01093 } else { 01094 for (std::vector<Connection>::iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01095 if ((*i).fromLane==lane) { 01096 Connection c = *i; 01097 i = myConnections.erase(i); 01098 setConnection(lane-1, c.toEdge, c.toLane, L2L_VALIDATED, false); 01099 return; 01100 } 01101 } 01102 } 01103 }
| void NBEdge::moveOutgoingConnectionsFrom | ( | NBEdge * | e, | |
| unsigned int | laneOff | |||
| ) |
Definition at line 1357 of file NBEdge.cpp.
References addLane2LaneConnection(), getConnectionsFromLane(), getNoLanes(), L2L_COMPUTED, NBEdge::Connection::tlID, NBEdge::Connection::toEdge, and NBEdge::Connection::toLane.
Referenced by NBEdgeCont::joinSameNodeConnectingEdges().
01357 { 01358 unsigned int lanes = e->getNoLanes(); 01359 for (unsigned int i=0; i<lanes; i++) { 01360 std::vector<NBEdge::Connection> elv = e->getConnectionsFromLane(i); 01361 for (std::vector<NBEdge::Connection>::iterator j=elv.begin(); j!=elv.end(); j++) { 01362 NBEdge::Connection el = *j; 01363 assert(el.tlID==""); 01364 bool ok = addLane2LaneConnection(i+laneOff, el.toEdge, el.toLane, L2L_COMPUTED); 01365 assert(ok); 01366 } 01367 } 01368 }
| void NBEdge::preferVehicleClass | ( | int | lane, | |
| SUMOVehicleClass | vclass | |||
| ) |
Definition at line 1889 of file NBEdge.cpp.
References myLanes.
Referenced by NIXMLEdgesHandler::myStartElement().
01889 { 01890 if (lane<0) { 01891 // if all lanes are meant... 01892 for (unsigned int i=0; i<myLanes.size(); i++) { 01893 // ... do it for each lane 01894 preferVehicleClass((int) i, vclass); 01895 } 01896 return; 01897 } 01898 assert(lane<(int) myLanes.size()); 01899 // add it only if not already done 01900 if (find(myLanes[lane].preferred.begin(), myLanes[lane].preferred.end(), vclass)==myLanes[lane].preferred.end()) { 01901 myLanes[lane].preferred.push_back(vclass); 01902 } 01903 }
| std::vector< unsigned int > * NBEdge::preparePriorities | ( | const std::vector< NBEdge * > * | outgoing | ) | [private] |
recomputes the priorities and manipulates them for a distribution of lanes on edges which is more like in real-life
Definition at line 1227 of file NBEdge.cpp.
References NBEdge::MainDirections::DIR_FORWARD, NBEdge::MainDirections::DIR_RIGHTMOST, NBEdge::MainDirections::empty(), NBEdge::MainDirections::includes(), myLanes, myTo, and size.
Referenced by divideOnEdges().
01227 { 01228 // copy the priorities first 01229 std::vector<unsigned int> *priorities = new std::vector<unsigned int>(); 01230 if (outgoing->size()==0) { 01231 return priorities; 01232 } 01233 priorities->reserve(outgoing->size()); 01234 std::vector<NBEdge*>::const_iterator i; 01235 for (i=outgoing->begin(); i!=outgoing->end(); i++) { 01236 int prio = (*i)->getJunctionPriority(myTo); 01237 assert((prio+1)*2>0); 01238 prio = (prio+1) * 2; 01239 priorities->push_back(prio); 01240 } 01241 // when the right turning direction has not a higher priority, divide 01242 // the importance by 2 due to the possibility to leave the junction 01243 // faster from this lane 01244 MainDirections mainDirections(*outgoing, this, myTo); 01245 std::vector<NBEdge*> tmp(*outgoing); 01246 sort(tmp.begin(), tmp.end(), NBContHelper::edge_similar_direction_sorter(this)); 01247 i=find(outgoing->begin(), outgoing->end(), *(tmp.begin())); 01248 unsigned int dist = (unsigned int) distance(outgoing->begin(), i); 01249 if (dist!=0&&!mainDirections.includes(MainDirections::DIR_RIGHTMOST)) { 01250 assert(priorities->size()>0); 01251 (*priorities)[0] = (*priorities)[0] / 2; 01252 } 01253 // HEURISTIC: 01254 // when no higher priority exists, let the forward direction be 01255 // the main direction 01256 if (mainDirections.empty()) { 01257 assert(dist<priorities->size()); 01258 (*priorities)[dist] = (*priorities)[dist] * 2; 01259 } 01260 if (mainDirections.includes(MainDirections::DIR_FORWARD)&&myLanes.size()>2) { 01261 (*priorities)[dist] = (*priorities)[dist] * 2; 01262 } 01263 // return 01264 return priorities; 01265 }
| bool NBEdge::recheckLanes | ( | ) |
recheck whether all lanes within the edge are all right and optimises the connections once again
Definition at line 1003 of file NBEdge.cpp.
References L2L_VALIDATED, LANES2LANES_DONE, LANES2LANES_USER, moveConnectionToLeft(), moveConnectionToRight(), myConnections, myLanes, myStep, and setConnection().
01003 { 01004 std::vector<unsigned int> connNumbersPerLane(myLanes.size(), 0); 01005 for (std::vector<Connection>::iterator i=myConnections.begin(); i!=myConnections.end();) { 01006 if ((*i).toEdge==0||(*i).fromLane<0||(*i).toLane<0) { 01007 i = myConnections.erase(i); 01008 } else { 01009 if ((*i).fromLane>=0) { 01010 ++connNumbersPerLane[(*i).fromLane]; 01011 } 01012 ++i; 01013 } 01014 } 01015 if (myStep!=LANES2LANES_DONE&&myStep!=LANES2LANES_USER) { 01016 // check #1: 01017 // If there is a lane with no connections and any neighbour lane has 01018 // more than one connections, try to move one of them. 01019 // This check is only done for edges which connections were assigned 01020 // using the standard algorithm. 01021 for (unsigned int i=0; i<myLanes.size(); i++) { 01022 if (connNumbersPerLane[i]==0) { 01023 if (i>0&&connNumbersPerLane[i-1]>1) { 01024 moveConnectionToLeft(i-1); 01025 } else if (i<myLanes.size()-1&&connNumbersPerLane[i+1]>1) { 01026 moveConnectionToRight(i+1); 01027 } 01028 } 01029 } 01030 } 01031 // check: 01032 // Go through all lanes and add an empty connection if no connection 01033 // is yet set. 01034 // This check must be done for all lanes to assert that there is at 01035 // least a dead end information (needed later for building the 01036 // node request 01037 for (unsigned int i=0; i<myLanes.size(); i++) { 01038 connNumbersPerLane[i] = 0; 01039 } 01040 for (std::vector<Connection>::iterator i=myConnections.begin(); i!=myConnections.end();) { 01041 if ((*i).toEdge==0||(*i).fromLane<0||(*i).toLane<0) { 01042 i = myConnections.erase(i); 01043 } else { 01044 if ((*i).fromLane>=0) { 01045 ++connNumbersPerLane[(*i).fromLane]; 01046 } 01047 ++i; 01048 } 01049 } 01050 for (unsigned int i=0; i<myLanes.size(); i++) { 01051 if (connNumbersPerLane[i]==0) { 01052 setConnection(i, 0, 0, L2L_VALIDATED, false); 01053 } 01054 } 01055 return true; 01056 }
| void NBEdge::reinit | ( | NBNode * | from, | |
| NBNode * | to, | |||
| std::string | type, | |||
| SUMOReal | speed, | |||
| unsigned int | nolanes, | |||
| int | priority, | |||
| Position2DVector | geom, | |||
| LaneSpreadFunction | spread = LANESPREAD_RIGHT | |||
| ) | throw (ProcessError) |
Resets initial values.
| [in] | position | The position of the node |
| [in] | type | The type of the node |
Definition at line 187 of file NBEdge.cpp.
References StringUtils::convertUmlaute(), init(), myFrom, myGeom, myLaneSpreadFunction, myLoadedLength, myPriority, mySpeed, myTo, myType, NBNode::removeIncoming(), and NBNode::removeOutgoing().
Referenced by NIXMLEdgesHandler::myStartElement().
00189 { 00190 if (myFrom!=from) { 00191 myFrom->removeOutgoing(this); 00192 } 00193 if (myTo!=to) { 00194 myTo->removeIncoming(this); 00195 } 00196 myType = StringUtils::convertUmlaute(type); 00197 myFrom = from; 00198 myTo = to; 00199 myPriority = priority; 00200 mySpeed = speed; 00201 //?myTurnDestination(0), 00202 //?myFromJunctionPriority(-1), myToJunctionPriority(-1), 00203 myGeom = geom; 00204 myLaneSpreadFunction = spread; 00205 myLoadedLength = -1; 00206 //?, myAmTurningWithAngle(0), myAmTurningOf(0), 00207 //?myAmInnerEdge(false), myAmMacroscopicConnector(false) 00208 init(nolanes, false); 00209 }
| void NBEdge::remapConnections | ( | const EdgeVector & | incoming | ) |
Remaps the connection in a way tha allows the removal of it This edges (which is a "dummy" edge, in fact) connections are spread over the incoming non-dummy edges.
Definition at line 1397 of file NBEdge.cpp.
References addEdge2EdgeConnection(), EDGE2EDGES, getConnectedEdges(), myStep, and removeFromConnections().
Referenced by NBNode::eraseDummies().
01397 { 01398 std::vector<NBEdge*> connected = getConnectedEdges(); 01399 for (EdgeVector::const_iterator i=incoming.begin(); i!=incoming.end(); i++) { 01400 NBEdge *inc = *i; 01401 // We have to do this 01402 inc->myStep = EDGE2EDGES; 01403 // add all connections 01404 for (EdgeVector::iterator j=connected.begin(); j!=connected.end(); j++) { 01405 inc->addEdge2EdgeConnection(*j); 01406 } 01407 inc->removeFromConnections(this); 01408 } 01409 }
| void NBEdge::removeFromConnections | ( | NBEdge * | which, | |
| int | lane = -1 | |||
| ) |
Definition at line 1413 of file NBEdge.cpp.
References NBEdge::Connection::fromLane, myConnections, myTurnDestination, and NBEdge::Connection::toEdge.
Referenced by decLaneNo(), NIXMLConnectionsHandler::myStartElement(), and remapConnections().
01413 { 01414 // remove from "myConnections" 01415 for (std::vector<Connection>::iterator i=myConnections.begin(); i!=myConnections.end();) { 01416 Connection &c = *i; 01417 if (c.toEdge==which && (lane<0 || c.fromLane==lane)) { 01418 i = myConnections.erase(i); 01419 } else { 01420 ++i; 01421 } 01422 } 01423 // check whether it was the turn destination 01424 if (myTurnDestination==which&&lane<0) { 01425 myTurnDestination = 0; 01426 } 01427 }
Definition at line 1342 of file NBEdge.cpp.
References myConnections, and myTurnDestination.
Referenced by NBNode::replaceOutgoing().
01342 { 01343 // replace in "_connectedEdges" 01344 for (std::vector<Connection>::iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01345 if ((*i).toEdge==which) { 01346 (*i).toEdge = by; 01347 } 01348 } 01349 // check whether it was the turn destination 01350 if (myTurnDestination==which) { 01351 myTurnDestination = by; 01352 } 01353 }
| void NBEdge::reshiftPosition | ( | SUMOReal | xoff, | |
| SUMOReal | yoff | |||
| ) | throw () |
Applies an offset to the edge.
| [in] | xoff | The x-offset to apply |
| [in] | yoff | The y-offset to apply |
Definition at line 364 of file NBEdge.cpp.
References myGeom, myLanes, and Position2DVector::reshiftRotate().
00364 { 00365 myGeom.reshiftRotate(xoff, yoff, 0); 00366 for (unsigned int i=0; i<myLanes.size(); i++) { 00367 myLanes[i].shape.reshiftRotate(xoff, yoff, 0); 00368 } 00369 }
| void NBEdge::setAsMacroscopicConnector | ( | ) | throw () [inline] |
Marks this edge as a macroscopic connector.
Definition at line 501 of file NBEdge.h.
References myAmMacroscopicConnector.
Referenced by NIImporter_VISUM::parse_Connectors().
00501 { 00502 myAmMacroscopicConnector = true; 00503 }
| void NBEdge::setConnection | ( | unsigned int | lane, | |
| NBEdge * | destEdge, | |||
| unsigned int | destLane, | |||
| Lane2LaneInfoType | type, | |||
| bool | mayUseSameDestination = false, |
|||
| bool | mayDefinitelyPass = false | |||
| ) | throw () |
Adds a connection to a certain lane of a certain edge.
| [in] | lane | The connection's starting lane (of this edge) |
| [in] | destEdge | The connection's destination edge |
| [in] | destLane | The connection's destination lane |
| [in] | type | The connections's type |
| [in] | mayUseSameDestination | Whether this connection may be set though connecting an already connected lane |
| [in] | mayDefinitelyPass | Whether this connection is definitely undistrubed (special case for on-ramps) |
Definition at line 434 of file NBEdge.cpp.
References MsgHandler::getErrorInstance(), hasConnectionTo(), MsgHandler::inform(), INIT_REJECT_CONNECTIONS, L2L_COMPUTED, L2L_USER, LANES2LANES_DONE, LANES2LANES_RECHECK, LANES2LANES_USER, myConnections, myID, myLanes, myStep, and toString().
Referenced by addLane2LaneConnection(), appendTurnaround(), NBNode::computeLanes2Lanes(), moveConnectionToLeft(), moveConnectionToRight(), and recheckLanes().
00437 { 00438 if (myStep==INIT_REJECT_CONNECTIONS) { 00439 return; 00440 } 00441 assert(destLane<=10); 00442 assert(lane<=10); 00443 // some kind of a misbehaviour which may occure when the junction's outgoing 00444 // edge priorities were not properly computed, what may happen due to 00445 // an incomplete or not proper input 00446 // what happens is that under some circumstances a single lane may set to 00447 // be approached more than once by the one of our lanes. 00448 // This must not be! 00449 // we test whether it is the case and do nothing if so - the connection 00450 // will be refused 00451 // 00452 if (!mayUseSameDestination && hasConnectionTo(destEdge, destLane)) { 00453 return; 00454 } 00455 if (find_if(myConnections.begin(), myConnections.end(), connections_finder(lane, destEdge, destLane))!=myConnections.end()) { 00456 return; 00457 } 00458 if (myLanes.size()<=lane) { 00459 MsgHandler::getErrorInstance()->inform("Could not set connection from '" + myID + "_" + toString(lane) + "' to '" + destEdge->getID() + "_" + toString(destLane) + "'."); 00460 return; 00461 } 00462 for (std::vector<Connection>::iterator i=myConnections.begin(); i!=myConnections.end();) { 00463 if ((*i).toEdge==destEdge && ((*i).fromLane==-1 || (*i).toLane==-1)) { 00464 i = myConnections.erase(i); 00465 } else { 00466 ++i; 00467 } 00468 } 00469 myConnections.push_back(Connection(lane, destEdge, destLane)); 00470 if (mayDefinitelyPass) { 00471 myConnections.back().mayDefinitelyPass = true; 00472 } 00473 if (type==L2L_USER) { 00474 myStep = LANES2LANES_USER; 00475 } else { 00476 // check whether we have to take another look at it later 00477 if (type==L2L_COMPUTED) { 00478 // yes, the connection was set using an algorithm which requires a recheck 00479 myStep = LANES2LANES_RECHECK; 00480 } else { 00481 // ok, let's only not recheck it if we did no add something that has to be recheked 00482 if (myStep!=LANES2LANES_RECHECK) { 00483 myStep = LANES2LANES_DONE; 00484 } 00485 } 00486 } 00487 }
| bool NBEdge::setControllingTLInformation | ( | int | fromLane, | |
| NBEdge * | toEdge, | |||
| int | toLane, | |||
| const std::string & | tlID, | |||
| unsigned int | tlPos | |||
| ) |
Returns if the link could be set as to be controlled.
Definition at line 1504 of file NBEdge.cpp.
References NBEdge::TLSDisabledConnection::fromLane, getID(), myConnections, myLanes, myTLSDisabledConnections, NBEdge::Connection::tlID, NBEdge::Connection::tlLinkNo, NBEdge::TLSDisabledConnection::to, NBEdge::TLSDisabledConnection::toLane, and WRITE_WARNING.
Referenced by NBTrafficLightDefinition::collectLinks(), NBOwnTLDef::setTLControllingInformation(), and NBLoadedTLDef::setTLControllingInformation().
01505 { 01506 // check whether the connection was not set as not to be controled previously 01507 TLSDisabledConnection tpl; 01508 tpl.fromLane = fromLane; 01509 tpl.to = toEdge; 01510 tpl.toLane = toLane; 01511 std::vector<TLSDisabledConnection>::iterator i = find_if(myTLSDisabledConnections.begin(), myTLSDisabledConnections.end(), tls_disable_finder(tpl)); 01512 if (i!=myTLSDisabledConnections.end()) { 01513 return false; 01514 } 01515 01516 assert(fromLane<0||fromLane<(int) myLanes.size()); 01517 // try to use information about the connections if given 01518 if (fromLane>=0&&toLane>=0) { 01519 // find the specified connection 01520 std::vector<Connection>::iterator i = 01521 find_if(myConnections.begin(), myConnections.end(), connections_finder(fromLane, toEdge, toLane)); 01522 // ok, we have to test this as on the removal of dummy edges some connections 01523 // will be reassigned 01524 if (i!=myConnections.end()) { 01525 // get the connection 01526 Connection &connection = *i; 01527 // set the information about the tl 01528 connection.tlID = tlID; 01529 connection.tlLinkNo = tlPos; 01530 return true; 01531 } 01532 } 01533 // if the original connection was not found, set the information for all 01534 // connections 01535 unsigned int no = 0; 01536 bool hadError = false; 01537 for (std::vector<Connection>::iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 01538 if ((*i).toEdge!=toEdge) { 01539 continue; 01540 } 01541 if (fromLane>=0&&fromLane!=(*i).fromLane) { 01542 continue; 01543 } 01544 if (toLane>=0&&toLane!=(*i).toLane) { 01545 continue; 01546 } 01547 if ((*i).tlID=="") { 01548 (*i).tlID = tlID; 01549 (*i).tlLinkNo = tlPos; 01550 no++; 01551 } else { 01552 if ((*i).tlID!=tlID&&(*i).tlLinkNo==tlPos) { 01553 WRITE_WARNING("The lane " + toString<int>((*i).fromLane)+ " on edge " + getID()+ " already had a traffic light signal."); 01554 hadError = true; 01555 } 01556 } 01557 } 01558 if (hadError&&no==0) { 01559 WRITE_WARNING("Could not set any signal of the traffic light '" + tlID + "' (unknown group)"); 01560 } 01561 return true; 01562 }
| void NBEdge::setGeometry | ( | const Position2DVector & | g | ) | throw () |
(Re)sets the edge's geometry
Replaces the edge's prior geometry by the given. Then, computes the geometries of all lanes using computeLaneShapes. Definitely not the best way to have it accessable from outside...
| [in] | g | The edge's new geometry |
Definition at line 266 of file NBEdge.cpp.
References computeLaneShapes(), and myGeom.
Referenced by NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), and NBNodeCont::guessRamps().
00266 { 00267 myGeom = s; 00268 computeLaneShapes(); 00269 }
| void NBEdge::setIsInnerEdge | ( | ) | throw () [inline] |
Marks this edge being within an intersection.
Definition at line 516 of file NBEdge.h.
References myAmInnerEdge.
00516 { 00517 myAmInnerEdge = true; 00518 }
| void NBEdge::setJunctionPriority | ( | const NBNode *const | node, | |
| int | prio | |||
| ) |
Sets the junction priority of the edge.
| [in] | node | The node for which the edge's priority is given |
| [in] | prio | The edge's new priority at this node |
Definition at line 520 of file NBEdge.cpp.
References myFrom, myFromJunctionPriority, and myToJunctionPriority.
Referenced by NBNode::extractAndMarkFirst(), NBEdgeCont::guessRoundabouts(), and NBNode::setPriorityJunctionPriorities().
00520 { 00521 if (node==myFrom) { 00522 myFromJunctionPriority = prio; 00523 } else { 00524 myToJunctionPriority = prio; 00525 } 00526 }
| void NBEdge::setLaneSpeed | ( | unsigned int | lane, | |
| SUMOReal | speed | |||
| ) |
Definition at line 716 of file NBEdge.cpp.
References myLanes.
Referenced by NIVissimEdge::buildNBEdge(), and NBEdgeCont::splitAt().
00716 { 00717 myLanes[lane].speed = speed; 00718 }
| void NBEdge::setLaneSpreadFunction | ( | LaneSpreadFunction | spread | ) | throw () |
(Re)sets how the lanes lateral offset shall be computed
| [in] | spread | The type of lateral offset to apply |
Definition at line 352 of file NBEdge.cpp.
References myLaneSpreadFunction.
Referenced by NIImporter_VISUM::parse_Edges().
00352 { 00353 myLaneSpreadFunction = spread; 00354 }
| void NBEdge::setLeftHanded | ( | ) | throw () [inline] |
Marks this edge to be left-handed.
Definition at line 228 of file NBEdge.h.
References myAmLeftHand.
00228 { 00229 myAmLeftHand = true; 00230 }
| void NBEdge::setLoadedLength | ( | SUMOReal | val | ) |
Definition at line 1959 of file NBEdge.cpp.
References myLoadedLength.
Referenced by NIXMLEdgesHandler::myStartElement().
01959 { 01960 myLoadedLength = val; 01961 }
| void NBEdge::setTurningDestination | ( | NBEdge * | e | ) |
Definition at line 560 of file NBEdge.cpp.
References acceptBeingTurning(), getAngle(), myTurnDestination, NBHelpers::relAngle(), and SUMOReal.
Referenced by computeTurningDirections(), and NIImporter_VISUM::parse_Turns().
00560 { 00561 SUMOReal cur = fabs(NBHelpers::relAngle(getAngle(), e->getAngle())); 00562 SUMOReal old = 00563 myTurnDestination==0 00564 ? 0 00565 : fabs(NBHelpers::relAngle(getAngle(), myTurnDestination->getAngle())); 00566 if (cur>old 00567 && 00568 e->acceptBeingTurning(this)) { 00569 00570 myTurnDestination = e; 00571 } 00572 }
| void NBEdge::setVehicleClasses | ( | const std::vector< SUMOVehicleClass > & | allowed, | |
| const std::vector< SUMOVehicleClass > & | disallowed, | |||
| int | lane = -1 | |||
| ) |
Definition at line 1907 of file NBEdge.cpp.
References allowVehicleClass(), and disallowVehicleClass().
Referenced by NIImporter_OpenStreetMap::insertEdge().
01907 { 01908 for (std::vector<SUMOVehicleClass>::const_iterator i=allowed.begin(); i!=allowed.end(); ++i) { 01909 allowVehicleClass(lane, *i); 01910 } 01911 for (std::vector<SUMOVehicleClass>::const_iterator i=disallowed.begin(); i!=disallowed.end(); ++i) { 01912 disallowVehicleClass(lane, *i); 01913 } 01914 }
| void NBEdge::sortOutgoingLanesConnections | ( | ) |
sorts the connections of outgoing lanes (!!! Kaskade beschreiben)
Definition at line 1294 of file NBEdge.cpp.
References myConnections, and myTo.
01294 { 01295 sort(myConnections.begin(), myConnections.end(), connections_relative_edgelane_sorter(this, myTo)); 01296 }
| bool NBEdge::splitGeometry | ( | NBEdgeCont & | ec, | |
| NBNodeCont & | nc | |||
| ) | [private] |
Definition at line 1809 of file NBEdge.cpp.
References NBNode::addIncomingEdge(), Position2DVector::clear(), NBNode::getPosition(), INIT, NBEdgeCont::insert(), NBNodeCont::insert(), myFrom, myGeom, myID, myLanes, myLaneSpreadFunction, myPriority, mySpeed, myStep, myTo, myType, NBEdge(), Position2DVector::push_back(), NBNode::removeIncoming(), NBNodeCont::retrieve(), Position2DVector::size(), and toString().
01809 { 01810 // check whether there any splits to perform 01811 if (myGeom.size()<3) { 01812 return false; 01813 } 01814 // ok, split 01815 NBNode *newFrom = myFrom; 01816 NBNode *myLastNode = myTo; 01817 NBNode *newTo = 0; 01818 NBEdge *currentEdge = this; 01819 for (int i=1; i<(int) myGeom.size()-1; i++) { 01820 // build the node first 01821 if (i!=myGeom.size()-2) { 01822 std::string nodename = myID + "_in_between#" + toString(i); 01823 if (!nc.insert(nodename, myGeom[i])) { 01824 throw ProcessError("Error on adding in-between node '" + nodename + "'."); 01825 } 01826 newTo = nc.retrieve(nodename); 01827 } else { 01828 newTo = myLastNode; 01829 } 01830 if (i==1) { 01831 currentEdge->myTo->removeIncoming(this); 01832 currentEdge->myTo = newTo; 01833 newTo->addIncomingEdge(currentEdge); 01834 } else { 01835 std::string edgename = myID + "[" + toString(i-1) + "]"; 01836 currentEdge = new NBEdge(edgename, newFrom, newTo, myType, mySpeed, (unsigned int) myLanes.size(), 01837 myPriority, myLaneSpreadFunction); 01838 if (!ec.insert(currentEdge, true)) { 01839 throw ProcessError("Error on adding splitted edge '" + edgename + "'."); 01840 } 01841 } 01842 newFrom = newTo; 01843 } 01844 myGeom.clear(); 01845 myGeom.push_back(myFrom->getPosition()); 01846 myGeom.push_back(myTo->getPosition()); 01847 myStep = INIT; 01848 return true; 01849 }
| NBNode * NBEdge::tryGetNodeAtPosition | ( | SUMOReal | pos, | |
| SUMOReal | tolerance = 5.0 | |||
| ) | const |
Returns the node at the given edges length (using an epsilon) When no node is existing at the given position, 0 is returned The epsilon is a static member of NBEdge, should be setable via program options.
Definition at line 1328 of file NBEdge.cpp.
References myFrom, myLength, and myTo.
01328 { 01329 // return the from-node when the position is at the begin of the edge 01330 if (pos<tolerance) { 01331 return myFrom; 01332 } 01333 // return the to-node when the position is at the end of the edge 01334 if (pos>myLength-tolerance) { 01335 return myTo; 01336 } 01337 return 0; 01338 }
| SUMOReal NBEdge::width | ( | ) | const |
Definition at line 1606 of file NBEdge.cpp.
References myLanes, SUMO_const_laneOffset, SUMO_const_laneWidth, and SUMOReal.
01606 { 01607 return (SUMOReal) myLanes.size() * SUMO_const_laneWidth + (SUMOReal)(myLanes.size()-1) * SUMO_const_laneOffset; 01608 }
| void NBEdge::writeLane | ( | OutputDevice & | into, | |
| NBEdge::Lane & | lane, | |||
| unsigned int | index | |||
| ) | const [private] |
writes information about the described lane into the given stream
Definition at line 649 of file NBEdge.cpp.
References NBEdge::Lane::allowed, getVehicleClassName(), myID, myLength, myLoadedLength, NBEdge::Lane::notAllowed, NBEdge::Lane::preferred, NBEdge::Lane::shape, NBEdge::Lane::speed, SUMOReal, toString(), and WRITE_WARNING.
Referenced by writeXMLStep1().
00649 { 00650 // output the lane's attributes 00651 into << " <lane id=\"" << myID << '_' << index << "\""; 00652 // the first lane of an edge will be the depart lane 00653 if (index==0) { 00654 into << " depart=\"1\""; 00655 } else { 00656 into << " depart=\"0\""; 00657 } 00658 // write the list of allowed/disallowed vehicle classes 00659 std::vector<SUMOVehicleClass>::const_iterator i; 00660 bool hadOne = false; 00661 if (lane.allowed.size() > 0) { 00662 into << " allow=\""; 00663 for (i=lane.allowed.begin(); i!=lane.allowed.end(); ++i) { 00664 if (hadOne) { 00665 into << ' '; 00666 } 00667 into << getVehicleClassName(*i); 00668 hadOne = true; 00669 } 00670 into << '\"'; 00671 } 00672 if (lane.notAllowed.size() > 0) { 00673 hadOne = false; 00674 into << " disallow=\""; 00675 for (i=lane.notAllowed.begin(); i!=lane.notAllowed.end(); ++i) { 00676 if (hadOne) { 00677 into << ' '; 00678 } 00679 into << getVehicleClassName(*i); 00680 hadOne = true; 00681 } 00682 into << '\"'; 00683 } 00684 if (lane.preferred.size() > 0) { 00685 hadOne = false; 00686 into << "\" prefer=\""; 00687 for (i=lane.preferred.begin(); i!=lane.preferred.end(); ++i) { 00688 if (hadOne) { 00689 into << ' '; 00690 } 00691 into << getVehicleClassName(*i); 00692 hadOne = true; 00693 } 00694 into << '\"'; 00695 } 00696 // some further information 00697 if (lane.speed==0) { 00698 WRITE_WARNING("Lane #" + toString(index) + " of edge '" + myID + "' has a maximum velocity of 0."); 00699 } else if (lane.speed<0) { 00700 throw ProcessError("Negative velocity (" + toString(lane.speed) + " on edge '" + myID + "' lane#" + toString(index) + "."); 00701 00702 } 00703 SUMOReal length = myLength; 00704 if (myLoadedLength>0) { 00705 length = myLoadedLength; 00706 } 00707 if (length<=0) { 00708 length = (SUMOReal) .1; 00709 } 00710 into << " maxspeed=\"" << lane.speed << "\" length=\"" << length << "\""; 00711 into << " shape=\"" << lane.shape << "\"/>\n"; 00712 }
| void NBEdge::writeLanesPlain | ( | OutputDevice & | into | ) |
Definition at line 924 of file NBEdge.cpp.
References NBEdge::Lane::allowed, getVehicleClassName(), myLanes, and NBEdge::Lane::notAllowed.
Referenced by NBEdgeCont::savePlain().
00924 { 00925 for (unsigned int i=0; i<myLanes.size(); ++i) { 00926 into << " <lane id=\"" << i << "\""; 00927 const Lane &lane = myLanes[i]; 00928 // write allowed lanes 00929 if (lane.allowed.size()!=0) { 00930 bool hadOne = false; 00931 into << " allow=\""; 00932 std::vector<SUMOVehicleClass>::const_iterator i; 00933 for (i=lane.allowed.begin(); i!=lane.allowed.end(); ++i) { 00934 if (hadOne) { 00935 into << ' '; 00936 } 00937 into << getVehicleClassName(*i); 00938 hadOne = true; 00939 } 00940 into << "\""; 00941 } 00942 if (lane.notAllowed.size()!=0) { 00943 bool hadOne = false; 00944 into << " disallow=\""; 00945 std::vector<SUMOVehicleClass>::const_iterator i; 00946 for (i=lane.notAllowed.begin(); i!=lane.notAllowed.end(); ++i) { 00947 if (hadOne) { 00948 into << ' '; 00949 } 00950 into << getVehicleClassName(*i); 00951 hadOne = true; 00952 } 00953 into << "\""; 00954 } 00955 into << "/>\n"; 00956 } 00957 }
| void NBEdge::writeSingleSucceeding | ( | OutputDevice & | into, | |
| const NBEdge::Connection & | c, | |||
| bool | includeInternal | |||
| ) | [private] |
Definition at line 841 of file NBEdge.cpp.
References NBEdge::Connection::fromLane, NBNode::getCrossingPosition(), getID(), NBNode::getInternalLaneID(), NBNode::getMMLDirection(), NBEdge::Connection::mayDefinitelyPass, MMLDIR_LEFT, MMLDIR_PARTLEFT, MMLDIR_PARTRIGHT, MMLDIR_RIGHT, MMLDIR_STRAIGHT, MMLDIR_TURN, NBNode::mustBrake(), myAmInnerEdge, myTo, NBNode::stateCode(), NBEdge::Connection::tlID, NBEdge::Connection::tlLinkNo, NBEdge::Connection::toEdge, and NBEdge::Connection::toLane.
Referenced by writeSucceeding().
00841 { 00842 // check whether the connected lane is invalid 00843 // (should not happen; this is an artefact left from previous versions) 00844 if (c.toEdge==0) { 00845 into << " <succlane lane=\"SUMO_NO_DESTINATION\""; // !!! check dummy values 00846 if (c.tlID!="") { 00847 into << " tl=\"" << c.tlID << "\""; 00848 into << " linkno=\"" << c.tlLinkNo << "\""; 00849 } 00850 into << " yield=\"1\" " << "dir=\"s\" state=\"O\"/>\n"; // !!! check dummy values 00851 return; 00852 } 00853 // write the id 00854 into << " <succlane lane=\"" << c.toEdge->getID() << '_' << c.toLane << '\"'; // !!! classe LaneEdge mit getLaneID 00855 if (includeInternal) { 00856 into << " via=\"" << myTo->getInternalLaneID(this, c.fromLane, c.toEdge, c.toLane) << "_0\""; 00857 } 00858 // set information about the controlling tl if any 00859 if (c.tlID!="") { 00860 into << " tl=\"" << c.tlID << "\""; 00861 into << " linkno=\"" << c.tlLinkNo << "\""; 00862 } 00863 // write information whether the connection yields 00864 if ((myAmInnerEdge||!myTo->mustBrake(this, c.toEdge, c.toLane)) || c.mayDefinitelyPass) { 00865 into << " yield=\"0\""; 00866 } else { 00867 into << " yield=\"1\""; 00868 } 00869 // write the direction information 00870 NBMMLDirection dir = myTo->getMMLDirection(this, c.toEdge); 00871 into << " dir=\""; 00872 switch (dir) { 00873 case MMLDIR_STRAIGHT: 00874 into << "s"; 00875 break; 00876 case MMLDIR_LEFT: 00877 into << "l"; 00878 break; 00879 case MMLDIR_RIGHT: 00880 into << "r"; 00881 break; 00882 case MMLDIR_TURN: 00883 into << "t"; 00884 break; 00885 case MMLDIR_PARTLEFT: 00886 into << "L"; 00887 break; 00888 case MMLDIR_PARTRIGHT: 00889 into << "R"; 00890 break; 00891 default: 00892 // should not happen 00893 assert(false); 00894 break; 00895 } 00896 into << "\" "; 00897 // write the state information 00898 if (c.tlID!="") { 00899 into << "state=\"t"; 00900 } else { 00901 into << "state=\"" << myTo->stateCode(this, c.toEdge, c.toLane, c.mayDefinitelyPass); 00902 } 00903 if (myTo->getCrossingPosition(this, c.fromLane, c.toEdge, c.toLane).first>=0) { 00904 into << "\" int_end=\"x"; 00905 } 00906 00907 // close 00908 into << "\"/>\n"; 00909 }
| void NBEdge::writeSucceeding | ( | OutputDevice & | into, | |
| unsigned int | lane, | |||
| bool | includeInternal | |||
| ) | [private] |
Definition at line 822 of file NBEdge.cpp.
References NBNode::getID(), myConnections, myID, myTo, and writeSingleSucceeding().
Referenced by writeXMLStep2().
00822 { 00823 into << " <succ edge=\"" << myID << "\" lane=\"" << myID << "_" << lane << "\" junction=\"" << myTo->getID() << "\">\n"; 00824 // output list of connected lanes 00825 unsigned int count = 0; 00826 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 00827 if ((*i).fromLane==lane) { 00828 writeSingleSucceeding(into, *i, includeInternal); 00829 ++count; 00830 } 00831 } 00832 // the lane may be unconnented; output information about being invalid 00833 if (count==0) { 00834 into << " <succlane lane=\"SUMO_NO_DESTINATION\" yield=\"1\"/>\n"; 00835 } 00836 into << " </succ>\n\n"; 00837 }
| void NBEdge::writeXMLStep1 | ( | OutputDevice & | into | ) |
writes the edge definition with lanes and connected edges into the given stream
Definition at line 598 of file NBEdge.cpp.
References getConnectedSorted(), NBNode::getID(), getTurnDestination(), isMacroscopicConnector(), myAmInnerEdge, myConnections, myFrom, myID, myLanes, myPriority, myTo, myType, and writeLane().
00598 { 00599 // write the edge's begin 00600 into << " <edge id=\"" << myID << 00601 "\" from=\"" << myFrom->getID() << 00602 "\" to=\"" << myTo->getID() << 00603 "\" priority=\"" << myPriority << 00604 "\" type=\"" << myType; 00605 if (isMacroscopicConnector()) { 00606 into << "\" function=\"connector"; 00607 } else { 00608 into << "\" function=\"normal"; 00609 } 00610 if (myAmInnerEdge) { 00611 into << "\" inner=\"x"; 00612 } 00613 into << "\">\n"; 00614 // write the lanes 00615 into << " <lanes>\n"; 00616 for (unsigned int i=0; i<(unsigned int) myLanes.size(); i++) { 00617 writeLane(into, myLanes[i], i); 00618 } 00619 into << " </lanes>\n"; 00620 // write the list of connected edges 00621 const std::vector<NBEdge*> *tmp = getConnectedSorted(); 00622 std::vector<NBEdge*> sortedConnected = *tmp; 00623 if (getTurnDestination()!=0) { 00624 sortedConnected.push_back(getTurnDestination()); 00625 } 00626 delete tmp; 00627 for (std::vector<NBEdge*>::iterator l=sortedConnected.begin(); l!=sortedConnected.end(); l++) { 00628 LaneVector lanes; 00629 for (std::vector<Connection>::const_iterator i=myConnections.begin(); i!=myConnections.end(); ++i) { 00630 if ((*i).toEdge==*l && find(lanes.begin(), lanes.end(), (*i).fromLane)==lanes.end()) { 00631 lanes.push_back((*i).fromLane); 00632 } 00633 } 00634 } 00635 // close the edge 00636 into << " </edge>\n\n"; 00637 }
| void NBEdge::writeXMLStep2 | ( | OutputDevice & | into, | |
| bool | includeInternal | |||
| ) |
writes the succeeding lane information
Definition at line 641 of file NBEdge.cpp.
References myLanes, and writeSucceeding().
00641 { 00642 for (unsigned int i=0; i<myLanes.size(); i++) { 00643 writeSucceeding(into, i, includeInternal); 00644 } 00645 }
friend class NBEdgeCont [friend] |
friend class NBEdgeSuccessorBuilder [friend] |
bool NBEdge::myAmInnerEdge [private] |
Information whether this is a junction-inner edge.
Definition at line 931 of file NBEdge.h.
Referenced by isInnerEdge(), setIsInnerEdge(), writeSingleSucceeding(), and writeXMLStep1().
bool NBEdge::myAmLeftHand [private] |
Whether this edge is a left-hand edge.
Definition at line 918 of file NBEdge.h.
Referenced by divideOnEdges(), getCCWBoundaryLine(), getCWBoundaryLine(), laneOffset(), moveConnectionToLeft(), moveConnectionToRight(), and setLeftHanded().
bool NBEdge::myAmMacroscopicConnector [private] |
Information whether this edge is a (macroscopic) connector.
Definition at line 934 of file NBEdge.h.
Referenced by isMacroscopicConnector(), and setAsMacroscopicConnector().
NBEdge* NBEdge::myAmTurningOf [private] |
Was assigned as a turning edge of this one.
Definition at line 927 of file NBEdge.h.
Referenced by acceptBeingTurning().
SUMOReal NBEdge::myAmTurningWithAngle [private] |
Was assigned as a turn with this angle.
Definition at line 925 of file NBEdge.h.
Referenced by acceptBeingTurning().
SUMOReal NBEdge::myAngle [private] |
The angle of the edge.
Definition at line 881 of file NBEdge.h.
Referenced by getAngle(), getNormedAngle(), and init().
std::vector<Connection> NBEdge::myConnections [private] |
List of connections to following edges.
Definition at line 892 of file NBEdge.h.
Referenced by addEdge2EdgeConnection(), append(), computeEdge2Edges(), computeLanes2Edges(), computeTurningDirections(), copyConnectionsFrom(), divideOnEdges(), expandableBy(), getConnectedEdges(), getConnectedSorted(), getConnectionLanes(), getConnections(), getConnectionsFromLane(), getMaxConnectedLane(), getMinConnectedLane(), hasConnectionTo(), hasSignalisedConnectionTo(), invalidateConnections(), isConnectedTo(), moveConnectionToLeft(), moveConnectionToRight(), recheckLanes(), removeFromConnections(), replaceInConnections(), setConnection(), setControllingTLInformation(), sortOutgoingLanesConnections(), writeSucceeding(), and writeXMLStep1().
NBNode* NBEdge::myFrom [private] |
The source and the destination node.
Definition at line 875 of file NBEdge.h.
Referenced by computeEdgeShape(), computeLaneShapes(), decLaneNo(), getAngle(), getCCWBoundaryLine(), getCWBoundaryLine(), getFromNode(), getJunctionPriority(), getMaxLaneOffsetPositionAt(), getMinLaneOffsetPositionAt(), incLaneNo(), init(), isTurningDirectionAt(), reinit(), NBEdgeCont::retrievePossiblySplitted(), setJunctionPriority(), splitGeometry(), tryGetNodeAtPosition(), and writeXMLStep1().
int NBEdge::myFromJunctionPriority [private] |
The priority normalised for the node the edge is outgoing of.
Definition at line 898 of file NBEdge.h.
Referenced by getJunctionPriority(), and setJunctionPriority().
Position2DVector NBEdge::myGeom [private] |
The geometry for the edge.
Definition at line 904 of file NBEdge.h.
Referenced by addGeometryPoint(), append(), computeLaneShape(), computeLaneShapes(), getAngle(), getGeometry(), init(), isNearEnough2BeJoined2(), reinit(), reshiftPosition(), setGeometry(), and splitGeometry().
std::string NBEdge::myID [private] |
The id of the edge.
Definition at line 869 of file NBEdge.h.
Referenced by getID(), getLaneID(), init(), setConnection(), splitGeometry(), writeLane(), writeSucceeding(), and writeXMLStep1().
std::vector<Lane> NBEdge::myLanes [private] |
Lane information.
Definition at line 912 of file NBEdge.h.
Referenced by allowVehicleClass(), append(), appendTurnaround(), computeEdgeShape(), computeLaneShape(), computeLaneShapes(), decLaneNo(), disallowVehicleClass(), dismissVehicleClassInformation(), divideOnEdges(), expandableBy(), getAllowedVehicleClasses(), getCCWBoundaryLine(), getCWBoundaryLine(), getLaneID(), getLaneShape(), getLaneSpeed(), getMaxLaneOffset(), getMaxLaneOffsetPositionAt(), getMinLaneOffsetPositionAt(), getNoLanes(), hasRestrictions(), incLaneNo(), init(), laneOffset(), preferVehicleClass(), preparePriorities(), recheckLanes(), reshiftPosition(), setConnection(), setControllingTLInformation(), setLaneSpeed(), splitGeometry(), width(), writeLanesPlain(), writeXMLStep1(), and writeXMLStep2().
The information about how to spread the lanes.
Definition at line 907 of file NBEdge.h.
Referenced by getLaneSpreadFunction(), laneOffset(), reinit(), setLaneSpreadFunction(), and splitGeometry().
SUMOReal NBEdge::myLength [private] |
The length of the edge.
Definition at line 878 of file NBEdge.h.
Referenced by append(), computeEdgeShape(), getLength(), init(), tryGetNodeAtPosition(), and writeLane().
SUMOReal NBEdge::myLoadedLength [private] |
An optional length to use (-1 if not valid).
Definition at line 915 of file NBEdge.h.
Referenced by reinit(), setLoadedLength(), and writeLane().
int NBEdge::myPriority [private] |
The priority of the edge.
Definition at line 884 of file NBEdge.h.
Referenced by getPriority(), reinit(), splitGeometry(), and writeXMLStep1().
SUMOReal NBEdge::mySpeed [private] |
The maximal speed.
Definition at line 887 of file NBEdge.h.
Referenced by expandableBy(), getSpeed(), incLaneNo(), init(), reinit(), and splitGeometry().
EdgeBuildingStep NBEdge::myStep [private] |
The building step.
Definition at line 866 of file NBEdge.h.
Referenced by addEdge2EdgeConnection(), addLane2LaneConnection(), append(), computeEdge2Edges(), computeLanes2Edges(), copyConnectionsFrom(), expandableBy(), getStep(), invalidateConnections(), lanesWereAssigned(), markAsInLane2LaneState(), recheckLanes(), remapConnections(), setConnection(), and splitGeometry().
std::vector<TLSDisabledConnection> NBEdge::myTLSDisabledConnections [private] |
Definition at line 942 of file NBEdge.h.
Referenced by disableConnection4TLS(), mayBeTLSControlled(), and setControllingTLInformation().
NBNode * NBEdge::myTo [private] |
Definition at line 875 of file NBEdge.h.
Referenced by addEdge2EdgeConnection(), addLane2LaneConnection(), append(), appendTurnaround(), computeEdge2Edges(), computeEdgeShape(), computeLaneShapes(), computeTurningDirections(), decLaneNo(), getAngle(), getConnectedSorted(), getToNode(), init(), isTurningDirectionAt(), markAsInLane2LaneState(), preparePriorities(), reinit(), NBEdgeCont::retrievePossiblySplitted(), sortOutgoingLanesConnections(), splitGeometry(), tryGetNodeAtPosition(), writeSingleSucceeding(), writeSucceeding(), and writeXMLStep1().
int NBEdge::myToJunctionPriority [private] |
The priority normalised for the node the edge is incoming in.
Definition at line 901 of file NBEdge.h.
Referenced by getJunctionPriority(), and setJunctionPriority().
NBEdge* NBEdge::myTurnDestination [private] |
The turn destination edge.
Definition at line 895 of file NBEdge.h.
Referenced by append(), appendTurnaround(), computeTurningDirections(), getConnectedSorted(), getConnectionLanes(), getTurnDestination(), invalidateConnections(), isConnectedTo(), isTurningDirectionAt(), removeFromConnections(), replaceInConnections(), and setTurningDestination().
std::string NBEdge::myType [private] |
The type of the edge.
Definition at line 872 of file NBEdge.h.
Referenced by getTypeID(), reinit(), splitGeometry(), and writeXMLStep1().
1.5.6