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-2012 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
(
const
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
87
protected
:
91
NIImporter_SUMO
(
NBNetBuilder
& nb);
92
93
95
~NIImporter_SUMO
() ;
96
97
98
100
101
112
void
myStartElement
(
int
element,
113
const
SUMOSAXAttributes
& attrs) ;
114
115
123
void
myCharacters
(
int
element,
124
const
std::string& chars) ;
125
126
133
void
myEndElement
(
int
element) ;
135
136
137
private
:
139
void
_loadNetwork
(
const
OptionsCont
& oc);
140
142
143
147
void
addEdge
(
const
SUMOSAXAttributes
& attrs);
148
149
153
void
addLane
(
const
SUMOSAXAttributes
& attrs);
154
155
159
void
addJunction
(
const
SUMOSAXAttributes
& attrs);
160
161
166
void
addSuccEdge
(
const
SUMOSAXAttributes
& attrs);
167
168
173
void
addSuccLane
(
const
SUMOSAXAttributes
& attrs);
174
179
void
addConnection
(
const
SUMOSAXAttributes
& attrs);
180
184
void
addProhibition
(
const
SUMOSAXAttributes
& attrs);
185
187
188
189
190
private
:
195
struct
Connection
{
197
std::string
toEdgeID
;
199
unsigned
int
toLaneIdx
;
201
std::string
tlID
;
203
unsigned
int
tlLinkNo
;
205
bool
mayDefinitelyPass
;
206
};
207
208
212
struct
LaneAttrs
{
214
SUMOReal
maxSpeed
;
216
PositionVector
shape
;
218
std::vector<Connection>
connections
;
220
std::string
allow
;
222
std::string
disallow
;
224
SUMOReal
width
;
226
SUMOReal
offset
;
227
};
228
229
233
struct
EdgeAttrs
{
235
std::string
id
;
237
std::string
streetName
;
239
std::string
type
;
241
std::string
func
;
243
std::string
fromNode
;
245
std::string
toNode
;
247
PositionVector
shape
;
249
SUMOReal
length
;
251
int
priority
;
253
SUMOReal
maxSpeed
;
255
std::vector<LaneAttrs*>
lanes
;
257
NBEdge
*
builtEdge
;
259
LaneSpreadFunction
lsf
;
260
};
261
262
266
struct
Prohibition
{
267
std::string
prohibitorFrom
;
268
std::string
prohibitorTo
;
269
std::string
prohibitedFrom
;
270
std::string
prohibitedTo
;
271
};
272
273
275
std::map<std::string, EdgeAttrs*>
myEdges
;
276
278
std::vector<Prohibition>
myProhibitions
;
279
281
NBNetBuilder
&
myNetBuilder
;
282
284
NBNodeCont
&
myNodeCont
;
285
287
NBTrafficLightLogicCont
&
myTLLCont
;
288
290
EdgeAttrs
*
myCurrentEdge
;
291
293
LaneAttrs
*
myCurrentLane
;
294
296
NBLoadedSUMOTLDef
*
myCurrentTL
;
297
299
GeoConvHelper
*
myLocation
;
300
302
bool
mySuspectKeepShape
;
303
304
bool
myHaveWarnedAboutDeprecatedSpreadType
;
305
bool
myHaveWarnedAboutDeprecatedMaxSpeed
;
306
311
LaneAttrs
*
getLaneAttrsFromID
(
EdgeAttrs
* edge, std::string lane_id);
312
318
static
void
interpretLaneID
(
const
std::string& lane_id, std::string& edge_id,
unsigned
int
& index);
319
325
static
PositionVector
reconstructEdgeShape
(
const
EdgeAttrs
* edge,
const
Position
& from,
const
Position
& to);
326
328
static
Position
readPosition
(
const
SUMOSAXAttributes
& attrs,
const
std::string&
id
,
bool
& ok);
329
336
void
parseProhibitionConnection
(
const
std::string& attr, std::string& from, std::string& to,
bool
& ok);
337
};
338
339
340
#endif
341
342
/****************************************************************************/
343
build
buildd
sumo-0.15.0~dfsg
src
netimport
NIImporter_SUMO.h
Generated on Wed Jul 18 2012 22:58:34 for SUMO - Simulation of Urban MObility by
1.8.1.1