Eclipse SUMO - Simulation of Urban MObility
NIXMLConnectionsHandler.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 edge connections 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>
34 #include <netbuild/NBEdge.h>
35 #include <netbuild/NBEdgeCont.h>
36 #include <netbuild/NBNodeCont.h>
38 #include <netbuild/NBNode.h>
39 #include <netbuild/NBNetBuilder.h>
43 #include <utils/common/ToString.h>
48 
49 
50 // ===========================================================================
51 // method definitions
52 // ===========================================================================
54  SUMOSAXHandler("xml-connection-description"),
55  myEdgeCont(ec),
56  myNodeCont(nc),
57  myTLLogicCont(tlc),
58  myHaveWarnedAboutDeprecatedLanes(false),
59  myErrorMsgHandler(OptionsCont::getOptions().getBool("ignore-errors.connections") ?
60  MsgHandler::getWarningInstance() : MsgHandler::getErrorInstance()) {}
61 
62 
64 
65 
66 void
68  const SUMOSAXAttributes& attrs) {
69  if (element == SUMO_TAG_DELETE) {
70  bool ok = true;
71  std::string from = attrs.get<std::string>(SUMO_ATTR_FROM, nullptr, ok);
72  std::string to = attrs.get<std::string>(SUMO_ATTR_TO, nullptr, ok);
73  if (!ok) {
74  return;
75  }
76  // these connections were removed when the edge was deleted
77  if (myEdgeCont.wasRemoved(from) || myEdgeCont.wasRemoved(to)) {
78  return;
79  }
80  NBEdge* fromEdge = myEdgeCont.retrieve(from);
81  NBEdge* toEdge = myEdgeCont.retrieve(to);
82  if (fromEdge == nullptr) {
83  myErrorMsgHandler->inform("The connection-source edge '" + from + "' to reset is not known.");
84  return;
85  }
86  if (toEdge == nullptr) {
87  myErrorMsgHandler->inform("The connection-destination edge '" + to + "' to reset is not known.");
88  return;
89  }
90  if (!fromEdge->isConnectedTo(toEdge) && fromEdge->getStep() >= NBEdge::EDGE2EDGES) {
91  WRITE_WARNING("Target edge '" + toEdge->getID() + "' is not connected with '" + fromEdge->getID() + "'; the connection cannot be reset.");
92  return;
93  }
94  int fromLane = -1; // Assume all lanes are to be reset.
95  int toLane = -1;
96  if (attrs.hasAttribute(SUMO_ATTR_LANE)
98  || attrs.hasAttribute(SUMO_ATTR_TO_LANE)) {
99  if (!parseLaneInfo(attrs, fromEdge, toEdge, &fromLane, &toLane)) {
100  return;
101  }
102  // we could be trying to reset a connection loaded from a sumo net and which has become obsolete.
103  // In this case it's ok to encounter invalid lance indices
104  if (!fromEdge->hasConnectionTo(toEdge, toLane) && fromEdge->getStep() >= NBEdge::LANES2EDGES) {
105  WRITE_WARNING("Edge '" + fromEdge->getID() + "' has no connection to lane " + toString(toLane) + " of edge '" + toEdge->getID() + "'; the connection cannot be reset.");
106  }
107  }
108  fromEdge->removeFromConnections(toEdge, fromLane, toLane, true);
109  }
110 
111  if (element == SUMO_TAG_CONNECTION) {
112  bool ok = true;
113  std::string from = attrs.get<std::string>(SUMO_ATTR_FROM, "connection", ok);
114  std::string to = attrs.getOpt<std::string>(SUMO_ATTR_TO, "connection", ok, "");
115  if (!ok || myEdgeCont.wasIgnored(from) || myEdgeCont.wasIgnored(to)) {
116  return;
117  }
118  // extract edges
119  NBEdge* fromEdge = myEdgeCont.retrieve(from);
120  NBEdge* toEdge = to.length() != 0 ? myEdgeCont.retrieve(to) : nullptr;
121  // check whether they are valid
122  if (fromEdge == nullptr) {
123  myErrorMsgHandler->inform("The connection-source edge '" + from + "' is not known.");
124  return;
125  }
126  if (toEdge == nullptr && to.length() != 0) {
127  myErrorMsgHandler->inform("The connection-destination edge '" + to + "' is not known.");
128  return;
129  }
130  // parse optional lane information
132  parseLaneBound(attrs, fromEdge, toEdge);
133  } else {
134  fromEdge->addEdge2EdgeConnection(toEdge);
135  fromEdge->getToNode()->invalidateTLS(myTLLogicCont, true, false);
136  }
137  }
138  if (element == SUMO_TAG_PROHIBITION) {
139  bool ok = true;
140  std::string prohibitor = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITOR, nullptr, ok, "");
141  std::string prohibited = attrs.getOpt<std::string>(SUMO_ATTR_PROHIBITED, nullptr, ok, "");
142  if (!ok) {
143  return;
144  }
145  NBConnection prohibitorC = parseConnection("prohibitor", prohibitor);
146  NBConnection prohibitedC = parseConnection("prohibited", prohibited);
147  if (prohibitorC == NBConnection::InvalidConnection || prohibitedC == NBConnection::InvalidConnection) {
148  // something failed
149  return;
150  }
151  NBNode* n = prohibitorC.getFrom()->getToNode();
152  n->addSortedLinkFoes(prohibitorC, prohibitedC);
153  }
154  if (element == SUMO_TAG_CROSSING) {
155  addCrossing(attrs);
156  }
157  if (element == SUMO_TAG_WALKINGAREA) {
158  addWalkingArea(attrs);
159  }
160 }
161 
162 
164 NIXMLConnectionsHandler::parseConnection(const std::string& defRole, const std::string& def) {
165  // split from/to
166  const std::string::size_type div = def.find("->");
167  if (div == std::string::npos) {
168  myErrorMsgHandler->inform("Missing connection divider in " + defRole + " '" + def + "'");
170  }
171  std::string fromDef = def.substr(0, div);
172  std::string toDef = def.substr(div + 2);
173 
174  // retrieve the edges
175  // check whether the definition includes a lane information (do not process it)
176  if (fromDef.find('_') != std::string::npos) {
177  fromDef = fromDef.substr(0, fromDef.find('_'));
178  }
179  if (toDef.find('_') != std::string::npos) {
180  toDef = toDef.substr(0, toDef.find('_'));
181  }
182  // retrieve them now
183  NBEdge* fromE = myEdgeCont.retrieve(fromDef);
184  NBEdge* toE = myEdgeCont.retrieve(toDef);
185  // check
186  if (fromE == nullptr) {
187  myErrorMsgHandler->inform("Could not find edge '" + fromDef + "' in " + defRole + " '" + def + "'");
189  }
190  if (toE == nullptr) {
191  myErrorMsgHandler->inform("Could not find edge '" + toDef + "' in " + defRole + " '" + def + "'");
193  }
194  return NBConnection(fromE, toE);
195 }
196 
197 
198 void
200  if (to == nullptr) {
201  // do nothing if it's a dead end
202  return;
203  }
204  bool ok = true;
205  // get the begin and the end lane
206  int fromLane;
207  int toLane;
208  try {
209  if (!parseLaneInfo(attrs, from, to, &fromLane, &toLane)) {
210  return;
211  }
212  if (fromLane < 0) {
213  myErrorMsgHandler->inform("Invalid value '" + toString(fromLane) +
214  "' for " + toString(SUMO_ATTR_FROM_LANE) + " in connection from '" +
215  from->getID() + "' to '" + to->getID() + "'.");
216  return;
217  }
218  if (toLane < 0) {
219  myErrorMsgHandler->inform("Invalid value '" + toString(toLane) +
220  "' for " + toString(SUMO_ATTR_TO_LANE) + " in connection from '" +
221  from->getID() + "' to '" + to->getID() + "'.");
222  return;
223  }
224  if (from->hasConnectionTo(to, toLane) && from->getToNode()->getType() != NODETYPE_ZIPPER) {
225  WRITE_WARNING("Target lane '" + to->getLaneID(toLane) + "' is already connected from '" + from->getID() + "'.");
226  }
227 
228  NBEdge::Connection defaultCon(fromLane, to, toLane);
229  if (from->getStep() == NBEdge::LANES2LANES_USER) {
230  // maybe we are patching an existing connection
231  std::vector<NBEdge::Connection> existing = from->getConnectionsFromLane(fromLane, to, toLane);
232  if (existing.size() > 0) {
233  assert(existing.size() == 1);
234  defaultCon = existing.front();
235  // remove the original so we can insert the replacement
236  from->removeFromConnections(defaultCon);
237  } else {
238  from->getToNode()->invalidateTLS(myTLLogicCont, true, false);
239  }
240  }
241  const bool mayDefinitelyPass = attrs.getOpt<bool>(SUMO_ATTR_PASS, nullptr, ok, defaultCon.mayDefinitelyPass);
242  const bool keepClear = attrs.getOpt<bool>(SUMO_ATTR_KEEP_CLEAR, nullptr, ok, defaultCon.keepClear);
243  const double contPos = attrs.getOpt<double>(SUMO_ATTR_CONTPOS, nullptr, ok, defaultCon.contPos);
244  const double visibility = attrs.getOpt<double>(SUMO_ATTR_VISIBILITY_DISTANCE, nullptr, ok, defaultCon.visibility);
245  const double speed = attrs.getOpt<double>(SUMO_ATTR_SPEED, nullptr, ok, defaultCon.speed);
246  const bool uncontrolled = attrs.getOpt<bool>(SUMO_ATTR_UNCONTROLLED, nullptr, ok, defaultCon.uncontrolled);
247  PositionVector customShape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, nullptr, ok, defaultCon.customShape);
248  if (attrs.hasAttribute(SUMO_ATTR_SHAPE) && !NBNetBuilder::transformCoordinates(customShape)) {
249  WRITE_ERROR("Unable to project shape for connection from edge '" + from->getID() + "' to edge '" + to->getID() + "'.");
250  }
251  if (!ok) {
252  return;
253  }
254  if (!from->addLane2LaneConnection(fromLane, to, toLane, NBEdge::L2L_USER, true, mayDefinitelyPass,
255  keepClear, contPos, visibility, speed, customShape, uncontrolled)) {
256  if (OptionsCont::getOptions().getBool("show-errors.connections-first-try")) {
257  WRITE_WARNING("Could not set loaded connection from '" + from->getLaneID(fromLane) + "' to '" + to->getLaneID(toLane) + "'.");
258  }
259  // set as to be re-applied after network processing
260  myEdgeCont.addPostProcessConnection(from->getID(), fromLane, to->getID(), toLane, mayDefinitelyPass, keepClear, contPos, visibility, speed, customShape, uncontrolled, false);
261  }
262  } catch (NumberFormatException&) {
263  myErrorMsgHandler->inform("At least one of the defined lanes was not numeric");
264  }
265 }
266 
267 bool
269  int* fromLane, int* toLane) {
270  if (attributes.hasAttribute(SUMO_ATTR_LANE)) {
271  return parseDeprecatedLaneDefinition(attributes, fromEdge, toEdge, fromLane, toLane);
272  } else {
273  return parseLaneDefinition(attributes, fromLane, toLane);
274  }
275 }
276 
277 
278 inline bool
280  NBEdge* from, NBEdge* to,
281  int* fromLane, int* toLane) {
282  bool ok = true;
285  WRITE_WARNING("'" + toString(SUMO_ATTR_LANE) + "' is deprecated, please use '" +
287  "' instead.");
288  }
289 
290  std::string laneConn = attributes.get<std::string>(SUMO_ATTR_LANE, nullptr, ok);
291  StringTokenizer st(laneConn, ':');
292  if (!ok || st.size() != 2) {
293  myErrorMsgHandler->inform("Invalid lane to lane connection from '" +
294  from->getID() + "' to '" + to->getID() + "'.");
295  return false; // There was an error.
296  }
297 
298  *fromLane = StringUtils::toIntSecure(st.next(), -1);
299  *toLane = StringUtils::toIntSecure(st.next(), -1);
300 
301  return true; // We succeeded.
302 }
303 
304 
305 inline bool
307  int* fromLane,
308  int* toLane) {
309  bool ok = true;
310  *fromLane = attributes.get<int>(SUMO_ATTR_FROM_LANE, nullptr, ok);
311  *toLane = attributes.get<int>(SUMO_ATTR_TO_LANE, nullptr, ok);
312  return ok;
313 }
314 
315 
316 void
318  bool ok = true;
319  EdgeVector edges;
320  const std::string nodeID = attrs.get<std::string>(SUMO_ATTR_NODE, nullptr, ok);
321  double width = attrs.getOpt<double>(SUMO_ATTR_WIDTH, nodeID.c_str(), ok, NBEdge::UNSPECIFIED_WIDTH, true);
322  const bool discard = attrs.getOpt<bool>(SUMO_ATTR_DISCARD, nodeID.c_str(), ok, false, true);
323  int tlIndex = attrs.getOpt<int>(SUMO_ATTR_TLLINKINDEX, nullptr, ok, -1);
324  int tlIndex2 = attrs.getOpt<int>(SUMO_ATTR_TLLINKINDEX2, nullptr, ok, -1);
325  NBNode* node = myNodeCont.retrieve(nodeID);
326  if (node == nullptr) {
327  if (!discard && myNodeCont.wasRemoved(nodeID)) {
328  WRITE_ERROR("Node '" + nodeID + "' in crossing is not known.");
329  }
330  return;
331  }
332  if (!attrs.hasAttribute(SUMO_ATTR_EDGES)) {
333  if (discard) {
334  node->discardAllCrossings(true);
335  return;
336  } else {
337  WRITE_ERROR("No edges specified for crossing at node '" + nodeID + "'.");
338  return;
339  }
340  }
341  for (const std::string& id : attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, nodeID.c_str(), ok)) {
342  NBEdge* edge = myEdgeCont.retrieve(id);
343  if (edge == nullptr) {
344  if (!(discard && myEdgeCont.wasRemoved(id))) {
345  WRITE_ERROR("Edge '" + id + "' for crossing at node '" + nodeID + "' is not known.");
346  return;
347  } else {
348  edge = myEdgeCont.retrieve(id, true);
349  }
350  } else {
351  if (edge->getToNode() != node && edge->getFromNode() != node) {
352  if (!discard) {
353  WRITE_ERROR("Edge '" + id + "' does not touch node '" + nodeID + "'.");
354  return;
355  }
356  }
357  }
358  edges.push_back(edge);
359  }
360  if (!ok) {
361  return;
362  }
363  bool priority = attrs.getOpt<bool>(SUMO_ATTR_PRIORITY, nodeID.c_str(), ok, node->isTLControlled(), true);
364  if (node->isTLControlled() && !priority) {
365  // traffic_light nodes should always have priority crossings
366  WRITE_WARNING("Crossing at controlled node '" + nodeID + "' must be prioritized");
367  priority = true;
368  }
369  PositionVector customShape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, nullptr, ok, PositionVector::EMPTY);
370  if (!NBNetBuilder::transformCoordinates(customShape)) {
371  WRITE_ERROR("Unable to project shape for crossing at node '" + node->getID() + "'.");
372  }
373  if (discard) {
374  node->removeCrossing(edges);
375  } else {
376  if (node->checkCrossingDuplicated(edges)) {
377  // possibly a diff
378  NBNode::Crossing* existing = node->getCrossing(edges);
379  if (!(
380  (attrs.hasAttribute(SUMO_ATTR_WIDTH) && width != existing->width)
381  || (attrs.hasAttribute(SUMO_ATTR_TLLINKINDEX) && tlIndex != existing->customTLIndex)
382  || (attrs.hasAttribute(SUMO_ATTR_TLLINKINDEX2) && tlIndex2 != existing->customTLIndex2)
383  || (attrs.hasAttribute(SUMO_ATTR_PRIORITY) && priority != existing->priority))) {
384  WRITE_ERROR("Crossing with edges '" + toString(edges) + "' already exists at node '" + node->getID() + "'.");
385  return;
386  } else {
387  // replace existing, keep old attributes
388  if (!attrs.hasAttribute(SUMO_ATTR_WIDTH)) {
389  width = existing->width;
390  }
391  if (!attrs.hasAttribute(SUMO_ATTR_TLLINKINDEX)) {
392  tlIndex = existing->customTLIndex;
393  }
394  if (!attrs.hasAttribute(SUMO_ATTR_TLLINKINDEX2)) {
395  tlIndex2 = existing->customTLIndex2;
396  }
397  if (!attrs.hasAttribute(SUMO_ATTR_PRIORITY)) {
398  priority = existing->priority;
399  }
400  node->removeCrossing(edges);
401  }
402  }
403  node->addCrossing(edges, width, priority, tlIndex, tlIndex2, customShape);
404  }
405 }
406 
407 
408 void
410  bool ok = true;
411  NBNode* node = nullptr;
412  EdgeVector edges;
413  const std::string nodeID = attrs.get<std::string>(SUMO_ATTR_NODE, nullptr, ok);
414  std::vector<std::string> edgeIDs;
415  if (!attrs.hasAttribute(SUMO_ATTR_EDGES)) {
416  WRITE_ERROR("No edges specified for walkingArea at node '" + nodeID + "'.");
417  return;
418  }
419  for (const std::string& id : attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, nodeID.c_str(), ok)) {
420  NBEdge* edge = myEdgeCont.retrieve(id);
421  if (edge == nullptr) {
422  WRITE_ERROR("Edge '" + id + "' for walkingArea at node '" + nodeID + "' is not known.");
423  return;
424  }
425  if (node == nullptr) {
426  if (edge->getToNode()->getID() == nodeID) {
427  node = edge->getToNode();
428  } else if (edge->getFromNode()->getID() == nodeID) {
429  node = edge->getFromNode();
430  } else {
431  WRITE_ERROR("Edge '" + id + "' does not touch node '" + nodeID + "'.");
432  return;
433  }
434  } else {
435  if (edge->getToNode() != node && edge->getFromNode() != node) {
436  WRITE_ERROR("Edge '" + id + "' does not touch node '" + nodeID + "'.");
437  return;
438  }
439  }
440  edges.push_back(edge);
441  }
442  if (!ok) {
443  return;
444  }
445  PositionVector customShape = attrs.getOpt<PositionVector>(SUMO_ATTR_SHAPE, nullptr, ok, PositionVector::EMPTY);
446  if (!NBNetBuilder::transformCoordinates(customShape)) {
447  WRITE_ERROR("Unable to project shape for walkingArea at node '" + node->getID() + "'.");
448  }
449  node->addWalkingAreaShape(edges, customShape);
450 }
451 
452 /****************************************************************************/
453 
static const PositionVector EMPTY
empty Vector
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:108
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
Whether vehicles must keep the junction clear.
The relationships between edges are computed/loaded.
Definition: NBEdge.h:109
bool isConnectedTo(const NBEdge *e) const
Returns the information whethe a connection to the given edge has been added (or computed) ...
Definition: NBEdge.cpp:1176
void addCrossing(const SUMOSAXAttributes &attrs)
Parses a crossing and updates the referenced node.
static const NBConnection InvalidConnection
Definition: NBConnection.h:121
A container for traffic light definitions and built programs.
bool myHaveWarnedAboutDeprecatedLanes
Information whether we have a deprecated attribute.
static int toIntSecure(const std::string &sData, int def)
converts a string into the integer value described by it
connectio between two lanes
bool parseLaneInfo(const SUMOSAXAttributes &attributes, NBEdge *fromEdge, NBEdge *toEdge, int *fromLane, int *toLane)
Parses information about lane-2-lane connection when it describes a lane-2-lane relationship.
The representation of a single edge during network building.
Definition: NBEdge.h:86
foe visibility distance of a link
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
NBEdge * getFrom() const
returns the from-edge (start of the connection)
void parseLaneBound(const SUMOSAXAttributes &attrs, NBEdge *from, NBEdge *to)
Parses a connection when it describes a lane-2-lane relationship.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
Definition: Named.h:77
SAX-handler base for SUMO-files.
bool parseLaneDefinition(const SUMOSAXAttributes &attributes, int *fromLane, int *toLane)
Parses information about lane-2-lane connection.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:303
prohibition of circulation between two edges
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
link: the index of the opposite direction link of a pedestrian crossing
bool priority
whether the pedestrians have priority
Definition: NBNode.h:152
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED)
Adds a connection between the specified this edge&#39;s lane and an approached one.
Definition: NBEdge.cpp:1014
NBEdgeCont & myEdgeCont
The edge container to fill.
void invalidateTLS(NBTrafficLightLogicCont &tlCont, bool removedConnections, bool addedConnections)
causes the traffic light to be computed anew
Definition: NBNode.cpp:385
bool parseDeprecatedLaneDefinition(const SUMOSAXAttributes &attributes, NBEdge *fromEdge, NBEdge *toEdge, int *fromLane, int *toLane)
Parses information about lane-2-lane connection in deprecated format.
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
Definition: NBEdge.cpp:990
NBConnection parseConnection(const std::string &defRole, const std::string &def)
Returns the connection described by def.
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
Definition: NBEdge.h:117
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
bool wasRemoved(std::string id) const
Returns whether the node with the id was deleted explicitly.
Definition: NBNodeCont.h:246
void addPostProcessConnection(const std::string &from, int fromLane, const std::string &to, int toLane, bool mayDefinitelyPass, bool keepClear, double contPos, double visibility, double speed, const PositionVector &customShape, bool uncontrolled, bool warnOnly)
Adds a connection which could not be set during loading.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
std::string getLaneID(int lane) const
get lane ID
Definition: NBEdge.cpp:3125
walking area for pedestrians
A list of positions.
bool wasRemoved(std::string id) const
Returns whether the edge with the id was deleted explicitly.
Definition: NBEdgeCont.h:514
bool hasConnectionTo(NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
Definition: NBEdge.cpp:1170
const std::string & getID() const
Definition: NBEdge.h:1364
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
NBNodeCont & myNodeCont
The edge container to fill.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
EdgeBuildingStep getStep() const
The building step of this edge.
Definition: NBEdge.h:568
edge: the shape in xml-definition
The connection was given by the user.
Definition: NBEdge.h:128
int customTLIndex2
Definition: NBNode.h:160
MsgHandler *const myErrorMsgHandler
the handler for loading errors
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
void addWalkingAreaShape(EdgeVector edges, const PositionVector &shape)
add custom shape for walkingArea
Definition: NBNode.cpp:3037
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.
double width
This crossing&#39;s width.
Definition: NBNode.h:144
int customTLIndex
the custom traffic light index of this crossing (if controlled)
Definition: NBNode.h:159
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:35
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:245
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
Definition: MsgHandler.cpp:118
A storage for options typed value containers)
Definition: OptionsCont.h:90
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:276
NIXMLConnectionsHandler(NBEdgeCont &ec, NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Constructor.
crossing between edges for pedestrians
void addWalkingArea(const SUMOSAXAttributes &attrs)
Parses a walkingArea and updates the referenced node.
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false, const bool keepPossibleTurns=false)
Removes the specified connection(s)
Definition: NBEdge.cpp:1293
Represents a single node (junction) during network building.
Definition: NBNode.h:68
std::vector< Connection > getConnectionsFromLane(int lane, NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
Definition: NBEdge.cpp:1127
A definition of a pedestrian crossing.
Definition: NBNode.h:132
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
add shorted link FOES
Definition: NBNode.cpp:1564
link: the index of the link within the traffic light
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:479
bool wasIgnored(std::string id) const
Returns whether the edge with the id was ignored during parsing.
Definition: NBEdgeCont.h:503
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
delete certain element
Lanes to edges - relationships are computed/loaded.
Definition: NBEdge.h:111
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to (when invalidating tls)
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486