SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SUMOVehicleParserHelper.cpp
Go to the documentation of this file.
1 /****************************************************************************/
11 // Helper methods for parsing vehicle attributes
12 /****************************************************************************/
13 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
14 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
15 /****************************************************************************/
16 //
17 // This file is part of SUMO.
18 // SUMO is free software: you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation, either version 3 of the License, or
21 // (at your option) any later version.
22 //
23 /****************************************************************************/
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <utils/common/ToString.h>
42 
43 #ifdef CHECK_MEMORY_LEAKS
44 #include <foreign/nvwa/debug_new.h>
45 #endif // CHECK_MEMORY_LEAKS
46 
47 
48 // ===========================================================================
49 // static members
50 // ===========================================================================
52 
63 
64 
65 // ===========================================================================
66 // method definitions
67 // ===========================================================================
70  bool ok = true;
71  std::string id = attrs.getStringReporting(SUMO_ATTR_ID, 0, ok);
73  throw ProcessError("At most one of '" + attrs.getName(SUMO_ATTR_PERIOD) +
74  "' and '" + attrs.getName(SUMO_ATTR_VEHSPERHOUR) +
75  "' has to be given in the definition of flow '" + id + "'.");
76  }
79  throw ProcessError("If '" + attrs.getName(SUMO_ATTR_PERIOD) +
80  "' or '" + attrs.getName(SUMO_ATTR_VEHSPERHOUR) +
81  "' are given at most one of '" + attrs.getName(SUMO_ATTR_END) +
82  "' and '" + attrs.getName(SUMO_ATTR_NUMBER) +
83  "' are allowed in flow '" + id + "'.");
84  }
85  } else {
87  throw ProcessError("At least one of '" + attrs.getName(SUMO_ATTR_PERIOD) +
88  "', '" + attrs.getName(SUMO_ATTR_VEHSPERHOUR) +
89  "', and '" + attrs.getName(SUMO_ATTR_NUMBER) +
90  "' is needed in flow '" + id + "'.");
91  }
92  }
94  ret->id = id;
95  parseCommonAttributes(attrs, ret, "flow");
96 
97  // parse repetition information
98  if (attrs.hasAttribute(SUMO_ATTR_PERIOD)) {
100 #ifdef HAVE_SUBSECOND_TIMESTEPS
101  ret->repetitionOffset = attrs.getSUMOTimeReporting(SUMO_ATTR_PERIOD, id.c_str(), ok);
102 #else
103  ret->repetitionOffset = attrs.getSUMORealReporting(SUMO_ATTR_PERIOD, id.c_str(), ok);
104 #endif
105  }
106  if (attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR)) {
108  const SUMOReal vph = attrs.getSUMORealReporting(SUMO_ATTR_VEHSPERHOUR, id.c_str(), ok);
109  if (ok && vph <= 0) {
110  delete ret;
111  throw ProcessError("Invalid repetition rate in the definition of flow '" + id + "'.");
112  }
113  if (ok && vph != 0) {
114  ret->repetitionOffset = TIME2STEPS(3600. / vph);
115  }
116  }
117 
118  ret->depart = string2time(OptionsCont::getOptions().getString("begin"));
119  if (attrs.hasAttribute(SUMO_ATTR_BEGIN)) {
120  ret->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), ok);
121  }
122  if (ok && ret->depart < 0) {
123  delete ret;
124  throw ProcessError("Negative begin time in the definition of flow '" + id + "'.");
125  }
126  SUMOTime end = string2time(OptionsCont::getOptions().getString("end"));
127  if (end < 0) {
128  end = SUMOTime_MAX;
129  }
130  if (attrs.hasAttribute(SUMO_ATTR_END)) {
131  end = attrs.getSUMOTimeReporting(SUMO_ATTR_END, id.c_str(), ok);
132  }
133  if (ok && end <= ret->depart) {
134  delete ret;
135  throw ProcessError("Flow '" + id + "' ends before or at its begin time.");
136  }
139  ? attrs.getIntReporting(SUMO_ATTR_NUMBER, id.c_str(), ok)
140  : attrs.getIntReporting(SUMO_ATTR_NO__DEPRECATED, id.c_str(), ok);
143  WRITE_WARNING("'" + toString(SUMO_ATTR_NO__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_NUMBER) + "' instead.");
144  }
146  if (ok && ret->repetitionNumber < 0) {
147  delete ret;
148  throw ProcessError("Negative repetition number in the definition of flow '" + id + "'.");
149  }
150  if (ok && ret->repetitionOffset < 0) {
151  ret->repetitionOffset = (end - ret->depart) / ret->repetitionNumber;
152  }
153  } else {
154  if (ok && ret->repetitionOffset <= 0) {
155  delete ret;
156  throw ProcessError("Invalid repetition rate in the definition of flow '" + id + "'.");
157  }
158  if (end == SUMOTime_MAX) {
159  ret->repetitionNumber = INT_MAX;
160  } else {
161  ret->repetitionNumber = static_cast<int>(static_cast<SUMOReal>(end - ret->depart) / ret->repetitionOffset + 0.5);
162  }
163  }
164  if (!ok) {
165  delete ret;
166  throw ProcessError();
167  }
168  return ret;
169 }
170 
171 
174  bool skipID, bool skipDepart) {
175  bool ok = true;
176  std::string id, errorMsg;
177  if (!skipID) {
178  id = attrs.getStringReporting(SUMO_ATTR_ID, 0, ok);
179  }
181  throw ProcessError("The attributes '" + attrs.getName(SUMO_ATTR_PERIOD) +
182  "' and '" + attrs.getName(SUMO_ATTR_REPNUMBER) +
183  "' have to be given both in the definition of '" + id + "'.");
184  }
186  ret->id = id;
187  try {
188  parseCommonAttributes(attrs, ret, "vehicle");
189  } catch (ProcessError&) {
190  delete ret;
191  throw;
192  }
193  if (!skipDepart) {
194  const std::string helper = attrs.getStringReporting(SUMO_ATTR_DEPART, 0, ok);
195  if (helper == "triggered") {
197  } else {
199  ret->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_DEPART, id.c_str(), ok);
200  if (ok && ret->depart < 0) {
201  errorMsg = "Negative departure time in the definition of '" + id + "'.";
202  ok = false;
203  }
204  }
205  }
206  // parse repetition information
207  if (attrs.hasAttribute(SUMO_ATTR_PERIOD)) {
208  WRITE_WARNING("period and repno are deprecated in vehicle '" + id + "', use flows instead.");
210 #ifdef HAVE_SUBSECOND_TIMESTEPS
211  ret->repetitionOffset = attrs.getSUMOTimeReporting(SUMO_ATTR_PERIOD, id.c_str(), ok);
212 #else
213  ret->repetitionOffset = attrs.getSUMORealReporting(SUMO_ATTR_PERIOD, id.c_str(), ok);
214 #endif
215  }
216  if (attrs.hasAttribute(SUMO_ATTR_REPNUMBER)) {
218  ret->repetitionNumber = attrs.getIntReporting(SUMO_ATTR_REPNUMBER, id.c_str(), ok);
219  }
220 
221  if (!ok) {
222  delete ret;
223  throw ProcessError(errorMsg);
224  }
225  return ret;
226 }
227 
228 
229 void
231  SUMOVehicleParameter* ret, std::string element) {
232  //ret->refid = attrs.getStringSecure(SUMO_ATTR_REFID, "");
233  bool ok = true;
234  // parse route information
235  if (attrs.hasAttribute(SUMO_ATTR_ROUTE)) {
236  ret->setParameter |= VEHPARS_ROUTE_SET; // !!! needed?
237  ret->routeid = attrs.getStringReporting(SUMO_ATTR_ROUTE, 0, ok);
238  }
239  // parse type information
240  if (attrs.hasAttribute(SUMO_ATTR_TYPE)) {
241  ret->setParameter |= VEHPARS_VTYPE_SET; // !!! needed?
242  ret->vtypeid = attrs.getStringReporting(SUMO_ATTR_TYPE, 0, ok);
243  }
244  // parse line information
245  if (attrs.hasAttribute(SUMO_ATTR_LINE)) {
246  ret->setParameter |= VEHPARS_LINE_SET; // !!! needed?
247  ret->line = attrs.getStringReporting(SUMO_ATTR_LINE, 0, ok);
248  }
249  // parse zone information
251  &&
255  ? attrs.getStringReporting(SUMO_ATTR_FROM_TAZ, 0, ok)
257  ret->toTaz = attrs.hasAttribute(SUMO_ATTR_TO_TAZ)
258  ? attrs.getStringReporting(SUMO_ATTR_TO_TAZ, 0, ok)
264  + "' is deprecated, please use '" + toString(SUMO_ATTR_FROM_TAZ)
265  + "'/'" + toString(SUMO_ATTR_TO_TAZ)
266  + "' instead.");
267  }
268  }
269  // parse reroute information
270  if (attrs.getOptBoolReporting(SUMO_ATTR_REROUTE, 0, ok, false)) {
272  }
273 
274  // parse depart lane information
277  const std::string helper = attrs.hasAttribute(SUMO_ATTR_DEPARTLANE)
282  WRITE_WARNING("'" + toString(SUMO_ATTR_DEPARTLANE__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_DEPARTLANE) + "' instead.");
283  }
284  if (helper == "random") {
286  } else if (helper == "free") {
288  } else if (helper == "allowed") {
290  } else if (helper == "best") {
292  } else {
293  try {
294  ret->departLane = TplConvert<char>::_2int(helper.c_str());
296  if (ret->departLane < 0) {
297  throw ProcessError("Invalid departLane definition for " + element + " '" + ret->id + "'");
298  }
299  } catch (NumberFormatException&) {
300  throw ProcessError("Invalid departLane definition for " + element + " '" + ret->id + "'");
301  } catch (EmptyData&) {
302  throw ProcessError("Invalid departLane definition for " + element + " '" + ret->id + "'");
303  }
304  }
305  }
306  // parse depart position information
309  const std::string helper = attrs.hasAttribute(SUMO_ATTR_DEPARTPOS)
314  WRITE_WARNING("'" + toString(SUMO_ATTR_DEPARTPOS__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_DEPARTPOS) + "' instead.");
315  }
316  if (helper == "random") {
318  } else if (helper == "random_free") {
320  } else if (helper == "free") {
322  } else if (helper == "base") {
324  } else if (helper == "pwagSimple") {
326  } else if (helper == "pwagGeneric") {
328  } else if (helper == "maxSpeedGap") {
330  } else {
331  try {
332  ret->departPos = TplConvert<char>::_2SUMOReal(helper.c_str());
334  } catch (NumberFormatException&) {
335  throw ProcessError("Invalid departPos definition for " + element + " '" + ret->id + "'");
336  } catch (EmptyData&) {
337  throw ProcessError("Invalid departPos definition for " + element + " '" + ret->id + "'");
338  }
339  }
340  }
341  // parse depart speed information
344  std::string helper = attrs.hasAttribute(SUMO_ATTR_DEPARTSPEED)
349  WRITE_WARNING("'" + toString(SUMO_ATTR_DEPARTSPEED__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_DEPARTSPEED) + "' instead.");
350  }
351  if (helper == "random") {
353  } else if (helper == "max") {
355  } else {
356  try {
357  ret->departSpeed = TplConvert<char>::_2SUMOReal(helper.c_str());
359  } catch (NumberFormatException&) {
360  throw ProcessError("Invalid departSpeed definition for " + element + " '" + ret->id + "'");
361  } catch (EmptyData&) {
362  throw ProcessError("Invalid departSpeed definition for " + element + " '" + ret->id + "'");
363  }
364  }
365  }
366 
367  // parse arrival lane information
370  std::string helper = attrs.hasAttribute(SUMO_ATTR_ARRIVALLANE)
375  WRITE_WARNING("'" + toString(SUMO_ATTR_ARRIVALLANE__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_ARRIVALLANE) + "' instead.");
376  }
377  if (helper == "current") {
379  } else {
380  try {
381  ret->arrivalLane = TplConvert<char>::_2int(helper.c_str());
383  } catch (NumberFormatException&) {
384  throw ProcessError("Invalid arrivalLane definition for " + element + " '" + ret->id + "'");
385  } catch (EmptyData&) {
386  throw ProcessError("Invalid arrivalLane definition for " + element + " '" + ret->id + "'");
387  }
388  }
389  }
390  // parse arrival position information
393  std::string helper = attrs.hasAttribute(SUMO_ATTR_ARRIVALPOS)
398  WRITE_WARNING("'" + toString(SUMO_ATTR_ARRIVALPOS__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_ARRIVALPOS) + "' instead.");
399  }
400  if (helper == "random") {
402  } else if (helper == "max") {
404  } else {
405  try {
406  ret->arrivalPos = TplConvert<char>::_2SUMOReal(helper.c_str());
408  } catch (NumberFormatException&) {
409  throw ProcessError("Invalid arrivalPos definition for " + element + " '" + ret->id + "'");
410  } catch (EmptyData&) {
411  throw ProcessError("Invalid arrivalPos definition for " + element + " '" + ret->id + "'");
412  }
413  }
414  }
415  // parse arrival speed information
418  std::string helper = attrs.hasAttribute(SUMO_ATTR_ARRIVALSPEED)
423  WRITE_WARNING("'" + toString(SUMO_ATTR_ARRIVALSPEED__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_ARRIVALSPEED) + "' instead.");
424  }
425  if (helper == "current") {
427  } else {
428  try {
429  ret->arrivalSpeed = TplConvert<char>::_2SUMOReal(helper.c_str());
431  } catch (NumberFormatException&) {
432  throw ProcessError("Invalid arrivalSpeed definition for " + element + " '" + ret->id + "'");
433  } catch (EmptyData&) {
434  throw ProcessError("Invalid arrivalSpeed definition for " + element + " '" + ret->id + "'");
435  }
436  }
437  }
438 
439  // parse color
440  if (attrs.hasAttribute(SUMO_ATTR_COLOR)) {
442  try {
444  } catch (NumberFormatException&) {
445  throw ProcessError("Invalid color definition for " + element + " '" + ret->id + "'");
446  } catch (EmptyData&) {
447  throw ProcessError("Invalid color definition for " + element + " '" + ret->id + "'");
448  }
449  } else {
451  }
452 }
453 
454 
457  SUMOVTypeParameter* vtype = new SUMOVTypeParameter();
458  bool ok = true;
459  vtype->id = attrs.getStringReporting(SUMO_ATTR_ID, 0, ok);
460  if (attrs.hasAttribute(SUMO_ATTR_LENGTH)) {
461  if (!attrs.hasAttribute(SUMO_ATTR_MINGAP)) {
462  WRITE_WARNING("The length does not include the gap to the preceeding vehicle anymore! Please recheck your values.");
463  }
464  vtype->length = attrs.getSUMORealReporting(SUMO_ATTR_LENGTH, vtype->id.c_str(), ok);
466  }
467  if (attrs.hasAttribute(SUMO_ATTR_MINGAP)) {
468  vtype->minGap = attrs.getSUMORealReporting(SUMO_ATTR_MINGAP, vtype->id.c_str(), ok);
470  }
471  if (attrs.hasAttribute(SUMO_ATTR_GUIOFFSET)) {
472  WRITE_WARNING("The guiOffset attribute is deprecated! Please use minGap instead.");
473  vtype->minGap = attrs.getSUMORealReporting(SUMO_ATTR_GUIOFFSET, vtype->id.c_str(), ok);
475  }
476  if (attrs.hasAttribute(SUMO_ATTR_MAXSPEED)) {
477  vtype->maxSpeed = attrs.getSUMORealReporting(SUMO_ATTR_MAXSPEED, vtype->id.c_str(), ok);
479  } else if (attrs.hasAttribute(SUMO_ATTR_MAXSPEED__DEPRECATED)) {
480  vtype->maxSpeed = attrs.getSUMORealReporting(SUMO_ATTR_MAXSPEED__DEPRECATED, vtype->id.c_str(), ok);
484  WRITE_WARNING("'" + toString(SUMO_ATTR_MAXSPEED__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_MAXSPEED) + "' instead.");
485  }
486  }
487  if (attrs.hasAttribute(SUMO_ATTR_SPEEDFACTOR)) {
488  vtype->speedFactor = attrs.getSUMORealReporting(SUMO_ATTR_SPEEDFACTOR, vtype->id.c_str(), ok);
490  }
491  if (attrs.hasAttribute(SUMO_ATTR_SPEEDDEV)) {
492  vtype->speedDev = attrs.getSUMORealReporting(SUMO_ATTR_SPEEDDEV, vtype->id.c_str(), ok);
494  }
496  vtype->emissionClass = parseEmissionClass(attrs, vtype->id);
498  }
502  WRITE_WARNING("'" + toString(SUMO_ATTR_VCLASS__DEPRECATED) + "' is deprecated, please use '" + toString(SUMO_ATTR_VCLASS) + "' instead.");
503  }
504  vtype->vehicleClass = parseVehicleClass(attrs, vtype->id);
506  }
507  if (attrs.hasAttribute(SUMO_ATTR_WIDTH)) {
508  vtype->width = attrs.getSUMORealReporting(SUMO_ATTR_WIDTH, vtype->id.c_str(), ok);
510  }
511  if (attrs.hasAttribute(SUMO_ATTR_HEIGHT)) {
512  vtype->height = attrs.getSUMORealReporting(SUMO_ATTR_HEIGHT, vtype->id.c_str(), ok);
514  }
515  if (attrs.hasAttribute(SUMO_ATTR_GUISHAPE)) {
516  vtype->shape = parseGuiShape(attrs, vtype->id);
518  }
519  if (attrs.hasAttribute(SUMO_ATTR_OSGFILE)) {
520  vtype->osgFile = attrs.getStringReporting(SUMO_ATTR_OSGFILE, vtype->id.c_str(), ok);
522  }
523  if (attrs.hasAttribute(SUMO_ATTR_COLOR)) {
524  vtype->color = RGBColor::parseColorReporting(attrs.getString(SUMO_ATTR_COLOR), attrs.getObjectType(), vtype->id.c_str(), true, ok);
526  } else {
527  vtype->color = RGBColor(1, 1, 0);
528  }
529  if (attrs.hasAttribute(SUMO_ATTR_PROB)) {
530  vtype->defaultProbability = attrs.getSUMORealReporting(SUMO_ATTR_PROB, vtype->id.c_str(), ok);
532  }
533  try {
534  parseVTypeEmbedded(*vtype, SUMO_TAG_CF_KRAUSS, attrs, true);
535  } catch (ProcessError&) {
536  throw;
537  }
538  if (!ok) {
539  delete vtype;
540  throw ProcessError();
541  }
542  return vtype;
543 }
544 
545 
546 void
548  int element, const SUMOSAXAttributes& attrs,
549  bool fromVType) {
550  const CFAttrMap& allowedAttrs = getAllowedCFModelAttrs();
551  CFAttrMap::const_iterator cf_it;
552  for (cf_it = allowedAttrs.begin(); cf_it != allowedAttrs.end(); cf_it++) {
553  if (cf_it->first == element) {
554  break;
555  }
556  }
557  if (cf_it == allowedAttrs.end()) {
558  if (SUMOXMLDefinitions::Tags.has(element)) {
559  WRITE_WARNING("Unknown cfmodel " + toString((SumoXMLTag)element) + " when parsing vtype '" + into.id + "'");
560  } else {
561  WRITE_WARNING("Unknown cfmodel when parsing vtype '" + into.id + "'");
562  }
563  }
564  if (!fromVType) {
565  into.cfModel = cf_it->first;
566  }
567  bool ok = true;
568  for (std::set<SumoXMLAttr>::const_iterator it = cf_it->second.begin(); it != cf_it->second.end(); it++) {
569  if (attrs.hasAttribute(*it)) {
570  into.cfParameter[*it] = attrs.getSUMORealReporting(*it, into.id.c_str(), ok);
571  }
572  }
573  if (!ok) {
574  throw ProcessError();
575  }
576 }
577 
578 
581  // init on first use
582  if (allowedCFModelAttrs.size() == 0) {
583  std::set<SumoXMLAttr> krausParams;
584  krausParams.insert(SUMO_ATTR_ACCEL);
585  krausParams.insert(SUMO_ATTR_DECEL);
586  krausParams.insert(SUMO_ATTR_SIGMA);
587  krausParams.insert(SUMO_ATTR_TAU);
590 
591  std::set<SumoXMLAttr> pwagParams;
592  pwagParams.insert(SUMO_ATTR_ACCEL);
593  pwagParams.insert(SUMO_ATTR_DECEL);
594  pwagParams.insert(SUMO_ATTR_SIGMA);
595  pwagParams.insert(SUMO_ATTR_TAU);
596  pwagParams.insert(SUMO_ATTR_CF_PWAGNER2009_TAULAST);
597  pwagParams.insert(SUMO_ATTR_CF_PWAGNER2009_APPROB);
599 
600  std::set<SumoXMLAttr> idmParams;
601  idmParams.insert(SUMO_ATTR_ACCEL);
602  idmParams.insert(SUMO_ATTR_DECEL);
603  idmParams.insert(SUMO_ATTR_TAU);
604  idmParams.insert(SUMO_ATTR_CF_IDM_DELTA);
605  idmParams.insert(SUMO_ATTR_CF_IDM_STEPPING);
607 
608  std::set<SumoXMLAttr> idmmParams;
609  idmmParams.insert(SUMO_ATTR_ACCEL);
610  idmmParams.insert(SUMO_ATTR_DECEL);
611  idmmParams.insert(SUMO_ATTR_TAU);
612  idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_FACTOR);
613  idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_TIME);
614  idmmParams.insert(SUMO_ATTR_CF_IDM_STEPPING);
616 
617  std::set<SumoXMLAttr> bkernerParams;
618  bkernerParams.insert(SUMO_ATTR_ACCEL);
619  bkernerParams.insert(SUMO_ATTR_DECEL);
620  bkernerParams.insert(SUMO_ATTR_TAU);
621  bkernerParams.insert(SUMO_ATTR_K);
622  bkernerParams.insert(SUMO_ATTR_CF_KERNER_PHI);
623  allowedCFModelAttrs[SUMO_TAG_CF_BKERNER] = bkernerParams;
624 
625  std::set<SumoXMLAttr> wiedemannParams;
626  wiedemannParams.insert(SUMO_ATTR_ACCEL);
627  wiedemannParams.insert(SUMO_ATTR_DECEL);
628  wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_SECURITY);
629  wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_ESTIMATION);
630  allowedCFModelAttrs[SUMO_TAG_CF_WIEDEMANN] = wiedemannParams;
631  }
632  return allowedCFModelAttrs;
633 }
634 
635 
638  const std::string& id) {
639  SUMOVehicleClass vclass = SVC_UNKNOWN;
640  try {
641  bool ok = true;
642  std::string vclassS = attrs.hasAttribute(SUMO_ATTR_VCLASS)
643  ? attrs.getOptStringReporting(SUMO_ATTR_VCLASS, id.c_str(), ok, "")
644  : attrs.getOptStringReporting(SUMO_ATTR_VCLASS__DEPRECATED, id.c_str(), ok, "");
645  if (vclassS == "") {
646  return vclass;
647  }
648  return getVehicleClassID(vclassS);
649  } catch (...) {
650  WRITE_ERROR("The class for " + attrs.getObjectType() + " '" + id + "' is not known.");
651  }
652  return vclass;
653 }
654 
655 
659  try {
660  bool ok = true;
661  std::string vclassS = attrs.getOptStringReporting(SUMO_ATTR_EMISSIONCLASS, id.c_str(), ok, "");
662  if (vclassS == "") {
663  return vclass;
664  }
665  return getVehicleEmissionTypeID(vclassS);
666  } catch (...) {
667  WRITE_ERROR("The emission class for " + attrs.getObjectType() + " '" + id + "' is not known.");
668  }
669  return vclass;
670 }
671 
672 
674 SUMOVehicleParserHelper::parseGuiShape(const SUMOSAXAttributes& attrs, const std::string& id) {
675  bool ok = true;
676  std::string vclassS = attrs.getOptStringReporting(SUMO_ATTR_GUISHAPE, id.c_str(), ok, "");
677  if (SumoVehicleShapeStrings.hasString(vclassS)) {
678  return SumoVehicleShapeStrings.get(vclassS);
679  } else {
680  WRITE_ERROR("The shape '" + vclassS + "' for " + attrs.getObjectType() + " '" + id + "' is not known.");
681  return SVS_UNKNOWN;
682  }
683 }
684 
685 
686 /****************************************************************************/
687