NBEdgeCont Class Reference

#include <NBEdgeCont.h>


Detailed Description

Storage for edges, including some functionality operating on multiple edges.

Definition at line 63 of file NBEdgeCont.h.


Public Member Functions

void applyOptions (OptionsCont &oc)
 Initialises the storage by applying given options.
void clear () throw ()
 Deletes all edges.
void guessRoundabouts (std::vector< std::set< NBEdge * > > &marked) throw ()
 Determines which edges belong to roundabouts and increases their priority.
bool isLeftHanded () const throw ()
 Returns whether the built edges are left-handed.
 NBEdgeCont (NBNetBuilder &tc) throw ()
 Constructor.
 ~NBEdgeCont () throw ()
 Destructor.
processing methods
void appendTurnarounds (bool noTLSControlled) throw ()
 Appends turnarounds to all edges stored in the container.
void computeEdge2Edges () throw ()
 Computes for each edge the approached edges.
void computeEdgeShapes () throw ()
 Computes the shapes of all edges stored in the container.
void computeLanes2Edges () throw ()
 Computes for each edge which lanes approach the next edges.
void computeTurningDirections () throw ()
 Computes the turn-around directions for all edges.
void joinSameNodeConnectingEdges (NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, EdgeVector edges) throw ()
 Joins the given edges because they connect the same nodes.
void recheckLanes () throw ()
 Rechecks whether all lanes have a successor for each of the stored edges.
void recheckLaneSpread () throw ()
 Rechecks whether the lane spread is proper.
void recomputeLaneShapes () throw ()
 Computes the shapes of all lanes of all edges stored in the container.
void removeUnwishedEdges (NBDistrictCont &dc) throw ()
 Removes unwished edges (not in keep-edges).
void reshiftEdgePositions (SUMOReal xoff, SUMOReal yoff) throw ()
 Translates and rotates the geometries of all known edges by the given values.
void sortOutgoingLanesConnections () throw ()
 Sorts all lanes of all edges within the container by their direction.
void splitGeometry (NBNodeCont &nc) throw ()
 Splits edges into multiple if they have a complex geometry.
edge access methods
void erase (NBDistrictCont &dc, NBEdge *edge) throw ()
 Removes the given edge from the container (deleting it).
bool insert (NBEdge *edge, bool ignorePrunning=false) throw ()
 Adds an edge to the dictionary.
NBEdgeretrieve (const std::string &id) const throw ()
 Returns the edge that has the given id.
NBEdgeretrievePossiblySplitted (const std::string &id, SUMOReal pos) const throw ()
 Tries to retrieve an edge, even if it is splitted.
NBEdgeretrievePossiblySplitted (const std::string &id, const std::string &hint, bool incoming) const throw ()
 Tries to retrieve an edge, even if it is splitted.
container access methods
std::vector< std::string > getAllNames () const throw ()
 Returns all ids of known edges.
unsigned int getNoEdgeSplits () const throw ()
 Returns the number of edge splits.
unsigned int size () const throw ()
 Returns the number of edges.
output methods
void savePlain (const std::string &efile, const std::string &cfile) throw (IOError)
 Writes the stored edges and their connections to an XML-edge-file and an XML-connections-file, respectively.
void writeXMLStep1 (OutputDevice &into) throw (IOError)
 Writes the edge definitions with lanes into the given stream.
void writeXMLStep2 (OutputDevice &into, bool includeInternal) throw (IOError)
 Writes the successor definitions of edges into the given stream.
explicite edge manipulation methods
bool splitAt (NBDistrictCont &dc, NBEdge *edge, SUMOReal edgepos, NBNode *node, const std::string &firstEdgeName, const std::string &secondEdgeName, unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge) throw (ProcessError)
 Splits the edge at the position nearest to the given node using the given modifications.
bool splitAt (NBDistrictCont &dc, NBEdge *edge, NBNode *node, const std::string &firstEdgeName, const std::string &secondEdgeName, unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge) throw (ProcessError)
 Splits the edge at the position nearest to the given node using the given modifications.
bool splitAt (NBDistrictCont &dc, NBEdge *edge, NBNode *node) throw (ProcessError)
 Splits the edge at the position nearest to the given node.

Private Types

typedef std::map< std::string,
NBEdge * > 
EdgeCont
 The type of the dictionary where an edge may be found by her id.

Private Member Functions

EdgeVector getGeneratedFrom (const std::string &id) const throw ()
 Returns the edges which have been built by splitting the edge of the given id.
 NBEdgeCont (const NBEdgeCont &s)
 invalidated copy constructor
NBEdgeContoperator= (const NBEdgeCont &s)
 invalidated assignment operator

Private Attributes

bool myAmLeftHanded
 Whether the network is left-handed.
EdgeCont myEdges
 The instance of the dictionary (id->edge).
unsigned int myEdgesSplit
 the number of splits of edges during the building
NBNetBuildermyNetBuilder
 The network builder; used to obtain type information.
Settings for accepting/dismissing edges
std::vector< std::string > myEdges2Keep
 Vector of ids of edges which shall explicitely be kept.
std::vector< std::string > myEdges2Remove
 Vector of ids of edges which shall explicitely be removed.
SUMOReal myEdgesMinSpeed
 The minimum speed an edge may have in order to be kept (default: -1).
Position2DVector myPrunningBoundary
 Boundary within which an edge must be located in order to be kept.
bool myRemoveEdgesAfterJoining
 Whether edges shall be joined first, then removed.
std::set< SUMOVehicleClassmyVehicleClasses2Keep
 Vector of vehicle types which must be allowed on edges in order to keep them.
std::set< SUMOVehicleClassmyVehicleClasses2Remove
 Vector of vehicle types which must not be disallowed on edges in order to keep them.

Member Typedef Documentation

typedef std::map<std::string, NBEdge*> NBEdgeCont::EdgeCont [private]

The type of the dictionary where an edge may be found by her id.

Definition at line 448 of file NBEdgeCont.h.


Constructor & Destructor Documentation

NBEdgeCont::NBEdgeCont ( NBNetBuilder tc  )  throw ()

Constructor.

Parameters:
[in] tc The net builded; used to obtain types

Definition at line 64 of file NBEdgeCont.cpp.

00065         : myNetBuilder(tc), myEdgesSplit(0) {
00066 }

NBEdgeCont::~NBEdgeCont (  )  throw ()

Destructor.

Definition at line 69 of file NBEdgeCont.cpp.

References clear().

00069                                 {
00070     clear();
00071 }

NBEdgeCont::NBEdgeCont ( const NBEdgeCont s  )  [private]

invalidated copy constructor


Member Function Documentation

