void MSVehicleTransfer::loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset, MSVehicleControl& vc) { MSVehicle* veh = dynamic_cast<MSVehicle*>(vc.getVehicle(attrs.getString(SUMO_ATTR_ID))); assert(veh != 0); SUMOTime proceedTime = (SUMOTime)attrs.getLong(SUMO_ATTR_DEPART); MSLane* parkingLane = attrs.hasAttribute(SUMO_ATTR_PARKING) ? MSLane::dictionary(attrs.getString(SUMO_ATTR_PARKING)): 0; myVehicles.push_back(VehicleInformation(veh, proceedTime + offset, parkingLane != 0)); if (parkingLane != 0) { myParkingVehicles[parkingLane].insert(veh); veh->setTentativeLaneAndPosition(parkingLane, veh->getPositionOnLane()); veh->processNextStop(veh->getSpeed()); } MSNet::getInstance()->getInsertionControl().alreadyDeparted(veh); }
void MESegment::loadState(std::vector<std::string>& vehIds, MSVehicleControl& vc, const SUMOTime block, const unsigned int queIdx) { for (std::vector<std::string>::const_iterator it = vehIds.begin(); it != vehIds.end(); ++it) { MEVehicle* v = static_cast<MEVehicle*>(vc.getVehicle(*it)); assert(v != 0); assert(v->getSegment() == this); myCarQues[queIdx].push_back(v); myOccupancy += v->getVehicleType().getLengthWithGap(); } if (myCarQues[queIdx].size() != 0) { // add the last vehicle of this queue // !!! one question - what about the previously added vehicle? Is it stored twice? MEVehicle* veh = myCarQues[queIdx].back(); MSGlobals::gMesoNet->addLeaderCar(veh, getLink(veh)); } myBlockTimes[queIdx] = block; myOccupancy = MIN2(myCapacity, myOccupancy); }