Eclipse SUMO - Simulation of Urban MObility
NIXMLTrafficLightsHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2011-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Importer for traffic lights stored in XML
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <string>
26 #include <iostream>
27 #include <xercesc/sax/HandlerBase.hpp>
28 #include <xercesc/sax/AttributeList.hpp>
29 #include <xercesc/sax/SAXParseException.hpp>
30 #include <xercesc/sax/SAXException.hpp>
34 #include <utils/common/ToString.h>
39 #include <netbuild/NBEdge.h>
40 #include <netbuild/NBEdgeCont.h>
41 #include <netbuild/NBNode.h>
42 #include <netbuild/NBOwnTLDef.h>
45 #include "NIImporter_SUMO.h"
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
53  NBTrafficLightLogicCont& tlCont, NBEdgeCont& ec, bool ignoreUnknown) :
54  SUMOSAXHandler("xml-tllogics"),
55  myTLLCont(tlCont),
56  myEdgeCont(ec),
57  myCurrentTL(nullptr),
58  myResetPhases(false),
59  myIgnoreUnknown(ignoreUnknown)
60 { }
61 
62 
64 
65 
66 void
68  int element, const SUMOSAXAttributes& attrs) {
69  switch (element) {
70  case SUMO_TAG_TLLOGIC:
72  break;
73  case SUMO_TAG_PHASE:
74  if (myCurrentTL != nullptr) {
75  if (myResetPhases) {
77  myResetPhases = false;
78  }
81  }
82  break;
84  addTlConnection(attrs);
85  break;
86  case SUMO_TAG_DELETE:
87  removeTlConnection(attrs);
88  break;
89  case SUMO_TAG_PARAM:
90  if (myCurrentTL != nullptr) {
91  bool ok = true;
92  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, ok);
93  // circumventing empty string test
94  const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
95  myCurrentTL->setParameter(key, val);
96  }
97  default:
98  break;
99  }
100 }
101 
102 
103 void
105  switch (element) {
106  case SUMO_TAG_TLLOGIC:
107  myCurrentTL = nullptr;
108  break;
109  default:
110  break;
111  }
112 }
113 
114 
117  if (currentTL) {
118  WRITE_ERROR("Definition of tlLogic '" + currentTL->getID() + "' was not finished.");
119  return nullptr;
120  }
121  bool ok = true;
122  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
123  std::string programID = attrs.getOpt<std::string>(SUMO_ATTR_PROGRAMID, id.c_str(), ok, "<unknown>");
124  SUMOTime offset = attrs.hasAttribute(SUMO_ATTR_OFFSET) ? TIME2STEPS(attrs.get<double>(SUMO_ATTR_OFFSET, id.c_str(), ok)) : 0;
125  std::string typeS = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, nullptr, ok,
126  OptionsCont::getOptions().getString("tls.default-type"));
127  TrafficLightType type;
128  if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) {
130  } else {
131  WRITE_ERROR("Unknown traffic light type '" + typeS + "' for tlLogic '" + id + "'.");
132  return nullptr;
133  }
134  // there are three scenarios to consider
135  // 1) the tll.xml is loaded to update traffic lights defined in a net.xml:
136  // simply retrieve the loaded definitions and update them
137  // 2) the tll.xml is loaded to define new traffic lights
138  // nod.xml will have triggered building of NBOwnTLDef. Replace it with NBLoadedSUMOTLDef
139  // 3) the tll.xml is loaded to define new programs for a defined traffic light
140  // there should be a definition with the same id but different programID
141  const std::map<std::string, NBTrafficLightDefinition*>& programs = myTLLCont.getPrograms(id);
142  if (programs.size() == 0) {
143  if (!myIgnoreUnknown) {
144  WRITE_ERROR("Cannot load traffic light program for unknown id '" + id + "', programID '" + programID + "'.");
145  }
146  return nullptr;
147  }
148  const std::string existingProgram = programs.begin()->first; // arbitrary for our purpose
149  NBLoadedSUMOTLDef* loadedDef = dynamic_cast<NBLoadedSUMOTLDef*>(myTLLCont.getDefinition(id, programID));
150  if (loadedDef == nullptr) {
151  NBLoadedSUMOTLDef* oldDef = dynamic_cast<NBLoadedSUMOTLDef*>(myTLLCont.getDefinition(id, existingProgram));
152  if (oldDef == nullptr) {
153  // case 2
154  NBTrafficLightDefinition* newDef = dynamic_cast<NBOwnTLDef*>(myTLLCont.getDefinition(
156  bool deleteDefault = false;
157  if (newDef == nullptr) {
158  // the default program may have already been replaced with a loaded program
159  newDef = dynamic_cast<NBLoadedSUMOTLDef*>(myTLLCont.getDefinition(
161  if (newDef == nullptr) {
162  WRITE_ERROR("Cannot load traffic light program for unknown id '" + id + "', programID '" + programID + "'.");
163  return nullptr;
164  }
165  } else {
166  deleteDefault = true;
167  }
168  assert(newDef != 0);
169  loadedDef = new NBLoadedSUMOTLDef(id, programID, offset, type);
170  // copy nodes and controlled inner edges
171  std::vector<NBNode*> nodes = newDef->getNodes();
172  for (std::vector<NBNode*>::iterator it = nodes.begin(); it != nodes.end(); it++) {
173  loadedDef->addNode(*it);
174  }
175  loadedDef->addControlledInnerEdges(newDef->getControlledInnerEdges());
176  if (deleteDefault) {
177  // replace default Program
178  std::vector<NBNode*> nodes = newDef->getNodes();
179  for (std::vector<NBNode*>::iterator it = nodes.begin(); it != nodes.end(); it++) {
180  (*it)->removeTrafficLight(newDef);
181  }
183  }
184  myTLLCont.insert(loadedDef);
185  } else {
186  // case 3
187  NBTrafficLightLogic* oldLogic = oldDef->getLogic();
188  NBTrafficLightLogic* newLogic = new NBTrafficLightLogic(id, programID,
189  oldLogic->getNumLinks(), offset, type);
190  loadedDef = new NBLoadedSUMOTLDef(oldDef, newLogic);
191  // copy nodes
192  std::vector<NBNode*> nodes = oldDef->getNodes();
193  for (std::vector<NBNode*>::iterator it = nodes.begin(); it != nodes.end(); it++) {
194  loadedDef->addNode(*it);
195  }
196  //std::cout << " case3 oldDef=" << oldDef->getDescription() << " loadedDef=" << loadedDef->getDescription() << "\n";
197  myTLLCont.insert(loadedDef);
198  }
199  } else {
200  // case 1
201  if (attrs.hasAttribute(SUMO_ATTR_OFFSET)) {
202  loadedDef->setOffset(offset);
203  }
204  if (attrs.hasAttribute(SUMO_ATTR_TYPE)) {
205  loadedDef->setType(type);
206  }
207  }
208  if (ok) {
209  myResetPhases = true;
210  return loadedDef;
211  } else {
212  return nullptr;
213  }
214 }
215 
216 
217 void
219  bool ok = true;
220  // parse identifying attributes
221  NBEdge* from = retrieveEdge(attrs, SUMO_ATTR_FROM, ok);
222  NBEdge* to = retrieveEdge(attrs, SUMO_ATTR_TO, ok);
223  if (!ok) {
224  return;
225  }
226  int fromLane = retrieveLaneIndex(attrs, SUMO_ATTR_FROM_LANE, from, ok);
227  int toLane = retrieveLaneIndex(attrs, SUMO_ATTR_TO_LANE, to, ok);
228  if (!ok) {
229  return;
230  }
231  // retrieve connection
232  const std::vector<NBEdge::Connection>& connections = from->getConnections();
233  std::vector<NBEdge::Connection>::const_iterator con_it;
234  con_it = find_if(connections.begin(), connections.end(),
235  NBEdge::connections_finder(fromLane, to, toLane));
236  if (con_it == connections.end()) {
237  WRITE_ERROR("Connection from=" + from->getID() + " to=" + to->getID() +
238  " fromLane=" + toString(fromLane) + " toLane=" + toString(toLane) + " not found");
239  return;
240  }
241  NBEdge::Connection c = *con_it;
242  // read other attributes
243  std::string tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, nullptr, ok, "");
244  if (tlID == "") {
245  // we are updating an existing tl-controlled connection
246  tlID = (*(from->getToNode()->getControllingTLS().begin()))->getID();
247  assert(tlID != "");
248  }
249  int tlIndex = attrs.getOpt<int>(SUMO_ATTR_TLLINKINDEX, nullptr, ok, -1);
250  if (tlIndex == -1) {
251  // we are updating an existing tl-controlled connection
252  tlIndex = c.tlLinkIndex;
253  }
254  int tlIndex2 = attrs.getOpt<int>(SUMO_ATTR_TLLINKINDEX2, nullptr, ok, -1);
255  if (tlIndex2 == -1) {
256  // we are updating an existing tl-controlled connection or index2 is not used
257  tlIndex2 = c.tlLinkIndex2;
258  }
259 
260  // register the connection with all definitions
261  const std::map<std::string, NBTrafficLightDefinition*>& programs = myTLLCont.getPrograms(tlID);
262  if (programs.size() > 0) {
263  std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
264  for (it = programs.begin(); it != programs.end(); it++) {
265  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(it->second);
266  if (tlDef) {
267  tlDef->addConnection(from, c.toEdge, c.fromLane, c.toLane, tlIndex, tlIndex2, false);
268  } else {
269  throw ProcessError("Corrupt traffic light definition '"
270  + tlID + "' (program '" + it->first + "')");
271  }
272  }
273  } else {
274  SumoXMLNodeType type = from->getToNode()->getType();
275  if (type != NODETYPE_RAIL_CROSSING && type != NODETYPE_RAIL_SIGNAL) {
276  WRITE_ERROR("The traffic light '" + tlID + "' is not known.");
277  }
278  }
279 }
280 
281 
282 void
284  bool ok = true;
285  std::string tlID = attrs.get<std::string>(SUMO_ATTR_TLID, nullptr, ok);
286  // does the traffic light still exist?
287  const std::map<std::string, NBTrafficLightDefinition*>& programs = myTLLCont.getPrograms(tlID);
288  if (programs.size() > 0) {
289  // parse identifying attributes
290  NBEdge* from = retrieveEdge(attrs, SUMO_ATTR_FROM, ok);
291  NBEdge* to = retrieveEdge(attrs, SUMO_ATTR_TO, ok);
292  if (!ok) {
293  return;
294  }
295  int fromLane = retrieveLaneIndex(attrs, SUMO_ATTR_FROM_LANE, from, ok, true);
296  int toLane = retrieveLaneIndex(attrs, SUMO_ATTR_TO_LANE, to, ok, true);
297  if (!ok) {
298  return;
299  }
300  int tlIndex = attrs.get<int>(SUMO_ATTR_TLLINKINDEX, nullptr, ok);
301 
302  NBConnection conn(from, fromLane, to, toLane, tlIndex);
303  // remove the connection from all definitions
304  std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
305  for (it = programs.begin(); it != programs.end(); it++) {
306  NBLoadedSUMOTLDef* tlDef = dynamic_cast<NBLoadedSUMOTLDef*>(it->second);
307  if (tlDef) {
308  tlDef->removeConnection(conn, false);
309  } else {
310  throw ProcessError("Corrupt traffic light definition '"
311  + tlID + "' (program '" + it->first + "')");
312  }
313  }
314  }
315 }
316 
317 
318 NBEdge*
320  const SUMOSAXAttributes& attrs, SumoXMLAttr attr, bool& ok) {
321  std::string edgeID = attrs.get<std::string>(attr, nullptr, ok);
322  NBEdge* edge = myEdgeCont.retrieve(edgeID, true);
323  if (edge == nullptr) {
324  WRITE_ERROR("Unknown edge '" + edgeID + "' given in connection.");
325  ok = false;
326  }
327  return edge;
328 }
329 
330 
331 int
333  const SUMOSAXAttributes& attrs, SumoXMLAttr attr, NBEdge* edge, bool& ok, bool isDelete) {
334  int laneIndex = attrs.get<int>(attr, nullptr, ok);
335  if (edge->getNumLanes() <= laneIndex) {
336  if (!isDelete) {
337  WRITE_ERROR("Invalid lane index '" + toString(laneIndex) + "' for edge '" + edge->getID() + "'.");
338  }
339  ok = false;
340  }
341  return laneIndex;
342 }
343 
344 
345 /****************************************************************************/
346 
SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
ToString.h
NBEdge::Connection::toEdge
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:212
SUMOSAXAttributes::hasAttribute
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
NBTrafficLightDefinition::getControlledInnerEdges
std::vector< std::string > getControlledInnerEdges() const
Retrieve the ids of edges explicitly controlled by the tls.
Definition: NBTrafficLightDefinition.cpp:440
NBTrafficLightLogicCont::getPrograms
const std::map< std::string, NBTrafficLightDefinition * > & getPrograms(const std::string &id) const
Returns all programs for the given tl-id.
Definition: NBTrafficLightLogicCont.cpp:243
NBEdgeCont::retrieve
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:246
NBTrafficLightLogicCont::removeProgram
bool removeProgram(const std::string id, const std::string programID, bool del=true)
Removes a program of a logic definition from the dictionary.
Definition: NBTrafficLightLogicCont.cpp:119
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:60
NIImporter_SUMO::addPhase
static void addPhase(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
adds a phase to the traffic lights logic currently build
Definition: NIImporter_SUMO.cpp:904
SUMOSAXAttributes::getString
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:41
NBTrafficLightLogicCont
A container for traffic light definitions and built programs.
Definition: NBTrafficLightLogicCont.h:57
OptionsCont.h
NBLoadedSUMOTLDef::removeConnection
void removeConnection(const NBConnection &conn, bool reconstruct=true)
removes the given connection from the traffic light if recontruct=true, reconstructs the logic and in...
Definition: NBLoadedSUMOTLDef.cpp:201
SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:169
NIXMLTrafficLightsHandler::retrieveLaneIndex
int retrieveLaneIndex(const SUMOSAXAttributes &attrs, SumoXMLAttr attr, NBEdge *edge, bool &ok, bool isDelete=false)
parses a lane index and verifies its correctness
Definition: NIXMLTrafficLightsHandler.cpp:332
SUMOSAXAttributes::get
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
Definition: SUMOSAXAttributes.h:492
SUMO_ATTR_TO_LANE
Definition: SUMOXMLDefinitions.h:720
NIXMLTrafficLightsHandler::myTLLCont
NBTrafficLightLogicCont & myTLLCont
The traffic light container to fill.
Definition: NIXMLTrafficLightsHandler.h:88
MsgHandler.h
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
SUMOSAXHandler.h
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1197
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
Definition: SUMOXMLDefinitions.h:682
NBEdgeCont.h
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
NBNode::getType
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:272
NBLoadedSUMOTLDef::setOffset
void setOffset(SUMOTime offset)
Sets the offset of this tls.
Definition: NBLoadedSUMOTLDef.cpp:223
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
NBLoadedSUMOTLDef::getLogic
NBTrafficLightLogic * getLogic()
Returns the internal logic.
Definition: NBLoadedSUMOTLDef.h:122
SUMO_TAG_DELETE
delete certain element
Definition: SUMOXMLDefinitions.h:176
NBEdge::Connection::tlLinkIndex
int tlLinkIndex
The index of this connection within the controlling traffic light.
Definition: NBEdge.h:221
SUMO_TAG_PHASE
a single phase description
Definition: SUMOXMLDefinitions.h:143
NBLoadedSUMOTLDef::addConnection
void addConnection(NBEdge *from, NBEdge *to, int fromLane, int toLane, int linkIndex, int linkIndex2, bool reconstruct=true)
Adds a connection and immediately informs the edges.
Definition: NBLoadedSUMOTLDef.cpp:95
NIXMLTrafficLightsHandler::NIXMLTrafficLightsHandler
NIXMLTrafficLightsHandler(NBTrafficLightLogicCont &tlCont, NBEdgeCont &ec, bool ignoreUnknown=false)
Constructor.
Definition: NIXMLTrafficLightsHandler.cpp:52
NBEdge::Connection::fromLane
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:209
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:640
NBEdge::Connection::toLane
int toLane
The lane the connections yields in.
Definition: NBEdge.h:215
NBTrafficLightLogicCont::getDefinition
NBTrafficLightDefinition * getDefinition(const std::string &id, const std::string &programID) const
Returns the named definition.
Definition: NBTrafficLightLogicCont.cpp:230
NIXMLTrafficLightsHandler::~NIXMLTrafficLightsHandler
~NIXMLTrafficLightsHandler()
Destructor.
Definition: NIXMLTrafficLightsHandler.cpp:63
NIXMLTrafficLightsHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: NIXMLTrafficLightsHandler.cpp:67
NODETYPE_RAIL_SIGNAL
Definition: SUMOXMLDefinitions.h:1059
NBEdge::connections_finder
Definition: NBEdge.h:1703
NBEdge::getToNode
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:498
NBTrafficLightDefinition::addControlledInnerEdges
void addControlledInnerEdges(const std::vector< std::string > &edges)
Adds the given ids into the list of inner edges controlled by the tls.
Definition: NBTrafficLightDefinition.cpp:434
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:58
SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
Definition: SUMOXMLDefinitions.h:688
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1054
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:97
NBTrafficLightLogic::getNumLinks
int getNumLinks()
Returns the number of participating links.
Definition: NBTrafficLightLogic.h:221
NIXMLTrafficLightsHandler::removeTlConnection
void removeTlConnection(const SUMOSAXAttributes &attrs)
reads and removes tl-controlled connection
Definition: NIXMLTrafficLightsHandler.cpp:283
NBEdge::getNumLanes
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:477
NBEdge::Connection::tlLinkIndex2
int tlLinkIndex2
The index of the internal junction within the controlling traffic light (optional)
Definition: NBEdge.h:224
ProcessError
Definition: UtilExceptions.h:39
NIXMLTrafficLightsHandler::myEdgeCont
NBEdgeCont & myEdgeCont
The edge container for retrieving edges.
Definition: NIXMLTrafficLightsHandler.h:91
NIImporter_SUMO.h
NBTrafficLightDefinition::getNodes
const std::vector< NBNode * > & getNodes() const
Returns the list of controlled nodes.
Definition: NBTrafficLightDefinition.h:172
NBLoadedSUMOTLDef::phasesLoaded
void phasesLoaded()
mark phases as load
Definition: NBLoadedSUMOTLDef.h:102
NIXMLTrafficLightsHandler.h
UtilExceptions.h
SUMOSAXAttributes::getOpt
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
Definition: SUMOSAXAttributes.h:518
NBConnection
Definition: NBConnection.h:43
NODETYPE_RAIL_CROSSING
Definition: SUMOXMLDefinitions.h:1060
SUMO_ATTR_FROM_LANE
Definition: SUMOXMLDefinitions.h:719
SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
SUMO_TAG_TLLOGIC
a traffic light logic
Definition: SUMOXMLDefinitions.h:141
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
StringUtils.h
SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
Definition: SUMOXMLDefinitions.h:686
NBNode::getControllingTLS
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node (The set of tls that control this node)
Definition: NBNode.h:318
SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:408
NIXMLTrafficLightsHandler::myCurrentTL
NBLoadedSUMOTLDef * myCurrentTL
The currently parsed traffic light.
Definition: NIXMLTrafficLightsHandler.h:94
NBTrafficLightDefinition::DefaultProgramID
static const std::string DefaultProgramID
Definition: NBTrafficLightDefinition.h:71
SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:779
SUMO_TAG_CONNECTION
connectio between two lanes
Definition: SUMOXMLDefinitions.h:202
NBTrafficLightDefinition::addNode
virtual void addNode(NBNode *node)
Adds a node to the traffic light logic.
Definition: NBTrafficLightDefinition.cpp:414
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:46
SUMOXMLDefinitions::TrafficLightTypes
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
Definition: SUMOXMLDefinitions.h:1392
NIXMLTrafficLightsHandler::myIgnoreUnknown
bool myIgnoreUnknown
whether definitions for unknown traffic lights shall be silently ignored
Definition: NIXMLTrafficLightsHandler.h:118
config.h
NBTrafficLightLogic::resetPhases
void resetPhases()
Definition: NBTrafficLightLogic.cpp:127
StringTokenizer.h
SUMO_ATTR_PROGRAMID
Definition: SUMOXMLDefinitions.h:412
NBTrafficLightLogic
A SUMO-compliant built logic for a traffic light.
Definition: NBTrafficLightLogic.h:51
NBOwnTLDef.h
NBTrafficLightLogicCont.h
NBLoadedSUMOTLDef.h
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:189
NBTrafficLightLogicCont::insert
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
Definition: NBTrafficLightLogicCont.cpp:73
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
NBNode.h
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
NIXMLTrafficLightsHandler::addTlConnection
void addTlConnection(const SUMOSAXAttributes &attrs)
reads and adds tl-controlled connection
Definition: NIXMLTrafficLightsHandler.cpp:218
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
NIXMLTrafficLightsHandler::initTrafficLightLogic
NBLoadedSUMOTLDef * initTrafficLightLogic(const SUMOSAXAttributes &attrs, NBLoadedSUMOTLDef *currentTL)
Definition: NIXMLTrafficLightsHandler.cpp:116
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
NBEdge::getConnections
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:934
NIXMLTrafficLightsHandler::retrieveEdge
NBEdge * retrieveEdge(const SUMOSAXAttributes &attrs, SumoXMLAttr attr, bool &ok)
parses and edge id an returns an existing edge
Definition: NIXMLTrafficLightsHandler.cpp:319
SUMOXMLDefinitions.h
NBTrafficLightDefinition
The base class for traffic light logic definitions.
Definition: NBTrafficLightDefinition.h:67
NIXMLTrafficLightsHandler::myEndElement
void myEndElement(int element)
Called when a closing tag occurs.
Definition: NIXMLTrafficLightsHandler.cpp:104
SUMO_ATTR_OFFSET
Definition: SUMOXMLDefinitions.h:413
NIXMLTrafficLightsHandler::myResetPhases
bool myResetPhases
whether phases of a previously loaded traffic light must be reset
Definition: NIXMLTrafficLightsHandler.h:97
NBEdge.h
NBLoadedSUMOTLDef::setType
void setType(TrafficLightType type)
Sets the algorithm type of this tls.
Definition: NBLoadedSUMOTLDef.cpp:230
NBEdge::getID
const std::string & getID() const
Definition: NBEdge.h:1380
NBLoadedSUMOTLDef
A loaded (complete) traffic light logic.
Definition: NBLoadedSUMOTLDef.h:44