Eclipse 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-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 /****************************************************************************/
17 // Importer for networks stored in Elmar's format
18 /****************************************************************************/
19 #ifndef NIImporter_DlrNavteq_h
20 #define NIImporter_DlrNavteq_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <map>
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class NBEdgeCont;
38 class NBNetBuilder;
39 class NBNodeCont;
41 class NBTypeCont;
42 class OptionsCont;
43 class PositionVector;
44 class StringTokenizer;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
56 public:
68  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
69 
71  static const std::string GEO_SCALE;
72 
74  static const std::string UNDEFINED;
75 
76 protected:
85  class NodesHandler : public LineHandler {
86  public:
92  NodesHandler(NBNodeCont& nc, const std::string& file,
93  std::map<std::string, PositionVector>& geoms);
94 
95 
97  ~NodesHandler();
98 
99 
111  bool report(const std::string& result);
112 
113 
114  protected:
115  // @brief The node container to store parsed nodes into
117 
119  std::map<std::string, PositionVector>& myGeoms;
120 
121 
122  private:
124  NodesHandler(const NodesHandler&);
125 
128 
129  };
130 
131 
140  class EdgesHandler : public LineHandler {
141 
142  public:
152  const std::string& file,
153  std::map<std::string, PositionVector>& geoms,
154  std::map<std::string, std::string>& streetNames);
155 
156 
158  ~EdgesHandler();
159 
160 
170  bool report(const std::string& result);
171 
172 
173  protected:
176 
179 
182 
184  std::map<std::string, PositionVector>& myGeoms;
185 
187  std::map<std::string, std::string>& myStreetNames;
188 
191 
193  double myVersion;
194 
196  std::vector<int> myColumns;
197 
199  const std::string myFile;
200 
201  static const int MISSING_COLUMN;
202 
203  enum ColumnName {
204  LINK_ID = 0,
228  CONNECTION
229  };
230 
231  std::string getColumn(const StringTokenizer& st, ColumnName name, const std::string fallback = "");
232 
233  private:
235  std::string getStreetNameFromIDs(const std::string& regionalID, const std::string& localID) const;
236 
237 
238  private:
240  EdgesHandler(const EdgesHandler&);
241 
244 
245  };
246 
247 
257  public:
264  NBEdgeCont& ne, const std::string& file);
265 
266 
269 
270 
280  bool report(const std::string& result);
281 
282 
283  protected:
286 
289 
292 
293 
294  private:
297 
300 
301  };
302 
303 
312  class NamesHandler : public LineHandler {
313  public:
318  NamesHandler(const std::string& file, std::map<std::string, std::string>& streetNames);
319 
320 
322  ~NamesHandler();
323 
324 
334  bool report(const std::string& result);
335 
336 
337  protected:
339  std::map<std::string, std::string>& myStreetNames;
340 
341 
342  private:
344  NamesHandler(const NamesHandler&);
345 
348 
349  };
350 
351 
361  public:
366  TimeRestrictionsHandler(NBEdgeCont& ec, NBDistrictCont& dc, time_t constructionTime);
367 
368 
371 
372 
382  bool report(const std::string& result);
383 
384  void printSummary();
385 
386 
387  protected:
391 
394  time_t myCS_min;
395  time_t myCS_max;
400  int myRemovedEdges; // only counts those not already removed through other options
401 
402 
403  private:
406 
409 
410  };
411 
412 
422  public:
427  ProhibitionHandler(NBEdgeCont& ne, const std::string& file, time_t constructionTime);
428 
429 
432 
433 
443  bool report(const std::string& result);
444 
445 
446  protected:
449  const std::string myFile;
450  double myVersion;
452 
453 
454  private:
457 
460 
461  };
462 
463 
473  public:
479 
480 
483 
484 
494  bool report(const std::string& result);
495 
496 
497  protected:
500 
501 
502  private:
505 
508 
509  };
510 
511 
512  static double readVersion(const std::string& line, const std::string& file);
513  static int readPrefixedInt(const std::string& s, const std::string& prefix, int fallBack = 0);
514  static time_t readTimeRec(const std::string& start, const std::string& duration);
515  static time_t readDate(const std::string& yyyymmdd);
516 
517 };
518 
519 
520 #endif
521 
522 /****************************************************************************/
523 
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:45
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:61
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:110
A storage for options typed value containers)
Definition: OptionsCont.h:90
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:60
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:55