void NBEdgeCont::appendTurnarounds ( bool  noTLSControlled  )  throw ()

Appends turnarounds to all edges stored in the container.

Calls "NBEdge::appendTurnaround" for all edges within the container.

Parameters:
[in] noTLSControlled Whether the turnaround shall not be connected if the edge is controlled by a tls
Todo:
Recheck whether a visitor-pattern should be used herefor
See also:
NBEdge::appendTurnaround

Definition at line 479 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00479                                                           {
00480     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00481         (*i).second->appendTurnaround(noTLSControlled);
00482     }
00483 }

void NBEdgeCont::applyOptions ( OptionsCont oc  ) 

Initialises the storage by applying given options.

Options, mainly steering the acceptance of edges, are parsed and the according internal variables are set.

Parameters:
[in] oc The options container to read options from
Todo:
Recheck exceptions

Definition at line 75 of file NBEdgeCont.cpp.

References OptionsCont::getBool(), OptionsCont::getFloat(), OptionsCont::getOptions(), OptionsCont::getStringVector(), getVehicleClassID(), OptionsCont::isSet(), myAmLeftHanded, myEdges2Keep, myEdges2Remove, myEdgesMinSpeed, myPrunningBoundary, myRemoveEdgesAfterJoining, myVehicleClasses2Keep, myVehicleClasses2Remove, Position2DVector::push_back(), and SUMOReal.

Referenced by NBNetBuilder::applyOptions().

00075                                         {
00076     myAmLeftHanded = oc.getBool("lefthand");
00077     // set edges dismiss/accept options
00078     myEdgesMinSpeed = oc.isSet("edges-min-speed") ? oc.getFloat("edges-min-speed") : -1;
00079     myRemoveEdgesAfterJoining = OptionsCont::getOptions().getBool("keep-edges.postload");
00080     myEdges2Keep = oc.isSet("keep-edges") ? oc.getStringVector("keep-edges") : std::vector<std::string>();
00081     myEdges2Remove = oc.isSet("remove-edges") ? oc.getStringVector("remove-edges") : std::vector<std::string>();
00082     if (oc.isSet("remove-edges.by-vclass")) {
00083         std::vector<std::string> classes = oc.getStringVector("remove-edges.by-vclass");
00084         for (std::vector<std::string>::iterator i=classes.begin(); i!=classes.end(); ++i) {
00085             myVehicleClasses2Remove.insert(getVehicleClassID(*i));
00086         }
00087     }
00088     if (oc.isSet("keep-edges.by-vclass")) {
00089         std::vector<std::string> classes = oc.getStringVector("keep-edges.by-vclass");
00090         for (std::vector<std::string>::iterator i=classes.begin(); i!=classes.end(); ++i) {
00091             myVehicleClasses2Keep.insert(getVehicleClassID(*i));
00092         }
00093     }
00094     if (oc.isSet("keep-edges.in-boundary")) {
00095         std::vector<std::string> polyS = oc.getStringVector("keep-edges.in-boundary");
00096         // !!! throw something if length<4 || length%2!=0?
00097         std::vector<SUMOReal> poly;
00098         for (std::vector<std::string>::iterator i=polyS.begin(); i!=polyS.end(); ++i) {
00099             poly.push_back(TplConvert<char>::_2SUMOReal((*i).c_str())); // !!! may throw something anyhow...
00100         }
00101         if (poly.size()==4) {
00102             // prunning boundary (box)
00103             myPrunningBoundary.push_back(Position2D(poly[0], poly[1]));
00104             myPrunningBoundary.push_back(Position2D(poly[2], poly[1]));
00105             myPrunningBoundary.push_back(Position2D(poly[2], poly[3]));
00106             myPrunningBoundary.push_back(Position2D(poly[0], poly[3]));
00107         } else {
00108             for (std::vector<SUMOReal>::iterator j=poly.begin(); j!=poly.end();) {
00109                 SUMOReal x = *j++;
00110                 SUMOReal y = *j++;
00111                 myPrunningBoundary.push_back(Position2D(x, y));
00112             }
00113         }
00114     }
00115 }

void NBEdgeCont::clear (  )  throw ()

Deletes all edges.

Definition at line 119 of file NBEdgeCont.cpp.

References myEdges.

Referenced by ~NBEdgeCont().

00119                           {
00120     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00121         delete((*i).second);
00122     }
00123     myEdges.clear();
00124 }

void NBEdgeCont::computeEdge2Edges (  )  throw ()

Computes for each edge the approached edges.

Calls "NBEdge::computeEdge2Edges" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
See also:
NBEdge::computeEdge2Edges

Definition at line 455 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00455                                       {
00456     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00457         (*i).second->computeEdge2Edges();
00458     }
00459 }

void NBEdgeCont::computeEdgeShapes (  )  throw ()

Computes the shapes of all edges stored in the container.

Calls "NBEdge::computeEdgeShape" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
Todo:
Recheck usage
See also:
NBEdge::computeEdgeShape

Definition at line 495 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00495                                       {
00496     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00497         (*i).second->computeEdgeShape();
00498     }
00499 }

void NBEdgeCont::computeLanes2Edges (  )  throw ()

Computes for each edge which lanes approach the next edges.

Calls "NBEdge::computeLanes2Edges" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
See also:
NBEdge::computeLanes2Edges

Definition at line 463 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00463                                        {
00464     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00465         (*i).second->computeLanes2Edges();
00466     }
00467 }

void NBEdgeCont::computeTurningDirections (  )  throw ()

Computes the turn-around directions for all edges.

Calls "NBEdge::computeTurningDirections" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
See also:
NBEdge::computeTurningDirections

Definition at line 439 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00439                                              {
00440     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00441         (*i).second->computeTurningDirections();
00442     }
00443 }

void NBEdgeCont::erase ( NBDistrictCont dc,
NBEdge edge 
) throw ()

Removes the given edge from the container (deleting it).

Parameters:
[in] dc The district container, in order to remove the edge from sources/sinks
[in] edge The edge to remove
Todo:
Recheck whether the district cont is needed - if districts are processed using an external tool

Definition at line 320 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNode::eraseDummies(), joinSameNodeConnectingEdges(), NBNodeCont::removeIsolatedRoads(), removeUnwishedEdges(), and splitAt().

00320                                                           {
00321     myEdges.erase(edge->getID());
00322     edge->myFrom->removeOutgoing(edge);
00323     edge->myTo->removeIncoming(edge);
00324     dc.removeFromSinksAndSources(edge);
00325     delete edge;
00326 }

std::vector< std::string > NBEdgeCont::getAllNames (  )  const throw ()

Returns all ids of known edges.

