#include <GUIEdgeControlBuilder.h>

Instead of building pure microsim-objects (MSEdge and MSLane), this class builds GUIEdges and GUILanes.
Definition at line 56 of file GUIEdgeControlBuilder.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) |
| Builds the lane to add. | |
| void | beginEdgeParsing (const std::string &id, MSEdge::EdgeBasicFunction function) throw (InvalidArgument) |
| MSEdgeControl * | build () |
| builds the MSEdgeControl-class which holds all edges | |
| MSEdge * | buildEdge (const std::string &id) throw () |
| Builds an edge instance (GUIEdge in this case). | |
| MSEdge * | closeEdge () |
| Closes the building of an edge; The edge is completely described by now and may not be opened again. | |
| GUIEdgeControlBuilder (GUIGlObjectStorage &glObjectIDStorage) throw () | |
| Constructor. | |
| ~GUIEdgeControlBuilder () throw () | |
| 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 | |
| GUIEdgeControlBuilder (const GUIEdgeControlBuilder &s) | |
| invalidated copy constructor | |
| GUIEdgeControlBuilder & | operator= (const GUIEdgeControlBuilder &s) |
| invalidated assignment operator | |
Private Attributes | |
| GUIGlObjectStorage & | myGlObjectIDStorage |
| The gl-object id giver. | |
typedef std::vector<MSEdge*> NLEdgeControlBuilder::EdgeCont [inherited] |
| GUIEdgeControlBuilder::GUIEdgeControlBuilder | ( | GUIGlObjectStorage & | glObjectIDStorage | ) | throw () |
Constructor.
| [in] | glObjectIDStorage | Storage of gl-ids used to assign new ids to built edges |
Definition at line 52 of file GUIEdgeControlBuilder.cpp.
00053 : NLEdgeControlBuilder(), 00054 myGlObjectIDStorage(glObjectIDStorage) {}
| GUIEdgeControlBuilder::~GUIEdgeControlBuilder | ( | ) | throw () |
| GUIEdgeControlBuilder::GUIEdgeControlBuilder | ( | const GUIEdgeControlBuilder & | s | ) | [private] |
invalidated copy constructor
| MSLane * GUIEdgeControlBuilder::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] |
Builds the lane to add.
Reimplemented from NLEdgeControlBuilder.
Definition at line 69 of file GUIEdgeControlBuilder.cpp.
References MSEdge::EDGEFUNCTION_CONNECTOR, MSEdge::EDGEFUNCTION_INTERNAL, MSEdge::EDGEFUNCTION_NORMAL, NLEdgeControlBuilder::m_Function, NLEdgeControlBuilder::m_pDepartLane, NLEdgeControlBuilder::m_pLaneStorage, NLEdgeControlBuilder::myActiveEdge, NLEdgeControlBuilder::myCurrentNumericalLaneID, and toString().
00073 { 00074 // checks if the depart lane was set before 00075 if (isDepart&&m_pDepartLane!=0) { 00076 throw InvalidArgument("Lane's '" + id + "' edge already has a depart lane."); 00077 } 00078 MSLane *lane = 0; 00079 switch (m_Function) { 00080 case MSEdge::EDGEFUNCTION_INTERNAL: 00081 lane = new GUIInternalLane(id, maxSpeed, length, myActiveEdge, 00082 myCurrentNumericalLaneID++, shape, allowed, disallowed); 00083 break; 00084 case MSEdge::EDGEFUNCTION_NORMAL: 00085 case MSEdge::EDGEFUNCTION_CONNECTOR: 00086 lane = new GUILane(id, maxSpeed, length, myActiveEdge, 00087 myCurrentNumericalLaneID++, shape, allowed, disallowed); 00088 break; 00089 default: 00090 throw InvalidArgument("A lane with an unknown type occured (" + toString(m_Function) + ")"); 00091 } 00092 m_pLaneStorage->push_back(lane); 00093 if (isDepart) { 00094 m_pDepartLane = lane; 00095 } 00096 return lane; 00097 }
| void NLEdgeControlBuilder::beginEdgeParsing | ( | const std::string & | id, | |
| MSEdge::EdgeBasicFunction | function | |||
| ) | throw (InvalidArgument) [inherited] |
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 NLEdgeControlBuilder::buildEdge(), MSEdge::dictionary(), NLEdgeControlBuilder::m_Function, NLEdgeControlBuilder::m_pDepartLane, NLEdgeControlBuilder::myActiveEdge, and NLEdgeControlBuilder::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 | ( | ) | [inherited] |
builds the MSEdgeControl-class which holds all edges
Definition at line 133 of file NLEdgeControlBuilder.cpp.
References OptionsCont::getOptions(), and NLEdgeControlBuilder::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 * GUIEdgeControlBuilder::buildEdge | ( | const std::string & | id | ) | throw () [virtual] |
Builds an edge instance (GUIEdge in this case).
Builds an GUIEdge-instance using the given name, the current index "myCurrentNumericalEdgeID" and the gl-id storage ("myGlObjectIDStorage"). Post-increments the index, returns the built edge.
| [in] | id | The id of the edge to build |
Reimplemented from NLEdgeControlBuilder.
Definition at line 102 of file GUIEdgeControlBuilder.cpp.
References NLEdgeControlBuilder::myCurrentNumericalEdgeID, and myGlObjectIDStorage.
00102 { 00103 return new GUIEdge(id, myCurrentNumericalEdgeID++, myGlObjectIDStorage); 00104 }
| MSEdge * GUIEdgeControlBuilder::closeEdge | ( | ) | [virtual] |
Closes the building of an edge; The edge is completely described by now and may not be opened again.
Reimplemented from NLEdgeControlBuilder.
Definition at line 61 of file GUIEdgeControlBuilder.cpp.
References NLEdgeControlBuilder::closeEdge(), and GUIGlObjectStorage::gIDStorage.
00061 { 00062 MSEdge *ret = NLEdgeControlBuilder::closeEdge(); 00063 static_cast<GUIEdge*>(ret)->initGeometry(GUIGlObjectStorage::gIDStorage); 00064 return ret; 00065 }
| GUIEdgeControlBuilder& GUIEdgeControlBuilder::operator= | ( | const GUIEdgeControlBuilder & | s | ) | [private] |
invalidated assignment operator
MSEdge::EdgeBasicFunction NLEdgeControlBuilder::m_Function [protected, inherited] |
the function of the current edge
Definition at line 147 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::addLane(), addLane(), NLEdgeControlBuilder::beginEdgeParsing(), and NLEdgeControlBuilder::closeEdge().
unsigned int NLEdgeControlBuilder::m_iNoMulti [protected, inherited] |
number of multi-lane-edges
Definition at line 144 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::closeEdge(), and NLEdgeControlBuilder::NLEdgeControlBuilder().
unsigned int NLEdgeControlBuilder::m_iNoSingle [protected, inherited] |
number of single-lane-edges
Definition at line 141 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::closeEdge(), and NLEdgeControlBuilder::NLEdgeControlBuilder().
MSLane* NLEdgeControlBuilder::m_pDepartLane [protected, inherited] |
pointer to the depart lane
Definition at line 138 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::addLane(), addLane(), NLEdgeControlBuilder::beginEdgeParsing(), NLEdgeControlBuilder::closeEdge(), and NLEdgeControlBuilder::NLEdgeControlBuilder().
std::vector<MSLane*>* NLEdgeControlBuilder::m_pLaneStorage [protected, inherited] |
pointer to a temporary lane storage
Definition at line 135 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::addLane(), addLane(), NLEdgeControlBuilder::closeEdge(), NLEdgeControlBuilder::NLEdgeControlBuilder(), and NLEdgeControlBuilder::~NLEdgeControlBuilder().
MSEdge* NLEdgeControlBuilder::myActiveEdge [protected, inherited] |
pointer to the currently chosen edge
Definition at line 132 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::addLane(), addLane(), NLEdgeControlBuilder::beginEdgeParsing(), NLEdgeControlBuilder::closeEdge(), and NLEdgeControlBuilder::NLEdgeControlBuilder().
unsigned int NLEdgeControlBuilder::myCurrentNumericalEdgeID [protected, inherited] |
A running number for edge numbering.
Definition at line 126 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::buildEdge(), and buildEdge().
unsigned int NLEdgeControlBuilder::myCurrentNumericalLaneID [protected, inherited] |
A running number for lane numbering.
Definition at line 123 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::addLane(), and addLane().
EdgeCont NLEdgeControlBuilder::myEdges [protected, inherited] |
Temporary, internal storage for built edges.
Definition at line 129 of file NLEdgeControlBuilder.h.
Referenced by NLEdgeControlBuilder::beginEdgeParsing(), and NLEdgeControlBuilder::build().
The gl-object id giver.
Definition at line 92 of file GUIEdgeControlBuilder.h.
Referenced by buildEdge().
1.5.6