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
NBTrafficLightDefinition.h
Go to the documentation of this file.
1
/****************************************************************************/
8
// The base class for traffic light logic definitions
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
#ifndef NBTrafficLightDefinition_h
22
#define NBTrafficLightDefinition_h
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include <vector>
35
#include <string>
36
#include <bitset>
37
#include <utility>
38
#include <set>
39
#include <
utils/common/Named.h
>
40
#include <
utils/common/VectorHelper.h
>
41
#include <
utils/common/SUMOTime.h
>
42
#include <
utils/common/UtilExceptions.h
>
43
#include "
NBCont.h
"
44
#include "
NBConnection.h
"
45
#include "
NBConnectionDefs.h
"
46
#include "
NBLinkPossibilityMatrix.h
"
47
48
49
// ===========================================================================
50
// class declarations
51
// ===========================================================================
52
class
NBNode
;
53
class
OptionsCont
;
54
class
NBTrafficLightLogic
;
55
56
57
// ===========================================================================
58
// class definitions
59
// ===========================================================================
72
class
NBTrafficLightDefinition
:
public
Named
{
73
public
:
74
75
static
const
std::string
DefaultProgramID
;
76
81
enum
TLColor
{
83
TLCOLOR_RED
,
85
TLCOLOR_YELLOW
,
87
TLCOLOR_REDYELLOW
,
89
TLCOLOR_GREEN
,
91
TLCOLOR_BLINK
92
};
93
94
102
NBTrafficLightDefinition
(
const
std::string&
id
,
103
const
std::vector<NBNode*>& junctions,
104
const
std::string& programID,
105
SUMOTime
offset,
106
TrafficLightType
type);
107
108
116
NBTrafficLightDefinition
(
const
std::string&
id
,
117
NBNode
* junction,
118
const
std::string& programID,
119
SUMOTime
offset,
120
TrafficLightType
type);
121
122
129
NBTrafficLightDefinition
(
const
std::string&
id
,
const
std::string& programID,
130
SUMOTime
offset,
131
TrafficLightType
type);
132
133
135
virtual
~NBTrafficLightDefinition
();
136
137
147
NBTrafficLightLogic
*
compute
(
const
NBEdgeCont
& ec,
OptionsCont
& oc);
148
149
150
153
157
virtual
void
addNode
(
NBNode
* node);
158
159
163
virtual
void
removeNode
(
NBNode
* node);
164
165
169
const
std::vector<NBNode*>&
getNodes
()
const
{
170
return
myControlledNodes
;
171
}
173
174
185
bool
mustBrake
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
186
187
195
bool
mustBrake
(
const
NBConnection
& possProhibited,
196
const
NBConnection
& possProhibitor,
197
bool
regardNonSignalisedLowerPriority)
const
;
198
208
bool
mustBrake
(
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
209
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
210
bool
regardNonSignalisedLowerPriority)
const
;
211
212
222
bool
forbids
(
const
NBEdge
*
const
possProhibitorFrom,
const
NBEdge
*
const
possProhibitorTo,
223
const
NBEdge
*
const
possProhibitedFrom,
const
NBEdge
*
const
possProhibitedTo,
224
bool
regardNonSignalisedLowerPriority)
const
;
225
226
234
bool
foes
(
const
NBEdge
*
const
from1,
const
NBEdge
*
const
to1,
235
const
NBEdge
*
const
from2,
const
NBEdge
*
const
to2)
const
;
236
237
241
virtual
void
setTLControllingInformation
(
const
NBEdgeCont
& ec)
const
= 0;
242
243
246
virtual
void
setParticipantsInformation
();
247
248
252
void
addControlledInnerEdges
(
const
std::vector<std::string>& edges);
253
254
260
virtual
void
remapRemoved
(
NBEdge
* removed,
261
const
EdgeVector
& incoming,
const
EdgeVector
& outgoing) = 0;
262
263
270
virtual
void
replaceRemoved
(
NBEdge
* removed,
int
removedLane,
271
NBEdge
* by,
int
byLane) = 0;
272
273
279
bool
isLeftMover
(
const
NBEdge
*
const
from,
const
NBEdge
*
const
to)
const
;
280
281
285
const
EdgeVector
&
getIncomingEdges
()
const
;
286
287
289
const
NBConnectionVector
&
getControlledLinks
()
const
{
290
return
myControlledLinks
;
291
}
292
293
294
// @breif returns the controlled nodes
295
const
std::vector<NBNode*>&
getControlledNodes
()
const
{
296
return
myControlledNodes
;
297
}
298
299
303
const
std::string&
getProgramID
()
const
{
304
return
mySubID
;
305
};
306
307
311
void
setProgramID
(
const
std::string& programID) {
312
mySubID
= programID;
313
}
314
315
319
SUMOTime
getOffset
() {
320
return
myOffset
;
321
}
322
323
325
TrafficLightType
getType
()
const
{
326
return
myType
;
327
}
328
329
protected
:
335
virtual
NBTrafficLightLogic
*
myCompute
(
const
NBEdgeCont
& ec,
336
unsigned
int
brakingTime) = 0;
337
338
342
virtual
void
collectLinks
() = 0;
343
344
347
void
collectEdges
();
348
349
355
unsigned
int
computeBrakingTime
(
SUMOReal
minDecel)
const
;
356
357
358
// @return whether this traffic light is invalid and should be computed
359
virtual
bool
amInvalid
()
const
;
360
362
void
collectAllLinks
();
363
364
365
protected
:
367
std::vector<NBNode*>
myControlledNodes
;
368
370
EdgeVector
myIncomingEdges
;
371
373
EdgeVector
myEdgesWithin
;
374
376
NBConnectionVector
myControlledLinks
;
377
379
std::set<std::string>
myControlledInnerEdges
;
380
382
std::string
mySubID
;
383
385
SUMOTime
myOffset
;
386
388
TrafficLightType
myType
;
389
};
390
391
392
#endif
393
394
/****************************************************************************/
395
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
netbuild
NBTrafficLightDefinition.h
Generated on Sun Jun 16 2013 07:07:54 for SUMO - Simulation of Urban MObility by
1.8.1.2