Returns:
All ids of known edges
Todo:
Recheck usage, probably, filling a given vector would be better...

Definition at line 427 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBJoinedEdgesMap::init(), and NBNodeCont::removeIsolatedRoads().

00427                                       {
00428     std::vector<std::string> ret;
00429     for (EdgeCont::const_iterator i=myEdges.begin(); i!=myEdges.end(); ++i) {
00430         ret.push_back((*i).first);
00431     }
00432     return ret;
00433 }

EdgeVector NBEdgeCont::getGeneratedFrom ( const std::string &  id  )  const throw () [private]

Returns the edges which have been built by splitting the edge of the given id.

Parameters:
[in] id The id of the original edge
Returns:
List of all edges which have been built by splitting the original edge
Todo:
Recheck usage

Definition at line 711 of file NBEdgeCont.cpp.

References myEdges.

Referenced by retrievePossiblySplitted().

00711                                                               {
00712     size_t len = id.length();
00713     EdgeVector ret;
00714     for (EdgeCont::const_iterator i=myEdges.begin(); i!=myEdges.end(); ++i) {
00715         std::string curr = (*i).first;
00716         // the next check makes it possibly faster - we don not have
00717         //  to compare the names
00718         if (curr.length()<=len) {
00719             continue;
00720         }
00721         // the name must be the same as the given id but something
00722         //  beginning with a '[' must be appended to it
00723         if (curr.substr(0, len)==id&&curr[len]=='[') {
00724             ret.push_back((*i).second);
00725             continue;
00726         }
00727         // ok, maybe the edge is a compound made during joining of edges
00728         size_t pos = curr.find(id);
00729         // surely not
00730         if (pos==std::string::npos) {
00731             continue;
00732         }
00733         // check leading char
00734         if (pos>0) {
00735             if (curr[pos-1]!=']'&&curr[pos-1]!='+') {
00736                 // actually, this is another id
00737                 continue;
00738             }
00739         }
00740         if (pos+id.length()<curr.length()) {
00741             if (curr[pos+id.length()]!='['&&curr[pos+id.length()]!='+') {
00742                 // actually, this is another id
00743                 continue;
00744             }
00745         }
00746         ret.push_back((*i).second);
00747     }
00748     return ret;
00749 }

unsigned int NBEdgeCont::getNoEdgeSplits (  )  const throw () [inline]

Returns the number of edge splits.

Returns:
How often an edge was split

Definition at line 245 of file NBEdgeCont.h.

References myEdgesSplit.

Referenced by NILoader::load().

00245                                                  {
00246         return myEdgesSplit;
00247     }

void NBEdgeCont::guessRoundabouts ( std::vector< std::set< NBEdge * > > &  marked  )  throw ()

Determines which edges belong to roundabouts and increases their priority.

Parameters:
[out] marked Edges which belong to a roundabout are stored here

Definition at line 753 of file NBEdgeCont.cpp.

References NBNode::getConnectionTo(), NBNode::getEdges(), NBEdge::getFromNode(), NBEdge::getToNode(), NBEdge::getTurnDestination(), myEdges, NBContHelper::nextCW(), and NBEdge::setJunctionPriority().

Referenced by NBNetBuilder::compute().

00753                                                                         {
00754     // step 1: keep only those edges which have no turnarounds
00755     std::set<NBEdge*> candidates;
00756     for (EdgeCont::const_iterator i=myEdges.begin(); i!=myEdges.end(); ++i) {
00757         NBEdge *e = (*i).second;
00758         NBNode * const to = e->getToNode();
00759         if (e->getTurnDestination()==0&&to->getConnectionTo(e->getFromNode())==0) {
00760             candidates.insert(e);
00761         }
00762     }
00763     // step 2:
00764     std::set<NBEdge*> visited;
00765     for (std::set<NBEdge*>::const_iterator i=candidates.begin(); i!=candidates.end(); ++i) {
00766         std::set<NBEdge*> loopEdges;
00767         // start with a random edge, keep it as "begin"
00768         NBEdge *begin = (*i);
00769         if (find(visited.begin(), visited.end(), begin)!=visited.end()) {
00770             // already seen
00771             continue;
00772         }
00773         NBEdge *e = (*i);
00774         // loop over connected edges (using always the leftmost one)
00775         bool noLoop = false;
00776         do {
00777             visited.insert(e);
00778             std::vector<NBEdge*> edges = e->getToNode()->getEdges();
00779             if (edges.size()<2) {
00780                 noLoop = true;
00781                 break;
00782             }
00783             sort(edges.begin(), edges.end(), NBContHelper::edge_by_junction_angle_sorter(e->getToNode()));
00784             std::vector<NBEdge*>::const_iterator me = find(edges.begin(), edges.end(), e);
00785             NBContHelper::nextCW(&edges, me);
00786             NBEdge *left = *me;
00787             loopEdges.insert(left);
00788             if (left==begin) {
00789                 break;
00790             }
00791             if (find(candidates.begin(), candidates.end(), left)==candidates.end()) {
00792                 noLoop = true;
00793                 break;
00794             }
00795             if (find(visited.begin(), visited.end(), left)!=visited.end()) {
00796                 noLoop = true;
00797                 break;
00798             }
00799             e = left;
00800         } while (true);
00801         // mark collected edges in the case a loop (roundabout) was found
00802         if (!noLoop) {
00803             for (std::set<NBEdge*>::const_iterator i=loopEdges.begin(); i!=loopEdges.end(); ++i) {
00804                 (*i)->setJunctionPriority((*i)->getToNode(), 1000);
00805             }
00806             marked.push_back(loopEdges);
00807         }
00808     }
00809 }

bool NBEdgeCont::insert ( NBEdge edge,
bool  ignorePrunning = false 
) throw ()

Adds an edge to the dictionary.

First, it is determined whether the edge shall not be discarded due to any reasons (being outside a boundary, or not in the optional list of edges to import, etc.). If so, the edge is deleted and "true" is returned. "true" is also returned if the edge is accepted - no edge with the same name exists within this container. If another edge with the same name exists, false is returned.

Parameters:
[in] edge The edge to add
[in] ignorePrunning Whether this edge must not be prunned
Returns:
Whether the edge was valid (no edge with the same id is already known)

Definition at line 130 of file NBEdgeCont.cpp.

References OptionsCont::getOptions(), NBTypeCont::getShallBeDiscarded(), NBNetBuilder::getTypeCont(), NBTypeCont::knows(), myAmLeftHanded, myEdges, myEdges2Keep, myEdges2Remove, myEdgesMinSpeed, myNetBuilder, myPrunningBoundary, myRemoveEdgesAfterJoining, myVehicleClasses2Keep, myVehicleClasses2Remove, POSITION_EPS, Position2DVector::size(), and SUMOReal.

