SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimSingleTypeParser_Parkplatzdefinition.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>
33 #include <vector>
34 #include <utility>
36 #include <utils/common/ToString.h>
39 #include <netbuild/NBDistrict.h>
40 #include <netbuild/NBNode.h>
41 #include <netbuild/NBNodeCont.h>
42 #include "../NIImporter_Vissim.h"
43 #include "../tempstructs/NIVissimDistrictConnection.h"
45 
46 #ifdef CHECK_MEMORY_LEAKS
47 #include <foreign/nvwa/debug_new.h>
48 #endif // CHECK_MEMORY_LEAKS
49 
50 
51 // ===========================================================================
52 // method definitions
53 // ===========================================================================
55  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
56 
57 
59 
60 
61 bool
63  int id;
64  from >> id;
65 
66  std::string tag;
67  from >> tag;
68  std::string name = readName(from);
69 
70  // parse the districts
71  // and allocate them if not done before
72  // A district may be already saved when another parking place with
73  // the same district was already build.
74  std::vector<int> districts;
75  std::vector<SUMOReal> percentages;
76  readUntil(from, "bezirke"); // "Bezirke"
77  while (tag != "ort") {
78  SUMOReal perc = -1;
79  int districtid;
80  from >> districtid;
81  tag = myRead(from);
82  if (tag == "anteil") {
83  from >> perc;
84  }
85  districts.push_back(districtid);
86  percentages.push_back(perc);
87  tag = myRead(from);
88  }
89 
90  from >> tag; // "Strecke"
91  int edgeid;
92  from >> edgeid;
93 
94  SUMOReal position;
95  from >> tag; // "bei"
96  from >> position;
97 
98  SUMOReal length;
99  from >> tag;
100  from >> length;
101 
102  from >> tag; // "Kapazität"
103  from >> tag; // "Kapazität"-value
104 
105  tag = myRead(from);
106  if (tag == "belegung") {
107  from >> tag;
108  tag = myRead(from); // "fahrzeugklasse"
109  }
110 
111  std::vector<std::pair<int, int> > assignedVehicles;
112  while (tag != "default") {
113  int vclass;
114  from >> vclass;
115  from >> tag; // "vwunsch"
116  int vwunsch;
117  from >> vwunsch; // "vwunsch"-value
118  assignedVehicles.push_back(std::pair<int, int>(vclass, vwunsch));
119  tag = myRead(from);
120  }
121 
122  from >> tag;
123  from >> tag;
124 // NIVissimEdge *e = NIVissimEdge::dictionary(edgeid);
125 // e->addReferencedDistrict(id);
126 
127  // build the district connection
129  districts, percentages, edgeid, position, assignedVehicles);
130 }
131 
132 
133 
134 /****************************************************************************/
135