Eclipse SUMO - Simulation of Urban MObility
NIVissimSingleTypeParser_Parkplatzdefinition.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 //
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <iostream>
26 #include <vector>
27 #include <utility>
29 #include <utils/common/ToString.h>
32 #include <netbuild/NBDistrict.h>
33 #include <netbuild/NBNode.h>
34 #include <netbuild/NBNodeCont.h>
35 #include "../NIImporter_Vissim.h"
36 #include "../tempstructs/NIVissimDistrictConnection.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
44  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
45 
46 
48 
49 
50 bool
52  int id;
53  from >> id;
54 
55  std::string tag;
56  from >> tag;
57  std::string name = readName(from);
58 
59  // parse the districts
60  // and allocate them if not done before
61  // A district may be already saved when another parking place with
62  // the same district was already build.
63  std::vector<int> districts;
64  std::vector<double> percentages;
65  readUntil(from, "bezirke"); // "Bezirke"
66  while (tag != "ort") {
67  double perc = -1;
68  int districtid;
69  from >> districtid;
70  tag = myRead(from);
71  if (tag == "anteil") {
72  from >> perc;
73  }
74  districts.push_back(districtid);
75  percentages.push_back(perc);
76  tag = myRead(from);
77  }
78 
79  from >> tag; // "Strecke"
80  int edgeid;
81  from >> edgeid;
82 
83  double position;
84  from >> tag; // "bei"
85  from >> position;
86 
87  double length;
88  from >> tag;
89  from >> length;
90 
91  from >> tag; // "Kapazitaet"
92  from >> tag; // "Kapazitaet"-value
93 
94  tag = myRead(from);
95  if (tag == "belegung") {
96  from >> tag;
97  tag = myRead(from); // "fahrzeugklasse"
98  }
99 
100  std::vector<std::pair<int, int> > assignedVehicles;
101  while (tag != "default") {
102  int vclass;
103  from >> vclass;
104  from >> tag; // "vwunsch"
105  int vwunsch;
106  from >> vwunsch; // "vwunsch"-value
107  assignedVehicles.push_back(std::pair<int, int>(vclass, vwunsch));
108  tag = myRead(from);
109  }
110 
111  from >> tag;
112  from >> tag;
113 // NIVissimEdge *e = NIVissimEdge::dictionary(edgeid);
114 // e->addReferencedDistrict(id);
115 
116  // build the district connection
118  districts, percentages, edgeid, position, assignedVehicles);
119 }
120 
121 
122 
123 /****************************************************************************/
124 
ToString.h
NIVissimSingleTypeParser_Parkplatzdefinition::parse
bool parse(std::istream &from)
Parses the data type from the given stream.
Definition: NIVissimSingleTypeParser_Parkplatzdefinition.cpp:51
NIVissimSingleTypeParser_Parkplatzdefinition::NIVissimSingleTypeParser_Parkplatzdefinition
NIVissimSingleTypeParser_Parkplatzdefinition(NIImporter_Vissim &parent)
Constructor.
Definition: NIVissimSingleTypeParser_Parkplatzdefinition.cpp:43
NIImporter_Vissim::VissimSingleTypeParser::readName
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
Definition: NIImporter_Vissim.cpp:798
NIImporter_Vissim
Importer for networks stored in Vissim format.
Definition: NIImporter_Vissim.h:59
NIVissimDistrictConnection::dictionary
static bool dictionary(int id, const std::string &name, const std::vector< int > &districts, const std::vector< double > &percentages, int edgeid, double position, const std::vector< std::pair< int, int > > &assignedVehicles)
Inserts the connection into the dictionary after building it.
Definition: NIVissimDistrictConnection.cpp:82
NBDistrict.h
NIVissimSingleTypeParser_Parkplatzdefinition.h
VectorHelper.h
NBNodeCont.h
StringUtils.h
NIImporter_Vissim::VissimSingleTypeParser::readUntil
void readUntil(std::istream &from, const std::string &name)
Reads from the stream until the keywor occurs.
Definition: NIImporter_Vissim.cpp:814
NBDistrictCont.h
config.h
NIVissimSingleTypeParser_Parkplatzdefinition::~NIVissimSingleTypeParser_Parkplatzdefinition
~NIVissimSingleTypeParser_Parkplatzdefinition()
Destructor.
Definition: NIVissimSingleTypeParser_Parkplatzdefinition.cpp:47
NIImporter_Vissim::VissimSingleTypeParser::myRead
std::string myRead(std::istream &from)
reads from the stream and returns the lower case version of the read value
Definition: NIImporter_Vissim.cpp:671
NBNode.h