Referenced by NIVissimDistrictConnection::dict_BuildDistricts(), joinSameNodeConnectingEdges(), NIImporter_ArcView::load(), NIImporter_RobocupRescue::loadEdges(), NIImporter_SUMO::loadNetwork(), NIImporter_OpenDrive::loadNetwork(), NIXMLEdgesHandler::myEndElement(), NIImporter_VISUM::parse_Connectors(), NIImporter_VISUM::parse_Edges(), NIImporter_DlrNavteq::EdgesHandler::report(), splitAt(), NBEdge::splitGeometry(), and NGNet::toNB().

00130                                                             {
00131     if (myAmLeftHanded) {
00132         edge->setLeftHanded();
00133     }
00134     EdgeCont::iterator i = myEdges.find(edge->getID());
00135     if (i!=myEdges.end()) {
00136         return false;
00137     }
00138     if (ignorePrunning) {
00139         myEdges.insert(EdgeCont::value_type(edge->getID(), edge));
00140         return true;
00141     }
00142     // remove edges which allow a speed below a set one (set using "edges-min-speed")
00143     if (edge->getSpeed()<myEdgesMinSpeed) {
00144         edge->getFromNode()->removeOutgoing(edge);
00145         edge->getToNode()->removeIncoming(edge);
00146         delete edge;
00147         return true;
00148     }
00149     // check whether the edge is a named edge to keep
00150     if (!myRemoveEdgesAfterJoining && myEdges2Keep.size()!=0) {
00151         if (find(myEdges2Keep.begin(), myEdges2Keep.end(), edge->getID())==myEdges2Keep.end()) {
00152             edge->getFromNode()->removeOutgoing(edge);
00153             edge->getToNode()->removeIncoming(edge);
00154             delete edge;
00155             return true;
00156         }
00157     }
00158     // check whether the edge is a named edge to remove
00159     if (myEdges2Remove.size()!=0) {
00160         if (find(myEdges2Remove.begin(), myEdges2Remove.end(), edge->getID())!=myEdges2Remove.end()) {
00161             edge->getFromNode()->removeOutgoing(edge);
00162             edge->getToNode()->removeIncoming(edge);
00163             delete edge;
00164             return true;
00165         }
00166     }
00167     // check whether the edge shall be removed due to allowing unwished classes only
00168     if (myVehicleClasses2Remove.size()!=0) {
00169         int matching = 0;
00170         std::vector<SUMOVehicleClass> allowed = edge->getAllowedVehicleClasses();
00171         for (std::set<SUMOVehicleClass>::const_iterator i=myVehicleClasses2Remove.begin(); i!=myVehicleClasses2Remove.end(); ++i) {
00172             std::vector<SUMOVehicleClass>::iterator j = find(allowed.begin(), allowed.end(), *i);
00173             if (j!=allowed.end()) {
00174                 allowed.erase(j);
00175                 matching++;
00176             }
00177         }
00178         // remove the edge if all allowed
00179         if (allowed.size()==0&&matching!=0) {
00180             edge->getFromNode()->removeOutgoing(edge);
00181             edge->getToNode()->removeIncoming(edge);
00182             delete edge;
00183             return true;
00184         }
00185     }
00186     // check whether the edge shall be removed due to a allow an unwished class
00187     if (myVehicleClasses2Keep.size()!=0) {
00188         int matching = 0;
00189         std::vector<SUMOVehicleClass> allowed = edge->getAllowedVehicleClasses();
00190         for (std::set<SUMOVehicleClass>::const_iterator i=myVehicleClasses2Remove.begin(); i!=myVehicleClasses2Remove.end(); ++i) {
00191             std::vector<SUMOVehicleClass>::iterator j = find(allowed.begin(), allowed.end(), *i);
00192             if (j!=allowed.end()) {
00193                 allowed.erase(j);
00194                 matching++;
00195             }
00196         }
00197         // remove the edge if all allowed
00198         if (matching==0&&allowed.size()!=0) {
00199             edge->getFromNode()->removeOutgoing(edge);
00200             edge->getToNode()->removeIncoming(edge);
00201             delete edge;
00202             return true;
00203         }
00204     }
00205     // check whether the edge is within the prunning boundary
00206     if (myPrunningBoundary.size()!=0) {
00207         Position2D p;
00208         if (!(edge->getGeometry().getBoxBoundary().grow((SUMOReal) POSITION_EPS).overlapsWith(myPrunningBoundary))) {
00209             edge->getFromNode()->removeOutgoing(edge);
00210             edge->getToNode()->removeIncoming(edge);
00211             delete edge;
00212             return true;
00213         }
00214     }
00215     if (myNetBuilder.getTypeCont().knows(edge->getTypeID())&&myNetBuilder.getTypeCont().getShallBeDiscarded(edge->getTypeID())) {
00216         edge->getFromNode()->removeOutgoing(edge);
00217         edge->getToNode()->removeIncoming(edge);
00218         delete edge;
00219         return true;
00220     }
00221 
00222     if (OptionsCont::getOptions().getBool("dismiss-vclasses")) {
00223         edge->dismissVehicleClassInformation();
00224     }
00225     myEdges.insert(EdgeCont::value_type(edge->getID(), edge));
00226     return true;
00227 }

bool NBEdgeCont::isLeftHanded (  )  const throw () [inline]

Returns whether the built edges are left-handed.

Returns:
Whether this edge container is left-handed

Definition at line 431 of file NBEdgeCont.h.

References myAmLeftHanded.

Referenced by NBNode::computeLogic().

00431                                       {
00432         return myAmLeftHanded;
00433     }

void NBEdgeCont::joinSameNodeConnectingEdges ( NBDistrictCont dc,
NBTrafficLightLogicCont tlc,
EdgeVector  edges 
) throw ()

Joins the given edges because they connect the same nodes.

Parameters:
[in] dc The district container needed to remove edges
[in] tlc The tls container needed to remove edges
[in] edges The edges to join
Todo:
Recheck and describe usage

Definition at line 511 of file NBEdgeCont.cpp.

References NBEdge::addEdge2EdgeConnection(), erase(), insert(), NBEdge::moveOutgoingConnectionsFrom(), NBNode::replaceIncoming(), NBNode::replaceOutgoing(), and SUMOReal.

Referenced by NBNodeCont::recheckEdges().

