SUMO - Simulation of Urban MObility
NIImporter_DlrNavteq.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2008-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // Importer for networks stored in Elmar's format
20 /****************************************************************************/
21 #ifndef NIImporter_DlrNavteq_h
22 #define NIImporter_DlrNavteq_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>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class NBEdgeCont;
44 class NBNetBuilder;
45 class NBNodeCont;
47 class NBTypeCont;
48 class OptionsCont;
49 class PositionVector;
50 class StringTokenizer;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
62 public:
74  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
75 
77  static const std::string GEO_SCALE;
78 
80  static const std::string UNDEFINED;
81 
82 protected:
91  class NodesHandler : public LineHandler {
92  public:
98  NodesHandler(NBNodeCont& nc, const std::string& file,
99  std::map<std::string, PositionVector>& geoms);
100 
101 
103  ~NodesHandler();
104 
105 
117  bool report(const std::string& result);
118 
119 
120  protected:
121  // @brief The node container to store parsed nodes into
123 
125  std::map<std::string, PositionVector>& myGeoms;
126 
127 
128  private:
130  NodesHandler(const NodesHandler&);
131 
134 
135  };
136 
137 
146  class EdgesHandler : public LineHandler {
147 
148  public:
158  const std::string& file,
159  std::map<std::string, PositionVector>& geoms,
160  std::map<std::string, std::string>& streetNames);
161 
162 
164  ~EdgesHandler();
165 
166 
176  bool report(const std::string& result);
177 
178 
179  protected:
182 
185 
188 
190  std::map<std::string, PositionVector>& myGeoms;
191 
193  std::map<std::string, std::string>& myStreetNames;
194 
197 
199  double myVersion;
200 
202  std::vector<int> myColumns;
203 
205  const std::string myFile;
206 
207  static const int MISSING_COLUMN;
208 
209  enum ColumnName {
210  LINK_ID = 0,
234  CONNECTION
235  };
236 
237  std::string getColumn(const StringTokenizer& st, ColumnName name, const std::string fallback = "");
238 
239  private:
241  std::string getStreetNameFromIDs(const std::string& regionalID, const std::string& localID) const;
242 
243 
244  private:
246  EdgesHandler(const EdgesHandler&);
247 
250 
251  };
252 
253 
263  public:
270  NBEdgeCont& ne, const std::string& file);
271 
272 
275 
276 
286  bool report(const std::string& result);
287 
288 
289  protected:
292 
295 
298 
299 
300  private:
303 
306 
307  };
308 
309 
318  class NamesHandler : public LineHandler {
319  public:
324  NamesHandler(const std::string& file, std::map<std::string, std::string>& streetNames);
325 
326 
328  ~NamesHandler();
329 
330 
340  bool report(const std::string& result);
341 
342 
343  protected:
345  std::map<std::string, std::string>& myStreetNames;
346 
347 
348  private:
350  NamesHandler(const NamesHandler&);
351 
354 
355  };
356 
357 
367  public:
372  TimeRestrictionsHandler(NBEdgeCont& ec, NBDistrictCont& dc, time_t constructionTime);
373 
374 
377 
378 
388  bool report(const std::string& result);
389 
390  void printSummary();
391 
392 
393  protected:
397 
400  time_t myCS_min;
401  time_t myCS_max;
406  int myRemovedEdges; // only counts those not already removed through other options
407 
408 
409  private:
412 
415 
416  };
417 
418 
428  public:
433  ProhibitionHandler(NBEdgeCont& ne, const std::string& file, time_t constructionTime);
434 
435 
438 
439 
449  bool report(const std::string& result);
450 
451 
452  protected:
455  const std::string myFile;
456  double myVersion;
458 
459 
460  private:
463 
466 
467  };
468 
469 
479  public:
485 
486 
489 
490 
500  bool report(const std::string& result);
501 
502 
503  protected:
506 
507 
508  private:
511 
514 
515  };
516 
517 
518  static double readVersion(const std::string& line, const std::string& file);
519  static int readPrefixedInt(const std::string& s, const std::string& prefix, int fallBack = 0);
520  static time_t readTimeRec(const std::string& start, const std::string& duration);
521  static time_t readDate(const std::string& yyyymmdd);
522 
523 };
524 
525 
526 #endif
527 
528 /****************************************************************************/
529 
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:51
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:115
A storage for options typed value containers)
Definition: OptionsCont.h:98
std::map< std::string, std::string > & myStreetNames
The container for storing read names.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:66
static const std::string GEO_SCALE
scaling factor for geo coordinates (DLRNavteq format uses this to increase floating point precisions)...
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:61