Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2017-2025 German Aerospace Center (DLR) and others.
4 : // This program and the accompanying materials are made available under the
5 : // terms of the Eclipse Public License 2.0 which is available at
6 : // https://www.eclipse.org/legal/epl-2.0/
7 : // This Source Code may also be made available under the following Secondary
8 : // Licenses when the conditions for such availability set forth in the Eclipse
9 : // Public License 2.0 are satisfied: GNU General Public License, version 2
10 : // or later which is available at
11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 : /****************************************************************************/
14 : /// @file Person.cpp
15 : /// @author Leonhard Luecken
16 : /// @date 15.09.2017
17 : ///
18 : // C++ TraCI client API implementation
19 : /****************************************************************************/
20 : #include <config.h>
21 :
22 : #define LIBTRACI 1
23 : #include "Domain.h"
24 : #include <libsumo/Person.h>
25 : #include <libsumo/StorageHelper.h>
26 :
27 : namespace libtraci {
28 :
29 : typedef Domain<libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_SET_PERSON_VARIABLE> Dom;
30 :
31 : // ===========================================================================
32 : // static member definitions
33 : // ===========================================================================
34 : std::vector<std::string>
35 14392 : Person::getIDList() {
36 28783 : return Dom::getStringVector(libsumo::TRACI_ID_LIST, "");
37 : }
38 :
39 :
40 : int
41 4 : Person::getIDCount() {
42 8 : return Dom::getInt(libsumo::ID_COUNT, "");
43 : }
44 :
45 :
46 : libsumo::TraCIPosition
47 24762 : Person::getPosition(const std::string& personID, const bool includeZ) {
48 24762 : return includeZ ? getPosition3D(personID) : Dom::getPos(libsumo::VAR_POSITION, personID);
49 : }
50 :
51 :
52 : libsumo::TraCIPosition
53 2 : Person::getPosition3D(const std::string& personID) {
54 2 : return Dom::getPos3D(libsumo::VAR_POSITION3D, personID);
55 : }
56 :
57 :
58 : double
59 22 : Person::getAngle(const std::string& personID) {
60 22 : return Dom::getDouble(libsumo::VAR_ANGLE, personID);
61 : }
62 :
63 :
64 : double
65 2 : Person::getSlope(const std::string& personID) {
66 2 : return Dom::getDouble(libsumo::VAR_SLOPE, personID);
67 : }
68 :
69 :
70 : double
71 6 : Person::getSpeed(const std::string& personID) {
72 6 : return Dom::getDouble(libsumo::VAR_SPEED, personID);
73 : }
74 :
75 :
76 : std::string
77 247 : Person::getRoadID(const std::string& personID) {
78 247 : return Dom::getString(libsumo::VAR_ROAD_ID, personID);
79 : }
80 :
81 :
82 : std::string
83 61 : Person::getLaneID(const std::string& personID) {
84 61 : return Dom::getString(libsumo::VAR_LANE_ID, personID);
85 : }
86 :
87 :
88 : double
89 23 : Person::getLanePosition(const std::string& personID) {
90 23 : return Dom::getDouble(libsumo::VAR_LANEPOSITION, personID);
91 : }
92 :
93 :
94 : double
95 2 : Person::getWalkingDistance(const std::string& personID, const std::string& edgeID, double pos, int laneIndex) {
96 2 : tcpip::Storage content;
97 : StoHelp::writeCompound(content, 2);
98 2 : content.writeUnsignedByte(libsumo::POSITION_ROADMAP);
99 2 : content.writeString(edgeID);
100 2 : content.writeDouble(pos);
101 2 : content.writeUnsignedByte(laneIndex);
102 2 : content.writeUnsignedByte(libsumo::REQUEST_DRIVINGDIST);
103 3 : return Dom::getDouble(libsumo::DISTANCE_REQUEST, personID, &content);
104 2 : }
105 :
106 :
107 : double
108 1 : Person::getWalkingDistance2D(const std::string& personID, double x, double y) {
109 1 : tcpip::Storage content;
110 : StoHelp::writeCompound(content, 2);
111 1 : content.writeUnsignedByte(libsumo::POSITION_2D);
112 1 : content.writeDouble(x);
113 1 : content.writeDouble(y);
114 1 : content.writeUnsignedByte(libsumo::REQUEST_DRIVINGDIST);
115 2 : return Dom::getDouble(libsumo::DISTANCE_REQUEST, personID, &content);
116 1 : }
117 :
118 :
119 : std::vector<libsumo::TraCIReservation>
120 858 : Person::getTaxiReservations(int onlyNew) {
121 858 : std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
122 858 : tcpip::Storage content;
123 : StoHelp::writeTypedInt(content, onlyNew);
124 1716 : tcpip::Storage& ret = Dom::get(libsumo::VAR_TAXI_RESERVATIONS, "", &content);
125 : std::vector<libsumo::TraCIReservation> result;
126 858 : int numReservations = ret.readInt();
127 2393 : while (numReservations-- > 0) {
128 : libsumo::TraCIReservation r;
129 1535 : StoHelp::readReservation(ret, r);
130 1535 : result.emplace_back(r);
131 1535 : }
132 858 : return result;
133 858 : }
134 :
135 :
136 : std::string
137 1 : Person::splitTaxiReservation(std::string reservationID, const std::vector<std::string>& personIDs) {
138 1 : tcpip::Storage content;
139 : StoHelp::writeTypedStringList(content, personIDs);
140 2 : return Dom::getString(libsumo::SPLIT_TAXI_RESERVATIONS, reservationID, &content);
141 1 : }
142 :
143 :
144 : libsumo::TraCIColor
145 2 : Person::getColor(const std::string& personID) {
146 2 : return Dom::getCol(libsumo::VAR_COLOR, personID);
147 : }
148 :
149 :
150 : std::string
151 5 : Person::getTypeID(const std::string& personID) {
152 5 : return Dom::getString(libsumo::VAR_TYPE, personID);
153 : }
154 :
155 :
156 : double
157 2 : Person::getWaitingTime(const std::string& personID) {
158 2 : return Dom::getDouble(libsumo::VAR_WAITING_TIME, personID);
159 : }
160 :
161 :
162 : std::string
163 1 : Person::getNextEdge(const std::string& personID) {
164 1 : return Dom::getString(libsumo::VAR_NEXT_EDGE, personID);
165 : }
166 :
167 :
168 : std::vector<std::string>
169 228 : Person::getEdges(const std::string& personID, int nextStageIndex) {
170 228 : tcpip::Storage content;
171 228 : content.writeUnsignedByte(libsumo::TYPE_INTEGER);
172 228 : content.writeInt(nextStageIndex);
173 456 : return Dom::getStringVector(libsumo::VAR_EDGES, personID, &content);
174 228 : }
175 :
176 :
177 : libsumo::TraCIStage
178 188 : Person::getStage(const std::string& personID, int nextStageIndex) {
179 188 : tcpip::Storage content;
180 188 : content.writeUnsignedByte(libsumo::TYPE_INTEGER);
181 188 : content.writeInt(nextStageIndex);
182 361 : return Dom::getTraCIStage(libsumo::VAR_STAGE, personID, &content);
183 188 : }
184 :
185 :
186 : int
187 19 : Person::getRemainingStages(const std::string& personID) {
188 19 : return Dom::getInt(libsumo::VAR_STAGES_REMAINING, personID);
189 : }
190 :
191 :
192 : std::string
193 2 : Person::getVehicle(const std::string& personID) {
194 2 : return Dom::getString(libsumo::VAR_VEHICLE, personID);
195 : }
196 :
197 :
198 : std::string
199 0 : Person::getEmissionClass(const std::string& personID) {
200 0 : return Dom::getString(libsumo::VAR_EMISSIONCLASS, personID);
201 : }
202 :
203 :
204 : std::string
205 0 : Person::getShapeClass(const std::string& personID) {
206 0 : return Dom::getString(libsumo::VAR_SHAPECLASS, personID);
207 : }
208 :
209 :
210 : double
211 2 : Person::getLength(const std::string& personID) {
212 2 : return Dom::getDouble(libsumo::VAR_LENGTH, personID);
213 : }
214 :
215 :
216 : double
217 2 : Person::getSpeedFactor(const std::string& personID) {
218 2 : return Dom::getDouble(libsumo::VAR_SPEED_FACTOR, personID);
219 : }
220 :
221 :
222 : double
223 0 : Person::getAccel(const std::string& personID) {
224 0 : return Dom::getDouble(libsumo::VAR_ACCEL, personID);
225 : }
226 :
227 :
228 : double
229 0 : Person::getDecel(const std::string& personID) {
230 0 : return Dom::getDouble(libsumo::VAR_DECEL, personID);
231 : }
232 :
233 :
234 0 : double Person::getEmergencyDecel(const std::string& personID) {
235 0 : return Dom::getDouble(libsumo::VAR_EMERGENCY_DECEL, personID);
236 : }
237 :
238 :
239 0 : double Person::getApparentDecel(const std::string& personID) {
240 0 : return Dom::getDouble(libsumo::VAR_APPARENT_DECEL, personID);
241 : }
242 :
243 :
244 0 : double Person::getActionStepLength(const std::string& personID) {
245 0 : return Dom::getDouble(libsumo::VAR_ACTIONSTEPLENGTH, personID);
246 : }
247 :
248 :
249 : double
250 0 : Person::getTau(const std::string& personID) {
251 0 : return Dom::getDouble(libsumo::VAR_TAU, personID);
252 : }
253 :
254 :
255 : double
256 0 : Person::getImperfection(const std::string& personID) {
257 0 : return Dom::getDouble(libsumo::VAR_IMPERFECTION, personID);
258 : }
259 :
260 :
261 : double
262 0 : Person::getSpeedDeviation(const std::string& personID) {
263 0 : return Dom::getDouble(libsumo::VAR_SPEED_DEVIATION, personID);
264 : }
265 :
266 :
267 : std::string
268 0 : Person::getVehicleClass(const std::string& personID) {
269 0 : return Dom::getString(libsumo::VAR_VEHICLECLASS, personID);
270 : }
271 :
272 :
273 : double
274 2 : Person::getMinGap(const std::string& personID) {
275 2 : return Dom::getDouble(libsumo::VAR_MINGAP, personID);
276 : }
277 :
278 :
279 : double
280 0 : Person::getMinGapLat(const std::string& personID) {
281 0 : return Dom::getDouble(libsumo::VAR_MINGAP_LAT, personID);
282 : }
283 :
284 :
285 : double
286 2 : Person::getMaxSpeed(const std::string& personID) {
287 2 : return Dom::getDouble(libsumo::VAR_MAXSPEED, personID);
288 : }
289 :
290 :
291 : double
292 0 : Person::getMaxSpeedLat(const std::string& personID) {
293 0 : return Dom::getDouble(libsumo::VAR_MAXSPEED_LAT, personID);
294 : }
295 :
296 :
297 : std::string
298 0 : Person::getLateralAlignment(const std::string& personID) {
299 0 : return Dom::getString(libsumo::VAR_LATALIGNMENT, personID);
300 : }
301 :
302 :
303 : double
304 2 : Person::getWidth(const std::string& personID) {
305 2 : return Dom::getDouble(libsumo::VAR_WIDTH, personID);
306 : }
307 :
308 :
309 : double
310 0 : Person::getHeight(const std::string& personID) {
311 0 : return Dom::getDouble(libsumo::VAR_HEIGHT, personID);
312 : }
313 :
314 :
315 : double
316 0 : Person::getMass(const std::string& personID) {
317 0 : return Dom::getDouble(libsumo::VAR_MASS, personID);
318 : }
319 :
320 :
321 : int
322 0 : Person::getPersonCapacity(const std::string& personID) {
323 0 : return Dom::getInt(libsumo::VAR_PERSON_CAPACITY, personID);
324 : }
325 :
326 :
327 : double
328 2 : Person::getBoardingDuration(const std::string& personID) {
329 2 : return Dom::getDouble(libsumo::VAR_BOARDING_DURATION, personID);
330 : }
331 :
332 : double
333 0 : Person::getImpatience(const std::string& personID) {
334 0 : return Dom::getDouble(libsumo::VAR_IMPATIENCE, personID);
335 : }
336 :
337 :
338 :
339 44 : LIBTRACI_PARAMETER_IMPLEMENTATION(Person, PERSON)
340 :
341 :
342 : void
343 3 : Person::setSpeed(const std::string& personID, double speed) {
344 3 : Dom::setDouble(libsumo::VAR_SPEED, personID, speed);
345 3 : }
346 :
347 :
348 : void
349 3 : Person::setType(const std::string& personID, const std::string& typeID) {
350 3 : Dom::setString(libsumo::VAR_TYPE, personID, typeID);
351 3 : }
352 :
353 :
354 : void
355 0 : Person::setImpatience(const std::string& personID, double impatience) {
356 0 : Dom::setDouble(libsumo::VAR_IMPATIENCE, personID, impatience);
357 0 : }
358 :
359 : void
360 0 : Person::setBoardingDuration(const std::string& personID, double boardingDuration) {
361 0 : Dom::setDouble(libsumo::VAR_BOARDING_DURATION, personID, boardingDuration);
362 0 : }
363 :
364 : void
365 50 : Person::add(const std::string& personID, const std::string& edgeID, double pos, double departInSecs, const std::string typeID) {
366 50 : tcpip::Storage content;
367 50 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
368 50 : content.writeInt(4);
369 50 : content.writeUnsignedByte(libsumo::TYPE_STRING);
370 50 : content.writeString(typeID);
371 50 : content.writeUnsignedByte(libsumo::TYPE_STRING);
372 50 : content.writeString(edgeID);
373 50 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
374 50 : content.writeDouble(departInSecs);
375 50 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
376 50 : content.writeDouble(pos);
377 50 : Dom::set(libsumo::ADD, personID, &content);
378 50 : }
379 :
380 :
381 : void
382 7 : Person::appendStage(const std::string& personID, const libsumo::TraCIStage& stage) {
383 7 : tcpip::Storage content;
384 7 : libsumo::StorageHelper::writeStage(content, stage);
385 7 : Dom::set(libsumo::APPEND_STAGE, personID, &content);
386 7 : }
387 :
388 :
389 : void
390 2 : Person::replaceStage(const std::string& personID, const int stageIndex, const libsumo::TraCIStage& stage) {
391 2 : tcpip::Storage content;
392 2 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
393 2 : content.writeInt(2);
394 2 : content.writeUnsignedByte(libsumo::TYPE_INTEGER);
395 2 : content.writeInt(stageIndex);
396 2 : libsumo::StorageHelper::writeStage(content, stage);
397 2 : Dom::set(libsumo::REPLACE_STAGE, personID, &content);
398 2 : }
399 :
400 :
401 : void
402 7 : Person::appendDrivingStage(const std::string& personID, const std::string& toEdge, const std::string& lines, const std::string& stopID) {
403 7 : tcpip::Storage content;
404 7 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
405 7 : content.writeInt(4);
406 7 : content.writeUnsignedByte(libsumo::TYPE_INTEGER);
407 7 : content.writeInt(libsumo::STAGE_DRIVING);
408 7 : content.writeUnsignedByte(libsumo::TYPE_STRING);
409 7 : content.writeString(toEdge);
410 7 : content.writeUnsignedByte(libsumo::TYPE_STRING);
411 7 : content.writeString(lines);
412 7 : content.writeUnsignedByte(libsumo::TYPE_STRING);
413 7 : content.writeString(stopID);
414 7 : Dom::set(libsumo::APPEND_STAGE, personID, &content);
415 7 : }
416 :
417 :
418 : void
419 5 : Person::appendWaitingStage(const std::string& personID, double duration, const std::string& description, const std::string& stopID) {
420 5 : tcpip::Storage content;
421 5 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
422 5 : content.writeInt(4);
423 5 : content.writeUnsignedByte(libsumo::TYPE_INTEGER);
424 5 : content.writeInt(libsumo::STAGE_WAITING);
425 5 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
426 5 : content.writeDouble(duration);
427 5 : content.writeUnsignedByte(libsumo::TYPE_STRING);
428 5 : content.writeString(description);
429 5 : content.writeUnsignedByte(libsumo::TYPE_STRING);
430 5 : content.writeString(stopID);
431 5 : Dom::set(libsumo::APPEND_STAGE, personID, &content);
432 5 : }
433 :
434 :
435 : void
436 45 : Person::appendWalkingStage(const std::string& personID, const std::vector<std::string>& edges, double arrivalPos, double duration, double speed, const std::string& stopID) {
437 45 : tcpip::Storage content;
438 45 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
439 45 : content.writeInt(6);
440 45 : content.writeUnsignedByte(libsumo::TYPE_INTEGER);
441 45 : content.writeInt(libsumo::STAGE_WALKING);
442 45 : content.writeUnsignedByte(libsumo::TYPE_STRINGLIST);
443 45 : content.writeStringList(edges);
444 45 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
445 45 : content.writeDouble(arrivalPos);
446 45 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
447 45 : content.writeDouble(duration);
448 45 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
449 45 : content.writeDouble(speed);
450 45 : content.writeUnsignedByte(libsumo::TYPE_STRING);
451 45 : content.writeString(stopID);
452 45 : Dom::set(libsumo::APPEND_STAGE, personID, &content);
453 45 : }
454 :
455 :
456 : void
457 17 : Person::removeStage(const std::string& personID, int nextStageIndex) {
458 17 : Dom::setInt(libsumo::REMOVE_STAGE, personID, nextStageIndex);
459 17 : }
460 :
461 :
462 : void
463 203 : Person::rerouteTraveltime(const std::string& personID) {
464 203 : tcpip::Storage content;
465 203 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
466 203 : content.writeInt(0);
467 203 : Dom::set(libsumo::CMD_REROUTE_TRAVELTIME, personID, &content);
468 203 : }
469 :
470 :
471 : void
472 4 : Person::moveTo(const std::string& personID, const std::string& laneID, double pos, double posLat) {
473 4 : tcpip::Storage content;
474 4 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
475 4 : content.writeInt(3);
476 4 : content.writeUnsignedByte(libsumo::TYPE_STRING);
477 4 : content.writeString(laneID);
478 4 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
479 4 : content.writeDouble(pos);
480 4 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
481 4 : content.writeDouble(posLat);
482 4 : Dom::set(libsumo::VAR_MOVE_TO, personID, &content);
483 4 : }
484 :
485 :
486 : void
487 515 : Person::moveToXY(const std::string& personID, const std::string& edgeID, const double x, const double y, double angle, const int keepRoute, double matchThreshold) {
488 515 : tcpip::Storage content;
489 515 : content.writeUnsignedByte(libsumo::TYPE_COMPOUND);
490 515 : content.writeInt(6);
491 515 : content.writeUnsignedByte(libsumo::TYPE_STRING);
492 515 : content.writeString(edgeID);
493 515 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
494 515 : content.writeDouble(x);
495 515 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
496 515 : content.writeDouble(y);
497 515 : content.writeUnsignedByte(libsumo::TYPE_DOUBLE);
498 515 : content.writeDouble(angle);
499 515 : content.writeUnsignedByte(libsumo::TYPE_BYTE);
500 515 : content.writeByte(keepRoute);
501 : StoHelp::writeTypedDouble(content, matchThreshold);
502 515 : Dom::set(libsumo::MOVE_TO_XY, personID, &content);
503 515 : }
504 :
505 :
506 : /** untested setter functions which alter the person's vtype ***/
507 :
508 : void
509 1 : Person::setLength(const std::string& personID, double length) {
510 1 : Dom::setDouble(libsumo::VAR_LENGTH, personID, length);
511 1 : }
512 :
513 :
514 : void
515 0 : Person::setMaxSpeed(const std::string& personID, double speed) {
516 0 : Dom::setDouble(libsumo::VAR_MAXSPEED, personID, speed);
517 0 : }
518 :
519 :
520 : void
521 0 : Person::setVehicleClass(const std::string& personID, const std::string& clazz) {
522 0 : Dom::setString(libsumo::VAR_VEHICLECLASS, personID, clazz);
523 0 : }
524 :
525 :
526 : void
527 0 : Person::setShapeClass(const std::string& personID, const std::string& clazz) {
528 0 : Dom::setString(libsumo::VAR_SHAPECLASS, personID, clazz);
529 0 : }
530 :
531 :
532 : void
533 0 : Person::setEmissionClass(const std::string& personID, const std::string& clazz) {
534 0 : Dom::setString(libsumo::VAR_EMISSIONCLASS, personID, clazz);
535 0 : }
536 :
537 :
538 : void
539 1 : Person::setWidth(const std::string& personID, double width) {
540 1 : Dom::setDouble(libsumo::VAR_WIDTH, personID, width);
541 1 : }
542 :
543 :
544 : void
545 1 : Person::setHeight(const std::string& personID, double height) {
546 1 : Dom::setDouble(libsumo::VAR_HEIGHT, personID, height);
547 1 : }
548 :
549 :
550 : void
551 0 : Person::setMass(const std::string& personID, double mass) {
552 0 : Dom::setDouble(libsumo::VAR_HEIGHT, personID, mass);
553 0 : }
554 :
555 :
556 : void
557 1 : Person::setMinGap(const std::string& personID, double minGap) {
558 1 : Dom::setDouble(libsumo::VAR_MINGAP, personID, minGap);
559 1 : }
560 :
561 :
562 : void
563 0 : Person::setAccel(const std::string& personID, double accel) {
564 0 : Dom::setDouble(libsumo::VAR_ACCEL, personID, accel);
565 0 : }
566 :
567 :
568 : void
569 0 : Person::setDecel(const std::string& personID, double decel) {
570 0 : Dom::setDouble(libsumo::VAR_DECEL, personID, decel);
571 0 : }
572 :
573 :
574 : void
575 0 : Person::setEmergencyDecel(const std::string& personID, double decel) {
576 0 : Dom::setDouble(libsumo::VAR_EMERGENCY_DECEL, personID, decel);
577 0 : }
578 :
579 :
580 : void
581 0 : Person::setApparentDecel(const std::string& personID, double decel) {
582 0 : Dom::setDouble(libsumo::VAR_APPARENT_DECEL, personID, decel);
583 0 : }
584 :
585 :
586 : void
587 0 : Person::setImperfection(const std::string& personID, double imperfection) {
588 0 : Dom::setDouble(libsumo::VAR_IMPERFECTION, personID, imperfection);
589 0 : }
590 :
591 :
592 : void
593 0 : Person::setTau(const std::string& personID, double tau) {
594 0 : Dom::setDouble(libsumo::VAR_TAU, personID, tau);
595 0 : }
596 :
597 :
598 : void
599 0 : Person::setMinGapLat(const std::string& personID, double minGapLat) {
600 0 : Dom::setDouble(libsumo::VAR_MINGAP_LAT, personID, minGapLat);
601 0 : }
602 :
603 :
604 : void
605 0 : Person::setMaxSpeedLat(const std::string& personID, double speed) {
606 0 : Dom::setDouble(libsumo::VAR_MAXSPEED_LAT, personID, speed);
607 0 : }
608 :
609 :
610 : void
611 0 : Person::setLateralAlignment(const std::string& personID, const std::string& latAlignment) {
612 0 : Dom::setString(libsumo::VAR_LATALIGNMENT, personID, latAlignment);
613 0 : }
614 :
615 :
616 : void
617 6 : Person::setSpeedFactor(const std::string& personID, double factor) {
618 6 : Dom::setDouble(libsumo::VAR_SPEED_FACTOR, personID, factor);
619 6 : }
620 :
621 :
622 : void
623 0 : Person::setActionStepLength(const std::string& personID, double actionStepLength, bool resetActionOffset) {
624 0 : if (!resetActionOffset) {
625 0 : actionStepLength *= -1;
626 : }
627 0 : Dom::setDouble(libsumo::VAR_ACTIONSTEPLENGTH, personID, actionStepLength);
628 0 : }
629 :
630 : void
631 5 : Person::remove(const std::string& personID, char reason) {
632 5 : tcpip::Storage content;
633 5 : content.writeUnsignedByte(libsumo::TYPE_BYTE);
634 5 : content.writeUnsignedByte(reason);
635 5 : Dom::set(libsumo::REMOVE, personID, &content);
636 5 : }
637 :
638 :
639 : void
640 1 : Person::setColor(const std::string& personID, const libsumo::TraCIColor& color) {
641 1 : Dom::setCol(libsumo::VAR_COLOR, personID, color);
642 1 : }
643 :
644 :
645 8333 : LIBTRACI_SUBSCRIPTION_IMPLEMENTATION(Person, PERSON)
646 :
647 :
648 : }
649 :
650 :
651 : /****************************************************************************/
|