00513                                                                   {
00514     // !!! Attention!
00515     //  No merging of the geometry to come is being done
00516     //  The connections are moved from one edge to another within
00517     //   the replacement where the edge is a node's incoming edge.
00518 
00519     // count the number of lanes, the speed and the id
00520     unsigned int nolanes = 0;
00521     SUMOReal speed = 0;
00522     int priority = 0;
00523     std::string id;
00524     sort(edges.begin(), edges.end(), NBContHelper::same_connection_edge_sorter());
00525     // retrieve the connected nodes
00526     NBEdge *tpledge = *(edges.begin());
00527     NBNode *from = tpledge->getFromNode();
00528     NBNode *to = tpledge->getToNode();
00529     EdgeVector::const_iterator i;
00530     for (i=edges.begin(); i!=edges.end(); i++) {
00531         // some assertions
00532         assert((*i)->getFromNode()==from);
00533         assert((*i)->getToNode()==to);
00534         // ad the number of lanes the current edge has
00535         nolanes += (*i)->getNoLanes();
00536         // build the id
00537         if (i!=edges.begin()) {
00538             id += "+";
00539         }
00540         id += (*i)->getID();
00541         // compute the speed
00542         speed += (*i)->getSpeed();
00543         // build the priority
00544         if (priority<(*i)->getPriority()) {
00545             priority = (*i)->getPriority();
00546         }
00547     }
00548     speed /= edges.size();
00549     // build the new edge
00550     NBEdge *newEdge = new NBEdge(id, from, to, "", speed,
00551                                  nolanes, priority, tpledge->myLaneSpreadFunction);
00552     insert(newEdge, true);
00553     // replace old edge by current within the nodes
00554     //  and delete the old
00555     from->replaceOutgoing(edges, newEdge);
00556     to->replaceIncoming(edges, newEdge);
00557     // patch connections
00558     //  add edge2edge-information
00559     for (i=edges.begin(); i!=edges.end(); i++) {
00560         EdgeVector ev = (*i)->getConnectedEdges();
00561         for (EdgeVector::iterator j=ev.begin(); j!=ev.end(); j++) {
00562             newEdge->addEdge2EdgeConnection(*j);
00563         }
00564     }
00565     //  move lane2lane-connections
00566     unsigned int currLane = 0;
00567     for (i=edges.begin(); i!=edges.end(); i++) {
00568         newEdge->moveOutgoingConnectionsFrom(*i, currLane);
00569         currLane += (*i)->getNoLanes();
00570     }
00571     // patch tl-information
00572     currLane = 0;
00573     for (i=edges.begin(); i!=edges.end(); i++) {
00574         unsigned int noLanes = (*i)->getNoLanes();
00575         for (unsigned int j=0; j<noLanes; j++, currLane++) {
00576             // replace in traffic lights
00577             tlc.replaceRemoved(*i, j, newEdge, currLane);
00578         }
00579     }
00580     // delete joined edges
00581     for (i=edges.begin(); i!=edges.end(); i++) {
00582         erase(dc, *i);
00583     }
00584 }

NBEdgeCont& NBEdgeCont::operator= ( const NBEdgeCont s  )  [private]

invalidated assignment operator

void NBEdgeCont::recheckLanes (  )  throw ()

Rechecks whether all lanes have a successor for each of the stored edges.

Calls "NBEdge::recheckLanes" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
See also:
NBEdge::recheckLanes

Definition at line 471 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00471                                  {
00472     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00473         (*i).second->recheckLanes();
00474     }
00475 }

void NBEdgeCont::recheckLaneSpread (  )  throw ()

Rechecks whether the lane spread is proper.

Todo:
Recheck usage; check whether this is really needed and whether it works at all

Definition at line 617 of file NBEdgeCont.cpp.

References NBEdge::LANESPREAD_CENTER, NBEdge::LANESPREAD_RIGHT, and myEdges.

Referenced by NIImporter_DlrNavteq::loadNetwork().

00617                                       {
00618     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); ++i) {
00619         std::string oppositeID;
00620         if ((*i).first[0]=='-') {
00621             oppositeID = (*i).first.substr(1);
00622         } else {
00623             oppositeID = "-" + (*i).first;
00624         }
00625         if (myEdges.find(oppositeID)!=myEdges.end()) {
00626             (*i).second->setLaneSpreadFunction(NBEdge::LANESPREAD_RIGHT);
00627             myEdges.find(oppositeID)->second->setLaneSpreadFunction(NBEdge::LANESPREAD_RIGHT);
00628         } else {
00629             (*i).second->setLaneSpreadFunction(NBEdge::LANESPREAD_CENTER);
00630         }
00631     }
00632 }

void NBEdgeCont::recomputeLaneShapes (  )  throw ()

Computes the shapes of all lanes of all edges stored in the container.

Calls "NBEdge::computeLaneShapes" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
Todo:
Recheck usage
See also:
NBEdge::computeLaneShapes

Definition at line 503 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00503                                         {
00504     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); ++i) {
00505         (*i).second->computeLaneShapes();
00506     }
00507 }

void NBEdgeCont::removeUnwishedEdges ( NBDistrictCont dc  )  throw ()

Removes unwished edges (not in keep-edges).

Parameters:
[in] dc The district container needed to remove edges
Todo:
Recheck usage; check whether keep-edges.postload is really useful

Definition at line 588 of file NBEdgeCont.cpp.

References erase(), NBEdge::getFromNode(), NBEdge::getID(), OptionsCont::getOptions(), NBEdge::getToNode(), OptionsCont::isInStringVector(), myEdges, NBNode::removeIncoming(), and NBNode::removeOutgoing().

Referenced by NBNetBuilder::compute().

00588                                                           {
00589     std::vector<NBEdge*> toRemove;
00590     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end();) {
00591         NBEdge *edge = (*i).second;
00592         if (!OptionsCont::getOptions().isInStringVector("keep-edges", edge->getID())) {
00593             edge->getFromNode()->removeOutgoing(edge);
00594             edge->getToNode()->removeIncoming(edge);
00595             toRemove.push_back(edge);
00596         }
00597         ++i;
00598     }
00599     for (std::vector<NBEdge*>::iterator j=toRemove.begin(); j!=toRemove.end(); ++j) {
00600         erase(dc, *j);
00601     }
00602 }

void NBEdgeCont::reshiftEdgePositions ( SUMOReal  xoff,
SUMOReal  yoff 
) throw ()

Translates and rotates the geometries of all known edges by the given values.

Calls "NBEdge::reshiftPosition" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
Todo:
Recheck usage
See also:
NBEdge::reshiftPosition

Definition at line 487 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00487                                                                      {
00488     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00489         (*i).second->reshiftPosition(xoff, yoff);
00490     }
00491 }

NBEdge * NBEdgeCont::retrieve ( const std::string &  id  )  const throw ()

NBEdge * NBEdgeCont::retrievePossiblySplitted ( const std::string &  id,
SUMOReal  pos 
) const throw ()

