Eclipse SUMO - Simulation of Urban MObility
NIVissimSingleTypeParser_Signalgeberdefinition.cpp
Go to the documentation of this file.
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 /****************************************************************************/
19 //
20 /****************************************************************************/
21 #include <config.h>
22 
23 #include <cassert>
24 #include <iostream>
26 #include <utils/common/ToString.h>
32 
33 
34 // ===========================================================================
35 // method definitions
36 // ===========================================================================
38  : NIImporter_Vissim::VissimSingleTypeParser(parent) {}
39 
40 
42 
43 
44 bool
46  //
47  int id;
48  from >> id;
49  //
50  std::string tag, name;
51  tag = myRead(from);
52  if (tag == "name") {
53  name = readName(from);
54  tag = myRead(from);
55  }
56  // skip optional "Beschriftung"
57  tag = overrideOptionalLabel(from, tag);
58  //
59  int lsaid;
60  std::vector<int> groupids;
61  if (tag == "lsa") {
62  int groupid;
63  from >> lsaid; // type-checking is missing!
64  from >> tag; // "Gruppe"
65  do {
66  from >> groupid;
67  groupids.push_back(groupid);
68  tag = myRead(from);
69  } while (tag == "oder");
70  //
71  } else {
72  from >> tag; // strecke
73  WRITE_WARNING(TL("Omitting unknown traffic light."));
74  return true;
75  }
76  if (tag == "typ") {
77  from >> tag; // typ-value
78  from >> tag; // "ort"
79  }
80 
81  //
82  from >> tag;
83  int edgeid;
84  from >> edgeid;
85 
86  from >> tag;
87  int laneno;
88  from >> laneno;
89 
90  from >> tag;
91  double position;
92  from >> position;
93  //
94  while (tag != "fahrzeugklassen") {
95  tag = myRead(from);
96  }
97  std::vector<int> assignedVehicleTypes = parseAssignedVehicleTypes(from, "N/A");
98  //
99  NIVissimTL::dictionary(lsaid); // !!! check whether someting is really done here
101  new NIVissimTL::NIVissimTLSignal(id, name, groupids, edgeid,
102  laneno, position, assignedVehicleTypes);
103  if (!NIVissimTL::NIVissimTLSignal::dictionary(lsaid, id, signal)) {
104  throw 1; // !!!
105  }
106  return true;
107 }
108 
109 
110 /****************************************************************************/
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:295
#define TL(string)
Definition: MsgHandler.h:315
std::vector< int > parseAssignedVehicleTypes(std::istream &from, const std::string &next)
parses a listof vehicle types assigned to the current data field One should remeber,...
std::string readName(std::istream &from)
Reads the structures name We cannot use the "<<" operator, as names may contain more than one word wh...
std::string overrideOptionalLabel(std::istream &from, const std::string &tag="")
overrides the optional label definition; returns the next tag as done by readEndSecure
std::string myRead(std::istream &from)
reads from the stream and returns the lower case version of the read value
Importer for networks stored in Vissim format.
bool parse(std::istream &from)
Parses the data type from the given stream.
static bool dictionary(int lsaid, int id, NIVissimTLSignal *o)
Definition: NIVissimTL.cpp:79
static bool dictionary(int id, const std::string &type, const std::string &name, SUMOTime absdur, SUMOTime offset)
Definition: NIVissimTL.cpp:310