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
NBNode.h
Go to the documentation of this file.
1
/****************************************************************************/
10
// The representation of a single node
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 NBNode_h
24
#define NBNode_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 <vector>
37
#include <deque>
38
#include <utility>
39
#include <string>
40
#include <set>
41
#include <
utils/common/Named.h
>
42
#include <
utils/geom/Bresenham.h
>
43
#include <
utils/common/VectorHelper.h
>
44
#include <
utils/geom/Position.h
>
45
#include <
utils/geom/Line.h
>
46
#include <
utils/geom/PositionVector.h
>
47
#include <
utils/xml/SUMOXMLDefinitions.h
>
48
#include "
NBEdge.h
"
49
#include "
NBConnection.h
"
50
#include "
NBConnectionDefs.h
"
51
#include "
NBContHelper.h
"
52
53
54
// ===========================================================================
55
// class declarations
56
// ===========================================================================
57
class
NBRequest
;
58
class
NBDistrict
;
59
class
OptionsCont
;
60
class
NBTrafficLightDefinition
;
61
class
NBTypeCont
;
62
class
NBTrafficLightLogicCont
;
63
class
NBDistrictCont
;
64
class
OutputDevice
;
65
66
67
// ===========================================================================
68
// class definitions
69
// ===========================================================================
74
class
NBNode
:
public
Named
{
75
friend
class
NBNodeCont
;
76
friend
class
GNEJunction
;
// < used for visualization (NETEDIT)
77
friend
class
NBNodesEdgesSorter
;
// < sorts the edges
78
friend
class
NBNodeTypeComputer
;
// < computes type
79
friend
class
NBEdgePriorityComputer
;
// < computes priorities of edges per intersection
80
81
public
:
93
class
ApproachingDivider
:
public
Bresenham::BresenhamCallBack
{
94
private
:
96
EdgeVector
*
myApproaching
;
97
99
NBEdge
*
myCurrentOutgoing
;
100
101
public
:
106
ApproachingDivider
(
EdgeVector
* approaching,
107
NBEdge
* currentOutgoing);
108
110
~ApproachingDivider
();
111
113
void
execute
(
const
unsigned
int
src,
const
unsigned
int
dest);
114
117
std::deque<int>*
spread
(
const
std::vector<int>& approachingLanes,
int
dest)
const
;
118
119
};
120
121
public
:
126
NBNode
(
const
std::string&
id
,
const
Position
& position);
127
128
134
NBNode
(
const
std::string&
id
,
const
Position
& position,
SumoXMLNodeType
type);
135
136
142
NBNode
(
const
std::string&
id
,
const
Position
& position,
NBDistrict
* district);
143
144
146
~NBNode
();
147
148
155
void
reinit
(
const
Position
& position,
SumoXMLNodeType
type,
156
bool
updateEdgeGeometries =
false
);
157
158
161
165
const
Position
&
getPosition
()
const
{
166
return
myPosition
;
167
}
168
169
173
const
EdgeVector
&
getIncomingEdges
()
const
{
174
return
myIncomingEdges
;
175
}
176
177
181
const
EdgeVector
&
getOutgoingEdges
()
const
{
182
return
myOutgoingEdges
;
183
}
184
185
189
const
EdgeVector
&
getEdges
()
const
{
190
return
myAllEdges
;
191
}
192
193
198
SumoXMLNodeType
getType
()
const
{
199
return
myType
;
200
}
202
203
204
207
211
void
addTrafficLight
(
NBTrafficLightDefinition
* tlDef);
212
214
void
removeTrafficLight
(
NBTrafficLightDefinition
* tlDef);
215
218
void
removeTrafficLights
();
219
220
224
bool
isTLControlled
()
const
{
225
return
myTrafficLights
.size() != 0;
226
}
227
228
232
bool
isJoinedTLSControlled
()
const
;
233
234
238
const
std::set<NBTrafficLightDefinition*>&
getControllingTLS
()
const
{
239
return
myTrafficLights
;
240
}
242
243
244
247
257
unsigned
int
removeSelfLoops
(
NBDistrictCont
& dc,
NBEdgeCont
& ec,
NBTrafficLightLogicCont
& tc);
259
260
261
264
269
void
reshiftPosition
(
SUMOReal
xoff,
SUMOReal
yoff);
271
272
273
275
void
addIncomingEdge
(
NBEdge
* edge);
276
278
void
addOutgoingEdge
(
NBEdge
* edge);
279
280
281
282
284
void
computeLanes2Lanes
();
285
287
void
computeLogic
(
const
NBEdgeCont
& ec,
OptionsCont
& oc);
288
291
bool
writeLogic
(
OutputDevice
& into)
const
;
292
295
Position
getEmptyDir
()
const
;
296
297
302
bool
hasIncoming
(
const
NBEdge
*
const
e)
const
;
303
304
309
bool
hasOutgoing
(
const
NBEdge
*
const
e)
const
;
310
311
312
NBEdge
*
getOppositeIncoming
(
NBEdge
* e)
const
;
313
void
invalidateIncomingConnections
();
314
void
invalidateOutgoingConnections
();
315
316
void
removeDoubleEdges
();
317
NBEdge
*
getConnectionTo
(
NBNode
* n)
const
;
318
319
320
void
addSortedLinkFoes
(
const
NBConnection
& mayDrive,
321
const
NBConnection
& mustStop);
322
323
NBEdge
*
getPossiblySplittedIncoming
(
const
std::string& edgeid);
324
NBEdge
*
getPossiblySplittedOutgoing
(
const
std::string& edgeid);
325
328
void
removeEdge
(
NBEdge
* edge,
bool
removeFromConnections =
true
);
329
339
bool
isLeftMover
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
340
341
348
bool
mustBrake
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to,
int
toLane)
const
;
349
350
359
bool
forbids
(
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
360
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
361
bool
regardNonSignalisedLowerPriority)
const
;
362
363
371
bool
foes
(
const
NBEdge
*
const
from1,
const
NBEdge
*
const
to1,
372
const
NBEdge
*
const
from2,
const
NBEdge
*
const
to2)
const
;
373
374
380
LinkDirection
getDirection
(
const
NBEdge
*
const
incoming,
const
NBEdge
*
const
outgoing)
const
;
381
382
LinkState
getLinkState
(
const
NBEdge
* incoming,
NBEdge
* outgoing,
383
int
fromLane,
bool
mayDefinitelyPass,
const
std::string& tlID)
const
;
384
385
void
computeNodeShape
(
bool
leftHand);
386
387
388
const
PositionVector
&
getShape
()
const
;
389
390
bool
checkIsRemovable
()
const
;
391
392
393
std::vector<std::pair<NBEdge*, NBEdge*> >
getEdgesToJoin
()
const
;
394
395
SUMOReal
getMaxEdgeWidth
()
const
;
396
397
friend
class
NBNodeShapeComputer
;
398
399
bool
isNearDistrict
()
const
;
400
bool
isDistrict
()
const
;
401
402
bool
needsCont
(
NBEdge
* fromE,
NBEdge
* toE,
NBEdge
* otherFromE,
NBEdge
* otherToE,
const
NBEdge::Connection
& c)
const
;
403
412
PositionVector
computeInternalLaneShape
(
413
NBEdge
* fromE,
int
fromL,
NBEdge
* toE,
int
toL,
int
numPoints = 5)
const
;
414
415
418
void
replaceIncoming
(
NBEdge
* which,
NBEdge
* by,
unsigned
int
laneOff);
419
422
void
replaceIncoming
(
const
EdgeVector
& which,
NBEdge
* by);
423
426
void
replaceOutgoing
(
NBEdge
* which,
NBEdge
* by,
unsigned
int
laneOff);
427
430
void
replaceOutgoing
(
const
EdgeVector
& which,
NBEdge
* by);
431
432
void
buildInnerEdges
();
433
434
const
NBConnectionProhibits
&
getProhibitions
() {
435
return
myBlockedConnections
;
436
}
437
442
class
nodes_by_id_sorter
{
443
public
:
445
explicit
nodes_by_id_sorter
() { }
446
449
int
operator()
(
NBNode
* n1,
NBNode
* n2)
const
{
450
return
n1->
getID
() < n2->
getID
();
451
}
452
453
};
454
455
private
:
456
bool
isSimpleContinuation
()
const
;
457
459
void
setPriorityJunctionPriorities
();
460
463
EdgeVector
*
getEdgesThatApproach
(
NBEdge
* currentOutgoing);
464
465
466
467
468
void
replaceInConnectionProhibitions
(
NBEdge
* which,
NBEdge
* by,
469
unsigned
int
whichLaneOff,
unsigned
int
byLaneOff);
470
471
472
void
remapRemoved
(
NBTrafficLightLogicCont
& tc,
473
NBEdge
* removed,
const
EdgeVector
& incoming,
const
EdgeVector
& outgoing);
474
475
476
private
:
478
Position
myPosition
;
479
481
EdgeVector
myIncomingEdges
;
482
484
EdgeVector
myOutgoingEdges
;
485
487
EdgeVector
myAllEdges
;
488
490
SumoXMLNodeType
myType
;
491
493
NBConnectionProhibits
myBlockedConnections
;
494
496
NBDistrict
*
myDistrict
;
497
499
PositionVector
myPoly
;
500
501
NBRequest
*
myRequest
;
502
503
std::set<NBTrafficLightDefinition*>
myTrafficLights
;
504
505
private
:
507
NBNode
(
const
NBNode
& s);
508
510
NBNode
&
operator=
(
const
NBNode
& s);
511
512
513
};
514
515
516
#endif
517
518
/****************************************************************************/
519
build
buildd
sumo-0.16.0~dfsg
src
netbuild
NBNode.h
Generated on Tue Apr 16 2013 01:32:18 for SUMO - Simulation of Urban MObility by
1.8.3.1