Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NBTrafficLightLogicCont.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// A container for traffic light definitions and built programs
21/****************************************************************************/
22#include <config.h>
23#include <map>
24#include <string>
25#include <algorithm>
31#include "NBTrafficLightLogic.h"
33#include "NBOwnTLDef.h"
34#include "NBLoadedSUMOTLDef.h"
35#include "NBEdgeCont.h"
36#include "NBNodeCont.h"
37
38
39// ===========================================================================
40// static members
41// ===========================================================================
43
44// ===========================================================================
45// method definitions
46// ===========================================================================
48
49
53
54
55void
57 // check whether any offsets shall be manipulated by setting
58 // them to half of the duration
59 if (oc.isSet("tls.half-offset")) {
60 std::vector<std::string> ids = oc.getStringVector("tls.half-offset");
61 myHalfOffsetTLS.insert(ids.begin(), ids.end());
62 }
63 // check whether any offsets shall be manipulated by setting
64 // them to a quarter of the duration
65 if (oc.isSet("tls.quarter-offset")) {
66 std::vector<std::string> ids = oc.getStringVector("tls.quarter-offset");
67 myQuarterOffsetTLS.insert(ids.begin(), ids.end());
68 }
69}
70
71
72std::string
73NBTrafficLightLogicCont::getNextProgramID(const std::string& id) const {
74 IDSupplier idS("", 0);
75 if (myDefinitions.count(id)) {
76 const Program2Def& programs = myDefinitions.find(id)->second;
77 for (auto item : programs) {
78 idS.avoid(item.first);
79 }
80 }
81 return idS.getNext();
82}
83
84
85bool
87 myExtracted.erase(logic);
88 if (myDefinitions.count(logic->getID())) {
89 if (myDefinitions[logic->getID()].count(logic->getProgramID())) {
90 if (forceInsert) {
91 logic->setProgramID(getNextProgramID(logic->getID()));
92 } else {
93 return false;
94 }
95 }
96 } else {
97 myDefinitions[logic->getID()] = Program2Def();
98 }
99 myDefinitions[logic->getID()][logic->getProgramID()] = logic;
100 return true;
101}
102
103
104bool
106 if (myDefinitions.count(id)) {
107 // delete all programs
108 for (Program2Def::iterator i = myDefinitions[id].begin(); i != myDefinitions[id].end(); i++) {
109 delete i->second;
110 }
111 myDefinitions.erase(id);
112 // also delete any logics that were already computed
113 if (myComputed.count(id)) {
114 for (Program2Logic::iterator i = myComputed[id].begin(); i != myComputed[id].end(); i++) {
115 delete i->second;
116 }
117 myComputed.erase(id);
118 }
119 return true;
120 } else {
121 return false;
122 }
123}
124
125
126bool
127NBTrafficLightLogicCont::removeProgram(const std::string id, const std::string programID, bool del) {
128 if (myDefinitions.count(id) && myDefinitions[id].count(programID)) {
129 if (del) {
130 delete myDefinitions[id][programID];
131 }
132 myDefinitions[id].erase(programID);
133 if (myComputed.count(id) && myComputed[id].count(programID)) {
134 if (del) {
135 delete myComputed[id][programID];
136 }
137 myComputed[id].erase(programID);
138 }
139 return true;
140 } else {
141 return false;
142 }
143}
144
145
146void
148 myExtracted.insert(definition);
149 removeProgram(definition->getID(), definition->getProgramID(), false);
150}
151
152
153bool
154NBTrafficLightLogicCont::exist(const std::string& newID, bool requireComputed) const {
155 const auto itD = myDefinitions.find(newID);
156 const auto itC = myComputed.find(newID);
157 if ((itD != myDefinitions.end()) && (itC != myComputed.end() || !requireComputed)) {
158 return true;
159 } else {
160 return false;
161 }
162}
163
164
165std::pair<int, int>
167 // clean previous logics
168 Logics logics = getComputed();
169 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
170 delete *it;
171 }
172 myComputed.clear();
173 if (oc.getBool("tls.rebuild")) {
175 NBLoadedSUMOTLDef* lDef = dynamic_cast<NBLoadedSUMOTLDef*>(def);
176 if (lDef != nullptr) {
177 TrafficLightType type = def->getType();
178 if (!oc.isDefault("tls.default-type")) {
179 type = SUMOXMLDefinitions::TrafficLightTypes.get(oc.getString("tls.default-type"));
180 }
181 NBOwnTLDef* oDef = new NBOwnTLDef(def->getID(), def->getNodes(), def->getOffset(), type);
182 oDef->setProgramID(def->getProgramID());
184 for (NBEdge* e : oDef->getIncomingEdges()) {
185 e->clearControllingTLInformation();
186 }
188 for (NBNode* node : oDef->getNodes()) {
189 node->removeTrafficLight(def);
190 for (auto c : node->getCrossings()) {
191 c->customTLIndex = -1;
192 c->customTLIndex2 = -1;
193 c->tlLinkIndex2 = -1;
194 }
195 }
196 removeProgram(def->getID(), def->getProgramID());
197 insert(oDef);
198 }
199 }
200 }
201 if (oc.getBool("tls.group-signals")) {
202 // replace NBOwnTLDef tld with NBLoadedSUMOTLDef
204 NBLoadedSUMOTLDef* lDef = dynamic_cast<NBLoadedSUMOTLDef*>(def);
205 if (lDef == nullptr) {
206 NBTrafficLightLogic* logic = def->compute(oc);
207 if (logic != nullptr) {
208 lDef = new NBLoadedSUMOTLDef(*def, *logic);
210 for (NBNode* node : lDef->getNodes()) {
211 node->removeTrafficLight(def);
212 node->addTrafficLight(lDef);
213 }
214 removeProgram(def->getID(), def->getProgramID());
215 insert(lDef);
216 delete logic;
217 }
218 }
219 if (lDef != nullptr) {
220 lDef->groupSignals();
221 }
222 }
223 } else if (oc.getBool("tls.ungroup-signals")) {
225 NBLoadedSUMOTLDef* lDef = dynamic_cast<NBLoadedSUMOTLDef*>(def);
226 // NBOwnTLDef are always ungrouped
227 if (lDef != nullptr) {
228 if (lDef->usingSignalGroups()) {
229 lDef->ungroupSignals();
230 }
231 }
232 }
233 }
234 int numPrograms = 0;
236 if (computeSingleLogic(oc, def)) {
237 numPrograms++;
238 }
239 }
240 return std::pair<int, int>((int)myComputed.size(), numPrograms);
241}
242
243
244bool
246 if (def->getNodes().size() == 0) {
247 return false;
248 }
249 const std::string& id = def->getID();
250 const std::string& programID = def->getProgramID();
251 // build program
252 NBTrafficLightLogic* built = def->compute(oc);
253 if (built == nullptr) {
254 WRITE_WARNINGF(TL("Could not build program '%' for traffic light '%'"), programID, id);
255 return false;
256 }
257 // compute offset
258 SUMOTime T = built->getDuration();
259 if (myHalfOffsetTLS.count(id)) {
260 built->setOffset(TIME2STEPS(floor(STEPS2TIME(T / 2))));
261 }
262 if (myQuarterOffsetTLS.count(id)) {
263 built->setOffset(TIME2STEPS(floor(STEPS2TIME(T / 4))));
264 }
265 // and insert the result after computation
266 // make sure we don't leak memory if computeSingleLogic is called externally
267 if (myComputed[id][programID] != nullptr) {
268 delete myComputed[id][programID];
269 }
270 myComputed[id][programID] = built;
271 return true;
272}
273
274
275void
277 Definitions definitions = getDefinitions();
278 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
279 delete *it;
280 }
281 myDefinitions.clear();
282 Logics logics = getComputed();
283 for (Logics::iterator it = logics.begin(); it != logics.end(); it++) {
284 delete *it;
285 }
286 myComputed.clear();
287 for (std::set<NBTrafficLightDefinition*>::iterator it = myExtracted.begin(); it != myExtracted.end(); it++) {
288 delete *it;
289 }
290 myExtracted.clear();
291}
292
293
294void
296 const EdgeVector& outgoing) {
297 Definitions definitions = getDefinitions();
298 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
299 (*it)->remapRemoved(removed, incoming, outgoing);
300 }
301}
302
303
304void
306 NBEdge* by, int byLane, bool incoming) {
307 Definitions definitions = getDefinitions();
308 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
309 (*it)->replaceRemoved(removed, removedLane, by, byLane, incoming);
310 }
311}
312
313
315NBTrafficLightLogicCont::getDefinition(const std::string& id, const std::string& programID) const {
316 Id2Defs::const_iterator i = myDefinitions.find(id);
317 if (i != myDefinitions.end()) {
318 Program2Def programs = i->second;
319 Program2Def::const_iterator i2 = programs.find(programID);
320 if (i2 != programs.end()) {
321 return i2->second;
322 }
323 }
324 return nullptr;
325}
326
328NBTrafficLightLogicCont::getPrograms(const std::string& id) const {
329 Id2Defs::const_iterator it = myDefinitions.find(id);
330 if (it != myDefinitions.end()) {
331 return it->second;
332 } else {
333 return EmptyDefinitions;
334 }
335}
336
337
339NBTrafficLightLogicCont::getLogic(const std::string& id, const std::string& programID) const {
340 Id2Logics::const_iterator i = myComputed.find(id);
341 if (i != myComputed.end()) {
342 Program2Logic programs = i->second;
343 Program2Logic::const_iterator i2 = programs.find(programID);
344 if (i2 != programs.end()) {
345 return i2->second;
346 }
347 }
348 return nullptr;
349}
350
351
352void
354 Definitions definitions = getDefinitions();
355 // set the information about all participants, first
356 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
357 (*it)->setParticipantsInformation();
358 }
359 // clear previous information because tlDefs may have been removed in netedit
361 // insert the information about the tl-controlling
362 for (Definitions::iterator it = definitions.begin(); it != definitions.end(); it++) {
363 (*it)->setTLControllingInformation();
364 }
365 // handle rail signals which are not instantiated as normal definitions
366 for (std::map<std::string, NBNode*>::const_iterator it = nc.begin(); it != nc.end(); it ++) {
367 NBNode* n = it->second;
369 NBOwnTLDef dummy(n->getID(), n, 0, TrafficLightType::STATIC);
372 n->setCrossingTLIndices(dummy.getID(), (int)dummy.getControlledLinks().size());
373 n->removeTrafficLight(&dummy);
374 }
375 }
376}
377
378
379void
382 std::map<NBEdge*, std::string> defaultSignalIDs;
383 for (const NBConnection& con : def->getControlledLinks()) {
384 const NBEdge::Connection& c = con.getFrom()->getConnection(con.getFromLane(), con.getTo(), con.getToLane());
385 if (c.hasParameter("signalID")) {
386 defaultSignalIDs[con.getFrom()] = c.getParameter("signalID");
387 def->setParameter("linkSignalID:" + toString(con.getTLIndex()), c.getParameter("signalID"));
388 }
389 }
390 // oftentimes, signals are placed on connecting road but are meant to apply to all connections from the incoming edge
391 for (const NBConnection& con : def->getControlledLinks()) {
392 const NBEdge::Connection& c = con.getFrom()->getConnection(con.getFromLane(), con.getTo(), con.getToLane());
393 if (!c.hasParameter("signalID") && defaultSignalIDs.count(con.getFrom()) != 0) {
394 WRITE_WARNINGF(TL("Guessing signalID for link index % at traffic light '%'."), con.getTLIndex(), def->getID());
395 def->setParameter("linkSignalID:" + toString(con.getTLIndex()), defaultSignalIDs[con.getFrom()]);
396 }
397 }
398 }
399}
400
401
402void
404 // collect connections with controllerID which can be controlled together
405 Definitions definitions = getDefinitions();
406 std::map<std::string, NBTrafficLightDefinition*> defsToGroup;
407 std::map<std::string, std::map<std::string, std::set<int>>> controllerID2tlIndex;
408 for (NBTrafficLightDefinition* def : definitions) {
409 bool makeGroups = false;
410 NBConnectionVector& connections = def->getControlledLinks();
411 std::string defID = def->getID();
412
413 for (NBConnection conn : connections) {
414 std::string controllerID = conn.getFrom()->getConnection(conn.getFromLane(), conn.getTo(), conn.getToLane()).getParameter("controllerID");
415 if (controllerID != "") {
416 if (controllerID2tlIndex.find(defID) == controllerID2tlIndex.end()) {
417 controllerID2tlIndex[defID][controllerID] = std::set<int>({ conn.getTLIndex() });
418 } else if (controllerID2tlIndex[defID].find(controllerID) != controllerID2tlIndex[defID].end()) {
419 controllerID2tlIndex[defID][controllerID].insert(conn.getTLIndex());
420 } else {
421 controllerID2tlIndex[defID][controllerID] = std::set<int>({ conn.getTLIndex() });
422 }
423 makeGroups = controllerID2tlIndex[defID][controllerID].size() > 1 || makeGroups;
424 }
425 }
426 if (makeGroups) {
427 defsToGroup[def->getID()] = def;
428 }
429 }
430 bool same = true;
431 for (NBTrafficLightLogic* computed : getComputed()) {
432 const std::string computedID = computed->getID();
433 if (defsToGroup.find(computedID) != defsToGroup.end()) {
434 // remember corresponding tl indices and check if they can be joined
435 // execute tl index joins if possible
436 const std::vector<NBTrafficLightLogic::PhaseDefinition> phases = computed->getPhases();
437 std::vector<int> major2minor;
438 for (const auto& indexSet : controllerID2tlIndex[computedID]) {
439 if (indexSet.second.size() < 2) {
440 continue;
441 }
442 bool toMinor = false;
443 for (NBTrafficLightLogic::PhaseDefinition phase : phases) {
444 std::set<int>::iterator it = indexSet.second.begin();
445 char firstChar = phase.state[*it];
446 if (firstChar == LINKSTATE_TL_GREEN_MAJOR) {
447 firstChar = LINKSTATE_TL_GREEN_MINOR;
448 }
449 it++;
450 for (; it != indexSet.second.end(); it++) {
451 const char compareChar = (phase.state[*it] != LINKSTATE_TL_GREEN_MAJOR) ? phase.state[*it] : (char)LINKSTATE_TL_GREEN_MINOR;
452 if (compareChar != firstChar) {
453 same = false;
454 break;
455 } else if (phase.state[*it] == LINKSTATE_TL_GREEN_MINOR) {
456 toMinor = true;
457 }
458 }
459 if (!same) {
460 break;
461 }
462 }
463 if (toMinor) {
464 major2minor.push_back(*indexSet.second.begin());
465 }
466 }
467 if (same) {
468 NBLoadedSUMOTLDef* lDef = dynamic_cast<NBLoadedSUMOTLDef*>(defsToGroup[computedID]);
469 if (lDef == nullptr) {
470 lDef = new NBLoadedSUMOTLDef(*defsToGroup[computedID], *computed);
472 for (int index : major2minor) { // update the signal states (G -> g where needed)
473 for (int i = 0; i < (int)phases.size(); i++) {
474 if (phases[i].state[index] == LINKSTATE_TL_GREEN_MAJOR) {
476 }
477 }
478 }
479 // join signal groups, update the connections
480 std::vector<int> indexToRemove;
481 for (const auto& indexSet : controllerID2tlIndex[computedID]) {
482 int minIndex = *indexSet.second.begin();
483 for (int index : indexSet.second) {
484 if (index != minIndex) {
485 lDef->replaceIndex(index, minIndex);
486 indexToRemove.push_back(index);
487 }
488 }
489 }
490 // remove unused indices from signal programs
491 lDef->cleanupStates();
492 for (NBNode* node : lDef->getNodes()) {
493 node->removeTrafficLight(defsToGroup[computedID]);
494 node->addTrafficLight(lDef);
495 }
496 removeProgram(defsToGroup[computedID]->getID(), defsToGroup[computedID]->getProgramID());
497 insert(lDef);
498 computeSingleLogic(oc, lDef);
499 }
500 } else { // TODO: try other strategy to build signal groups
501 WRITE_WARNINGF(TL("Was not able to apply the OpenDRIVE signal group information onto the signal program of traffic light % generated by SUMO."), computed->getID());
502 }
503 break;
504 }
505 }
506}
507
508
511 Logics result;
512 for (Id2Logics::const_iterator it_id = myComputed.begin(); it_id != myComputed.end(); it_id++) {
513 const Program2Logic& programs = it_id->second;
514 for (Program2Logic::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
515 result.push_back(it_prog->second);
516 }
517 }
518 return result;
519}
520
521
524 Definitions result;
525 for (Id2Defs::const_iterator it_id = myDefinitions.begin(); it_id != myDefinitions.end(); it_id++) {
526 const Program2Def& programs = it_id->second;
527 for (Program2Def::const_iterator it_prog = programs.begin(); it_prog != programs.end(); it_prog++) {
528 result.push_back(it_prog->second);
529 }
530 }
531 return result;
532}
533
534
535void
537 auto it = myDefinitions.find(tlDef->getID());
538 if (it != myDefinitions.end()) {
539 for (auto item : it->second) {
540 item.second->setID(newID);
541 }
542 myDefinitions[newID] = it->second;
543 myDefinitions.erase(it);
544 }
545 auto it2 = myComputed.find(tlDef->getID());
546 if (it2 != myComputed.end()) {
547 for (auto item : it2->second) {
548 item.second->setID(newID);
549 }
550 myComputed[newID] = it2->second;
551 myComputed.erase(it2);
552 }
553}
554
555
556int
558 return (int)myExtracted.size();
559}
560
561/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:299
#define TL(string)
Definition MsgHandler.h:316
std::vector< NBConnection > NBConnectionVector
Definition of a connection vector.
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition NBCont.h:42
#define STEPS2TIME(x)
Definition SUMOTime.h:58
constexpr SUMOTime TIME2STEPS(double x)
Definition SUMOTime.h:60
@ LINKSTATE_TL_GREEN_MAJOR
The link has green light, may pass.
@ LINKSTATE_TL_GREEN_MINOR
The link has green light, has to brake.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
std::string getNext()
Returns the next id.
void avoid(const std::string &id)
make sure that the given id is never supplied
Storage for edges, including some functionality operating on multiple edges.
Definition NBEdgeCont.h:59
void clearControllingTLInformation() const
Clears information about controlling traffic lights for all connenections of all edges.
The representation of a single edge during network building.
Definition NBEdge.h:92
A loaded (complete) traffic light logic.
bool usingSignalGroups() const
whether this definition uses signal group (multiple connections with the same link index)
void ungroupSignals()
let all connections use a distinct link index
NBTrafficLightLogic * getLogic()
Returns the internal logic.
void groupSignals()
let connections with the same state use the same link index
void replaceIndex(int oldIndex, int newIndex)
replace the given link index in all connections
Container for nodes during the netbuilding process.
Definition NBNodeCont.h:57
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition NBNodeCont.h:118
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition NBNodeCont.h:123
Represents a single node (junction) during network building.
Definition NBNode.h:66
SumoXMLNodeType getType() const
Returns the type of this node.
Definition NBNode.h:287
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
Definition NBNode.cpp:447
bool setCrossingTLIndices(const std::string &tlID, int startIndex, bool ignoreCustom=false)
Definition NBNode.cpp:4170
A traffic light logics which must be computed (only nodes/edges are given)
Definition NBOwnTLDef.h:44
void setTLControllingInformation() const
Informs edges about being controlled by a tls.
The base class for traffic light logic definitions.
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
const std::string & getProgramID() const
Returns the ProgramID.
const EdgeVector & getIncomingEdges() const
Returns the list of incoming edges (must be build first)
TrafficLightType getType() const
get the algorithm type (static etc..)
virtual void setProgramID(const std::string &programID)
Sets the programID.
NBTrafficLightLogic * compute(const OptionsCont &oc)
Computes the traffic light logic.
const NBConnectionVector & getControlledLinks() const
returns the controlled links (depends on previous call to collectLinks)
virtual void setParticipantsInformation()
Builds the list of participating nodes/edges/links.
The definition of a single phase of the logic.
bool exist(const std::string &newID, bool requireComputed=true) const
check if exists a definition with the given ID
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane, bool incoming)
Replaces occurrences of the removed edge/lane in all definitions by the given edge.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void setOpenDriveSignalParameters()
set OpenDRIVE signal reference parameters after all link indices are known
std::vector< NBTrafficLightLogic * > getComputed() const
Returns a list of all computed logics.
void rename(NBTrafficLightDefinition *tlDef, const std::string &newID)
rename traffic light
std::map< std::string, NBTrafficLightDefinition * > Program2Def
std::set< std::string > myHalfOffsetTLS
List of tls which shall have an offset of T/2.
static const Program2Def EmptyDefinitions
empty definition
std::vector< NBTrafficLightLogic * > Logics
std::vector< NBTrafficLightDefinition * > Definitions
Returns a list of all definitions (convenience for easier iteration)
bool removeProgram(const std::string id, const std::string programID, bool del=true)
Removes a program of a logic definition from the dictionary.
bool computeSingleLogic(OptionsCont &oc, NBTrafficLightDefinition *def)
Computes a specific traffic light logic (using by netedit)
int getNumExtracted() const
return the number of extracted traffic light definitions
void clear()
Destroys all stored definitions and logics.
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
void remapRemoved(NBEdge *removed, const EdgeVector &incoming, const EdgeVector &outgoing)
Replaces occurrences of the removed edge in incoming/outgoing edges of all definitions.
std::set< std::string > myQuarterOffsetTLS
List of tls which shall have an offset of T/2.
Id2Logics myComputed
The container for previously computed tl-logics.
NBTrafficLightLogic * getLogic(const std::string &id, const std::string &programID) const
Returns the computed logic for the given name.
void applyOpenDriveControllers(OptionsCont &oc)
post processing of signal programs to group tl indices according to OpenDrive controllers (signal gro...
Id2Defs myDefinitions
The container for tl-ids to their definitions.
std::pair< int, int > computeLogics(OptionsCont &oc)
Computes the traffic light logics using the stored definitions and stores the results.
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
std::map< std::string, NBTrafficLightLogic * > Program2Logic
Definition of internal the container types.
std::string getNextProgramID(const std::string &id) const
Returns a new (unused) programID for the given traffic light.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
NBTrafficLightDefinition * getDefinition(const std::string &id, const std::string &programID) const
Returns the named definition.
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
void setTLControllingInformation(const NBEdgeCont &ec, const NBNodeCont &nc)
Informs the edges about being controlled by a tls.
std::set< NBTrafficLightDefinition * > myExtracted
The container for extracted definitions.
A SUMO-compliant built logic for a traffic light.
SUMOTime getDuration() const
Returns the duration of the complete cycle.
void setPhaseState(int phaseIndex, int tlIndex, LinkState linkState)
Modifies the state for an existing phase (used by netedit)
void setOffset(SUMOTime offset)
Sets the offset of this tls.
const std::string & getID() const
Returns the id.
Definition Named.h:73
A storage for options typed value containers)
Definition OptionsCont.h:92
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
T get(const std::string &str) const
get key
unsigned node
A structure which describes a connection between edges or lanes.
Definition NBEdge.h:201