SUMO - Simulation of Urban MObility
NIImporter_DlrNavteq.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Importer for networks stored in Elmar's format
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NIImporter_DlrNavteq_h
23 #define NIImporter_DlrNavteq_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <map>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class NBEdgeCont;
45 class NBNetBuilder;
46 class NBNodeCont;
48 class NBTypeCont;
49 class OptionsCont;
50 class PositionVector;
51 class StringTokenizer;
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
63 public:
75  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
76 
78  static const int GEO_SCALE;
79 
81  static const std::string UNDEFINED;
82 
83 protected:
92  class NodesHandler : public LineHandler {
93  public:
99  NodesHandler(NBNodeCont& nc, const std::string& file,
100  std::map<std::string, PositionVector>& geoms);
101 
102 
104  ~NodesHandler();
105 
106 
118  bool report(const std::string& result);
119 
120 
121  protected:
122  // @brief The node container to store parsed nodes into
124 
126  std::map<std::string, PositionVector>& myGeoms;
127 
128 
129  private:
131  NodesHandler(const NodesHandler&);
132 
135 
136  };
137 
138 
147  class EdgesHandler : public LineHandler {
148 
149  public:
159  const std::string& file,
160  std::map<std::string, PositionVector>& geoms,
161  std::map<std::string, std::string>& streetNames);
162 
163 
165  ~EdgesHandler();
166 
167 
177  bool report(const std::string& result);
178 
179 
180  protected:
183 
186 
189 
191  std::map<std::string, PositionVector>& myGeoms;
192 
194  std::map<std::string, std::string>& myStreetNames;
195 
198 
200  double myVersion;
201 
203  std::vector<int> myColumns;
204 
206  const std::string myFile;
207 
208  static const int MISSING_COLUMN;
209 
210  enum ColumnName {
211  LINK_ID = 0,
235  CONNECTION
236  };
237 
238  std::string getColumn(const StringTokenizer& st, ColumnName name, const std::string fallback = "");
239 
240  private:
242  std::string getStreetNameFromIDs(const std::string& regionalID, const std::string& localID) const;
243 
244 
245  private:
247  EdgesHandler(const EdgesHandler&);
248 
251 
252  };
253 
254 
264  public:
271  NBEdgeCont& ne, const std::string& file);
272 
273 
276 
277 
287  bool report(const std::string& result);
288 
289 
290  protected:
293 
296 
299 
300 
301  private:
304 
307 
308  };
309 
310 
319  class NamesHandler : public LineHandler {
320  public:
325  NamesHandler(const std::string& file, std::map<std::string, std::string>& streetNames);
326 
327 
329  ~NamesHandler();
330 
331 
341  bool report(const std::string& result);
342 
343 
344  protected:
346  std::map<std::string, std::string>& myStreetNames;
347 
348 
349  private:
351  NamesHandler(const NamesHandler&);
352 
355 
356  };
357 
358 
368  public:
373  TimeRestrictionsHandler(NBEdgeCont& ec, NBDistrictCont& dc, time_t constructionTime);
374 
375 
378 
379 
389  bool report(const std::string& result);
390 
391  void printSummary();
392 
393 
394  protected:
398 
401  time_t myCS_min;
402  time_t myCS_max;
407  int myRemovedEdges; // only counts those not already removed through other options
408 
409 
410  private:
413 
416 
417  };
418 
419 
429  public:
434  ProhibitionHandler(NBEdgeCont& ne, const std::string& file, time_t constructionTime);
435 
436 
439 
440 
450  bool report(const std::string& result);
451 
452 
453  protected:
456  const std::string myFile;
457  double myVersion;
459 
460 
461  private:
464 
467 
468  };
469 
470 
480  public:
486 
487 
490 
491 
501  bool report(const std::string& result);
502 
503 
504  protected:
507 
508 
509  private:
512 
515 
516  };
517 
518 
519  static double readVersion(const std::string& line, const std::string& file);
520  static int readPrefixedInt(const std::string& s, const std::string& prefix, int fallBack = 0);
521  static time_t readTimeRec(const std::string& start, const std::string& duration);
522  static time_t readDate(const std::string& yyyymmdd);
523 
524 };
525 
526 
527 #endif
528 
529 /****************************************************************************/
530 
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
NBNodeCont & myNodeCont
The node container to get the referenced nodes from.
bool report(const std::string &result)
Parsing method.
std::map< std::string, std::string > & myStreetNames
Previously read streat names (non-const because operate[] is more convenient)
Importer of street names in DLRNavteq&#39;s (aka elmar) format.
Importer of nodes stored in unsplit elmar format.
A container for traffic light definitions and built programs.
Importer for networks stored in Elmar&#39;s format.
NodesHandler(NBNodeCont &nc, const std::string &file, std::map< std::string, PositionVector > &geoms)
Constructor.
static const std::string UNDEFINED
magic value for undefined stuff
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given dlr-navteq (aka Elmar-fomat) folder.
A container for districts.
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
bool myTryIgnoreNodePositions
Whether node positions shall not be added to the edge&#39;s geometry.
std::map< std::string, PositionVector > & myGeoms
Previously read edge geometries (manipulated during use)
Imports prohibitions regarding connectivity.
NBNodeCont & myNodeCont
The node container to get the referenced nodes from.
Importer of street names in DLRNavteq&#39;s (aka elmar) format.
NBTypeCont & myTypeCont
The type container to retrieve type info from.
Importer of traffic lights stored in DLRNavteq&#39;s (aka elmar) format.
Interface definition for a class which retrieves lines from a LineHandler.
Definition: LineHandler.h:52
time_t myConstructionTime
The date for which to build the network (in case some edges are still under construction) ...
Importer of edges stored in unsplit elmar format.
static double readVersion(const std::string &line, const std::string &file)
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
A list of positions.
static time_t readTimeRec(const std::string &start, const std::string &duration)
std::map< std::string, PositionVector > & myGeoms
A container for parsed geometries.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
const std::string myFile
the file being parsed
static int readPrefixedInt(const std::string &s, const std::string &prefix, int fallBack=0)
double myVersion
version number of current file
NodesHandler & operator=(const NodesHandler &)
Invalidated assignment operator.
NBEdgeCont & myEdgeCont
The edge container to get the referenced edges from.
Instance responsible for building networks.
Definition: NBNetBuilder.h:114
A storage for options typed value containers)
Definition: OptionsCont.h:99
std::map< std::string, std::string > & myStreetNames
The container for storing read names.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
static const int GEO_SCALE
scaling factor for geo coordinates (DLRNavteq format uses this to increase floating point precisions)...
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
static time_t readDate(const std::string &yyyymmdd)
Imports prohibitions regarding connectivity.
std::vector< int > myColumns
the version number of the edge file being parsed
A storage for available types of edges.
Definition: NBTypeCont.h:62