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-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
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
396
friend
class
NBNodeShapeComputer
;
397
398
bool
isNearDistrict
()
const
;
399
bool
isDistrict
()
const
;
400
401
bool
needsCont
(
NBEdge
* fromE,
NBEdge
* toE,
NBEdge
* otherFromE,
NBEdge
* otherToE,
const
NBEdge::Connection
& c)
const
;
402
411
PositionVector
computeInternalLaneShape
(
412
NBEdge
* fromE,
int
fromL,
NBEdge
* toE,
int
toL,
int
numPoints = 5)
const
;
413
414
417
void
replaceIncoming
(
NBEdge
* which,
NBEdge
* by,
unsigned
int
laneOff);
418
421
void
replaceIncoming
(
const
EdgeVector
& which,
NBEdge
* by);
422
425
void
replaceOutgoing
(
NBEdge
* which,
NBEdge
* by,
unsigned
int
laneOff);
426
429
void
replaceOutgoing
(
const
EdgeVector
& which,
NBEdge
* by);
430
431
void
buildInnerEdges
();
432
433
const
NBConnectionProhibits
&
getProhibitions
() {
434
return
myBlockedConnections
;
435
}
436
439
bool
geometryLike
()
const
;
440
445
class
nodes_by_id_sorter
{
446
public
:
448
explicit
nodes_by_id_sorter
() { }
449
452
int
operator()
(
NBNode
* n1,
NBNode
* n2)
const
{
453
return
n1->
getID
() < n2->
getID
();
454
}
455
456
};
457
458
private
:
459
bool
isSimpleContinuation
()
const
;
460
462
void
setPriorityJunctionPriorities
();
463
466
EdgeVector
*
getEdgesThatApproach
(
NBEdge
* currentOutgoing);
467
468
469
470
471
void
replaceInConnectionProhibitions
(
NBEdge
* which,
NBEdge
* by,
472
unsigned
int
whichLaneOff,
unsigned
int
byLaneOff);
473
474
475
void
remapRemoved
(
NBTrafficLightLogicCont
& tc,
476
NBEdge
* removed,
const
EdgeVector
& incoming,
const
EdgeVector
& outgoing);
477
478
479
private
:
481
Position
myPosition
;
482
484
EdgeVector
myIncomingEdges
;
485
487
EdgeVector
myOutgoingEdges
;
488
490
EdgeVector
myAllEdges
;
491
493
SumoXMLNodeType
myType
;
494
496
NBConnectionProhibits
myBlockedConnections
;
497
499
NBDistrict
*
myDistrict
;
500
502
PositionVector
myPoly
;
503
504
NBRequest
*
myRequest
;
505
506
std::set<NBTrafficLightDefinition*>
myTrafficLights
;
507
508
private
:
510
NBNode
(
const
NBNode
& s);
511
513
NBNode
&
operator=
(
const
NBNode
& s);
514
515
516
};
517
518
519
#endif
520
521
/****************************************************************************/
522
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
netbuild
NBNode.h
Generated on Sun Jun 16 2013 07:07:52 for SUMO - Simulation of Urban MObility by
1.8.1.2