#include <NLEdgeControlBuilder.h>

This class is the container for MSEdge-instances while they are build.
While building instances of MSEdge, these are stored in a list. The list of edges is later split into two lists, one containing single-lane-edges and one containing multi-lane-edges.
Definition at line 61 of file NLEdgeControlBuilder.h.
Public Types | |
| typedef std::vector< MSEdge * > | EdgeCont |
| definition of the used storage for edges | |
Public Member Functions | |
| virtual MSLane * | addLane (const std::string &id, SUMOReal maxSpeed, SUMOReal length, bool isDepart, const Position2DVector &shape, const std::vector< SUMOVehicleClass > &allowed, const std::vector< SUMOVehicleClass > &disallowed) |
| Adds a lane to the current edge; This method throws an ProcessError when the lane is marked to be the depart lane and another so marked lane was added before. | |
| void | beginEdgeParsing (const std::string &id, MSEdge::EdgeBasicFunction function) throw (InvalidArgument) |
| MSEdgeControl * | build () |
| builds the MSEdgeControl-class which holds all edges | |
| virtual MSEdge * | buildEdge (const std::string &id) throw () |
| Builds an edge instance (MSEdge in this case). | |
| virtual MSEdge * | closeEdge () |
| Closes the building of an edge; The edge is completely described by now and may not be opened again. | |
| NLEdgeControlBuilder () | |
| Constructor. | |
| virtual | ~NLEdgeControlBuilder () |
| Destructor. | |
Protected Attributes | |
| MSEdge::EdgeBasicFunction | m_Function |
| the function of the current edge | |
| unsigned int | m_iNoMulti |
| number of multi-lane-edges | |
| unsigned int | m_iNoSingle |
| number of single-lane-edges | |
| MSLane * | m_pDepartLane |
| pointer to the depart lane | |
| std::vector< MSLane * > * | m_pLaneStorage |
| pointer to a temporary lane storage | |
| MSEdge * | myActiveEdge |
| pointer to the currently chosen edge | |
| unsigned int | myCurrentNumericalEdgeID |
| A running number for edge numbering. | |
| unsigned int | myCurrentNumericalLaneID |
| A running number for lane numbering. | |
| EdgeCont | myEdges |
| Temporary, internal storage for built edges. | |
Private Member Functions | |
| NLEdgeControlBuilder (const NLEdgeControlBuilder &s) | |
| invalidated copy constructor | |
| NLEdgeControlBuilder & | operator= (const NLEdgeControlBuilder &s) |
| invalidated assignment operator | |
| typedef std::vector<MSEdge*> NLEdgeControlBuilder::EdgeCont |
| NLEdgeControlBuilder::NLEdgeControlBuilder | ( | ) |
Constructor.
Definition at line 57 of file NLEdgeControlBuilder.cpp.
References m_iNoMulti, m_iNoSingle, m_pDepartLane, m_pLaneStorage, and myActiveEdge.
00058 : myCurrentNumericalLaneID(0), myCurrentNumericalEdgeID(0), myEdges(0) { 00059 myActiveEdge = (MSEdge*) 0; 00060 m_pLaneStorage = new std::vector<MSLane*>(); 00061 m_pDepartLane = (MSLane*) 0; 00062 m_iNoSingle = m_iNoMulti = 0; 00063 }
| NLEdgeControlBuilder::~NLEdgeControlBuilder | ( | ) | [virtual] |
Destructor.
Definition at line 66 of file NLEdgeControlBuilder.cpp.
References m_pLaneStorage.
00066 { 00067 delete m_pLaneStorage; 00068 }
| NLEdgeControlBuilder::NLEdgeControlBuilder | ( | const NLEdgeControlBuilder & | s | ) | [private] |
invalidated copy constructor
| MSLane * NLEdgeControlBuilder::addLane | ( | const std::string & | id, | |
| SUMOReal | maxSpeed, | |||
| SUMOReal | length, | |||
| bool | isDepart, | |||
| const Position2DVector & | shape, | |||
| const std::vector< SUMOVehicleClass > & | allowed, | |||
| const std::vector< SUMOVehicleClass > & | disallowed | |||
| ) | [virtual] |
Adds a lane to the current edge; This method throws an ProcessError when the lane is marked to be the depart lane and another so marked lane was added before.
Reimplemented in GUIEdgeControlBuilder.
Definition at line 85 of file NLEdgeControlBuilder.cpp.
References MSEdge::EDGEFUNCTION_CONNECTOR, MSEdge::EDGEFUNCTION_INTERNAL, MSEdge::EDGEFUNCTION_NORMAL, m_Function, m_pDepartLane, m_pLaneStorage, myActiveEdge, and myCurrentNumericalLaneID.
Referenced by NLHandler::closeLane().
00089 { 00090 // checks if the depart lane was set before 00091 if (isDepart&&m_pDepartLane!=0) { 00092 throw InvalidArgument("Lane's '" + id + "' edge already has a depart lane."); 00093 } 00094 MSLane *lane = 0; 00095 switch (m_Function) { 00096 case MSEdge::EDGEFUNCTION_INTERNAL: 00097 lane = new MSInternalLane(id, maxSpeed, length, myActiveEdge, 00098 myCurrentNumericalLaneID++, shape, allowed, disallowed); 00099 break; 00100 case MSEdge::EDGEFUNCTION_NORMAL: 00101 case MSEdge::EDGEFUNCTION_CONNECTOR: 00102 lane = new MSLane(id, maxSpeed, length, myActiveEdge, 00103 myCurrentNumericalLaneID++, shape, allowed, disallowed); 00104 break; 00105 default: 00106 throw InvalidArgument("Unrecognised edge type."); 00107 } 00108 m_pLaneStorage->push_back(lane); 00109 if (isDepart) { 00110 m_pDepartLane = lane; 00111 } 00112 return lane; 00113 }
| void NLEdgeControlBuilder::beginEdgeParsing | ( | const std::string & | id, | |
| MSEdge::EdgeBasicFunction | function | |||
| ) | throw (InvalidArgument) |
Begins building of an MSEdge
Builds an instance of MSEdge using "buildEdge". Stores it as the current edge in "myActiveEdge" and appends it to the list of built edges ("myEdges").
The given information is used to build the edge.
| [in] | id | The id of the edge |
| [in] | function | The function of the edge |
| InvalidArgument | If an edge with the same name was already built |
Definition at line 72 of file NLEdgeControlBuilder.cpp.
References buildEdge(), MSEdge::dictionary(), m_Function, m_pDepartLane, myActiveEdge, and myEdges.
Referenced by NLHandler::beginEdgeParsing().
00073 { 00074 myActiveEdge = buildEdge(id); 00075 if (!MSEdge::dictionary(id, myActiveEdge)) { 00076 throw InvalidArgument("Another edge with the id '" + id + "' exists."); 00077 } 00078 myEdges.push_back(myActiveEdge); 00079 m_pDepartLane = (MSLane*) 0; 00080 m_Function = function; 00081 }
| MSEdgeControl * NLEdgeControlBuilder::build | ( | ) |
builds the MSEdgeControl-class which holds all edges
Definition at line 133 of file NLEdgeControlBuilder.cpp.
References OptionsCont::getOptions(), and myEdges.
Referenced by NLBuilder::buildNet().
00133 { 00134 for (EdgeCont::iterator i1=myEdges.begin(); i1!=myEdges.end(); i1++) { 00135 (*i1)->closeBuilding(); 00136 #ifdef HAVE_MESOSIM 00137 if (MSGlobals::gUseMesoSim) { 00138 MSGlobals::gMesoNet->buildSegmentsFor(**i1, OptionsCont::getOptions()); 00139 } 00140 #endif 00141 } 00142 return new MSEdgeControl(myEdges); 00143 }
| MSEdge * NLEdgeControlBuilder::buildEdge | ( | const std::string & | id | ) | throw () [virtual] |
Builds an edge instance (MSEdge in this case).
Builds an MSEdge-instance using the given name and the current index "myCurrentNumericalEdgeID". Post-increments the index, returns the built edge.
| [in] | id | The id of the edge to build |
Reimplemented in GUIEdgeControlBuilder.
Definition at line 147 of file NLEdgeControlBuilder.cpp.
References myCurrentNumericalEdgeID.
Referenced by NLHandler::addDistrict(), and beginEdgeParsing().
00147 { 00148 return new MSEdge(id, myCurrentNumericalEdgeID++); 00149 }
| MSEdge * NLEdgeControlBuilder::closeEdge | ( | ) | [virtual] |
Closes the building of an edge; The edge is completely described by now and may not be opened again.
Reimplemented in GUIEdgeControlBuilder.
Definition at line 117 of file NLEdgeControlBuilder.cpp.
References MSEdge::initialize(), m_Function, m_iNoMulti, m_iNoSingle, m_pDepartLane, m_pLaneStorage, and myActiveEdge.
Referenced by NLHandler::closeEdge(), and GUIEdgeControlBuilder::closeEdge().
00117 { 00118 std::vector<MSLane*> *lanes = new std::vector<MSLane*>(); 00119 lanes->reserve(m_pLaneStorage->size()); 00120 copy(m_pLaneStorage->begin(), m_pLaneStorage->end(), back_inserter(*lanes)); 00121 if (m_pLaneStorage->size()==1) { 00122 m_iNoSingle++; 00123 } else { 00124 m_iNoMulti++; 00125 } 00126 m_pLaneStorage->clear(); 00127 myActiveEdge->initialize(m_pDepartLane, lanes, m_Function); 00128 return myActiveEdge; 00129 }
| NLEdgeControlBuilder& NLEdgeControlBuilder::operator= | ( | const NLEdgeControlBuilder & | s | ) | [private] |
invalidated assignment operator
the function of the current edge
Definition at line 147 of file NLEdgeControlBuilder.h.
Referenced by addLane(), GUIEdgeControlBuilder::addLane(), beginEdgeParsing(), and closeEdge().
unsigned int NLEdgeControlBuilder::m_iNoMulti [protected] |
number of multi-lane-edges
Definition at line 144 of file NLEdgeControlBuilder.h.
Referenced by closeEdge(), and NLEdgeControlBuilder().
unsigned int NLEdgeControlBuilder::m_iNoSingle [protected] |
number of single-lane-edges
Definition at line 141 of file NLEdgeControlBuilder.h.
Referenced by closeEdge(), and NLEdgeControlBuilder().
MSLane* NLEdgeControlBuilder::m_pDepartLane [protected] |
pointer to the depart lane
Definition at line 138 of file NLEdgeControlBuilder.h.
Referenced by addLane(), GUIEdgeControlBuilder::addLane(), beginEdgeParsing(), closeEdge(), and NLEdgeControlBuilder().
std::vector<MSLane*>* NLEdgeControlBuilder::m_pLaneStorage [protected] |
pointer to a temporary lane storage
Definition at line 135 of file NLEdgeControlBuilder.h.
Referenced by addLane(), GUIEdgeControlBuilder::addLane(), closeEdge(), NLEdgeControlBuilder(), and ~NLEdgeControlBuilder().
MSEdge* NLEdgeControlBuilder::myActiveEdge [protected] |
pointer to the currently chosen edge
Definition at line 132 of file NLEdgeControlBuilder.h.
Referenced by addLane(), GUIEdgeControlBuilder::addLane(), beginEdgeParsing(), closeEdge(), and NLEdgeControlBuilder().
unsigned int NLEdgeControlBuilder::myCurrentNumericalEdgeID [protected] |
A running number for edge numbering.
Definition at line 126 of file NLEdgeControlBuilder.h.
Referenced by buildEdge(), and GUIEdgeControlBuilder::buildEdge().
unsigned int NLEdgeControlBuilder::myCurrentNumericalLaneID [protected] |
A running number for lane numbering.
Definition at line 123 of file NLEdgeControlBuilder.h.
Referenced by addLane(), and GUIEdgeControlBuilder::addLane().
EdgeCont NLEdgeControlBuilder::myEdges [protected] |
Temporary, internal storage for built edges.
Definition at line 129 of file NLEdgeControlBuilder.h.
Referenced by beginEdgeParsing(), and build().
1.5.6