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