#include <MSRouteHandler.h>

MSRouteHandler is the container for routes while they are build until their transfering to the MSNet::RouteDict The result of the operations are single MSNet::Route-instances
Definition at line 58 of file MSRouteHandler.h.
Public Member Functions | |
| void | characters (const XMLCh *const chars, const XERCES3_SIZE_t length) |
| The inherited method called when characters occured. | |
| void | endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) |
| The inherited method called when a tag is being closed. | |
| const std::string & | getFileName () const throw () |
| returns the current file name | |
| SUMOTime | getLastDepart () const |
| Returns the last loaded depart time. | |
| MSRouteHandler (const std::string &file, bool addVehiclesDirectly) | |
| standard constructor | |
| void | registerParent (const SumoXMLTag tag, GenericSAXHandler *handler) |
| Assigning a parent handler which is enabled when the specified tag is closed. | |
| void | retrieveLastReadVehicle (MSEmitControl *into) |
| Returns the last loaded vehicle. | |
| void | setFileName (const std::string &name) throw () |
| Sets the current file name. | |
| void | startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs) |
| The inherited method called when a new tag opens. | |
| virtual | ~MSRouteHandler () throw () |
| standard destructor | |
SAX ErrorHandler callbacks | |
| void | error (const SAXParseException &exception) throw (ProcessError) |
| Handler for XML-errors. | |
| void | fatalError (const SAXParseException &exception) throw (ProcessError) |
| Handler for XML-errors. | |
| void | warning (const SAXParseException &exception) throw () |
| Handler for XML-warnings. | |
Protected Member Functions | |
| std::string | buildErrorMessage (const SAXParseException &exception) throw () |
| Builds an error message. | |
| void | closeFlow () throw (ProcessError) |
| Ends the processing of a flow. | |
| void | closePerson () throw (ProcessError) |
| Ends the processing of a person. | |
| void | closeRoute () throw (ProcessError) |
| void | closeRouteDistribution () |
| void | closeVehicle () throw (ProcessError) |
| Ends the processing of a vehicle. | |
| void | closeVehicleTypeDistribution () |
| void | openRoute (const SUMOSAXAttributes &attrs) |
| void | openRouteDistribution (const SUMOSAXAttributes &attrs) |
| void | openVehicleTypeDistribution (const SUMOSAXAttributes &attrs) |
inherited from GenericSAXHandler | |
| virtual void | myCharacters (SumoXMLTag element, const std::string &chars) throw (ProcessError) |
| Called when characters occure. | |
| virtual void | myEndElement (SumoXMLTag element) throw (ProcessError) |
| Called when a closing tag occurs. | |
| virtual void | myStartElement (SumoXMLTag element, const SUMOSAXAttributes &attrs) throw (ProcessError) |
| Called on the opening of a tag;. | |
Protected Attributes | |
| MSPerson::MSPersonPlan * | myActivePlan |
| the plan of the current person | |
| MSEdgeVector | myActiveRoute |
| the current route | |
| RGBColor | myActiveRouteColor |
| The currently parsed route's color. | |
| std::string | myActiveRouteID |
| the id of the current route | |
| SUMOReal | myActiveRouteProbability |
| the id of the current route | |
| std::vector < SUMOVehicleParameter::Stop > | myActiveRouteStops |
| List of the stops on the parsed route. | |
| bool | myAddVehiclesDirectly |
| bool | myAmUsingIncrementalDUA |
| Information whether not all vehicle shall be emitted due to inc-dua. | |
| RandomDistributor< const MSRoute * > * | myCurrentRouteDistribution |
| The currently parsed distribution of routes (probability->route). | |
| std::string | myCurrentRouteDistributionID |
| The id of the currently parsed route distribution. | |
| SUMOVTypeParameter * | myCurrentVType |
| The currently parsed vehicle type. | |
| RandomDistributor < MSVehicleType * > * | myCurrentVTypeDistribution |
| The currently parsed distribution of vehicle types (probability->vehicle type). | |
| std::string | myCurrentVTypeDistributionID |
| The id of the currently parsed vehicle type distribution. | |
| bool | myHaveWarned |
| whether we have warned about routes defined as character strings | |
| int | myIncrementalBase |
| The base for inc-dua. | |
| int | myIncrementalStage |
| The current stage of inc-dua. | |
| SUMOTime | myLastDepart |
| the emission time of the vehicle read last | |
| MSVehicle * | myLastReadVehicle |
| the last vehicle read | |
| unsigned int | myRunningVehicleNumber |
| The current vehicle number (for inc-dua). | |
| SUMOVehicleParameter * | myVehicleParameter |
Private Member Functions | |
| MSRouteHandler (const MSRouteHandler &s) | |
| MSRouteHandler & | operator= (const MSRouteHandler &s) |
| MSRouteHandler::MSRouteHandler | ( | const std::string & | file, | |
| bool | addVehiclesDirectly | |||
| ) |
standard constructor
Definition at line 62 of file MSRouteHandler.cpp.
References OptionsCont::getInt(), OptionsCont::getOptions(), myActiveRoute, myAmUsingIncrementalDUA, myIncrementalBase, and myIncrementalStage.
00064 : SUMOSAXHandler(file), myVehicleParameter(0), 00065 myLastDepart(0), myLastReadVehicle(0), 00066 myAddVehiclesDirectly(addVehiclesDirectly), 00067 myRunningVehicleNumber(0), 00068 myCurrentVTypeDistribution(0), 00069 myCurrentRouteDistribution(0), 00070 myHaveWarned(false), myCurrentVType(0) { 00071 myIncrementalBase = OptionsCont::getOptions().getInt("incremental-dua-base"); 00072 myIncrementalStage = OptionsCont::getOptions().getInt("incremental-dua-step"); 00073 myAmUsingIncrementalDUA = (myIncrementalStage>0); 00074 myActiveRoute.reserve(100); 00075 }
| MSRouteHandler::~MSRouteHandler | ( | ) | throw () [virtual] |
standard destructor
Definition at line 78 of file MSRouteHandler.cpp.
References myVehicleParameter.
00078 { 00079 delete myVehicleParameter; 00080 }
| MSRouteHandler::MSRouteHandler | ( | const MSRouteHandler & | s | ) | [private] |
invalid copy constructor
| std::string SUMOSAXHandler::buildErrorMessage | ( | const SAXParseException & | exception | ) | throw () [protected, inherited] |
Builds an error message.
The error message includes the file name and the line/column information as supported by the given SAXParseException
| [in] | exception | The name of the currently processed file |
Definition at line 55 of file SUMOSAXHandler.cpp.
References GenericSAXHandler::getFileName().
Referenced by SUMOSAXHandler::error(), SUMOSAXHandler::fatalError(), and SUMOSAXHandler::warning().
00055 { 00056 std::ostringstream buf; 00057 char *pMsg = XMLString::transcode(exception.getMessage()); 00058 buf << pMsg << std::endl; 00059 buf << " In file '" << getFileName() << "'" << std::endl; 00060 buf << " At line/column " << exception.getLineNumber()+1 00061 << '/' << exception.getColumnNumber() << "." << std::endl; 00062 XMLString::release(&pMsg); 00063 return buf.str(); 00064 }
| void GenericSAXHandler::characters | ( | const XMLCh *const | chars, | |
| const XERCES3_SIZE_t | length | |||
| ) | [inherited] |
The inherited method called when characters occured.
The retrieved characters are converted into a string and appended into a private buffer. They are reported as soon as the element ends.
Definition at line 168 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myCharactersVector.
00169 { 00170 myCharactersVector.push_back(TplConvert<XMLCh>::_2str(chars, length)); 00171 }
| void MSRouteHandler::closeFlow | ( | ) | throw (ProcessError) [protected] |
Ends the processing of a flow.
Definition at line 590 of file MSRouteHandler.cpp.
References MSEmitControl::add(), SUMOVehicleParameter::depart, MSRoute::dictionary(), MSNet::getEmitControl(), MSNet::getInstance(), OptionsCont::getOptions(), SUMOVehicleParameter::id, myActiveRouteID, myAddVehiclesDirectly, myVehicleParameter, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::repetitionsDone, SUMOVehicleParameter::routeid, string2time(), SUMOReal, and SUMOVehicleParameter::vtypeid.
Referenced by myEndElement().
00590 { 00591 // let's check whether vehicles had to be emitted before the simulation starts 00592 myVehicleParameter->repetitionsDone = 0; 00593 SUMOReal offsetToBegin = string2time(OptionsCont::getOptions().getString("begin")) - myVehicleParameter->depart; 00594 while (myVehicleParameter->repetitionsDone * myVehicleParameter->repetitionOffset < offsetToBegin) { 00595 myVehicleParameter->repetitionsDone++; 00596 if (myVehicleParameter->repetitionsDone == myVehicleParameter->repetitionNumber) { 00597 return; 00598 } 00599 } 00600 if (MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid)==0) { 00601 throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); 00602 } 00603 if (MSRoute::dictionary("!" + myVehicleParameter->id)==0) { 00604 // if not, try via the (hopefully) given route-id 00605 if (MSRoute::dictionary(myVehicleParameter->routeid) == 0) { 00606 if (myVehicleParameter->routeid!="") { 00607 throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); 00608 } else { 00609 throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route."); 00610 } 00611 } 00612 } else { 00613 myVehicleParameter->routeid = "!" + myVehicleParameter->id; 00614 } 00615 myActiveRouteID = ""; 00616 00617 // check whether the vehicle shall be added directly to the network or 00618 // shall stay in the internal buffer 00619 if (myAddVehiclesDirectly) { 00620 MSNet::getInstance()->getEmitControl().add(myVehicleParameter); 00621 myVehicleParameter = 0; 00622 } 00623 }
| void MSRouteHandler::closePerson | ( | ) | throw (ProcessError) [protected] |
Ends the processing of a person.
Definition at line 579 of file MSRouteHandler.cpp.
References SUMOVehicleParameter::depart, MSNet::getInstance(), MSNet::getPersonControl(), SUMOVehicleParameter::id, myActivePlan, myVehicleParameter, and MSPersonControl::setArrival().
Referenced by myEndElement().
00579 { 00580 MSPerson *person = new MSPerson(myVehicleParameter, myActivePlan); 00581 if (MSNet::getInstance()->getPersonControl().add(myVehicleParameter->id, person)) { 00582 MSNet::getInstance()->getPersonControl().setArrival(myVehicleParameter->depart, person); 00583 } 00584 myVehicleParameter = 0; 00585 myActivePlan = 0; 00586 }
| void MSRouteHandler::closeRoute | ( | ) | throw (ProcessError) [protected] |
closes (ends) the building of a route. Afterwards no edges may be added to it; this method may throw exceptions when a) the route is empty or b) another route with the same id already exists
Definition at line 419 of file MSRouteHandler.cpp.
References RandomDistributor< T >::add(), MSRoute::dictionary(), MSNet::getInstance(), SUMOVehicleParameter::id, myActiveRoute, myActiveRouteColor, myActiveRouteID, myActiveRouteProbability, myActiveRouteStops, myCurrentRouteDistribution, myVehicleParameter, and SUMOVehicleParameter::repetitionNumber.
Referenced by myEndElement(), and myStartElement().
00419 { 00420 if (myActiveRoute.size()==0) { 00421 if (myVehicleParameter!=0) { 00422 throw ProcessError("Vehicle's '" + myVehicleParameter->id + "' route has no edges."); 00423 } else { 00424 throw ProcessError("Route '" + myActiveRouteID + "' has no edges."); 00425 } 00426 } 00427 MSRoute *route = new MSRoute(myActiveRouteID, myActiveRoute, 00428 myVehicleParameter==0||myVehicleParameter->repetitionNumber>=1, 00429 myActiveRouteColor, myActiveRouteStops); 00430 myActiveRoute.clear(); 00431 if (!MSRoute::dictionary(myActiveRouteID, route)) { 00432 delete route; 00433 #ifdef HAVE_MESOSIM 00434 if (!MSGlobals::gStateLoaded) { 00435 #endif 00436 if (myVehicleParameter!=0) { 00437 if (MSNet::getInstance()->getVehicleControl().getVehicle(myVehicleParameter->id)==0) { 00438 throw ProcessError("Another route for vehicle '" + myVehicleParameter->id + "' exists."); 00439 } else { 00440 throw ProcessError("A vehicle with id '" + myVehicleParameter->id + "' already exists."); 00441 } 00442 } else { 00443 throw ProcessError("Another route (or distribution) with the id '" + myActiveRouteID + "' exists."); 00444 } 00445 #ifdef HAVE_MESOSIM 00446 } 00447 #endif 00448 } else { 00449 if (myCurrentRouteDistribution != 0) { 00450 myCurrentRouteDistribution->add(myActiveRouteProbability, route); 00451 } 00452 } 00453 myActiveRouteID = ""; 00454 myActiveRouteStops.clear(); 00455 }
| void MSRouteHandler::closeRouteDistribution | ( | ) | [protected] |
closes (ends) the building of a distribution
Definition at line 479 of file MSRouteHandler.cpp.
References MSRoute::dictionary(), MsgHandler::getErrorInstance(), RandomDistributor< T >::getOverallProb(), MsgHandler::inform(), myCurrentRouteDistribution, and myCurrentRouteDistributionID.
Referenced by myEndElement().
00479 { 00480 if (myCurrentRouteDistribution != 0) { 00481 if (myCurrentRouteDistribution->getOverallProb() == 0) { 00482 delete myCurrentRouteDistribution; 00483 MsgHandler::getErrorInstance()->inform("Route distribution '" + myCurrentRouteDistributionID + "' is empty."); 00484 } else if (!MSRoute::dictionary(myCurrentRouteDistributionID, myCurrentRouteDistribution)) { 00485 delete myCurrentRouteDistribution; 00486 MsgHandler::getErrorInstance()->inform("Another route (or distribution) with the id '" + myCurrentRouteDistributionID + "' exists."); 00487 } 00488 myCurrentRouteDistribution = 0; 00489 } 00490 }
| void MSRouteHandler::closeVehicle | ( | ) | throw (ProcessError) [protected] |
Ends the processing of a vehicle.
Definition at line 494 of file MSRouteHandler.cpp.
References MSEmitControl::add(), MSVehicleControl::addVehicle(), MSVehicleControl::addWaiting(), MSRoute::begin(), MSVehicleControl::buildVehicle(), SUMOVehicleParameter::depart, DEPART_GIVEN, DEPART_TRIGGERED, SUMOVehicleParameter::departProcedure, MSRoute::dictionary(), MSNet::getEmitControl(), MSNet::getInstance(), OptionsCont::getOptions(), MSVehicle::getParameter(), MSNet::getVehicleControl(), MSVehicleControl::getVType(), SUMOVehicleParameter::id, myActiveRouteID, myAddVehiclesDirectly, myAmUsingIncrementalDUA, myIncrementalBase, myIncrementalStage, myLastDepart, myLastReadVehicle, myRunningVehicleNumber, myVehicleParameter, SUMOVehicleParameter::routeid, string2time(), and SUMOVehicleParameter::vtypeid.
Referenced by myEndElement(), and myStartElement().
00494 { 00495 if (myVehicleParameter->departProcedure == DEPART_GIVEN) { 00496 myLastDepart = myVehicleParameter->depart; 00497 // let's check whether this vehicle had to be emitted before the simulation starts 00498 if (myVehicleParameter->depart<string2time(OptionsCont::getOptions().getString("begin"))) { 00499 return; 00500 } 00501 } 00502 // get the vehicle's type 00503 MSVehicleType *vtype = 0; 00504 if (myVehicleParameter->vtypeid!="") { 00505 vtype = MSNet::getInstance()->getVehicleControl().getVType(myVehicleParameter->vtypeid); 00506 if (vtype==0) { 00507 throw ProcessError("The vehicle type '" + myVehicleParameter->vtypeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); 00508 } 00509 } else { 00510 // there should be one (at least the default one) 00511 vtype = MSNet::getInstance()->getVehicleControl().getVType(); 00512 } 00513 // get the vehicle's route 00514 // maybe it was explicitely assigned to the vehicle 00515 const MSRoute *route = MSRoute::dictionary("!" + myVehicleParameter->id); 00516 if (route==0) { 00517 // if not, try via the (hopefully) given route-id 00518 route = MSRoute::dictionary(myVehicleParameter->routeid); 00519 } 00520 if (route==0) { 00521 // nothing found? -> error 00522 if (myVehicleParameter->routeid!="") { 00523 throw ProcessError("The route '" + myVehicleParameter->routeid + "' for vehicle '" + myVehicleParameter->id + "' is not known."); 00524 } else { 00525 throw ProcessError("Vehicle '" + myVehicleParameter->id + "' has no route."); 00526 } 00527 } 00528 myActiveRouteID = ""; 00529 00530 // try to build the vehicle 00531 MSVehicle *vehicle = 0; 00532 if (MSNet::getInstance()->getVehicleControl().getVehicle(myVehicleParameter->id)==0) { 00533 // ok there was no other vehicle with the same id, yet 00534 // maybe we do not want this vehicle to be emitted due to using incremental dua 00535 bool add = true; 00536 if (myAmUsingIncrementalDUA) { 00537 if ((int)(myRunningVehicleNumber%myIncrementalBase)>=(int) myIncrementalStage) { 00538 add = false; 00539 } 00540 myRunningVehicleNumber++; 00541 } 00542 if (add) { 00543 vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(myVehicleParameter, route, vtype); 00544 // add the vehicle to the vehicle control 00545 MSNet::getInstance()->getVehicleControl().addVehicle(myVehicleParameter->id, vehicle); 00546 if (myVehicleParameter->departProcedure == DEPART_TRIGGERED) { 00547 MSNet::getInstance()->getVehicleControl().addWaiting(*route->begin(), vehicle); 00548 } 00549 myVehicleParameter = 0; 00550 } 00551 } else { 00552 // strange: another vehicle with the same id already exists 00553 #ifdef HAVE_MESOSIM 00554 if (!MSGlobals::gStateLoaded) { 00555 #endif 00556 // and was not loaded while loading a simulation state 00557 // -> error 00558 throw ProcessError("Another vehicle with the id '" + myVehicleParameter->id + "' exists."); 00559 #ifdef HAVE_MESOSIM 00560 } else { 00561 // ok, it seems to be loaded previously while loading a simulation state 00562 vehicle = 0; 00563 } 00564 #endif 00565 } 00566 // check whether the vehicle shall be added directly to the network or 00567 // shall stay in the internal buffer 00568 if (myAddVehiclesDirectly&&vehicle!=0) { 00569 if (vehicle->getParameter().departProcedure == DEPART_GIVEN) { 00570 MSNet::getInstance()->getEmitControl().add(vehicle); 00571 } 00572 } else { 00573 myLastReadVehicle = vehicle; 00574 } 00575 }
| void MSRouteHandler::closeVehicleTypeDistribution | ( | ) | [protected] |
closes (ends) the building of a distribution
Definition at line 293 of file MSRouteHandler.cpp.
References MsgHandler::getErrorInstance(), MSNet::getInstance(), RandomDistributor< T >::getOverallProb(), MsgHandler::inform(), myCurrentVTypeDistribution, and myCurrentVTypeDistributionID.
Referenced by myEndElement().
00293 { 00294 if (myCurrentVTypeDistribution != 0) { 00295 if (myCurrentVTypeDistribution->getOverallProb() == 0) { 00296 delete myCurrentVTypeDistribution; 00297 MsgHandler::getErrorInstance()->inform("Vehicle type distribution '" + myCurrentVTypeDistributionID + "' is empty."); 00298 } else if (!MSNet::getInstance()->getVehicleControl().addVTypeDistribution(myCurrentVTypeDistributionID, myCurrentVTypeDistribution)) { 00299 delete myCurrentVTypeDistribution; 00300 MsgHandler::getErrorInstance()->inform("Another vehicle type (or distribution) with the id '" + myCurrentVTypeDistributionID + "' exists."); 00301 } 00302 myCurrentVTypeDistribution = 0; 00303 } 00304 }
| void GenericSAXHandler::endElement | ( | const XMLCh *const | uri, | |
| const XMLCh *const | localname, | |||
| const XMLCh *const | qname | |||
| ) | [inherited] |
The inherited method called when a tag is being closed.
This method calls the user-implemented methods myCharacters with the previously collected and converted characters.
Then, myEndElement is called, supplying it the qname converted to its enum- and string-representations.
Definition at line 118 of file GenericSAXHandler.cpp.
References TplConvert< E >::_2str(), GenericSAXHandler::convertTag(), GenericSAXHandler::myCharacters(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myEndElement(), GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, XMLSubSys::setHandler(), SUMO_TAG_INCLUDE, and SUMO_TAG_NOTHING.
00120 { 00121 std::string name = TplConvert<XMLCh>::_2str(qname); 00122 SumoXMLTag element = convertTag(name); 00123 // collect characters 00124 if (myCharactersVector.size()!=0) { 00125 size_t len = 0; 00126 unsigned i; 00127 for (i=0; i<myCharactersVector.size(); ++i) { 00128 len += myCharactersVector[i].length(); 00129 } 00130 char *buf = new char[len+1]; 00131 size_t pos = 0; 00132 for (i=0; i<myCharactersVector.size(); ++i) { 00133 memcpy((unsigned char*) buf+pos, (unsigned char*) myCharactersVector[i].c_str(), 00134 sizeof(char)*myCharactersVector[i].length()); 00135 pos += myCharactersVector[i].length(); 00136 } 00137 buf[pos] = 0; 00138 00139 // call user handler 00140 try { 00141 myCharacters(element, buf); 00142 } catch (std::runtime_error &) { 00143 delete[] buf; 00144 throw; 00145 } 00146 delete[] buf; 00147 } 00148 if (element != SUMO_TAG_INCLUDE) { 00149 myEndElement(element); 00150 if (myParentHandler && myParentIndicator == element) { 00151 XMLSubSys::setHandler(*myParentHandler); 00152 myParentIndicator = SUMO_TAG_NOTHING; 00153 myParentHandler = 0; 00154 } 00155 } 00156 }
| void SUMOSAXHandler::error | ( | const SAXParseException & | exception | ) | throw (ProcessError) [inherited] |
Handler for XML-errors.
The message is built using buildErrorMessage and thrown within a ProcessError.
| [in] | exception | The occured exception to process |
| ProcessError | On any call |
Definition at line 74 of file SUMOSAXHandler.cpp.
References SUMOSAXHandler::buildErrorMessage().
00074 { 00075 throw ProcessError(buildErrorMessage(exception)); 00076 }
| void SUMOSAXHandler::fatalError | ( | const SAXParseException & | exception | ) | throw (ProcessError) [inherited] |
Handler for XML-errors.
The message is built using buildErrorMessage and thrown within a ProcessError.
| ProcessError | On any call |
| [in] | exception | The occured exception to process |
Definition at line 80 of file SUMOSAXHandler.cpp.
References SUMOSAXHandler::buildErrorMessage().
00080 { 00081 throw ProcessError(buildErrorMessage(exception)); 00082 }
| const std::string & GenericSAXHandler::getFileName | ( | ) | const throw () [inherited] |
returns the current file name
Definition at line 78 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myFileName.
Referenced by NLHandler::addE1Detector(), NLHandler::addE2Detector(), NLHandler::addEdgeLaneMeanData(), NLHandler::addRouteProbeDetector(), NLHandler::addSource(), NLHandler::addTrigger(), NLHandler::addVTypeProbeDetector(), NLHandler::beginE3Detector(), SUMOSAXHandler::buildErrorMessage(), MSRouteLoader::init(), PCNetProjectionLoader::loadIfSet(), NILoader::loadXMLType(), MSTriggeredXMLReader::myInit(), RODFDetectorHandler::myStartElement(), NLHandler::myStartElement(), NIImporter_OpenDrive::myStartElement(), MSLaneSpeedTrigger::myStartElement(), GUISettingsHandler::myStartElement(), RORDGenerator_ODAmounts::RORDGenerator_ODAmounts(), and GenericSAXHandler::startElement().
00078 { 00079 return myFileName; 00080 }
| SUMOTime MSRouteHandler::getLastDepart | ( | ) | const |
Returns the last loaded depart time.
Definition at line 84 of file MSRouteHandler.cpp.
References myLastDepart.
Referenced by MSRouteLoader::loadUntil().
00084 { 00085 return myLastDepart; 00086 }
| void MSRouteHandler::myCharacters | ( | SumoXMLTag | element, | |
| const std::string & | chars | |||
| ) | throw (ProcessError) [protected, virtual] |
Called when characters occure.
| [in] | element | ID of the last opened element |
| [in] | chars | The read characters (complete) |
| ProcessError | If something fails |
Reimplemented from GenericSAXHandler.
Reimplemented in NLHandler.
Definition at line 334 of file MSRouteHandler.cpp.
References MsgHandler::getWarningInstance(), MsgHandler::inform(), myActiveRoute, myActiveRouteID, myHaveWarned, MSEdge::parseEdgesList(), and SUMO_TAG_ROUTE.
Referenced by NLHandler::myCharacters().
00335 { 00336 switch (element) { 00337 case SUMO_TAG_ROUTE: { 00338 size_t len = chars.length(); 00339 size_t beg = 0; 00340 while (beg<len&&chars[beg]<=32) { 00341 beg++; 00342 } 00343 if (beg<len) { 00344 if (!myHaveWarned) { 00345 MsgHandler::getWarningInstance()->inform("Defining routes as a nested string is deprecated, use the edges attribute instead."); 00346 myHaveWarned = true; 00347 } 00348 MSEdge::parseEdgesList(chars, myActiveRoute, myActiveRouteID); 00349 } 00350 break; 00351 } 00352 default: 00353 break; 00354 } 00355 }
| void MSRouteHandler::myEndElement | ( | SumoXMLTag | element | ) | throw (ProcessError) [protected, virtual] |
Called when a closing tag occurs.
| [in] | element | ID of the currently opened element |
| ProcessError | If something fails |
Reimplemented from GenericSAXHandler.
Reimplemented in NLHandler.
Definition at line 361 of file MSRouteHandler.cpp.
References RandomDistributor< T >::add(), MSVehicleType::build(), closeFlow(), closePerson(), closeRoute(), closeRouteDistribution(), closeVehicle(), closeVehicleTypeDistribution(), SUMOVehicleParserHelper::closeVTypeParsing(), MSVehicleType::getDefaultProbability(), MSVehicleType::getID(), MSNet::getInstance(), myCurrentVType, myCurrentVTypeDistribution, myVehicleParameter, SUMOVehicleParameter::repetitionNumber, SUMO_TAG_FLOW, SUMO_TAG_PERSON, SUMO_TAG_ROUTE, SUMO_TAG_ROUTE_DISTRIBUTION, SUMO_TAG_VEHICLE, SUMO_TAG_VTYPE, and SUMO_TAG_VTYPE_DISTRIBUTION.
Referenced by NLHandler::myEndElement().
00361 { 00362 switch (element) { 00363 case SUMO_TAG_ROUTE: 00364 closeRoute(); 00365 break; 00366 case SUMO_TAG_PERSON: 00367 closePerson(); 00368 delete myVehicleParameter; 00369 myVehicleParameter = 0; 00370 break; 00371 case SUMO_TAG_VEHICLE: 00372 if (myVehicleParameter->repetitionNumber>0) { 00373 myVehicleParameter->repetitionNumber++; // for backwards compatibility 00374 // it is a flow, thus no break here 00375 } else { 00376 closeVehicle(); 00377 delete myVehicleParameter; 00378 myVehicleParameter = 0; 00379 break; 00380 } 00381 case SUMO_TAG_FLOW: 00382 closeFlow(); 00383 break; 00384 case SUMO_TAG_VTYPE_DISTRIBUTION: 00385 closeVehicleTypeDistribution(); 00386 break; 00387 case SUMO_TAG_ROUTE_DISTRIBUTION: 00388 closeRouteDistribution(); 00389 break; 00390 case SUMO_TAG_VTYPE: { 00391 SUMOVehicleParserHelper::closeVTypeParsing(*myCurrentVType); 00392 MSVehicleType *vehType = MSVehicleType::build(*myCurrentVType); 00393 delete myCurrentVType; 00394 myCurrentVType = 0; 00395 if (!MSNet::getInstance()->getVehicleControl().addVType(vehType)) { 00396 std::string id = vehType->getID(); 00397 delete vehType; 00398 #ifdef HAVE_MESOSIM 00399 if (!MSGlobals::gStateLoaded) { 00400 #endif 00401 throw ProcessError("Another vehicle type (or distribution) with the id '" + id + "' exists."); 00402 #ifdef HAVE_MESOSIM 00403 } 00404 #endif 00405 } else { 00406 if (myCurrentVTypeDistribution != 0) { 00407 myCurrentVTypeDistribution->add(vehType->getDefaultProbability(), vehType); 00408 } 00409 } 00410 } 00411 break; 00412 default: 00413 break; 00414 } 00415 }
| void MSRouteHandler::myStartElement | ( | SumoXMLTag | element, | |
| const SUMOSAXAttributes & | attrs | |||
| ) | throw (ProcessError) [protected, virtual] |
Called on the opening of a tag;.
| [in] | element | ID of the currently opened element |
| [in] | attrs | Attributes within the currently opened element |
| ProcessError | If something fails |
Reimplemented from GenericSAXHandler.
Reimplemented in NLHandler.
Definition at line 105 of file MSRouteHandler.cpp.
References SUMOVehicleParserHelper::beginVTypeParsing(), SUMOVehicleParameter::Stop::busstop, closeRoute(), closeVehicle(), SUMOVehicleParameter::depart, MSLane::dictionary(), MSEdge::dictionary(), SUMOVehicleParameter::Stop::duration, SUMOVehicleParameter::fromTaz, MSNet::getBusStop(), MSBusStop::getEndLanePosition(), MsgHandler::getErrorInstance(), MSEdge::getFollower(), MSLane::getID(), MSNet::getInstance(), MSBusStop::getLane(), MSEdge::getNoFollowing(), StringTokenizer::getVector(), SUMOVehicleParameter::id, MsgHandler::inform(), SUMOVehicleParameter::Stop::lane, myActivePlan, myActiveRoute, myActiveRouteID, myActiveRouteStops, myCurrentVType, myVehicleParameter, openRoute(), openRouteDistribution(), openVehicleTypeDistribution(), MSEdge::parseEdgesList(), SUMOVehicleParserHelper::parseFlowAttributes(), SUMOVehicleParserHelper::parseVehicleAttributes(), SUMOVehicleParserHelper::parseVTypeEmbedded(), SUMOVehicleParameter::Stop::pos, SUMOVehicleParameter::stops, SUMO_ATTR_BUS_STOP, SUMO_ATTR_DURATION, SUMO_ATTR_EDGES, SUMO_ATTR_FROM, SUMO_ATTR_LANE, SUMO_ATTR_LINES, SUMO_ATTR_POSITION, SUMO_ATTR_SPEED, SUMO_ATTR_TO, SUMO_ATTR_UNTIL, SUMO_TAG_FLOW, SUMO_TAG_PERSON, SUMO_TAG_RIDE, SUMO_TAG_ROUTE, SUMO_TAG_ROUTE_DISTRIBUTION, SUMO_TAG_STOP, SUMO_TAG_TRIPDEF, SUMO_TAG_VEHICLE, SUMO_TAG_VTYPE, SUMO_TAG_VTYPE_DISTRIBUTION, SUMO_TAG_WALK, SUMOReal, SUMOVehicleParameter::Stop::until, VEHPARS_TAZ_SET, SUMOVehicleParameter::wasSet(), and WRITE_ERROR.
Referenced by NLHandler::myStartElement().
00106 { 00107 switch (element) { 00108 case SUMO_TAG_VEHICLE: 00109 delete myVehicleParameter; 00110 myVehicleParameter = SUMOVehicleParserHelper::parseVehicleAttributes(attrs); 00111 break; 00112 case SUMO_TAG_PERSON: 00113 delete myVehicleParameter; 00114 myVehicleParameter = SUMOVehicleParserHelper::parseVehicleAttributes(attrs); 00115 myActivePlan = new MSPerson::MSPersonPlan(); 00116 break; 00117 case SUMO_TAG_RIDE: { 00118 const std::string pid = myVehicleParameter->id; 00119 bool ok = true; 00120 MSEdge *from = 0; 00121 if (attrs.hasAttribute(SUMO_ATTR_FROM)) { 00122 const std::string fromID = attrs.getStringReporting(SUMO_ATTR_FROM, "ride", pid.c_str(), ok); 00123 from = MSEdge::dictionary(fromID); 00124 if (from==0) { 00125 throw ProcessError("The from edge '" + fromID + "' within a ride of person '" + pid + "' is not known."); 00126 } 00127 if (myActivePlan->empty() || &myActivePlan->back()->getDestination() != from) { 00128 myActivePlan->push_back(new MSPerson::MSPersonStage_Waiting(*from, -1, myVehicleParameter->depart)); 00129 } 00130 } 00131 const std::string toID = attrs.getStringReporting(SUMO_ATTR_TO, "ride", pid.c_str(), ok); 00132 MSEdge *to = MSEdge::dictionary(toID); 00133 if (to==0) { 00134 throw ProcessError("The to edge '" + toID + "' within a ride of person '" + pid + "' is not known."); 00135 } 00136 const std::string desc = attrs.getStringReporting(SUMO_ATTR_LINES, "ride", pid.c_str(), ok); 00137 StringTokenizer st(desc); 00138 myActivePlan->push_back(new MSPerson::MSPersonStage_Driving(*to, st.getVector())); 00139 break; 00140 } 00141 case SUMO_TAG_WALK: { 00142 myActiveRoute.clear(); 00143 bool ok = true; 00144 MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_EDGES, "walk", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID); 00145 if (myActiveRoute.empty()) { 00146 throw ProcessError("No edges to walk for person '" + myVehicleParameter->id + "'."); 00147 } 00148 if (myActivePlan->empty() || &myActivePlan->back()->getDestination() != myActiveRoute.front()) { 00149 myActivePlan->push_back(new MSPerson::MSPersonStage_Waiting(*myActiveRoute.front(), -1, myVehicleParameter->depart)); 00150 } 00151 const SUMOTime duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, "walk", 0, ok, -1); 00152 const SUMOReal speed = attrs.getOptSUMORealReporting(SUMO_ATTR_SPEED, "walk", 0, ok, -1); 00153 myActivePlan->push_back(new MSPerson::MSPersonStage_Walking(myActiveRoute, duration, speed)); 00154 myActiveRoute.clear(); 00155 break; 00156 } 00157 case SUMO_TAG_FLOW: 00158 delete myVehicleParameter; 00159 myVehicleParameter = SUMOVehicleParserHelper::parseFlowAttributes(attrs); 00160 if (attrs.hasAttribute(SUMO_ATTR_FROM) && attrs.hasAttribute(SUMO_ATTR_TO)) { 00161 myActiveRouteID = "!" + myVehicleParameter->id; 00162 bool ok = true; 00163 MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_FROM, "flow", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID); 00164 MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_TO, "flow", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID); 00165 closeRoute(); 00166 } 00167 break; 00168 case SUMO_TAG_VTYPE: 00169 myCurrentVType = SUMOVehicleParserHelper::beginVTypeParsing(attrs); 00170 break; 00171 case SUMO_TAG_VTYPE_DISTRIBUTION: 00172 openVehicleTypeDistribution(attrs); 00173 break; 00174 case SUMO_TAG_ROUTE: 00175 openRoute(attrs); 00176 break; 00177 case SUMO_TAG_ROUTE_DISTRIBUTION: 00178 openRouteDistribution(attrs); 00179 break; 00180 case SUMO_TAG_TRIPDEF: { 00181 bool ok = true; 00182 myVehicleParameter = SUMOVehicleParserHelper::parseVehicleAttributes(attrs); 00183 myActiveRouteID = "!" + myVehicleParameter->id; 00184 if (attrs.hasAttribute(SUMO_ATTR_FROM) || !myVehicleParameter->wasSet(VEHPARS_TAZ_SET)) { 00185 MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_FROM, "tripdef", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID); 00186 MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_TO, "tripdef", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID); 00187 } else { 00188 const MSEdge* fromTaz = MSEdge::dictionary(myVehicleParameter->fromTaz+"-source"); 00189 if (fromTaz == 0) { 00190 WRITE_ERROR("Source district '" + myVehicleParameter->fromTaz + "' not known for '" + myVehicleParameter->id + "'!"); 00191 } else if (fromTaz->getNoFollowing() == 0) { 00192 WRITE_ERROR("Source district '" + myVehicleParameter->fromTaz + "' has no outgoing edges for '" + myVehicleParameter->id + "'!"); 00193 } else { 00194 myActiveRoute.push_back(fromTaz->getFollower(0)); 00195 } 00196 } 00197 closeRoute(); 00198 closeVehicle(); 00199 } 00200 break; 00201 default: 00202 break; 00203 } 00204 // parse embedded vtype information 00205 if (myCurrentVType!=0&&element!=SUMO_TAG_VTYPE) { 00206 SUMOVehicleParserHelper::parseVTypeEmbedded(*myCurrentVType, element, attrs); 00207 return; 00208 } 00209 00210 if (element==SUMO_TAG_STOP) { 00211 bool ok = true; 00212 SUMOVehicleParameter::Stop stop; 00213 // try to parse the assigne bus stop 00214 stop.busstop = attrs.getOptStringReporting(SUMO_ATTR_BUS_STOP, "stop", 0, ok, ""); 00215 if (stop.busstop!="") { 00216 // ok, we have obviously a bus stop 00217 MSBusStop *bs = MSNet::getInstance()->getBusStop(stop.busstop); 00218 if (bs!=0) { 00219 const MSLane &l = bs->getLane(); 00220 stop.lane = l.getID(); 00221 stop.pos = bs->getEndLanePosition(); 00222 } else { 00223 MsgHandler::getErrorInstance()->inform("The bus stop '" + stop.busstop + "' is not known."); 00224 return; 00225 } 00226 } else { 00227 // no, the lane and the position should be given 00228 // get the lane 00229 stop.lane = attrs.getOptStringReporting(SUMO_ATTR_LANE, "stop", 0, ok, ""); 00230 if (stop.lane!="") { 00231 if (MSLane::dictionary(stop.lane)==0) { 00232 MsgHandler::getErrorInstance()->inform("The lane '" + stop.lane + "' for a stop is not known."); 00233 return; 00234 } 00235 } else { 00236 MsgHandler::getErrorInstance()->inform("A stop must be placed on a bus stop or a lane."); 00237 return; 00238 } 00239 // get the position 00240 bool ok = true; 00241 stop.pos = attrs.getSUMORealReporting(SUMO_ATTR_POSITION, "stop", 0, ok); 00242 if (!ok) { 00243 return; 00244 } 00245 } 00246 00247 // get the standing duration 00248 if (!attrs.hasAttribute(SUMO_ATTR_DURATION) && !attrs.hasAttribute(SUMO_ATTR_UNTIL)) { 00249 MsgHandler::getErrorInstance()->inform("The duration of a stop is not defined."); 00250 return; 00251 } else { 00252 bool ok = true; 00253 stop.duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, "stop", 0, ok, -1); 00254 stop.until = attrs.getOptSUMOTimeReporting(SUMO_ATTR_UNTIL, "stop", 0, ok, -1); 00255 if (!ok) { 00256 return; 00257 } 00258 if (stop.duration<0&&stop.until<0) { 00259 MsgHandler::getErrorInstance()->inform("Neither the duration nor the end time is given for a stop."); 00260 return; 00261 } 00262 } 00263 if (myActiveRouteID != "") { 00264 myActiveRouteStops.push_back(stop); 00265 } else { 00266 myVehicleParameter->stops.push_back(stop); 00267 } 00268 } 00269 }
| void MSRouteHandler::openRoute | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
opens a route for reading
Definition at line 308 of file MSRouteHandler.cpp.
References DEFAULT_VEH_PROB, RGBColor::getDefaultColor(), SUMOSAXAttributes::getOptSUMORealReporting(), SUMOSAXAttributes::getString(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), SUMOVehicleParameter::id, myActiveRoute, myActiveRouteColor, myActiveRouteID, myActiveRouteProbability, myVehicleParameter, RGBColor::parseColorReporting(), MSEdge::parseEdgesList(), SUMO_ATTR_COLOR, SUMO_ATTR_EDGES, SUMO_ATTR_ID, and SUMO_ATTR_PROB.
Referenced by myStartElement().
00308 { 00309 // check whether the id is really necessary 00310 if (myVehicleParameter!=0) { 00311 // ok, a vehicle is wrapping the route, 00312 // we may use this vehicle's id as default 00313 myActiveRouteID = "!" + myVehicleParameter->id; // !!! document this 00314 } else { 00315 bool ok = true; 00316 myActiveRouteID = attrs.getStringReporting(SUMO_ATTR_ID, "route", 0, ok, false); 00317 if (!ok) { 00318 return; 00319 } 00320 } 00321 bool ok = true; 00322 if (attrs.hasAttribute(SUMO_ATTR_EDGES)) { 00323 MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_EDGES, "route", myActiveRouteID.c_str(), ok), myActiveRoute, myActiveRouteID); 00324 } 00325 myActiveRouteProbability = attrs.getOptSUMORealReporting(SUMO_ATTR_PROB, "route", myActiveRouteID.c_str(), ok, DEFAULT_VEH_PROB); 00326 myActiveRouteColor = attrs.hasAttribute(SUMO_ATTR_COLOR) ? RGBColor::parseColorReporting(attrs.getString(SUMO_ATTR_COLOR), "route", myActiveRouteID.c_str(), true, ok) : RGBColor::getDefaultColor(); 00327 }
| void MSRouteHandler::openRouteDistribution | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
opens a route distribution for reading
Definition at line 459 of file MSRouteHandler.cpp.
References RandomDistributor< T >::add(), MSRoute::dictionary(), SUMOSAXAttributes::getStringReporting(), SUMOSAXAttributes::hasAttribute(), StringTokenizer::hasNext(), myCurrentRouteDistribution, myCurrentRouteDistributionID, StringTokenizer::next(), SUMOSAXAttributes::setIDFromAttributes(), and SUMO_ATTR_ROUTES.
Referenced by myStartElement().
00459 { 00460 if (attrs.setIDFromAttributes("routeDistribution", myCurrentRouteDistributionID)) { 00461 myCurrentRouteDistribution = new RandomDistributor<const MSRoute*>(); 00462 if (attrs.hasAttribute(SUMO_ATTR_ROUTES)) { 00463 bool ok = true; 00464 StringTokenizer st(attrs.getStringReporting(SUMO_ATTR_ROUTES, "routeDistribution", myCurrentRouteDistributionID.c_str(), ok)); 00465 while (st.hasNext()) { 00466 std::string routeID = st.next(); 00467 const MSRoute *route = MSRoute::dictionary(routeID); 00468 if (route==0) { 00469 throw ProcessError("Unknown route '" + routeID + "' in distribution '" + myCurrentRouteDistributionID + "'."); 00470 } 00471 myCurrentRouteDistribution->add(1., route, false); 00472 } 00473 } 00474 } 00475 }
| void MSRouteHandler::openVehicleTypeDistribution | ( | const SUMOSAXAttributes & | attrs | ) | [protected] |
opens a type distribution for reading
Definition at line 273 of file MSRouteHandler.cpp.
References RandomDistributor< T >::add(), MSVehicleType::getDefaultProbability(), MSNet::getInstance(), SUMOSAXAttributes::getStringReporting(), MSNet::getVehicleControl(), MSVehicleControl::getVType(), SUMOSAXAttributes::hasAttribute(), StringTokenizer::hasNext(), myCurrentVTypeDistribution, myCurrentVTypeDistributionID, StringTokenizer::next(), SUMOSAXAttributes::setIDFromAttributes(), and SUMO_ATTR_VTYPES.
Referenced by myStartElement().
00273 { 00274 if (attrs.setIDFromAttributes("vtypeDistribution", myCurrentVTypeDistributionID)) { 00275 myCurrentVTypeDistribution = new RandomDistributor<MSVehicleType*>(); 00276 if (attrs.hasAttribute(SUMO_ATTR_VTYPES)) { 00277 bool ok = true; 00278 StringTokenizer st(attrs.getStringReporting(SUMO_ATTR_VTYPES, "vtypeDistribution", myCurrentVTypeDistributionID.c_str(), ok)); 00279 while (st.hasNext()) { 00280 std::string vtypeID = st.next(); 00281 MSVehicleType *type = MSNet::getInstance()->getVehicleControl().getVType(vtypeID); 00282 if (type==0) { 00283 throw ProcessError("Unknown vtype '" + vtypeID + "' in distribution '" + myCurrentVTypeDistributionID + "'."); 00284 } 00285 myCurrentVTypeDistribution->add(type->getDefaultProbability(), type); 00286 } 00287 } 00288 } 00289 }
| MSRouteHandler& MSRouteHandler::operator= | ( | const MSRouteHandler & | s | ) | [private] |
invalid assignment operator
| void GenericSAXHandler::registerParent | ( | const SumoXMLTag | tag, | |
| GenericSAXHandler * | handler | |||
| ) | [inherited] |
Assigning a parent handler which is enabled when the specified tag is closed.
Definition at line 160 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myParentHandler, GenericSAXHandler::myParentIndicator, and XMLSubSys::setHandler().
Referenced by NLTriggerBuilder::parseAndBuildLaneSpeedTrigger().
00160 { 00161 myParentHandler = handler; 00162 myParentIndicator = tag; 00163 XMLSubSys::setHandler(*this); 00164 }
| void MSRouteHandler::retrieveLastReadVehicle | ( | MSEmitControl * | into | ) |
Returns the last loaded vehicle.
Definition at line 90 of file MSRouteHandler.cpp.
References MSEmitControl::add(), DEPART_GIVEN, SUMOVehicleParameter::departProcedure, MSVehicle::getParameter(), myLastReadVehicle, myVehicleParameter, and SUMOVehicleParameter::repetitionsDone.
Referenced by MSRouteLoader::loadUntil().
00090 { 00091 if (myLastReadVehicle != 0) { 00092 if (myLastReadVehicle->getParameter().departProcedure == DEPART_GIVEN) { 00093 into->add(myLastReadVehicle); 00094 } 00095 myLastReadVehicle = 0; 00096 } 00097 if (myVehicleParameter != 0 && myVehicleParameter->repetitionsDone>=0) { 00098 into->add(myVehicleParameter); 00099 myVehicleParameter = 0; 00100 } 00101 }
| void GenericSAXHandler::setFileName | ( | const std::string & | name | ) | throw () [inherited] |
Sets the current file name.
| [in] | name | The name of the currently processed file |
Definition at line 72 of file GenericSAXHandler.cpp.
References GenericSAXHandler::myFileName.
Referenced by PCNetProjectionLoader::loadIfSet(), ROLoader::loadNet(), NIImporter_OpenStreetMap::loadNetwork(), NILoader::loadXMLType(), and traci::TraCIServer::TraCIServer().
00072 { 00073 myFileName = name; 00074 }
| void GenericSAXHandler::startElement | ( | const XMLCh *const | uri, | |
| const XMLCh *const | localname, | |||
| const XMLCh *const | qname, | |||
| const Attributes & | attrs | |||
| ) | [inherited] |
The inherited method called when a new tag opens.
The method parses the supplied XMLCh*-qname using the internal name/enum-map to obtain the enum representation of the attribute name.
Then, "myStartElement" is called supplying the enumeration value, the string-representation of the name and the attributes.
Definition at line 97 of file GenericSAXHandler.cpp.
References TplConvert< E >::_2str(), GenericSAXHandler::convertTag(), FileHelpers::getConfigurationRelative(), GenericSAXHandler::getFileName(), SUMOSAXAttributesImpl_Xerces::getString(), FileHelpers::isAbsolute(), GenericSAXHandler::myCharactersVector, GenericSAXHandler::myPredefinedTags, GenericSAXHandler::myPredefinedTagsMML, GenericSAXHandler::myStartElement(), XMLSubSys::runParser(), SUMO_ATTR_HREF, and SUMO_TAG_INCLUDE.
00100 { 00101 std::string name = TplConvert<XMLCh>::_2str(qname); 00102 SumoXMLTag element = convertTag(name); 00103 myCharactersVector.clear(); 00104 SUMOSAXAttributesImpl_Xerces na(attrs, myPredefinedTags, myPredefinedTagsMML); 00105 if (element == SUMO_TAG_INCLUDE) { 00106 std::string file = na.getString(SUMO_ATTR_HREF); 00107 if (!FileHelpers::isAbsolute(file)) { 00108 file = FileHelpers::getConfigurationRelative(getFileName(), file); 00109 } 00110 XMLSubSys::runParser(*this, file); 00111 } else { 00112 myStartElement(element, na); 00113 } 00114 }
| void SUMOSAXHandler::warning | ( | const SAXParseException & | exception | ) | throw () [inherited] |
Handler for XML-warnings.
The message is built using buildErrorMessage and reported to the warning-instance of the MsgHandler.
| [in] | exception | The occured exception to process |
Definition at line 68 of file SUMOSAXHandler.cpp.
References SUMOSAXHandler::buildErrorMessage(), MsgHandler::getWarningInstance(), and MsgHandler::inform().
00068 { 00069 MsgHandler::getWarningInstance()->inform(buildErrorMessage(exception)); 00070 }
MSPerson::MSPersonPlan* MSRouteHandler::myActivePlan [protected] |
the plan of the current person
Definition at line 166 of file MSRouteHandler.h.
Referenced by closePerson(), and myStartElement().
MSEdgeVector MSRouteHandler::myActiveRoute [protected] |
the current route
Definition at line 151 of file MSRouteHandler.h.
Referenced by closeRoute(), MSRouteHandler(), myCharacters(), myStartElement(), and openRoute().
RGBColor MSRouteHandler::myActiveRouteColor [protected] |
The currently parsed route's color.
Definition at line 160 of file MSRouteHandler.h.
Referenced by closeRoute(), and openRoute().
std::string MSRouteHandler::myActiveRouteID [protected] |
the id of the current route
Definition at line 154 of file MSRouteHandler.h.
Referenced by closeFlow(), closeRoute(), closeVehicle(), myCharacters(), myStartElement(), and openRoute().
SUMOReal MSRouteHandler::myActiveRouteProbability [protected] |
the id of the current route
Definition at line 157 of file MSRouteHandler.h.
Referenced by closeRoute(), and openRoute().
std::vector<SUMOVehicleParameter::Stop> MSRouteHandler::myActiveRouteStops [protected] |
List of the stops on the parsed route.
Definition at line 163 of file MSRouteHandler.h.
Referenced by closeRoute(), and myStartElement().
bool MSRouteHandler::myAddVehiclesDirectly [protected] |
information whether vehicles shall be directly added to the network or kept within the buffer
Definition at line 170 of file MSRouteHandler.h.
Referenced by closeFlow(), and closeVehicle().
bool MSRouteHandler::myAmUsingIncrementalDUA [protected] |
Information whether not all vehicle shall be emitted due to inc-dua.
Definition at line 185 of file MSRouteHandler.h.
Referenced by closeVehicle(), and MSRouteHandler().
RandomDistributor<const MSRoute*>* MSRouteHandler::myCurrentRouteDistribution [protected] |
The currently parsed distribution of routes (probability->route).
Definition at line 179 of file MSRouteHandler.h.
Referenced by closeRoute(), closeRouteDistribution(), and openRouteDistribution().
std::string MSRouteHandler::myCurrentRouteDistributionID [protected] |
The id of the currently parsed route distribution.
Definition at line 182 of file MSRouteHandler.h.
Referenced by closeRouteDistribution(), and openRouteDistribution().
SUMOVTypeParameter* MSRouteHandler::myCurrentVType [protected] |
The currently parsed vehicle type.
Definition at line 200 of file MSRouteHandler.h.
Referenced by myEndElement(), and myStartElement().
The currently parsed distribution of vehicle types (probability->vehicle type).
Definition at line 173 of file MSRouteHandler.h.
Referenced by closeVehicleTypeDistribution(), myEndElement(), and openVehicleTypeDistribution().
std::string MSRouteHandler::myCurrentVTypeDistributionID [protected] |
The id of the currently parsed vehicle type distribution.
Definition at line 176 of file MSRouteHandler.h.
Referenced by closeVehicleTypeDistribution(), and openVehicleTypeDistribution().
bool MSRouteHandler::myHaveWarned [protected] |
whether we have warned about routes defined as character strings
Definition at line 197 of file MSRouteHandler.h.
Referenced by myCharacters().
int MSRouteHandler::myIncrementalBase [protected] |
The base for inc-dua.
Definition at line 191 of file MSRouteHandler.h.
Referenced by closeVehicle(), and MSRouteHandler().
int MSRouteHandler::myIncrementalStage [protected] |
The current stage of inc-dua.
Definition at line 194 of file MSRouteHandler.h.
Referenced by closeVehicle(), and MSRouteHandler().
SUMOTime MSRouteHandler::myLastDepart [protected] |
the emission time of the vehicle read last
Definition at line 144 of file MSRouteHandler.h.
Referenced by closeVehicle(), and getLastDepart().
MSVehicle* MSRouteHandler::myLastReadVehicle [protected] |
the last vehicle read
Definition at line 147 of file MSRouteHandler.h.
Referenced by closeVehicle(), and retrieveLastReadVehicle().
unsigned int MSRouteHandler::myRunningVehicleNumber [protected] |
The current vehicle number (for inc-dua).
Definition at line 188 of file MSRouteHandler.h.
Referenced by closeVehicle().
SUMOVehicleParameter* MSRouteHandler::myVehicleParameter [protected] |
Definition at line 141 of file MSRouteHandler.h.
Referenced by closeFlow(), closePerson(), closeRoute(), closeVehicle(), myEndElement(), myStartElement(), openRoute(), retrieveLastReadVehicle(), and ~MSRouteHandler().
1.5.6