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_OpenStreetMap.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// Importer for networks stored in OpenStreetMap format
11
/****************************************************************************/
12
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
13
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
14
/****************************************************************************/
15
//
16
// This file is part of SUMO.
17
// SUMO is free software: you can redistribute it and/or modify
18
// it under the terms of the GNU General Public License as published by
19
// the Free Software Foundation, either version 3 of the License, or
20
// (at your option) any later version.
21
//
22
/****************************************************************************/
23
#ifndef NIImporter_OpenStreetMap_h
24
#define NIImporter_OpenStreetMap_h
25
26
27
// ===========================================================================
28
// included modules
29
// ===========================================================================
30
#ifdef _MSC_VER
31
#include <
windows_config.h
>
32
#else
33
#include <
config.h
>
34
#endif
35
36
#include <string>
37
#include <map>
38
#include <
utils/xml/SUMOSAXHandler.h
>
39
#include <
utils/common/UtilExceptions.h
>
40
41
42
// ===========================================================================
43
// class declarations
44
// ===========================================================================
45
class
NBEdge
;
46
class
NBEdgeCont
;
47
class
NBNetBuilder
;
48
class
NBNode
;
49
class
NBNodeCont
;
50
class
NBTrafficLightLogicCont
;
51
class
NBTypeCont
;
52
class
OptionsCont
;
53
54
55
// ===========================================================================
56
// class definitions
57
// ===========================================================================
63
class
NIImporter_OpenStreetMap
{
64
public
:
76
static
void
loadNetwork
(
const
OptionsCont
& oc,
NBNetBuilder
& nb);
77
78
79
protected
:
82
struct
NIOSMNode
{
84
SUMOLong
id
;
86
double
lon
;
88
double
lat
;
90
bool
tlsControlled
;
91
};
92
93
96
struct
Edge
{
98
std::string
id
;
100
std::string
streetName
;
102
int
myNoLanes
;
104
double
myMaxSpeed
;
106
std::string
myHighWayType
;
108
std::string
myIsOneWay
;
110
std::vector<SUMOLong>
myCurrentNodes
;
112
bool
myCurrentIsRoad
;
113
};
114
115
116
NIImporter_OpenStreetMap
();
117
118
~NIImporter_OpenStreetMap
();
119
120
void
load
(
const
OptionsCont
& oc,
NBNetBuilder
& nb);
121
122
private
:
126
class
CompareNodes
{
127
public
:
128
bool
operator()
(
const
NIOSMNode
* n1,
const
NIOSMNode
* n2)
const
{
129
return
(n1->
lat
> n2->
lat
) || (n1->
lat
== n2->
lat
&& n1->
lon
> n2->
lon
);
130
}
131
};
132
133
135
static
const
std::string
compoundTypeSeparator
;
136
137
class
CompareEdges
;
138
142
std::map<SUMOLong, NIOSMNode*>
myOSMNodes
;
143
145
std::set<NIOSMNode*, CompareNodes>
myUniqueNodes
;
146
147
148
std::map<std::string, Edge*>
myEdges
;
149
164
NBNode
*
insertNodeChecking
(
SUMOLong
id
,
NBNodeCont
& nc,
NBTrafficLightLogicCont
& tlsc);
165
166
179
int
insertEdge
(
Edge
* e,
int
index,
NBNode
* from,
NBNode
* to,
180
const
std::vector<SUMOLong>& passed,
NBNetBuilder
& nb);
181
182
183
protected
:
184
static
const
SUMOReal
MAXSPEED_UNGIVEN
;
185
190
friend
class
NodesHandler
;
191
class
NodesHandler
:
public
SUMOSAXHandler
{
192
public
:
198
NodesHandler
(std::map<SUMOLong, NIOSMNode*>& toFill,
199
std::set<NIOSMNode*, CompareNodes>& uniqueNodes);
200
201
203
~NodesHandler
();
204
205
206
protected
:
208
209
217
void
myStartElement
(
int
element,
const
SUMOSAXAttributes
& attrs);
218
219
226
void
myEndElement
(
int
element);
228
229
230
private
:
231
233
std::map<SUMOLong, NIOSMNode*>&
myToFill
;
234
236
SUMOLong
myLastNodeID
;
237
239
bool
myIsInValidNodeTag
;
240
242
int
myHierarchyLevel
;
243
245
std::set<NIOSMNode*, CompareNodes>&
myUniqueNodes
;
246
247
248
private
:
250
NodesHandler
(
const
NodesHandler
& s);
251
253
NodesHandler
&
operator=
(
const
NodesHandler
& s);
254
255
};
256
257
258
263
class
EdgesHandler
:
public
SUMOSAXHandler
{
264
public
:
270
EdgesHandler
(
const
std::map<SUMOLong, NIOSMNode*>& osmNodes,
271
std::map<std::string, Edge*>& toFill);
272
273
275
~EdgesHandler
();
276
277
278
protected
:
280
281
289
void
myStartElement
(
int
element,
const
SUMOSAXAttributes
& attrs);
290
291
298
void
myEndElement
(
int
element);
300
301
302
private
:
304
const
std::map<SUMOLong, NIOSMNode*>&
myOSMNodes
;
305
307
std::map<std::string, Edge*>&
myEdgeMap
;
308
310
Edge
*
myCurrentEdge
;
311
313
std::vector<int>
myParentElements
;
314
316
std::map<std::string, SUMOReal>
mySpeedMap
;
317
318
319
private
:
321
EdgesHandler
(
const
EdgesHandler
& s);
322
324
EdgesHandler
&
operator=
(
const
EdgesHandler
& s);
325
326
};
327
328
329
};
330
331
332
#endif
333
334
/****************************************************************************/
335
build
buildd
sumo-0.16.0~dfsg
src
netimport
NIImporter_OpenStreetMap.h
Generated on Tue Apr 16 2013 01:32:18 for SUMO - Simulation of Urban MObility by
1.8.3.1