55 #ifdef CHECK_MEMORY_LEAKS
57 #endif // CHECK_MEMORY_LEAKS
63 using namespace traci;
72 std::string warning =
"";
104 std::vector<std::string> ids;
107 if ((*i).second->isOnRoad()) {
108 ids.push_back((*i).first);
155 tempMsg.
writeInt((
int)std::distance(lanes.begin(), std::find(lanes.begin(), lanes.end(), v->
getLane())));
212 if (inputStorage.
readInt() != 2) {
227 std::string edgeID = inputStorage.
readString();
249 if (inputStorage.
readInt() != 2) {
264 std::string edgeID = inputStorage.
readString();
303 unsigned int cnt = 0;
305 const std::vector<MSVehicle::LaneQ> &bestLanes = onRoad ? v->
getBestLanes() : std::vector<MSVehicle::LaneQ>();
306 tempContent.
writeInt((
int) bestLanes.size());
308 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
325 std::vector<std::string> bestContIDs;
327 bestContIDs.push_back((*j)->getID());
338 if (!commandDistanceRequest(server, inputStorage, tempMsg, v)) {
356 std::string warning =
"";
379 if (v == 0 && variable !=
ADD) {
391 if (inputStorage.
readInt() != 4) {
401 std::string roadId = inputStorage.
readString();
413 int laneIndex = inputStorage.
readByte();
432 const std::vector<MSLane*> &allLanes = road->
getLanes();
433 if ((laneIndex < 0) || laneIndex >= (
int)(allLanes.size())) {
438 if (!static_cast<MSVehicle*>(v)->addTraciStop(allLanes[laneIndex], pos, 0, waitTime)) {
449 if (inputStorage.
readInt() != 2) {
459 int laneIndex = inputStorage.
readByte();
467 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()))) {
472 std::vector<std::pair<SUMOTime, unsigned int> > laneTimeLine;
473 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
474 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + stickyTime, laneIndex));
475 static_cast<MSVehicle*
>(v)->getInfluencer().setLaneTimeLine(laneTimeLine);
477 *static_cast<MSVehicle*>(v)->getEdge(), static_cast<MSVehicle*>(v)->getLaneIndex());
478 static_cast<MSVehicle*
>(v)->getLaneChangeModel().requestLaneChange(req);
486 if (inputStorage.
readInt() != 2) {
508 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
510 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, newSpeed));
511 static_cast<MSVehicle*
>(v)->getInfluencer().setSpeedTimeLine(speedTimeLine);
519 std::string edgeID = inputStorage.
readString();
562 std::vector<const MSEdge*> edges;
575 int parameterCount = inputStorage.
readInt();
576 if (parameterCount == 4) {
594 std::string edgeID = inputStorage.
readString();
607 static_cast<MSVehicle*
>(v)->getWeightsStorage().addTravelTime(edge, begTime, endTime, value);
608 }
else if (parameterCount == 2) {
614 std::string edgeID = inputStorage.
readString();
627 while (static_cast<MSVehicle*>(v)->getWeightsStorage().knowsTravelTime(edge)) {
628 static_cast<MSVehicle*
>(v)->getWeightsStorage().removeTravelTime(edge);
631 }
else if (parameterCount == 1) {
637 std::string edgeID = inputStorage.
readString();
644 while (static_cast<MSVehicle*>(v)->getWeightsStorage().knowsTravelTime(edge)) {
645 static_cast<MSVehicle*
>(v)->getWeightsStorage().removeTravelTime(edge);
658 int parameterCount = inputStorage.
readInt();
659 if (parameterCount == 4) {
677 std::string edgeID = inputStorage.
readString();
690 static_cast<MSVehicle*
>(v)->getWeightsStorage().addEffort(edge, begTime, endTime, value);
691 }
else if (parameterCount == 2) {
697 std::string edgeID = inputStorage.
readString();
710 while (static_cast<MSVehicle*>(v)->getWeightsStorage().knowsEffort(edge)) {
711 static_cast<MSVehicle*
>(v)->getWeightsStorage().removeEffort(edge);
714 }
else if (parameterCount == 1) {
720 std::string edgeID = inputStorage.
readString();
727 while (static_cast<MSVehicle*>(v)->getWeightsStorage().knowsEffort(edge)) {
728 static_cast<MSVehicle*
>(v)->getWeightsStorage().removeEffort(edge);
741 if (inputStorage.
readInt() != 0) {
755 if (inputStorage.
readInt() != 0) {
769 static_cast<MSVehicle*
>(v)->switchOffSignal(0x0fffffff);
777 if (inputStorage.
readInt() != 2) {
786 std::string laneID = inputStorage.
readString();
800 if (!static_cast<MSVehicle*>(v)->willPass(&destinationEdge)) {
805 static_cast<MSVehicle*
>(v)->getLane()->removeVehicle(static_cast<MSVehicle*>(v));
806 while (v->
getEdge() != &destinationEdge) {
809 if (static_cast<MSVehicle*>(v)->enterLaneAtMove(nextEdge->
getLanes()[0],
true)) {
823 std::vector<std::pair<SUMOTime, SUMOReal> > speedTimeLine;
825 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
826 speedTimeLine.push_back(std::make_pair(
SUMOTime_MAX, speed));
828 static_cast<MSVehicle*
>(v)->getInfluencer().setSpeedTimeLine(speedTimeLine);
836 int speedMode = inputStorage.
readInt();
837 static_cast<MSVehicle*
>(v)->getInfluencer().setConsiderSafeVelocity((speedMode & 1) != 0);
838 static_cast<MSVehicle*
>(v)->getInfluencer().setConsiderMaxAcceleration((speedMode & 2) != 0);
839 static_cast<MSVehicle*
>(v)->getInfluencer().setConsiderMaxDeceleration((speedMode & 4) != 0);
863 if (inputStorage.
readInt() != 6) {
868 vehicleParams.
id = id;
884 const std::string routeID = inputStorage.
readString();
896 if (vehicleParams.
depart < 0) {
897 const int proc =
static_cast<int>(-vehicleParams.
depart);
911 const int proc =
static_cast<int>(-vehicleParams.
departPos);
927 const int proc =
static_cast<int>(-vehicleParams.
departSpeed);
943 const int proc =
static_cast<int>(-vehicleParams.
departLane);
954 *params = vehicleParams;
990 static_cast<MSVehicle*
>(v)->onRemovalFromNet(n);
991 static_cast<MSVehicle*
>(v)->getLane()->removeVehicle(static_cast<MSVehicle*>(v));
998 getSingularType(v), server, inputStorage, outputStorage)) {
1019 if (inputStorage.
readInt() != 2) {
1025 std::pair<const MSLane*, SUMOReal> roadPos;
1032 std::string roadID = inputStorage.
readString();
1035 pos = roadPos.first->getShape().positionAtLengthPosition(roadPos.second);
1043 const double p1x = inputStorage.
readDouble();
1044 const double p1y = inputStorage.
readDouble();
1064 v->
getEdge(), &roadPos.first->getEdge());
1083 std::string newID = oType.
getID().find(
'@') == std::string::npos ? oType.
getID() +
"@" + veh->
getID() : oType.
getID();
1085 static_cast<MSVehicle*
>(veh)->replaceVehicleType(type);