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-sim.org/
13
// Copyright (C) 2001-2013 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
171
Position
getCenter
()
const
;
172
173
177
const
EdgeVector
&
getIncomingEdges
()
const
{
178
return
myIncomingEdges
;
179
}
180
181
185
const
EdgeVector
&
getOutgoingEdges
()
const
{
186
return
myOutgoingEdges
;
187
}
188
189
193
const
EdgeVector
&
getEdges
()
const
{
194
return
myAllEdges
;
195
}
196
197
202
SumoXMLNodeType
getType
()
const
{
203
return
myType
;
204
}
206
207
208
211
215
void
addTrafficLight
(
NBTrafficLightDefinition
* tlDef);
216
218
void
removeTrafficLight
(
NBTrafficLightDefinition
* tlDef);
219
222
void
removeTrafficLights
();
223
224
228
bool
isTLControlled
()
const
{
229
return
myTrafficLights
.size() != 0;
230
}
231
232
236
bool
isJoinedTLSControlled
()
const
;
237
238
242
const
std::set<NBTrafficLightDefinition*>&
getControllingTLS
()
const
{
243
return
myTrafficLights
;
244
}
245
246
248
void
invalidateTLS
(
NBTrafficLightLogicCont
& tlCont);
250
251
252
255
265
unsigned
int
removeSelfLoops
(
NBDistrictCont
& dc,
NBEdgeCont
& ec,
NBTrafficLightLogicCont
& tc);
267
268
269
272
277
void
reshiftPosition
(
SUMOReal
xoff,
SUMOReal
yoff);
279
280
281
283
void
addIncomingEdge
(
NBEdge
* edge);
284
286
void
addOutgoingEdge
(
NBEdge
* edge);
287
288
289
290
292
void
computeLanes2Lanes
();
293
295
void
computeLogic
(
const
NBEdgeCont
& ec,
OptionsCont
& oc);
296
299
bool
writeLogic
(
OutputDevice
& into,
const
bool
checkLaneFoes)
const
;
300
303
Position
getEmptyDir
()
const
;
304
305
310
bool
hasIncoming
(
const
NBEdge
*
const
e)
const
;
311
312
317
bool
hasOutgoing
(
const
NBEdge
*
const
e)
const
;
318
319
320
NBEdge
*
getOppositeIncoming
(
NBEdge
* e)
const
;
321
void
invalidateIncomingConnections
();
322
void
invalidateOutgoingConnections
();
323
324
void
removeDoubleEdges
();
325
NBEdge
*
getConnectionTo
(
NBNode
* n)
const
;
326
327
328
void
addSortedLinkFoes
(
const
NBConnection
& mayDrive,
329
const
NBConnection
& mustStop);
330
331
NBEdge
*
getPossiblySplittedIncoming
(
const
std::string& edgeid);
332
NBEdge
*
getPossiblySplittedOutgoing
(
const
std::string& edgeid);
333
336
void
removeEdge
(
NBEdge
* edge,
bool
removeFromConnections =
true
);
337
347
bool
isLeftMover
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
348
349
356
bool
mustBrake
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to,
int
toLane)
const
;
357
358
367
bool
forbids
(
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
368
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
369
bool
regardNonSignalisedLowerPriority)
const
;
370
371
379
bool
foes
(
const
NBEdge
*
const
from1,
const
NBEdge
*
const
to1,
380
const
NBEdge
*
const
from2,
const
NBEdge
*
const
to2)
const
;
381
382
388
LinkDirection
getDirection
(
const
NBEdge
*
const
incoming,
const
NBEdge
*
const
outgoing)
const
;
389
390
LinkState
getLinkState
(
const
NBEdge
* incoming,
NBEdge
* outgoing,
391
int
fromLane,
bool
mayDefinitelyPass,
const
std::string& tlID)
const
;
392
393
void
computeNodeShape
(
bool
leftHand);
394
395
396
const
PositionVector
&
getShape
()
const
;
397
398
bool
checkIsRemovable
()
const
;
399
400
401
std::vector<std::pair<NBEdge*, NBEdge*> >
getEdgesToJoin
()
const
;
402
403
404
friend
class
NBNodeShapeComputer
;
405
406
bool
isNearDistrict
()
const
;
407
bool
isDistrict
()
const
;
408
409
bool
needsCont
(
NBEdge
* fromE,
NBEdge
* toE,
NBEdge
* otherFromE,
NBEdge
* otherToE,
const
NBEdge::Connection
& c)
const
;
410
419
PositionVector
computeInternalLaneShape
(
420
NBEdge
* fromE,
int
fromL,
NBEdge
* toE,
int
toL,
int
numPoints = 5)
const
;
421
422
425
void
replaceIncoming
(
NBEdge
* which,
NBEdge
* by,
unsigned
int
laneOff);
426
429
void
replaceIncoming
(
const
EdgeVector
& which,
NBEdge
* by);
430
433
void
replaceOutgoing
(
NBEdge
* which,
NBEdge
* by,
unsigned
int
laneOff);
434
437
void
replaceOutgoing
(
const
EdgeVector
& which,
NBEdge
* by);
438
439
void
buildInnerEdges
();
440
441
const
NBConnectionProhibits
&
getProhibitions
() {
442
return
myBlockedConnections
;
443
}
444
447
bool
geometryLike
()
const
;
448
453
class
nodes_by_id_sorter
{
454
public
:
456
explicit
nodes_by_id_sorter
() { }
457
460
int
operator()
(
NBNode
* n1,
NBNode
* n2)
const
{
461
return
n1->
getID
() < n2->
getID
();
462
}
463
464
};
465
466
private
:
467
bool
isSimpleContinuation
()
const
;
468
470
void
setPriorityJunctionPriorities
();
471
474
EdgeVector
*
getEdgesThatApproach
(
NBEdge
* currentOutgoing);
475
476
477
478
479
void
replaceInConnectionProhibitions
(
NBEdge
* which,
NBEdge
* by,
480
unsigned
int
whichLaneOff,
unsigned
int
byLaneOff);
481
482
483
void
remapRemoved
(
NBTrafficLightLogicCont
& tc,
484
NBEdge
* removed,
const
EdgeVector
& incoming,
const
EdgeVector
& outgoing);
485
486
487
private
:
489
Position
myPosition
;
490
492
EdgeVector
myIncomingEdges
;
493
495
EdgeVector
myOutgoingEdges
;
496
498
EdgeVector
myAllEdges
;
499
501
SumoXMLNodeType
myType
;
502
504
NBConnectionProhibits
myBlockedConnections
;
505
507
NBDistrict
*
myDistrict
;
508
510
PositionVector
myPoly
;
511
512
NBRequest
*
myRequest
;
513
514
std::set<NBTrafficLightDefinition*>
myTrafficLights
;
515
516
private
:
518
NBNode
(
const
NBNode
& s);
519
521
NBNode
&
operator=
(
const
NBNode
& s);
522
523
524
};
525
526
527
#endif
528
529
/****************************************************************************/
530
build
buildd
sumo-0.18~dfsg
src
netbuild
NBNode.h
Generated on Wed Oct 23 2013 01:15:10 for SUMO - Simulation of Urban MObility by
1.8.4