Tries to retrieve an edge, even if it is splitted.

To describe which part of the edge shall be returned, a position hint is supplied.

Parameters:
[in] id The id of the edge to retrieve
[in] pos An additional about the position of the basic edge's subpart
Returns:
The searched edge
Todo:
Recheck usage

Definition at line 275 of file NBEdgeCont.cpp.

References NBEdge::getLength(), MAX2(), myEdges, retrieve(), and SUMOReal.

00275                                                                                     {
00276     // check whether the edge was not split, yet
00277     NBEdge *edge = retrieve(id);
00278     if (edge!=0) {
00279         return edge;
00280     }
00281     size_t maxLength = 0;
00282     std::string tid = id + "[";
00283     for (EdgeCont::const_iterator i=myEdges.begin(); i!=myEdges.end(); ++i) {
00284         if ((*i).first.find(tid)==0) {
00285             maxLength = MAX2(maxLength, (*i).first.length());
00286         }
00287     }
00288     // find the part of the edge which matches the position
00289     SUMOReal seen = 0;
00290     std::vector<std::string> names;
00291     names.push_back(id + "[1]");
00292     names.push_back(id + "[0]");
00293     while (names.size()>0) {
00294         // retrieve the first subelement (to follow)
00295         std::string cid = names.back();
00296         names.pop_back();
00297         edge = retrieve(cid);
00298         // The edge was splitted; check its subparts within the
00299         //  next step
00300         if (edge==0) {
00301             if (cid.length()+3<maxLength) {
00302                 names.push_back(cid + "[1]");
00303                 names.push_back(cid + "[0]");
00304             }
00305         }
00306         // an edge with the name was found,
00307         //  check whether the position lies within it
00308         else {
00309             seen += edge->getLength();
00310             if (seen>=pos) {
00311                 return edge;
00312             }
00313         }
00314     }
00315     return 0;
00316 }

NBEdge * NBEdgeCont::retrievePossiblySplitted ( const std::string &  id,
const std::string &  hint,
bool  incoming 
) const throw ()

Tries to retrieve an edge, even if it is splitted.

To describe which part of the edge shall be returned, the id of a second edge, participating at the node and the information whether to return the outgoing or the incoming is needed.

Parameters:
[in] id The id of the edge to retrieve
[in] hint An additional information which helps to retrieve the correct edge
[in] incoming Whether the edge to find is an incoming edge at the node "hint" participates
Returns:
The searched edge
Todo:
Recheck usage

Definition at line 239 of file NBEdgeCont.cpp.

References getGeneratedFrom(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBEdge::myFrom, NBEdge::myTo, and retrieve().

Referenced by NIVissimTL::NIVissimTLSignal::addTo(), NIVissimDisturbance::addToNode(), NIVissimConnection::buildEdgeConnections(), NBConnection::checkFrom(), NBConnection::checkTo(), and NIVissimDistrictConnection::dict_BuildDistricts().

00241                                                                   {
00242     // try to retrieve using the given name (iterative)
00243     NBEdge *edge = retrieve(id);
00244     if (edge!=0) {
00245         return edge;
00246     }
00247     // now, we did not find it; we have to look over all possibilities
00248     EdgeVector hints;
00249     // check whether at least the hint was not splitted
00250     NBEdge *hintedge = retrieve(hint);
00251     if (hintedge==0) {
00252         hints = getGeneratedFrom(hint);
00253     } else {
00254         hints.push_back(hintedge);
00255     }
00256     EdgeVector candidates = getGeneratedFrom(id);
00257     for (EdgeVector::iterator i=hints.begin(); i!=hints.end(); i++) {
00258         NBEdge *hintedge = (*i);
00259         for (EdgeVector::iterator j=candidates.begin(); j!=candidates.end(); j++) {
00260             NBEdge *poss_searched = (*j);
00261             NBNode *node = incoming
00262                            ? poss_searched->myTo : poss_searched->myFrom;
00263             const EdgeVector &cont = incoming
00264                                      ? node->getOutgoingEdges() : node->getIncomingEdges();
00265             if (find(cont.begin(), cont.end(), hintedge)!=cont.end()) {
00266                 return poss_searched;
00267             }
00268         }
00269     }
00270     return 0;
00271 }

void NBEdgeCont::savePlain ( const std::string &  efile,
const std::string &  cfile 
) throw (IOError)

Writes the stored edges and their connections to an XML-edge-file and an XML-connections-file, respectively.

Parameters:
[in] efile The path to write the edge definitions into
[in] cfile The path to write the connection definitions into
Exceptions:
IOError If one of the files could not be opened

Definition at line 657 of file NBEdgeCont.cpp.

References OutputDevice::close(), NBEdge::getConnectionsFromLane(), OutputDevice::getDevice(), NBEdge::getFromNode(), NBEdge::getGeometry(), NBNode::getID(), NBEdge::getID(), NBEdge::getLaneSpreadFunction(), NBEdge::getNoLanes(), NBEdge::getSpeed(), NBEdge::getToNode(), NBEdge::hasRestrictions(), NBEdge::LANESPREAD_RIGHT, myEdges, NBEdge::writeLanesPlain(), and OutputDevice::writeXMLHeader().

Referenced by NBNetBuilder::compute().

00657                                                                                    {
00658     OutputDevice& edevice = OutputDevice::getDevice(efile);
00659     edevice.writeXMLHeader("edges");
00660     OutputDevice& cdevice = OutputDevice::getDevice(cfile);
00661     cdevice.writeXMLHeader("connections");
00662     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00663         // write the edge itself to the edges-files
00664         NBEdge *e = (*i).second;
00665         edevice << "   <edge id=\"" << e->getID()
00666         << "\" fromnode=\"" << e->getFromNode()->getID()
00667         << "\" tonode=\"" << e->getToNode()->getID()
00668         << "\" nolanes=\"" << e->getNoLanes()
00669         << "\" speed=\"" << e->getSpeed() << "\"";
00670         // write the geometry only if larger than just the from/to positions
00671         edevice << " shape=\"" << e->getGeometry() << "\"";
00672         // write the spread type if not default ("right")
00673         if (e->getLaneSpreadFunction()!=NBEdge::LANESPREAD_RIGHT) {
00674             edevice << " spread_type=\"center\"";
00675         }
00676         // write the vehicles class if restrictions exist
00677         if (!e->hasRestrictions()) {
00678             edevice << "/>\n";
00679         } else {
00680             edevice << ">\n";
00681             e->writeLanesPlain(edevice);
00682             edevice << "   </edge>\n";
00683         }
00684         // write this edge's connections to the connections-files
00685         unsigned int noLanes = e->getNoLanes();
00686         unsigned int noWritten = 0;
00687         for (unsigned int lane=0; lane<noLanes; ++lane) {
00688             std::vector<NBEdge::Connection> connections = e->getConnectionsFromLane(lane);
00689             for (std::vector<NBEdge::Connection>::iterator c=connections.begin(); c!=connections.end(); ++c) {
00690                 if ((*c).toEdge!=0) {
00691                     cdevice << "    <connection from=\"" << e->getID()
00692                     << "\" to=\"" << (*c).toEdge->getID()
00693                     << "\" lane=\"" << (*c).fromLane << ":" << (*c).toLane;
00694                     cdevice << "\"/>\n";
00695                     ++noWritten;
00696                 }
00697             }
00698         }
00699         if (noWritten>0) {
00700             cdevice << "\n";
00701         }
00702     }
00703     edevice.close();
00704     cdevice.close();
00705 }

