Eclipse SUMO - Simulation of Urban MObility
NIImporter_MATSim.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2022 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 /****************************************************************************/
19 // Importer for networks stored in MATSim format
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <string>
25 #include <map>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class NBEdge;
35 class NBEdgeCont;
36 class NBNetBuilder;
37 class NBNode;
38 class NBNodeCont;
40 class NBTypeCont;
41 class OptionsCont;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
53 public:
65  static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
66 
67 
68 private:
74  public:
78  NodesHandler(NBNodeCont& toFill);
79 
80 
82  ~NodesHandler();
83 
84 
85  protected:
87 
88 
96  void myStartElement(int element, const SUMOSAXAttributes& attrs);
98 
99 
100  private:
103 
104 
105  private:
108 
111 
112  };
113 
114 
115 
121  public:
130  EdgesHandler(NBNodeCont& nc, NBEdgeCont& toFill,
131  bool keepEdgeLengths, bool lanesFromCapacity,
132  NBCapacity2Lanes capacity2Lanes);
133 
134 
136  ~EdgesHandler();
137 
138 
139  protected:
141 
142 
150  void myStartElement(int element, const SUMOSAXAttributes& attrs);
152 
153  private:
154  void insertEdge(const std::string& id, NBNode* fromNode, NBNode* toNode, double freeSpeed, int numLanes, double capacity, double length);
155 
156  private:
159 
162 
165 
168 
171 
174 
175 
176  private:
179 
182 
183  };
184 
185 
197  };
198 
199 
221  };
222 
225 
228 
229 
230 };
A handler which converts occuring elements and attributes into enums.
A helper class which computes the lane number from given capacity.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:59
The representation of a single edge during network building.
Definition: NBEdge.h:91
Instance responsible for building networks.
Definition: NBNetBuilder.h:107
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:58
Represents a single node (junction) during network building.
Definition: NBNode.h:66
A container for traffic light definitions and built programs.
A storage for available edgeTypes of edges.
Definition: NBTypeCont.h:52
A class which extracts MATSIM-edges from a parsed MATSIM-file.
double myCapacityNorm
The capacity norming.
EdgesHandler(const EdgesHandler &s)
invalidated copy constructor
NBCapacity2Lanes myCapacity2Lanes
The converter from flow to lanes.
bool myKeepEdgeLengths
Whether the loaded lengths shal be used.
bool myLanesFromCapacity
Whether the lane number shall be computed from the capacity.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
EdgesHandler(NBNodeCont &nc, NBEdgeCont &toFill, bool keepEdgeLengths, bool lanesFromCapacity, NBCapacity2Lanes capacity2Lanes)
Constructor.
void insertEdge(const std::string &id, NBNode *fromNode, NBNode *toNode, double freeSpeed, int numLanes, double capacity, double length)
NBNodeCont & myNodeCont
The previously parsed nodes.
NBEdgeCont & myEdgeCont
The edge container to fill.
EdgesHandler & operator=(const EdgesHandler &s)
invalidated assignment operator
A class which extracts MATSIM-nodes from a parsed MATSIM-file.
NodesHandler(const NodesHandler &s)
invalidated copy constructor
NodesHandler(NBNodeCont &toFill)
Contructor.
NodesHandler & operator=(const NodesHandler &s)
invalidated assignment operator
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NBNodeCont & myNodeCont
The nodes container to fill.
Importer for networks stored in MATSim format.
MatsimXMLTag
Numbers representing MATSIM-XML - element names.
static StringBijection< int >::Entry matsimAttrs[]
The names of MATSIM-XML attributes (for passing to GenericSAXHandler)
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given MATSIM network files.
static StringBijection< int >::Entry matsimTags[]
The names of MATSIM-XML elements (for passing to GenericSAXHandler)
MatsimXMLAttr
Numbers representing MATSIM-XML - attributes.
A storage for options typed value containers)
Definition: OptionsCont.h:89
Encapsulated SAX-Attributes.