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-sim.org/
12
// Copyright (C) 2001-2014 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
153
void
addRequest
(
const
SUMOSAXAttributes
& attrs);
154
155
160
void
addConnection
(
const
SUMOSAXAttributes
& attrs);
161
165
void
addProhibition
(
const
SUMOSAXAttributes
& attrs);
166
168
169
170
171
private
:
176
struct
Connection
{
178
std::string
toEdgeID
;
180
unsigned
int
toLaneIdx
;
182
std::string
tlID
;
184
unsigned
int
tlLinkNo
;
186
bool
mayDefinitelyPass
;
187
};
188
189
193
struct
LaneAttrs
{
195
SUMOReal
maxSpeed
;
197
PositionVector
shape
;
199
std::vector<Connection>
connections
;
201
std::string
allow
;
203
std::string
disallow
;
205
SUMOReal
width
;
207
SUMOReal
endOffset
;
208
};
209
210
214
struct
EdgeAttrs
{
216
std::string
id
;
218
std::string
streetName
;
220
std::string
type
;
222
SumoXMLEdgeFunc
func
;
224
std::string
fromNode
;
226
std::string
toNode
;
228
PositionVector
shape
;
230
SUMOReal
length
;
232
int
priority
;
234
SUMOReal
maxSpeed
;
236
std::vector<LaneAttrs*>
lanes
;
238
NBEdge
*
builtEdge
;
240
LaneSpreadFunction
lsf
;
241
};
242
243
247
struct
Prohibition
{
248
std::string
prohibitorFrom
;
249
std::string
prohibitorTo
;
250
std::string
prohibitedFrom
;
251
std::string
prohibitedTo
;
252
};
253
257
struct
Crossing
{
258
std::string
laneID
;
259
std::vector<std::string>
crossingEdges
;
260
SUMOReal
width
;
261
bool
priority
;
262
};
263
267
struct
JunctionAttrs
{
268
NBNode
*
node
;
269
// @the list of internal lanes corresponding to each link
270
std::vector<std::string>
intLanes
;
271
// @brief the complete response definition for all links
272
std::vector<std::string>
response
;
273
};
274
275
277
std::map<std::string, EdgeAttrs*>
myEdges
;
278
280
std::vector<Prohibition>
myProhibitions
;
281
283
NBNetBuilder
&
myNetBuilder
;
284
286
NBNodeCont
&
myNodeCont
;
287
289
NBTrafficLightLogicCont
&
myTLLCont
;
290
292
EdgeAttrs
*
myCurrentEdge
;
293
295
JunctionAttrs
myCurrentJunction
;
296
298
LaneAttrs
*
myCurrentLane
;
299
301
NBLoadedSUMOTLDef
*
myCurrentTL
;
302
304
GeoConvHelper
*
myLocation
;
305
307
std::map<std::string, std::vector<Crossing> >
myPedestrianCrossings
;
308
310
bool
myHaveSeenInternalEdge
;
311
316
LaneAttrs
*
getLaneAttrsFromID
(
EdgeAttrs
* edge, std::string lane_id);
317
323
static
void
interpretLaneID
(
const
std::string& lane_id, std::string& edge_id,
unsigned
int
& index);
324
330
static
PositionVector
reconstructEdgeShape
(
const
EdgeAttrs
* edge,
const
Position
& from,
const
Position
& to);
331
333
static
Position
readPosition
(
const
SUMOSAXAttributes
& attrs,
const
std::string&
id
,
bool
& ok);
334
341
void
parseProhibitionConnection
(
const
std::string& attr, std::string& from, std::string& to,
bool
& ok);
342
};
343
344
345
#endif
346
347
/****************************************************************************/
348
tmp
buildd
sumo-0.21.0+dfsg
src
netimport
NIImporter_SUMO.h
Generated on Thu Nov 20 2014 19:49:57 for SUMO - Simulation of Urban MObility by
1.8.1.2