SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
NIImporter_SUMO.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// Importer for networks stored in SUMO format
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
#ifndef NIImporter_SUMO_h
23
#define NIImporter_SUMO_h
24
25
26
// ===========================================================================
27
// included modules
28
// ===========================================================================
29
#ifdef _MSC_VER
30
#include <
windows_config.h
>
31
#else
32
#include <
config.h
>
33
#endif
34
35
#include <string>
36
#include <map>
37
#include <
utils/xml/SUMOSAXHandler.h
>
38
#include <
utils/geom/GeoConvHelper.h
>
39
#include <
netbuild/NBLoadedSUMOTLDef.h
>
40
41
42
// ===========================================================================
43
// class declarations
44
// ===========================================================================
45
class
NBNetBuilder
;
46
class
NBEdge
;
47
class
OptionsCont
;
48
49
50
// ===========================================================================
51
// class definitions
52
// ===========================================================================
58
class
NIImporter_SUMO
:
public
SUMOSAXHandler
{
59
public
:
75
static
void
loadNetwork
(
OptionsCont
& oc,
NBNetBuilder
& nb);
76
78
static
NBLoadedSUMOTLDef
*
initTrafficLightLogic
(
const
SUMOSAXAttributes
& attrs,
NBLoadedSUMOTLDef
* currentTL);
79
81
static
void
addPhase
(
const
SUMOSAXAttributes
& attrs,
NBLoadedSUMOTLDef
* currentTL);
82
84
static
GeoConvHelper
*
loadLocation
(
const
SUMOSAXAttributes
& attrs);
85
86
protected
:
90
NIImporter_SUMO
(
NBNetBuilder
& nb);
91
92
94
~NIImporter_SUMO
();
95
96
97
99
100
111
void
myStartElement
(
int
element,
112
const
SUMOSAXAttributes
& attrs);
113
114
121
void
myEndElement
(
int
element);
123
124
125
private
:
127
void
_loadNetwork
(
OptionsCont
& oc);
128
130
131
135
void
addEdge
(
const
SUMOSAXAttributes
& attrs);
136
137
141
void
addLane
(
const
SUMOSAXAttributes
& attrs);
142
143
147
void
addJunction
(
const
SUMOSAXAttributes
& attrs);
148
149
154
void
addConnection
(
const
SUMOSAXAttributes
& attrs);
155
159
void
addProhibition
(
const
SUMOSAXAttributes
& attrs);
160
162
163
164
165
private
:
170
struct
Connection
{
172
std::string
toEdgeID
;
174
unsigned
int
toLaneIdx
;
176
std::string
tlID
;
178
unsigned
int
tlLinkNo
;
180
bool
mayDefinitelyPass
;
181
};
182
183
187
struct
LaneAttrs
{
189
SUMOReal
maxSpeed
;
191
PositionVector
shape
;
193
std::vector<Connection>
connections
;
195
std::string
allow
;
197
std::string
disallow
;
199
SUMOReal
width
;
201
SUMOReal
offset
;
202
};
203
204
208
struct
EdgeAttrs
{
210
std::string
id
;
212
std::string
streetName
;
214
std::string
type
;
216
SumoXMLEdgeFunc
func
;
218
std::string
fromNode
;
220
std::string
toNode
;
222
PositionVector
shape
;
224
SUMOReal
length
;
226
int
priority
;
228
SUMOReal
maxSpeed
;
230
std::vector<LaneAttrs*>
lanes
;
232
NBEdge
*
builtEdge
;
234
LaneSpreadFunction
lsf
;
235
};
236
237
241
struct
Prohibition
{
242
std::string
prohibitorFrom
;
243
std::string
prohibitorTo
;
244
std::string
prohibitedFrom
;
245
std::string
prohibitedTo
;
246
};
247
248
250
std::map<std::string, EdgeAttrs*>
myEdges
;
251
253
std::vector<Prohibition>
myProhibitions
;
254
256
NBNetBuilder
&
myNetBuilder
;
257
259
NBNodeCont
&
myNodeCont
;
260
262
NBTrafficLightLogicCont
&
myTLLCont
;
263
265
EdgeAttrs
*
myCurrentEdge
;
266
268
LaneAttrs
*
myCurrentLane
;
269
271
NBLoadedSUMOTLDef
*
myCurrentTL
;
272
274
GeoConvHelper
*
myLocation
;
275
277
bool
mySuspectKeepShape
;
278
280
bool
myHaveSeenInternalEdge
;
281
286
LaneAttrs
*
getLaneAttrsFromID
(
EdgeAttrs
* edge, std::string lane_id);
287
293
static
void
interpretLaneID
(
const
std::string& lane_id, std::string& edge_id,
unsigned
int
& index);
294
300
static
PositionVector
reconstructEdgeShape
(
const
EdgeAttrs
* edge,
const
Position
& from,
const
Position
& to);
301
303
static
Position
readPosition
(
const
SUMOSAXAttributes
& attrs,
const
std::string&
id
,
bool
& ok);
304
311
void
parseProhibitionConnection
(
const
std::string& attr, std::string& from, std::string& to,
bool
& ok);
312
};
313
314
315
#endif
316
317
/****************************************************************************/
318
build
buildd
sumo-0.17.1~dfsg
src
netimport
NIImporter_SUMO.h
Generated on Sun Jun 16 2013 17:30:18 for SUMO - Simulation of Urban MObility by
1.8.3.1