unsigned int NBEdgeCont::size (  )  const throw () [inline]

Returns the number of edges.

Returns:
The number of edges stored in this container

Definition at line 230 of file NBEdgeCont.h.

References myEdges.

Referenced by NILoader::load(), and main().

00230                                       {
00231         return (unsigned int) myEdges.size();
00232     }

void NBEdgeCont::sortOutgoingLanesConnections (  )  throw ()

Sorts all lanes of all edges within the container by their direction.

Calls "NBEdge::sortOutgoingLanesConnections" for all edges within the container.

Todo:
Recheck whether a visitor-pattern should be used herefor
See also:
NBEdge::sortOutgoingLanesConnections

Definition at line 447 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00447                                                  {
00448     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00449         (*i).second->sortOutgoingLanesConnections();
00450     }
00451 }

bool NBEdgeCont::splitAt ( NBDistrictCont dc,
NBEdge edge,
SUMOReal  edgepos,
NBNode node,
const std::string &  firstEdgeName,
const std::string &  secondEdgeName,
unsigned int  noLanesFirstEdge,
unsigned int  noLanesSecondEdge 
) throw (ProcessError)

Splits the edge at the position nearest to the given node using the given modifications.

Parameters:
[in] dc The district container, in order to remove/add the edge from/to sources/sinks
[in] edge The edge to split
[in] node The node to split the edge at
[in] firstEdgeName The id the first part of the split edge shall have
[in] secondEdgeName The id the second part of the split edge shall have
[in] noLanesFirstEdge The number of lanes the second part of the split edge shall have
[in] noLanesSecondEdge The number of lanes the second part of the split edge shall have
Returns:
Whether the edge could be split
Exceptions:
ProcessError If connections between the edges can not be built

Definition at line 359 of file NBEdgeCont.cpp.

References NBEdge::addLane2LaneConnection(), NBEdge::copyConnectionsFrom(), erase(), NBEdge::getNoLanes(), insert(), NBEdge::L2L_COMPUTED, myEdgesSplit, and NBEdge::setLaneSpeed().

00363                                                                                                        {
00364     // build the new edges' geometries
00365     std::pair<Position2DVector, Position2DVector> geoms =
00366         edge->getGeometry().splitAt(pos);
00367     if (geoms.first[-1]!=node->getPosition()) {
00368         geoms.first.pop_back();
00369         geoms.first.push_back(node->getPosition());
00370     }
00371 
00372     if (geoms.second[0]!=node->getPosition()) {
00373         geoms.second.pop_front();
00374         geoms.second.push_front(node->getPosition());
00375     }
00376     // build and insert the edges
00377     NBEdge *one = new NBEdge(firstEdgeName,
00378                              edge->myFrom, node, edge->myType, edge->mySpeed, noLanesFirstEdge,
00379                              edge->getPriority(), geoms.first, edge->myLaneSpreadFunction, true);
00380     for (unsigned int i=0; i<noLanesFirstEdge&&i<edge->getNoLanes(); i++) {
00381         one->setLaneSpeed(i, edge->getLaneSpeed(i));
00382     }
00383     NBEdge *two = new NBEdge(secondEdgeName,
00384                              node, edge->myTo, edge->myType, edge->mySpeed, noLanesSecondEdge,
00385                              edge->getPriority(), geoms.second,
00386                              edge->myLaneSpreadFunction, true);
00387     for (unsigned int i=0; i<noLanesSecondEdge&&i<edge->getNoLanes(); i++) {
00388         two->setLaneSpeed(i, edge->getLaneSpeed(i));
00389     }
00390     two->copyConnectionsFrom(edge);
00391     // replace information about this edge within the nodes
00392     edge->myFrom->replaceOutgoing(edge, one, 0);
00393     edge->myTo->replaceIncoming(edge, two, 0);
00394     // the edge is now occuring twice in both nodes...
00395     //  clean up
00396     edge->myFrom->removeDoubleEdges();
00397     edge->myTo->removeDoubleEdges();
00398     // add connections from the first to the second edge
00399     // check special case:
00400     //  one in, one out, the outgoing has one lane more
00401     if (noLanesFirstEdge==noLanesSecondEdge-1) {
00402         for (unsigned int i=0; i<one->getNoLanes(); i++) {
00403             if (!one->addLane2LaneConnection(i, two, i+1, NBEdge::L2L_COMPUTED)) {// !!! Bresenham, here!!!
00404                 throw ProcessError("Could not set connection!");
00405             }
00406         }
00407         one->addLane2LaneConnection(0, two, 0, NBEdge::L2L_COMPUTED);
00408     } else {
00409         for (unsigned int i=0; i<one->getNoLanes()&&i<two->getNoLanes(); i++) {
00410             if (!one->addLane2LaneConnection(i, two, i, NBEdge::L2L_COMPUTED)) {// !!! Bresenham, here!!!
00411                 throw ProcessError("Could not set connection!");
00412             }
00413         }
00414     }
00415     // erase the splitted edge
00416     erase(dc, edge);
00417     insert(one, true);
00418     insert(two, true);
00419     myEdgesSplit++;
00420     return true;
00421 }

bool NBEdgeCont::splitAt ( NBDistrictCont dc,
NBEdge edge,
NBNode node,
const std::string &  firstEdgeName,
const std::string &  secondEdgeName,
unsigned int  noLanesFirstEdge,
unsigned int  noLanesSecondEdge 
) throw (ProcessError)

Splits the edge at the position nearest to the given node using the given modifications.

Determines the position of the split by finding the nearest position on the edge to the given node. If this position is too near to the edges begin/end, false is returned.

Otherwise, "splitAt(NBDistrictCont &, NBEdge *, SUMOReal, NBNode *, const std::string &, const std::string &, unsigned int , unsigned int)" is used to perform the split.

