SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimSingleTypeParser_Fahrzeugklassendefinition.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 //
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <iostream>
34 #include <utils/common/ToString.h>
36 #include "../NIImporter_Vissim.h"
37 #include "../tempstructs/NIVissimVehTypeClass.h"
39 
40 #ifdef CHECK_MEMORY_LEAKS
41 #include <foreign/nvwa/debug_new.h>
42 #endif // CHECK_MEMORY_LEAKS
43 
44 
45 // ===========================================================================
46 // method definitions
47 // ===========================================================================
50  : NIImporter_Vissim::VissimSingleTypeParser(parent),
51  myColorMap(colorMap) {}
52 
53 
55 
56 
57 bool
59  // id
60  int id;
61  from >> id; // type-checking is missing!
62  // name
63  std::string tag;
64  from >> tag;
65  std::string name = readName(from);
66  // color
67  from >> tag;
68  std::string colorName = myRead(from);
69  RGBColor color;
70  NIImporter_Vissim::ColorMap::iterator i = myColorMap.find(colorName);
71  if (i != myColorMap.end()) {
72  color = (*i).second;
73  } else {
74  int r, g, b;
75  r = TplConvert::_2int(colorName.c_str());
76  from >> g; // type-checking is missing!
77  from >> b; // type-checking is missing!
78  color = RGBColor(r, g, b, 255);
79  }
80  // types
81  from >> tag;
82  if (tag == "ANM_ID") {
83  readName(from);
84  from >> tag;
85  }
86  std::vector<int> types;
87  from >> tag;
88  do {
89  types.push_back(TplConvert::_2int(tag.c_str()));
90  tag = readEndSecure(from);
91  } while (tag != "DATAEND");
92  return NIVissimVehTypeClass::dictionary(id, name, color, types);
93 }
94 
95 
96 
97 /****************************************************************************/
98