void Person::appendWalkingStage(const std::string& personID, const std::vector<std::string>& edgeIDs, double arrivalPos, double duration, double speed, const std::string& stopID) { MSTransportable* p = getPerson(personID); ConstMSEdgeVector edges; try { MSEdge::parseEdgesList(edgeIDs, edges, "<unknown>"); } catch (ProcessError& e) { throw TraCIException(e.what()); } if (edges.empty()) { throw TraCIException("Empty edge list for walking stage of person '" + personID + "'."); } if (fabs(arrivalPos) > edges.back()->getLength()) { throw TraCIException("Invalid arrivalPos for walking stage of person '" + personID + "'."); } if (arrivalPos < 0) { arrivalPos += edges.back()->getLength(); } if (speed < 0) { speed = p->getVehicleType().getMaxSpeed(); } MSStoppingPlace* bs = nullptr; if (stopID != "") { bs = MSNet::getInstance()->getStoppingPlace(stopID, SUMO_TAG_BUS_STOP); if (bs == nullptr) { throw TraCIException("Invalid stopping place id '" + stopID + "' for person: '" + personID + "'"); } } p->appendStage(new MSPerson::MSPersonStage_Walking(p->getID(), edges, bs, TIME2STEPS(duration), speed, p->getArrivalPos(), arrivalPos, 0)); }
void Person::appendWaitingStage(const std::string& personID, double duration, const std::string& description, const std::string& stopID) { MSTransportable* p = getPerson(personID); if (duration < 0) { throw TraCIException("Duration for person: '" + personID + "' must not be negative"); } MSStoppingPlace* bs = nullptr; if (stopID != "") { bs = MSNet::getInstance()->getStoppingPlace(stopID, SUMO_TAG_BUS_STOP); if (bs == nullptr) { throw TraCIException("Invalid stopping place id '" + stopID + "' for person: '" + personID + "'"); } } p->appendStage(new MSTransportable::Stage_Waiting(p->getArrivalEdge(), nullptr, TIME2STEPS(duration), 0, p->getArrivalPos(), description, false)); }