Parameters:
[in] dc The district container, in order to remove/add the edge from/to sources/sinks
[in] edge The edge to split
[in] node The node to split the edge at
[in] firstEdgeName The id the first part of the split edge shall have
[in] secondEdgeName The id the second part of the split edge shall have
[in] noLanesFirstEdge The number of lanes the second part of the split edge shall have
[in] noLanesSecondEdge The number of lanes the second part of the split edge shall have
Returns:
Whether the edge could be split
Exceptions:
ProcessError If connections between the edges can not be built
See also:
NBEdge::splitAt(NBDistrictCont &, NBEdge *, SUMOReal, NBNode *, const std::string &, const std::string &, unsigned int , unsigned int)

Definition at line 339 of file NBEdgeCont.cpp.

References GeomHelper::nearest_position_on_line_to_point(), splitAt(), and SUMOReal.

00342                                                                                                        {
00343     SUMOReal pos;
00344     pos = edge->getGeometry().nearest_position_on_line_to_point(node->getPosition());
00345     if (pos<=0) {
00346         pos = GeomHelper::nearest_position_on_line_to_point(
00347                   edge->myFrom->getPosition(), edge->myTo->getPosition(),
00348                   node->getPosition());
00349     }
00350     if (pos<=0||pos+POSITION_EPS>edge->getGeometry().length()) {
00351         return false;
00352     }
00353     return splitAt(dc, edge, pos, node, firstEdgeName, secondEdgeName,
00354                    noLanesFirstEdge, noLanesSecondEdge);
00355 }

bool NBEdgeCont::splitAt ( NBDistrictCont dc,
NBEdge edge,
NBNode node 
) throw (ProcessError)

Splits the edge at the position nearest to the given node.

Uses "splitAt(NBDistrictCont &, NBEdge *, NBNode *, const std::string &, const std::string &, unsigned int , unsigned int)" to perform the split; the edge names are built by appending "[0]" and "[1]", respectively. Both edges will have the same number of lanes.

Parameters:
[in] dc The district container, in order to remove/add the edge from/to sources/sinks
[in] edge The edge to split
[in] node The node to split the edge at
Returns:
Whether the edge could be split
Exceptions:
ProcessError If connections between the edges can not be built
See also:
NBEdge::splitAt(NBDistrictCont &, NBEdge *, NBNode *, const std::string &, const std::string &, unsigned int , unsigned int)

Definition at line 332 of file NBEdgeCont.cpp.

Referenced by NIVissimDisturbance::addToNode(), NBNodeCont::buildOffRamp(), NBNodeCont::buildOnRamp(), NBNodeCont::guessRamps(), NIXMLEdgesHandler::myEndElement(), NIImporter_VISUM::parse_Lanes(), and splitAt().

00332                                                                                       {
00333     return splitAt(dc, edge, node, edge->getID() + "[0]", edge->getID() + "[1]",
00334                    (unsigned int) edge->myLanes.size(), (unsigned int) edge->myLanes.size());
00335 }

void NBEdgeCont::splitGeometry ( NBNodeCont nc  )  throw ()

Splits edges into multiple if they have a complex geometry.

Calls "NBEdge::splitGeometry" for all edges within the container which have more than three positions in their geometry.

Parameters:
[in] nc The node container needed to build (geometry) nodes
See also:
NBEdge::splitGeometry

Definition at line 606 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::compute().

00606                                                 {
00607     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); ++i) {
00608         if ((*i).second->getGeometry().size()<3) {
00609             continue;
00610         }
00611         (*i).second->splitGeometry(*this, nc);
00612     }
00613 }

void NBEdgeCont::writeXMLStep1 ( OutputDevice into  )  throw (IOError)

Writes the edge definitions with lanes into the given stream.

Calls "NBEdge::writeXMLStep1" for all edges within the container.

Parameters:
[in] into The stream to write the definieions into
Exceptions:
IOError (not yet implemented)

Definition at line 638 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::save().

00638                                                            {
00639     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00640         (*i).second->writeXMLStep1(into);
00641     }
00642     into << "\n";
00643 }

void NBEdgeCont::writeXMLStep2 ( OutputDevice into,
bool  includeInternal 
) throw (IOError)

Writes the successor definitions of edges into the given stream.

Calls "NBEdge::writeXMLStep2" for all edges within the container.

Parameters:
[in] into The stream to write the definieions into
[in] includeInternal Whether internal successors shal be written, too
Exceptions:
IOError (not yet implemented)

Definition at line 647 of file NBEdgeCont.cpp.

References myEdges.

Referenced by NBNetBuilder::save().

00647                                                                                  {
00648     for (EdgeCont::iterator i=myEdges.begin(); i!=myEdges.end(); i++) {
00649         (*i).second->writeXMLStep2(into, includeInternal);
00650     }
00651     into << "\n";
00652 }


Field Documentation

Whether the network is left-handed.

Definition at line 457 of file NBEdgeCont.h.

Referenced by applyOptions(), insert(), and isLeftHanded().

std::vector<std::string> NBEdgeCont::myEdges2Keep [private]

Vector of ids of edges which shall explicitely be kept.

Definition at line 470 of file NBEdgeCont.h.

Referenced by applyOptions(), and insert().

std::vector<std::string> NBEdgeCont::myEdges2Remove [private]

Vector of ids of edges which shall explicitely be removed.

Definition at line 473 of file NBEdgeCont.h.

Referenced by applyOptions(), and insert().

SUMOReal NBEdgeCont::myEdgesMinSpeed [private]

The minimum speed an edge may have in order to be kept (default: -1).

Definition at line 464 of file NBEdgeCont.h.

Referenced by applyOptions(), and insert().

unsigned int NBEdgeCont::myEdgesSplit [private]

the number of splits of edges during the building

Definition at line 454 of file NBEdgeCont.h.

Referenced by getNoEdgeSplits(), and splitAt().

The network builder; used to obtain type information.

Definition at line 487 of file NBEdgeCont.h.

Referenced by insert().

Boundary within which an edge must be located in order to be kept.

Definition at line 482 of file NBEdgeCont.h.

Referenced by applyOptions(), and insert().

Whether edges shall be joined first, then removed.

Definition at line 467 of file NBEdgeCont.h.

Referenced by applyOptions(), and insert().

Vector of vehicle types which must be allowed on edges in order to keep them.

Definition at line 476 of file NBEdgeCont.h.

Referenced by applyOptions(), and insert().

Vector of vehicle types which must not be disallowed on edges in order to keep them.

Definition at line 479 of file NBEdgeCont.h.

Referenced by applyOptions(), and insert().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:51 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6