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