Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2001-2024 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 SUMOVehicleClass.cpp
15 : /// @author Daniel Krajzewicz
16 : /// @author Jakob Erdmann
17 : /// @author Michael Behrisch
18 : /// @author Walter Bamberger
19 : /// @author Laura Bieker-Walz
20 : /// @date 2006-01-24
21 : ///
22 : // Definitions of SUMO vehicle classes and helper functions
23 : /****************************************************************************/
24 : #include <config.h>
25 :
26 : #include <string>
27 : #include <map>
28 : #include "SUMOVehicleClass.h"
29 : #include <utils/common/StringUtils.h>
30 : #include <utils/common/ToString.h>
31 : #include <utils/common/MsgHandler.h>
32 : #include <utils/common/StringTokenizer.h>
33 : #include <utils/iodevices/OutputDevice.h>
34 : #include <utils/xml/SUMOSAXAttributes.h>
35 :
36 :
37 : // ===========================================================================
38 : // static members
39 : // ===========================================================================
40 :
41 : static StringBijection<SUMOVehicleClass>::Entry sumoVehicleClassStringInitializer[] = {
42 : {"ignoring", SVC_IGNORING},
43 : {"private", SVC_PRIVATE},
44 : {"public_emergency", SVC_EMERGENCY}, // !!! deprecated
45 : {"emergency", SVC_EMERGENCY},
46 : {"public_authority", SVC_AUTHORITY}, // !!! deprecated
47 : {"authority", SVC_AUTHORITY},
48 : {"public_army", SVC_ARMY}, // !!! deprecated
49 : {"army", SVC_ARMY},
50 : {"vip", SVC_VIP},
51 : {"passenger", SVC_PASSENGER},
52 : {"hov", SVC_HOV},
53 : {"taxi", SVC_TAXI},
54 : {"public_transport", SVC_BUS}, // !!! deprecated
55 : {"bus", SVC_BUS},
56 : {"coach", SVC_COACH},
57 : {"delivery", SVC_DELIVERY},
58 : {"transport", SVC_TRUCK}, // !!! deprecated
59 : {"truck", SVC_TRUCK},
60 : {"trailer", SVC_TRAILER},
61 : {"lightrail", SVC_TRAM}, // !!! deprecated
62 : {"tram", SVC_TRAM},
63 : {"cityrail", SVC_RAIL_URBAN}, // !!! deprecated
64 : {"rail_urban", SVC_RAIL_URBAN},
65 : {"rail_slow", SVC_RAIL}, // !!! deprecated
66 : {"rail", SVC_RAIL},
67 : {"rail_fast", SVC_RAIL_FAST},
68 : {"rail_electric", SVC_RAIL_ELECTRIC},
69 : {"motorcycle", SVC_MOTORCYCLE},
70 : {"moped", SVC_MOPED},
71 : {"bicycle", SVC_BICYCLE},
72 : {"pedestrian", SVC_PEDESTRIAN},
73 : {"evehicle", SVC_E_VEHICLE},
74 : {"ship", SVC_SHIP},
75 : {"container", SVC_CONTAINER},
76 : {"cable_car", SVC_CABLE_CAR},
77 : {"subway", SVC_SUBWAY},
78 : {"aircraft", SVC_AIRCRAFT},
79 : {"wheelchair", SVC_WHEELCHAIR},
80 : {"scooter", SVC_SCOOTER},
81 : {"drone", SVC_DRONE},
82 : {"custom1", SVC_CUSTOM1},
83 : {"custom2", SVC_CUSTOM2}
84 : };
85 :
86 :
87 : StringBijection<SUMOVehicleClass> SumoVehicleClassStrings(
88 : sumoVehicleClassStringInitializer, SVC_CUSTOM2, false);
89 :
90 : // count only non-deprecated classes
91 : const int NUM_VCLASSES = SumoVehicleClassStrings.size() - 8;
92 :
93 : std::set<std::string> deprecatedVehicleClassesSeen;
94 :
95 :
96 : static StringBijection<SUMOVehicleShape>::Entry sumoVehicleShapeStringInitializer[] = {
97 : {"pedestrian", SUMOVehicleShape::PEDESTRIAN},
98 : {"bicycle", SUMOVehicleShape::BICYCLE},
99 : {"moped", SUMOVehicleShape::MOPED},
100 : {"motorcycle", SUMOVehicleShape::MOTORCYCLE},
101 : {"passenger", SUMOVehicleShape::PASSENGER},
102 : {"passenger/sedan", SUMOVehicleShape::PASSENGER_SEDAN},
103 : {"passenger/hatchback", SUMOVehicleShape::PASSENGER_HATCHBACK},
104 : {"passenger/wagon", SUMOVehicleShape::PASSENGER_WAGON},
105 : {"passenger/van", SUMOVehicleShape::PASSENGER_VAN},
106 : {"taxi", SUMOVehicleShape::TAXI},
107 : {"delivery", SUMOVehicleShape::DELIVERY},
108 : {"transport", SUMOVehicleShape::TRUCK}, // !!! deprecated
109 : {"truck", SUMOVehicleShape::TRUCK},
110 : {"transport/semitrailer", SUMOVehicleShape::TRUCK_SEMITRAILER}, // !!! deprecated
111 : {"truck/semitrailer", SUMOVehicleShape::TRUCK_SEMITRAILER},
112 : {"transport/trailer", SUMOVehicleShape::TRUCK_1TRAILER}, // !!! deprecated
113 : {"truck/trailer", SUMOVehicleShape::TRUCK_1TRAILER},
114 : {"bus/city", SUMOVehicleShape::BUS}, // !!! deprecated
115 : {"bus", SUMOVehicleShape::BUS},
116 : {"bus/overland", SUMOVehicleShape::BUS_COACH}, // !!! deprecated
117 : {"bus/coach", SUMOVehicleShape::BUS_COACH},
118 : {"bus/flexible", SUMOVehicleShape::BUS_FLEXIBLE},
119 : {"bus/trolley", SUMOVehicleShape::BUS_TROLLEY},
120 : {"rail/slow", SUMOVehicleShape::RAIL}, // !!! deprecated
121 : {"rail/fast", SUMOVehicleShape::RAIL}, // !!! deprecated
122 : {"rail", SUMOVehicleShape::RAIL},
123 : {"rail/light", SUMOVehicleShape::RAIL_CAR}, // !!! deprecated
124 : {"rail/city", SUMOVehicleShape::RAIL_CAR}, // !!! deprecated
125 : {"rail/railcar", SUMOVehicleShape::RAIL_CAR},
126 : {"rail/cargo", SUMOVehicleShape::RAIL_CARGO},
127 : {"evehicle", SUMOVehicleShape::E_VEHICLE},
128 : {"ant", SUMOVehicleShape::ANT},
129 : {"ship", SUMOVehicleShape::SHIP},
130 : {"emergency", SUMOVehicleShape::EMERGENCY},
131 : {"firebrigade", SUMOVehicleShape::FIREBRIGADE},
132 : {"police", SUMOVehicleShape::POLICE},
133 : {"rickshaw", SUMOVehicleShape::RICKSHAW },
134 : {"scooter", SUMOVehicleShape::SCOOTER},
135 : {"aircraft", SUMOVehicleShape::AIRCRAFT},
136 : {"", SUMOVehicleShape::UNKNOWN}
137 : };
138 :
139 :
140 : StringBijection<SUMOVehicleShape> SumoVehicleShapeStrings(
141 : sumoVehicleShapeStringInitializer, SUMOVehicleShape::UNKNOWN, false);
142 :
143 : // ===========================================================================
144 : // static values used for cached
145 : // ===========================================================================
146 :
147 : static std::map<SVCPermissions, std::vector<std::string> > vehicleClassNamesListCached;
148 : static std::map<std::string, SVCPermissions> parseVehicleClassesCached;
149 : static std::map<SVCPermissions, std::string> getVehicleClassNamesCached;
150 : static std::string VehicleClassNameAll = "all";
151 :
152 : // ===========================================================================
153 : // additional constants
154 : // ===========================================================================
155 :
156 : const SUMOVehicleClass SUMOVehicleClass_MAX = SVC_CUSTOM2;
157 :
158 : const SVCPermissions SVCAll = 2 * (long long int)SUMOVehicleClass_MAX - 1; // all relevant bits set to 1
159 :
160 : const SVCPermissions SVC_UNSPECIFIED = -1;
161 :
162 : const SUMOEmissionClass EMISSION_CLASS_UNSPECIFIED = -1;
163 :
164 : const std::string DEFAULT_VTYPE_ID("DEFAULT_VEHTYPE");
165 : const std::string DEFAULT_PEDTYPE_ID("DEFAULT_PEDTYPE");
166 : const std::string DEFAULT_BIKETYPE_ID("DEFAULT_BIKETYPE");
167 : const std::string DEFAULT_CONTAINERTYPE_ID("DEFAULT_CONTAINERTYPE");
168 : const std::string DEFAULT_TAXITYPE_ID("DEFAULT_TAXITYPE");
169 : const std::string DEFAULT_RAILTYPE_ID("DEFAULT_RAILTYPE");
170 :
171 : const std::set<std::string> DEFAULT_VTYPES({DEFAULT_VTYPE_ID, DEFAULT_PEDTYPE_ID, DEFAULT_BIKETYPE_ID, DEFAULT_CONTAINERTYPE_ID, DEFAULT_TAXITYPE_ID, DEFAULT_RAILTYPE_ID});
172 :
173 : const double DEFAULT_VEH_PROB(1.);
174 :
175 : const double DEFAULT_PEDESTRIAN_SPEED(5. / 3.6);
176 :
177 : const double DEFAULT_BICYCLE_SPEED(20. / 3.6);
178 :
179 : const double DEFAULT_CONTAINER_TRANSHIP_SPEED(5. / 3.6);
180 :
181 :
182 : // ===========================================================================
183 : // method definitions
184 : // ===========================================================================
185 :
186 : // Stop Offset
187 :
188 2638660 : StopOffset::StopOffset() :
189 2638660 : myPermissions(SVCAll),
190 2638660 : myOffset(0) {
191 2638660 : }
192 :
193 :
194 2229 : StopOffset::StopOffset(const SUMOSAXAttributes& attrs, bool& ok) :
195 2229 : myPermissions(SVC_IGNORING),
196 2229 : myOffset(0) {
197 : // first check conditions
198 2229 : if (attrs.hasAttribute(SUMO_ATTR_VCLASSES) && attrs.hasAttribute(SUMO_ATTR_EXCEPTIONS)) {
199 0 : WRITE_ERROR(TL("Simultaneous specification of vClasses and exceptions is not allowed"));
200 0 : ok = false;
201 : }
202 2229 : if (!attrs.hasAttribute(SUMO_ATTR_VALUE)) {
203 2 : WRITE_ERROR(TL("StopOffset requires an offset value"));
204 2 : ok = false;
205 : }
206 : // parse elements
207 2229 : const std::string vClasses = attrs.getOpt<std::string>(SUMO_ATTR_VCLASSES, nullptr, ok, "");
208 2229 : const std::string exceptions = attrs.getOpt<std::string>(SUMO_ATTR_EXCEPTIONS, nullptr, ok, "");
209 : // parse permissions
210 2229 : if (attrs.hasAttribute(SUMO_ATTR_VCLASSES)) {
211 1212 : myPermissions = parseVehicleClasses(vClasses);
212 1017 : } else if (attrs.hasAttribute(SUMO_ATTR_EXCEPTIONS)) {
213 1001 : myPermissions = ~parseVehicleClasses(exceptions);
214 : } else {
215 : // no vClasses specified, thus apply to all
216 16 : myPermissions = parseVehicleClasses("all");
217 : }
218 : // parse offset
219 2229 : myOffset = attrs.getOpt<double>(SUMO_ATTR_VALUE, nullptr, ok, 0);
220 2229 : }
221 :
222 :
223 : bool
224 2178526949 : StopOffset::isDefined() const {
225 2178526949 : return myOffset != 0;
226 : }
227 :
228 :
229 : void
230 1737768 : StopOffset::reset() {
231 1737768 : myPermissions = SVC_IGNORING;
232 1737768 : myOffset = 0;
233 1737768 : }
234 :
235 :
236 : SVCPermissions
237 88189 : StopOffset::getPermissions() const {
238 88189 : return myPermissions;
239 : }
240 :
241 :
242 : std::string
243 0 : StopOffset::getExceptions() const {
244 0 : return getVehicleClassNames(~myPermissions);
245 : }
246 :
247 :
248 : double
249 83576 : StopOffset::getOffset() const {
250 83576 : return myOffset;
251 : }
252 :
253 :
254 : void
255 0 : StopOffset::setPermissions(const SVCPermissions permissions) {
256 0 : myPermissions = permissions;
257 0 : }
258 :
259 :
260 : void
261 0 : StopOffset::setExceptions(const std::string permissions) {
262 0 : myPermissions = ~parseVehicleClasses(permissions);
263 0 : }
264 :
265 :
266 : void
267 0 : StopOffset::setOffset(const double offset) {
268 0 : myOffset = offset;
269 0 : }
270 :
271 :
272 : bool
273 0 : StopOffset::operator==(StopOffset const& other) const {
274 0 : return ((myPermissions == other.myPermissions) &&
275 0 : (myOffset == other.myOffset));
276 : }
277 :
278 :
279 : bool
280 114854 : StopOffset::operator!=(StopOffset const& other) const {
281 114854 : return ((myPermissions != other.myPermissions) ||
282 114831 : (myOffset != other.myOffset));
283 : }
284 :
285 : // Conversion of SUMOVehicleClass
286 :
287 : const std::string&
288 136485 : getVehicleClassNames(SVCPermissions permissions, bool expand) {
289 136485 : if ((permissions & SVCAll) == SVCAll && !expand) {
290 : return VehicleClassNameAll;
291 : }
292 : // check if previously was cached
293 : if (getVehicleClassNamesCached.count(permissions) == 0) {
294 4348 : getVehicleClassNamesCached[permissions] = joinToString(getVehicleClassNamesList(permissions), ' ');
295 : }
296 136481 : return getVehicleClassNamesCached.at(permissions);
297 : }
298 :
299 :
300 : const std::vector<std::string>&
301 2343 : getVehicleClassNamesList(SVCPermissions permissions) {
302 : // first check if it's cached
303 : if (vehicleClassNamesListCached.count(permissions) == 0) {
304 2312 : const std::vector<std::string> classNames = SumoVehicleClassStrings.getStrings();
305 : std::vector<std::string> result;
306 80920 : for (std::vector<std::string>::const_iterator it = classNames.begin(); it != classNames.end(); it++) {
307 78608 : const SVCPermissions svc = (SVCPermissions)SumoVehicleClassStrings.get(*it);
308 78608 : if ((svc & permissions) == svc && svc != SVC_IGNORING) {
309 9602 : result.push_back(*it);
310 : }
311 : }
312 : // add it into vehicleClassNamesListCached
313 2312 : vehicleClassNamesListCached[permissions] = result;
314 2312 : }
315 2343 : return vehicleClassNamesListCached.at(permissions);
316 : }
317 :
318 :
319 : SUMOVehicleClass
320 183179 : getVehicleClassID(const std::string& name) {
321 : if (SumoVehicleClassStrings.hasString(name)) {
322 183164 : return SumoVehicleClassStrings.get(name);
323 : }
324 30 : throw InvalidArgument("Unknown vehicle class '" + name + "'.");
325 : }
326 :
327 :
328 : SVCPermissions
329 0 : getVehicleClassCompoundID(const std::string& name) {
330 : SVCPermissions ret = SVC_IGNORING;
331 0 : const std::vector<std::string> names = SumoVehicleClassStrings.getStrings();
332 0 : for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); it++) {
333 0 : if (name.find(*it) != std::string::npos) {
334 0 : ret = ret | (SVCPermissions) SumoVehicleClassStrings.get(*it);
335 : }
336 : }
337 0 : return ret;
338 0 : }
339 :
340 :
341 : SVCPermissions
342 933746 : parseVehicleClasses(const std::string& allowedS) {
343 933746 : if (allowedS == VehicleClassNameAll) {
344 : return SVCAll;
345 : }
346 : // check if allowedS was previously cached
347 : if (parseVehicleClassesCached.count(allowedS) == 0) {
348 : SVCPermissions result = 0;
349 125709 : StringTokenizer sta(allowedS, " ");
350 139583 : while (sta.hasNext()) {
351 97680 : const std::string s = sta.next();
352 97680 : if (!SumoVehicleClassStrings.hasString(s)) {
353 16 : if (gIgnoreUnknownVClass) {
354 27 : WRITE_WARNINGF(TL("Unknown vehicle class '%' ignored."), s);
355 : } else {
356 21 : WRITE_ERRORF(TL("Unknown vehicle class '%' encountered."), s);
357 : }
358 : } else {
359 97664 : const SUMOVehicleClass vc = getVehicleClassID(s);
360 97664 : const std::string& realName = SumoVehicleClassStrings.getString(vc);
361 97664 : if (realName != s) {
362 : deprecatedVehicleClassesSeen.insert(s);
363 : }
364 97664 : result |= vc;
365 : }
366 : }
367 : // save parsed vehicle class cached
368 41903 : parseVehicleClassesCached[allowedS] = result;
369 41903 : }
370 921671 : return parseVehicleClassesCached.at(allowedS);
371 : }
372 :
373 :
374 : bool
375 0 : canParseVehicleClasses(const std::string& classes) {
376 0 : if (classes == VehicleClassNameAll) {
377 : return true;
378 : }
379 : // check if was previously cached
380 : if (parseVehicleClassesCached.count(classes) != 0) {
381 0 : return true;
382 : }
383 0 : StringTokenizer sta(classes, " ");
384 0 : while (sta.hasNext()) {
385 0 : if (!SumoVehicleClassStrings.hasString(sta.next())) {
386 : return false;
387 : }
388 : }
389 : return true;
390 0 : }
391 :
392 :
393 : SVCPermissions
394 7188227 : parseVehicleClasses(const std::string& allowedS, const std::string& disallowedS, const MMVersion& networkVersion) {
395 7188227 : if (allowedS.size() == 0 && disallowedS.size() == 0) {
396 : return SVCAll;
397 931515 : } else if (allowedS.size() > 0 && disallowedS.size() > 0) {
398 1 : WRITE_WARNING(TL("SVCPermissions must be specified either via 'allow' or 'disallow'. Ignoring 'disallow'"));
399 1 : return parseVehicleClasses(allowedS);
400 931514 : } else if (allowedS.size() > 0) {
401 547850 : return parseVehicleClasses(allowedS);
402 : } else {
403 383664 : return invertPermissions(extraDisallowed(parseVehicleClasses(disallowedS), networkVersion));
404 : }
405 : }
406 :
407 : SVCPermissions
408 383664 : extraDisallowed(SVCPermissions disallowed, const MMVersion& networkVersion) {
409 : if (networkVersion < MMVersion(1, 3)) {
410 28228 : disallowed |= SVC_RAIL_FAST;
411 : }
412 : if (networkVersion < MMVersion(1, 20)) {
413 189979 : if ((disallowed & SVC_RAIL_URBAN) != 0) {
414 : disallowed |= SVC_SUBWAY;
415 33847 : disallowed |= SVC_CABLE_CAR;
416 : }
417 : }
418 383664 : return disallowed;
419 : }
420 :
421 :
422 : SVCPermissions
423 383743 : invertPermissions(SVCPermissions permissions) {
424 383743 : return SVCAll & ~permissions;
425 : }
426 :
427 :
428 : SVCPermissions
429 12416 : parseVehicleClasses(const std::vector<std::string>& allowedS) {
430 : SVCPermissions result = 0;
431 12416 : if (std::find(allowedS.begin(), allowedS.end(), VehicleClassNameAll) != allowedS.end()) {
432 : return SVCAll;
433 : }
434 37107 : for (std::vector<std::string>::const_iterator i = allowedS.begin(); i != allowedS.end(); ++i) {
435 24699 : const SUMOVehicleClass vc = getVehicleClassID(*i);
436 24692 : const std::string& realName = SumoVehicleClassStrings.getString(vc);
437 24692 : if (realName != *i) {
438 0 : WRITE_WARNINGF(TL("The vehicle class '%' is deprecated, use '%' instead."), (*i), realName);
439 : }
440 24692 : result |= getVehicleClassID(*i);
441 : }
442 : return result;
443 : }
444 :
445 :
446 : void
447 232923 : writePermissions(OutputDevice& into, SVCPermissions permissions) {
448 232923 : if (permissions == SVCAll) {
449 : return;
450 136255 : } else if (permissions == 0) {
451 : into.writeAttr(SUMO_ATTR_DISALLOW, VehicleClassNameAll);
452 870 : return;
453 : } else {
454 : int num_allowed = 0;
455 4603090 : for (SVCPermissions mask = 1; mask <= SUMOVehicleClass_MAX; mask = mask << 1) {
456 4467705 : if ((mask & permissions) == mask) {
457 1523696 : ++num_allowed;
458 : }
459 : }
460 135385 : if (num_allowed <= (NUM_VCLASSES - num_allowed) && num_allowed > 0) {
461 74613 : into.writeAttr(SUMO_ATTR_ALLOW, getVehicleClassNames(permissions));
462 : } else {
463 60772 : into.writeAttr(SUMO_ATTR_DISALLOW, getVehicleClassNames(~permissions));
464 : }
465 : }
466 : }
467 :
468 :
469 : void
470 230114 : writePreferences(OutputDevice& into, SVCPermissions preferred) {
471 230114 : if (preferred == SVCAll || preferred == 0) {
472 : return;
473 : } else {
474 116 : into.writeAttr(SUMO_ATTR_PREFER, getVehicleClassNames(preferred));
475 : }
476 : }
477 :
478 :
479 : SUMOVehicleShape
480 16 : getVehicleShapeID(const std::string& name) {
481 : if (SumoVehicleShapeStrings.hasString(name)) {
482 16 : return SumoVehicleShapeStrings.get(name);
483 : } else {
484 0 : throw InvalidArgument("Unknown vehicle shape '" + name + "'.");
485 : }
486 : }
487 :
488 :
489 : bool
490 0 : canParseVehicleShape(const std::string& shape) {
491 0 : return SumoVehicleShapeStrings.hasString(shape);
492 : }
493 :
494 :
495 : std::string
496 147 : getVehicleShapeName(SUMOVehicleShape id) {
497 147 : return SumoVehicleShapeStrings.getString(id);
498 : }
499 :
500 :
501 2894102521 : bool isRailway(SVCPermissions permissions) {
502 2894102521 : return (permissions & SVC_RAIL_CLASSES) > 0 && (permissions & SVC_PASSENGER) == 0;
503 : }
504 :
505 2340 : bool isTram(SVCPermissions permissions) {
506 2340 : return (permissions & SVC_RAIL_CLASSES) == SVC_TRAM && (permissions & SVC_PASSENGER) == 0;
507 : }
508 :
509 108872 : bool isBikepath(SVCPermissions permissions) {
510 108872 : return (permissions & SVC_BICYCLE) == SVC_BICYCLE && (permissions & SVC_PASSENGER) == 0;
511 : }
512 :
513 :
514 : bool
515 28502525 : isWaterway(SVCPermissions permissions) {
516 28502525 : return permissions == SVC_SHIP;
517 : }
518 :
519 : bool
520 2870151 : isAirway(SVCPermissions permissions) {
521 2870151 : return permissions == SVC_AIRCRAFT || permissions == SVC_DRONE;
522 : }
523 :
524 : bool
525 185382 : isForbidden(SVCPermissions permissions) {
526 185382 : return (permissions & SVCAll) == 0;
527 : }
528 :
529 :
530 : bool
531 101058 : isSidewalk(SVCPermissions permissions) {
532 101058 : return (permissions & SVCAll) == SVC_PEDESTRIAN;
533 : }
534 :
535 :
536 : bool
537 1914 : isForVulnerableModes(SVCPermissions permissions) {
538 1914 : return ((permissions & SVC_VULNERABLE) != 0 && (permissions & ~SVC_VULNERABLE) == 0);
539 : }
540 :
541 :
542 : bool
543 10717 : noVehicles(SVCPermissions permissions) {
544 10717 : return isForbidden(permissions) || isSidewalk(permissions);
545 : }
546 :
547 :
548 : double
549 722457 : getDefaultVehicleLength(const SUMOVehicleClass vc) {
550 722457 : switch (vc) {
551 : case SVC_PEDESTRIAN:
552 : return 0.215;
553 : case SVC_WHEELCHAIR:
554 : return 0.5;
555 54056 : case SVC_BICYCLE:
556 54056 : return 1.6;
557 24 : case SVC_SCOOTER:
558 24 : return 1.2;
559 118 : case SVC_MOPED:
560 118 : return 2.1;
561 139 : case SVC_MOTORCYCLE:
562 139 : return 2.2;
563 481 : case SVC_TRUCK:
564 481 : return 7.1;
565 58 : case SVC_TRAILER:
566 58 : return 16.5;
567 1180 : case SVC_BUS:
568 1180 : return 12.;
569 41 : case SVC_COACH:
570 41 : return 14.;
571 321 : case SVC_TRAM:
572 321 : return 22.;
573 966 : case SVC_RAIL_URBAN:
574 : case SVC_SUBWAY:
575 966 : return 36.5 * 3;
576 55005 : case SVC_RAIL:
577 55005 : return 67.5 * 2;
578 48 : case SVC_RAIL_ELECTRIC:
579 : case SVC_RAIL_FAST:
580 48 : return 25. * 8;
581 329 : case SVC_DELIVERY:
582 : case SVC_EMERGENCY:
583 329 : return 6.5;
584 296 : case SVC_SHIP:
585 296 : return 17;
586 43196 : case SVC_CONTAINER:
587 43196 : return 6.096;
588 : case SVC_DRONE:
589 : return 0.5;
590 24 : case SVC_AIRCRAFT:
591 24 : return 72.7;
592 460530 : default:
593 460530 : return 5; /*4.3*/
594 : }
595 : }
596 :
597 :
598 :
599 : /****************************************************************************/
|