Eclipse SUMO - Simulation of Urban MObility
NIXMLNodesHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
18 // Importer for network nodes stored in XML
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
28 #include <iostream>
29 #include <xercesc/sax/HandlerBase.hpp>
30 #include <xercesc/sax/AttributeList.hpp>
31 #include <xercesc/sax/SAXParseException.hpp>
32 #include <xercesc/sax/SAXException.hpp>
37 #include <utils/common/ToString.h>
41 #include <netbuild/NBNodeCont.h>
43 #include <netbuild/NBOwnTLDef.h>
44 #include <netbuild/NBNetBuilder.h>
45 #include "NIXMLNodesHandler.h"
46 #include "NIImporter_SUMO.h"
47 
48 
49 // ===========================================================================
50 // method definitions
51 // ===========================================================================
54  OptionsCont& options) :
55  SUMOSAXHandler("xml-nodes - file"),
56  myOptions(options),
57  myNodeCont(nc),
58  myEdgeCont(ec),
59  myTLLogicCont(tlc),
60  myLocation(nullptr),
61  myLastParameterised(nullptr) {
62 }
63 
64 
66  delete myLocation;
67 }
68 
69 
70 void
72  const SUMOSAXAttributes& attrs) {
73  switch (element) {
74  case SUMO_TAG_LOCATION:
76  break;
77  case SUMO_TAG_NODE:
78  addNode(attrs);
79  break;
80  case SUMO_TAG_JOIN:
81  addJoinCluster(attrs);
82  break;
84  addJoinExclusion(attrs);
85  break;
86  case SUMO_TAG_DELETE:
87  deleteNode(attrs);
88  break;
89  case SUMO_TAG_PARAM:
90  if (myLastParameterised != 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) : "";
96  }
97  default:
98  break;
99  }
100 }
101 
102 
103 void
105  switch (element) {
106  case SUMO_TAG_NODE:
107  myLastParameterised = nullptr;
108  break;
109  default:
110  break;
111  }
112 }
113 
114 
115 void
117  bool ok = true;
118  // get the id, report a warning if not given or empty...
119  myID = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
120  if (!ok) {
121  return;
122  }
123  NBNode* node = myNodeCont.retrieve(myID);
124  // retrieve the position of the node
125  bool xOk = false;
126  bool yOk = false;
127  bool needConversion = true;
128  if (node != nullptr) {
129  myPosition = node->getPosition();
130  xOk = yOk = true;
131  needConversion = false;
132  } else {
133  myPosition.set(0, 0, 0); // better to reset than to reuse the previous (z)-value
134  }
135  if (attrs.hasAttribute(SUMO_ATTR_X)) {
136  myPosition.set(attrs.get<double>(SUMO_ATTR_X, myID.c_str(), ok), myPosition.y());
137  xOk = true;
138  needConversion = true;
139  }
140  if (attrs.hasAttribute(SUMO_ATTR_Y)) {
141  myPosition.set(myPosition.x(), attrs.get<double>(SUMO_ATTR_Y, myID.c_str(), ok));
142  yOk = true;
143  needConversion = true;
144  }
145  if (attrs.hasAttribute(SUMO_ATTR_Z)) {
146  myPosition.set(myPosition.x(), myPosition.y(), attrs.get<double>(SUMO_ATTR_Z, myID.c_str(), ok));
147  }
148  if (xOk && yOk) {
149  if (needConversion && !NBNetBuilder::transformCoordinate(myPosition, true, myLocation)) {
150  WRITE_ERROR("Unable to project coordinates for node '" + myID + "'.");
151  }
152  } else {
153  WRITE_ERROR("Missing position (at node ID='" + myID + "').");
154  }
155  bool updateEdgeGeometries = node != nullptr && myPosition != node->getPosition();
156  // check whether the y-axis shall be flipped
157  if (myOptions.getBool("flip-y-axis")) {
158  myPosition.mul(1.0, -1.0);
159  }
160  node = processNodeType(attrs, node, myID, myPosition, updateEdgeGeometries, myNodeCont, myEdgeCont, myTLLogicCont);
161  myLastParameterised = node;
162 }
163 
164 
165 NBNode*
166 NIXMLNodesHandler::processNodeType(const SUMOSAXAttributes& attrs, NBNode* node, const std::string& nodeID, const Position& position,
167  bool updateEdgeGeometries,
169  bool ok = true;
170  // get the type
172  if (node != nullptr) {
173  type = node->getType();
174  }
175  std::string typeS = attrs.getOpt<std::string>(SUMO_ATTR_TYPE, nodeID.c_str(), ok, "");
176  if (SUMOXMLDefinitions::NodeTypes.hasString(typeS)) {
177  type = SUMOXMLDefinitions::NodeTypes.get(typeS);
178  if (type == NODETYPE_DEAD_END_DEPRECATED || type == NODETYPE_DEAD_END) {
179  // dead end is a computed status. Reset this to unknown so it will
180  // be corrected if additional connections are loaded
181  type = NODETYPE_UNKNOWN;
182  }
183  }
184  std::set<NBTrafficLightDefinition*> oldTLS;
185  // check whether a prior node shall be modified
186  if (node == nullptr) {
187  node = new NBNode(nodeID, position, type);
188  if (!nc.insert(node)) {
189  throw ProcessError("Could not insert node though checked this before (id='" + nodeID + "').");
190  }
191  } else {
192  // patch information
193  oldTLS = node->getControllingTLS();
194  if (node->getType() == NODETYPE_PRIORITY && type == NODETYPE_RIGHT_BEFORE_LEFT) {
195  ec.removeRoundabout(node);
196  }
197  node->reinit(position, type, updateEdgeGeometries);
198  }
199  // process traffic light definition
200  if (NBNode::isTrafficLight(type)) {
201  processTrafficLightDefinitions(attrs, node, tlc);
202  }
203  // remove previously set tls if this node is not controlled by them
204  for (std::set<NBTrafficLightDefinition*>::iterator i = oldTLS.begin(); i != oldTLS.end(); ++i) {
205  if ((*i)->getNodes().size() == 0) {
206  tlc.removeFully((*i)->getID());
207  }
208  }
209 
210  // set optional shape
211  PositionVector shape;
212  if (attrs.hasAttribute(SUMO_ATTR_SHAPE)) {
213  shape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, nodeID.c_str(), ok, PositionVector());
215  WRITE_ERROR("Unable to project node shape at node '" + node->getID() + "'.");
216  }
217  if (shape.size() > 2) {
218  shape.closePolygon();
219  }
220  node->setCustomShape(shape);
221  }
222  // set optional radius
223  if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) {
224  node->setRadius(attrs.get<double>(SUMO_ATTR_RADIUS, nodeID.c_str(), ok));
225  }
226  // set optional keepClear flag
227  if (attrs.hasAttribute(SUMO_ATTR_KEEP_CLEAR)) {
228  node->setKeepClear(attrs.get<bool>(SUMO_ATTR_KEEP_CLEAR, nodeID.c_str(), ok));
229  }
230 
231  // set optional right-of-way hint
233  node->setRightOfWay(attrs.getRightOfWay(ok));
234  }
235 
236  // set optional fringe type
237  if (attrs.hasAttribute(SUMO_ATTR_FRINGE)) {
238  node->setFringeType(attrs.getFringeType(ok));
239  }
240  return node;
241 }
242 
243 
244 void
246  bool ok = true;
247  // get the id, report a warning if not given or empty...
248  myID = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
249  if (!ok) {
250  return;
251  }
252  NBNode* node = myNodeCont.retrieve(myID);
253  if (node == nullptr) {
254  WRITE_WARNING("Ignoring tag '" + toString(SUMO_TAG_DELETE) + "' for unknown node '" +
255  myID + "'");
256  return;
257  } else {
258  myNodeCont.extract(node, true);
259  }
260 }
261 
262 
263 void
265  bool ok = true;
266  const std::string clusterString = attrs.get<std::string>(SUMO_ATTR_NODES, nullptr, ok);
267  std::vector<std::string> ids = StringTokenizer(clusterString).getVector();
268  std::sort(ids.begin(), ids.end());
269 
270  myID = attrs.getOpt<std::string>(SUMO_ATTR_ID, nullptr, ok, "cluster_" + joinToString(ids, "_"));
271 
273  if (attrs.hasAttribute(SUMO_ATTR_X)) {
274  myPosition.setx(attrs.get<double>(SUMO_ATTR_X, myID.c_str(), ok));
275  }
276  if (attrs.hasAttribute(SUMO_ATTR_Y)) {
277  myPosition.sety(attrs.get<double>(SUMO_ATTR_Y, myID.c_str(), ok));
278  }
279  if (attrs.hasAttribute(SUMO_ATTR_Z)) {
280  myPosition.setz(attrs.get<double>(SUMO_ATTR_Z, myID.c_str(), ok));
281  }
282 
283  NBNode* node = processNodeType(attrs, nullptr, myID, myPosition, false, myNodeCont, myEdgeCont, myTLLogicCont);
284  if (ok) {
285  myNodeCont.addCluster2Join(std::set<std::string>(ids.begin(), ids.end()), node);
286  }
287 }
288 
289 
290 void
292  bool ok = true;
293  const std::vector<std::string> ids = StringTokenizer(
294  attrs.get<std::string>(SUMO_ATTR_NODES, nullptr, ok)).getVector();
295  if (ok) {
297  }
298 }
299 
300 
301 void
303  NBNode* currentNode, NBTrafficLightLogicCont& tlc) {
304  // try to get the tl-id
305  // if a tl-id is given, we will look whether this tl already exists
306  // if so, we will add the node to it (and to all programs with this id), otherwise allocate a new one with this id
307  // if no tl-id exists, we will build a tl with the node's id
308  std::set<NBTrafficLightDefinition*> tlDefs;
309  bool ok = true;
310 
311  std::string oldTlID = "";
312  std::string oldTypeS = OptionsCont::getOptions().getString("tls.default-type");
313 
314  if (currentNode->isTLControlled()) {
315  NBTrafficLightDefinition* oldDef = *(currentNode->getControllingTLS().begin());
316  oldTlID = oldDef->getID();
317  oldTypeS = toString(oldDef->getType());
318  }
319  std::string tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, nullptr, ok, oldTlID);
320  std::string typeS = attrs.getOpt<std::string>(SUMO_ATTR_TLTYPE, nullptr, ok, oldTypeS);
321  if (tlID != oldTlID || typeS != oldTypeS) {
322  currentNode->removeTrafficLights();
323  }
324  TrafficLightType type;
325  if (SUMOXMLDefinitions::TrafficLightTypes.hasString(typeS)) {
327  } else {
328  WRITE_ERROR("Unknown traffic light type '" + typeS + "' for node '" + currentNode->getID() + "'.");
329  return;
330  }
331  if (tlID != "" && tlc.getPrograms(tlID).size() > 0) {
332  // we already have definitions for this tlID
333  const std::map<std::string, NBTrafficLightDefinition*>& programs = tlc.getPrograms(tlID);
334  std::map<std::string, NBTrafficLightDefinition*>::const_iterator it;
335  for (it = programs.begin(); it != programs.end(); it++) {
336  if (it->second->getType() != type) {
337  WRITE_ERROR("Mismatched traffic light type '" + typeS + "' for tl '" + tlID + "'.");
338  ok = false;
339  } else {
340  tlDefs.insert(it->second);
341  it->second->addNode(currentNode);
342  }
343  }
344  } else {
345  // we need to add a new defition
346  tlID = (tlID == "" ? currentNode->getID() : tlID);
347  NBTrafficLightDefinition* tlDef = new NBOwnTLDef(tlID, currentNode, 0, type);
348  if (!tlc.insert(tlDef)) {
349  // actually, nothing should fail here
350  delete tlDef;
351  throw ProcessError("Could not allocate tls '" + currentNode->getID() + "'.");
352  }
353  tlDefs.insert(tlDef);
354  }
355  // process inner edges which shall be controlled
356  const std::vector<std::string>& controlledInner = attrs.getOptStringVector(SUMO_ATTR_CONTROLLED_INNER, nullptr, ok);
357  if (controlledInner.size() != 0) {
358  for (std::set<NBTrafficLightDefinition*>::iterator it = tlDefs.begin(); it != tlDefs.end(); it++) {
359  (*it)->addControlledInnerEdges(controlledInner);
360  }
361  }
362 }
363 
364 
365 
366 /****************************************************************************/
367 
SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:382
NODETYPE_PRIORITY
Definition: SUMOXMLDefinitions.h:1056
ToString.h
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.
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:244
SUMO_TAG_JOINEXCLUDE
join exlude operation
Definition: SUMOXMLDefinitions.h:225
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
NODETYPE_DEAD_END_DEPRECATED
Definition: SUMOXMLDefinitions.h:1065
NBEdgeCont
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
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:42
SUMO_ATTR_TLTYPE
node: the type of traffic light
Definition: SUMOXMLDefinitions.h:681
NBTrafficLightLogicCont
A container for traffic light definitions and built programs.
Definition: NBTrafficLightLogicCont.h:58
NBNode::setRightOfWay
void setRightOfWay(RightOfWay rightOfWay)
set method for computing right-of-way
Definition: NBNode.h:520
NIXMLNodesHandler::myEdgeCont
NBEdgeCont & myEdgeCont
The node container to add built nodes to.
Definition: NIXMLNodesHandler.h:152
Position::INVALID
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:285
OptionsCont.h
SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:170
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:493
Position::setx
void setx(double x)
set position x
Definition: Position.h:72
MsgHandler.h
NIXMLNodesHandler::myPosition
Position myPosition
The position of the currently parsed node.
Definition: NIXMLNodesHandler.h:146
NBNodeCont::insert
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:79
SUMO_ATTR_Z
Definition: SUMOXMLDefinitions.h:401
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:202
SUMOSAXHandler.h
NIXMLNodesHandler::deleteNode
void deleteNode(const SUMOSAXAttributes &attrs)
Definition: NIXMLNodesHandler.cpp:245
NIXMLNodesHandler::myEndElement
void myEndElement(int element)
Called when a closing tag occurs.
Definition: NIXMLNodesHandler.cpp:104
TrafficLightType
TrafficLightType
Definition: SUMOXMLDefinitions.h:1192
NBNetBuilder::transformCoordinates
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
Definition: NBNetBuilder.cpp:690
SUMO_ATTR_TLID
link,node: the traffic light id responsible for this link
Definition: SUMOXMLDefinitions.h:679
GeoConvHelper.h
NIXMLNodesHandler.h
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:223
NBOwnTLDef
A traffic light logics which must be computed (only nodes/edges are given)
Definition: NBOwnTLDef.h:47
NODETYPE_UNKNOWN
Definition: SUMOXMLDefinitions.h:1050
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
NBNode::getType
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:276
NBNetBuilder::transformCoordinate
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Definition: NBNetBuilder.cpp:663
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:379
NBNodeCont::addCluster2Join
void addCluster2Join(std::set< std::string > cluster, NBNode *node)
add ids of nodes which shall be joined into a single node
Definition: NBNodeCont.cpp:581
SUMO_TAG_DELETE
delete certain element
Definition: SUMOXMLDefinitions.h:177
PositionVector
A list of positions.
Definition: PositionVector.h:46
NIXMLNodesHandler::addJoinExclusion
void addJoinExclusion(const SUMOSAXAttributes &attrs)
Definition: NIXMLNodesHandler.cpp:291
NBNodeCont
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
SUMOSAXAttributes::getFringeType
virtual FringeType getFringeType(bool &ok) const =0
returns fringe type
NIXMLNodesHandler::myTLLogicCont
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
Definition: NIXMLNodesHandler.h:155
NIXMLNodesHandler::myLastParameterised
Parameterised * myLastParameterised
last item the could receive parameters
Definition: NIXMLNodesHandler.h:161
NIXMLNodesHandler::~NIXMLNodesHandler
~NIXMLNodesHandler()
Destructor.
Definition: NIXMLNodesHandler.cpp:65
SUMO_TAG_LOCATION
Definition: SUMOXMLDefinitions.h:264
NIXMLNodesHandler::myID
std::string myID
The id of the currently parsed node.
Definition: NIXMLNodesHandler.h:143
NBNode::getPosition
const Position & getPosition() const
Definition: NBNode.h:251
NBNode::isTLControlled
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:317
NBTrafficLightDefinition::getType
TrafficLightType getType() const
get the algorithm type (static etc..)
Definition: NBTrafficLightDefinition.h:331
SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
Definition: SUMOXMLDefinitions.h:693
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1049
Position::set
void set(double x, double y)
set positions x and y
Definition: Position.h:87
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:98
SUMOSAXAttributes::getOptStringVector
const std::vector< std::string > getOptStringVector(int attr, const char *objectid, bool &ok, bool report=true) const
convenience function to avoid the default argument and the template stuff at getOpt<>
Definition: SUMOSAXAttributes.cpp:124
StringTokenizer
Definition: StringTokenizer.h:62
PositionVector::closePolygon
void closePolygon()
ensures that the last position equals the first
Definition: PositionVector.cpp:1214
NBNetBuilder.h
ProcessError
Definition: UtilExceptions.h:40
NIImporter_SUMO.h
NIXMLNodesHandler::addNode
void addNode(const SUMOSAXAttributes &attrs)
Definition: NIXMLNodesHandler.cpp:116
NIImporter_SUMO::loadLocation
static GeoConvHelper * loadLocation(const SUMOSAXAttributes &attrs)
Parses network location description and registers it with GeoConveHelper::setLoaded.
Definition: NIImporter_SUMO.cpp:969
NIXMLNodesHandler::processTrafficLightDefinitions
static void processTrafficLightDefinitions(const SUMOSAXAttributes &attrs, NBNode *currentNode, NBTrafficLightLogicCont &tlc)
Builds the defined traffic light or adds a node to it.
Definition: NIXMLNodesHandler.cpp:302
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
NBNode::removeTrafficLights
void removeTrafficLights()
Removes all references to traffic lights that control this tls.
Definition: NBNode.cpp:376
Position::x
double x() const
Returns the x-position.
Definition: Position.h:57
SUMOSAXAttributes::getRightOfWay
virtual RightOfWay getRightOfWay(bool &ok) const =0
Returns the right-of-way method.
SUMO_ATTR_Y
Definition: SUMOXMLDefinitions.h:400
NBNodeCont::addJoinExclusion
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
Definition: NBNodeCont.cpp:565
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
NBNode::setCustomShape
void setCustomShape(const PositionVector &shape)
set the junction shape
Definition: NBNode.cpp:2149
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:519
NIXMLNodesHandler::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: NIXMLNodesHandler.cpp:71
NBNode::setRadius
void setRadius(double radius)
set the turning radius
Definition: NBNode.h:510
NIXMLNodesHandler::addJoinCluster
void addJoinCluster(const SUMOSAXAttributes &attrs)
Definition: NIXMLNodesHandler.cpp:264
NIXMLNodesHandler::NIXMLNodesHandler
NIXMLNodesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, OptionsCont &options)
Constructor.
Definition: NIXMLNodesHandler.cpp:52
Position::mul
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:107
NODETYPE_RIGHT_BEFORE_LEFT
Definition: SUMOXMLDefinitions.h:1058
NODETYPE_DEAD_END
Definition: SUMOXMLDefinitions.h:1064
NBNodeCont::retrieve
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:108
SUMO_ATTR_RADIUS
The turning radius at an intersection in m.
Definition: SUMOXMLDefinitions.h:691
SUMO_ATTR_CONTROLLED_INNER
Definition: SUMOXMLDefinitions.h:782
NIXMLNodesHandler::myNodeCont
NBNodeCont & myNodeCont
The node container to add built nodes to.
Definition: NIXMLNodesHandler.h:149
NBNodeCont.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
StringUtils.h
Position::y
double y() const
Returns the y-position.
Definition: Position.h:62
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:322
SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:409
NBTrafficLightLogicCont::removeFully
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
Definition: NBTrafficLightLogicCont.cpp:98
SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:776
SUMO_ATTR_RIGHT_OF_WAY
How to compute right of way.
Definition: SUMOXMLDefinitions.h:695
NBNode::isTrafficLight
static bool isTrafficLight(SumoXMLNodeType type)
return whether the given type is a traffic light
Definition: NBNode.cpp:3270
joinToString
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:247
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:45
SUMOXMLDefinitions::TrafficLightTypes
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
Definition: SUMOXMLDefinitions.h:1387
NBNode::setKeepClear
void setKeepClear(bool keepClear)
set the keepClear flag
Definition: NBNode.h:515
NBNode::setFringeType
void setFringeType(FringeType fringeType)
set method for computing right-of-way
Definition: NBNode.h:525
StringTokenizer::getVector
std::vector< std::string > getVector()
return vector of strings
Definition: StringTokenizer.cpp:192
NBNodeCont::extract
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
Definition: NBNodeCont.cpp:149
config.h
StringTokenizer.h
SUMO_TAG_JOIN
Join operation.
Definition: SUMOXMLDefinitions.h:223
NBEdgeCont::removeRoundabout
void removeRoundabout(const NBNode *node)
remove roundabout that contains the given node
Definition: NBEdgeCont.cpp:1251
SUMO_ATTR_FRINGE
Fringe type of node.
Definition: SUMOXMLDefinitions.h:697
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:68
NBOwnTLDef.h
NBTrafficLightLogicCont.h
Position::sety
void sety(double y)
set position y
Definition: Position.h:77
NBTrafficLightLogicCont::insert
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
Definition: NBTrafficLightLogicCont.cpp:74
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:57
SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:687
Position::setz
void setz(double z)
set position z
Definition: Position.h:82
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
SUMO_ATTR_X
Definition: SUMOXMLDefinitions.h:399
NIXMLNodesHandler::processNodeType
static NBNode * processNodeType(const SUMOSAXAttributes &attrs, NBNode *node, const std::string &nodeID, const Position &position, bool updateEdgeGeometries, NBNodeCont &nc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
parses node attributes (not related to positioning)
Definition: NIXMLNodesHandler.cpp:166
NIXMLNodesHandler::myLocation
GeoConvHelper * myLocation
The coordinate transformation which was used compute the node coordinates.
Definition: NIXMLNodesHandler.h:158
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
SUMOXMLDefinitions.h
SUMOXMLDefinitions::NodeTypes
static StringBijection< SumoXMLNodeType > NodeTypes
node types
Definition: SUMOXMLDefinitions.h:1363
NBNode::reinit
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
Definition: NBNode.cpp:304
NBTrafficLightDefinition
The base class for traffic light logic definitions.
Definition: NBTrafficLightDefinition.h:68
NIXMLNodesHandler::myOptions
OptionsCont & myOptions
A reference to the program's options.
Definition: NIXMLNodesHandler.h:140
SUMO_ATTR_NODES
a list of node ids, used for controlling joining
Definition: SUMOXMLDefinitions.h:724
SUMO_TAG_NODE
alternative definition for junction
Definition: SUMOXMLDefinitions.h:209