Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NIImporter_ITSUMO.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 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/****************************************************************************/
18// Importer for networks stored in ITSUMO format
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <string>
24#include <map>
28
29
30// ===========================================================================
31// class declarations
32// ===========================================================================
33class NBEdge;
34class NBEdgeCont;
35class NBNetBuilder;
36class NBNode;
37class NBNodeCont;
39class NBTypeCont;
40class OptionsCont;
41
42
43// ===========================================================================
44// class definitions
45// ===========================================================================
52public:
64 static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);
65
66
67private:
72 class Handler : public GenericSAXHandler {
73 public:
77 Handler(NBNetBuilder& toFill);
78
79
81 ~Handler();
82
83
84 protected:
86
87
95 void myStartElement(int element, const SUMOSAXAttributes& attrs);
96
97
106 void myCharacters(int element, const std::string& chars);
107
108
115 void myEndElement(int element);
117
118
119 private:
122
125
126
127 struct Lane {
128 public:
129 Lane(const std::string& _id, int _idx, double _v)
130 : id(_id), index(_idx), v(_v) {}
131 std::string id;
132 int index;
133 double v;
134 };
135
136 std::vector<Lane> myCurrentLanes;
137
138 struct LaneSet {
139 public:
140 LaneSet(const std::string& _id, const std::vector<Lane>& _lanes, double _v, int _pos, NBNode* _from, NBNode* _to)
141 : id(_id), lanes(_lanes), v(_v), position(_pos), from(_from), to(_to) {}
142 std::string id;
143 std::vector<Lane> lanes;
144 double v;
148 };
149
150 std::map<std::string, LaneSet*> myLaneSets;
151 std::vector<LaneSet*> myCurrentLaneSets;
152
153 struct Section {
154 public:
155 Section(const std::string& _id, const std::vector<LaneSet*>& _laneSets)
156 : id(_id), laneSets(_laneSets) {}
157 std::string id;
158 std::vector<LaneSet*> laneSets;
159 };
160
161 std::vector<Section*> mySections;
162
163
164 private:
166 Handler(const Handler& s);
167
170
171 };
172
173
174
221
222
231
234
237
238
239};
A handler which converts occuring elements and attributes into enums.
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:92
Instance responsible for building networks.
Container for nodes during the netbuilding process.
Definition NBNodeCont.h:57
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
Handler(const Handler &s)
invalidated copy constructor
Parameterised::Map myParameter
A temporary parameter map.
void myCharacters(int element, const std::string &chars)
Callback method for characters to implement by derived classes.
std::vector< LaneSet * > myCurrentLaneSets
Handler & operator=(const Handler &s)
invalidated assignment operator
std::vector< Lane > myCurrentLanes
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NBNetBuilder & myNetBuilder
The container to fill.
void myEndElement(int element)
Callback method for a closing tag to implement by derived classes.
std::vector< Section * > mySections
std::map< std::string, LaneSet * > myLaneSets
Importer for networks stored in ITSUMO format.
static StringBijection< int >::Entry itsumoAttrs[]
The names of MATSIM-XML attributes (for passing to GenericSAXHandler)
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given ITSUMO network files.
ItsumoXMLTag
Numbers representing ITSUMO-XML - element names.
static StringBijection< int >::Entry itsumoTags[]
The names of MATSIM-XML elements (for passing to GenericSAXHandler)
ItsumoXMLAttr
Numbers representing MATSIM-XML - attributes.
A storage for options typed value containers)
Definition OptionsCont.h:89
std::map< std::string, std::string > Map
parameters map
Encapsulated SAX-Attributes.
Lane(const std::string &_id, int _idx, double _v)
LaneSet(const std::string &_id, const std::vector< Lane > &_lanes, double _v, int _pos, NBNode *_from, NBNode *_to)
Section(const std::string &_id, const std::vector< LaneSet * > &_laneSets)