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.dev/sumo
3 // Copyright (C) 2008-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 /****************************************************************************/
20 // Importer for networks stored in Elmar's format
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <string>
26 #include <map>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class NBEdgeCont;
35 class NBNetBuilder;
36 class NBNodeCont;
38 class NBTypeCont;
39 class OptionsCont;
40 class PositionVector;
41 class StringTokenizer;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
53 public:
65  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
66 
68  static const std::string GEO_SCALE;
69 
71  static bool keepLength;
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:
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:
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:
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 };
Interface definition for a class which retrieves lines from a LineHandler.
Definition: LineHandler.h:42
A container for districts.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
Instance responsible for building networks.
Definition: NBNetBuilder.h:107
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:57
A container for traffic light definitions and built programs.
A storage for available edgeTypes of edges.
Definition: NBTypeCont.h:52
Imports prohibitions regarding connectivity.
ConnectedLanesHandler(const ConnectedLanesHandler &)
Invalidated copy constructor.
ConnectedLanesHandler & operator=(const ConnectedLanesHandler &)
Invalidated assignment operator.
bool report(const std::string &result)
Parsing method.
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
Importer of edges stored in unsplit elmar format.
std::vector< int > myColumns
the version number of the edge file being parsed
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
double myVersion
version number of current file
std::string getStreetNameFromIDs(const std::string &regionalID, const std::string &localID) const
build the street name for the given ids
std::map< std::string, std::string > & myStreetNames
Previously read streat names (non-const because operate[] is more convenient)
const std::string myFile
the file being parsed
std::string getColumn(const StringTokenizer &st, ColumnName name, const std::string fallback="")
EdgesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTypeCont &tc, const std::string &file, std::map< std::string, PositionVector > &geoms, std::map< std::string, std::string > &streetNames)
Constructor.
EdgesHandler(const EdgesHandler &)
Invalidated copy constructor.
bool myTryIgnoreNodePositions
Whether node positions shall not be added to the edge's geometry.
NBTypeCont & myTypeCont
The type container to retrieve type info from.
EdgesHandler & operator=(const EdgesHandler &)
Invalidated assignment operator.
NBNodeCont & myNodeCont
The node container to get the referenced nodes from.
bool report(const std::string &result)
Parsing method.
std::map< std::string, PositionVector > & myGeoms
Previously read edge geometries (manipulated during use)
Importer of street names in DLRNavteq's (aka elmar) format.
bool report(const std::string &result)
Parsing method.
std::map< std::string, std::string > & myStreetNames
The container for storing read names.
NamesHandler(const NamesHandler &)
Invalidated copy constructor.
NamesHandler & operator=(const NamesHandler &)
Invalidated assignment operator.
NamesHandler(const std::string &file, std::map< std::string, std::string > &streetNames)
Constructor.
Importer of nodes stored in unsplit elmar format.
std::map< std::string, PositionVector > & myGeoms
A container for parsed geometries.
NodesHandler(NBNodeCont &nc, const std::string &file, std::map< std::string, PositionVector > &geoms)
Constructor.
bool report(const std::string &result)
Parsing method.
NodesHandler & operator=(const NodesHandler &)
Invalidated assignment operator.
NodesHandler(const NodesHandler &)
Invalidated copy constructor.
Imports prohibitions regarding connectivity.
ProhibitionHandler(const ProhibitionHandler &)
Invalidated copy constructor.
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
bool report(const std::string &result)
Parsing method.
ProhibitionHandler & operator=(const ProhibitionHandler &)
Invalidated assignment operator.
ProhibitionHandler(NBEdgeCont &ne, const std::string &file, time_t constructionTime)
Constructor.
Importer of street names in DLRNavteq's (aka elmar) format.
time_t myConstructionTime
The date for which to build the network (in case some edges are still under construction)
TimeRestrictionsHandler & operator=(const TimeRestrictionsHandler &)
Invalidated assignment operator.
TimeRestrictionsHandler(NBEdgeCont &ec, NBDistrictCont &dc, time_t constructionTime)
Constructor.
bool report(const std::string &result)
Parsing method.
TimeRestrictionsHandler(const TimeRestrictionsHandler &)
Invalidated copy constructor.
Importer of traffic lights stored in DLRNavteq's (aka elmar) format.
NBNodeCont & myNodeCont
The node container to get the referenced nodes from.
TrafficlightsHandler(NBNodeCont &nc, NBTrafficLightLogicCont &tlc, NBEdgeCont &ne, const std::string &file)
Constructor.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
NBEdgeCont & myEdgeCont
The edge container to get the referenced edges from.
TrafficlightsHandler & operator=(const TrafficlightsHandler &)
Invalidated assignment operator.
TrafficlightsHandler(const TrafficlightsHandler &)
Invalidated copy constructor.
bool report(const std::string &result)
Parsing method.
Importer for networks stored in Elmar's format.
static double readVersion(const std::string &line, const std::string &file)
static time_t readTimeRec(const std::string &start, const std::string &duration)
static int readPrefixedInt(const std::string &s, const std::string &prefix, int fallBack=0)
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given dlr-navteq (aka Elmar-fomat) folder.
static const std::string GEO_SCALE
scaling factor for geo coordinates (DLRNavteq format uses this to increase floating point precisions)
static const std::string UNDEFINED
magic value for undefined stuff
static time_t readDate(const std::string &yyyymmdd)
static bool keepLength
decides whether the edge length of the input format should be used
A storage for options typed value containers)
Definition: OptionsCont.h:89
A list of positions.