SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIImporter_Vissim.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // Importer for networks stored in Vissim format
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2014 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 #ifndef NIImporter_Vissim_h
22 #define NIImporter_Vissim_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <string>
35 #include <map>
36 #include <vector>
37 #include <utils/common/RGBColor.h>
38 #include <utils/geom/Position.h>
40 #include "NIVissimElements.h"
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class OptionsCont;
47 class NBNetBuilder;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
58 public:
70  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
71 
72 
73 protected:
75  NIImporter_Vissim(NBNetBuilder& nb, const std::string& file);
76 
79 
81  void load(const OptionsCont& options);
82 
83  bool admitContinue(const std::string& tag);
84 
85 public:
87  public:
90 
92  virtual ~VissimSingleTypeParser();
93 
96  virtual bool parse(std::istream& from) = 0;
97 
98  protected:
100  std::string myRead(std::istream& from);
101 
103  std::string readEndSecure(std::istream& from,
104  const std::string& excl = "");
105 
106  std::string readEndSecure(std::istream& from,
107  const std::vector<std::string>& excl);
108 
110  std::string overrideOptionalLabel(std::istream& from,
111  const std::string& tag = "");
112 
114  Position getPosition(std::istream& from);
115 
118  std::vector<int> parseAssignedVehicleTypes(std::istream& from,
119  const std::string& next);
120 
122 
126  std::string readName(std::istream& from);
127 
130  bool skipOverreading(std::istream& from, const std::string& name = "");
131 
133  void readUntil(std::istream& from, const std::string& name);
134 
135  private:
137 
138  private:
141 
142  };
143 
144 
146  typedef std::map<std::string, RGBColor> ColorMap;
147 
148 private:
149  bool readContents(std::istream& strm);
150  void postLoadBuild(SUMOReal offset);
151 
152 
154  void insertKnownElements();
155 
157  void buildParsers();
158 
159 private:
161  typedef std::map<std::string, NIVissimElement> ToElemIDMap;
162 
165 
167  typedef std::map<NIVissimElement, VissimSingleTypeParser*> ToParserMap;
168 
171 
174 
175  std::string myLastSecure;
176 
178 
179 private:
182 
185 
186 };
187 
188 
189 #endif
190 
191 /****************************************************************************/
192