Eclipse SUMO - Simulation of Urban MObility
RONetHandler.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-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 // The handler for SUMO-Networks
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <string>
31 #include <utils/common/ToString.h>
38 #include "ROEdge.h"
39 #include "ROLane.h"
40 #include "RONode.h"
41 #include "RONet.h"
42 #include "RONetHandler.h"
43 #include "ROAbstractEdgeBuilder.h"
44 
45 
46 // ===========================================================================
47 // method definitions
48 // ===========================================================================
49 RONetHandler::RONetHandler(RONet& net, ROAbstractEdgeBuilder& eb, const bool ignoreInternal, const double minorPenalty) :
50  SUMOSAXHandler("sumo-network"),
51  myNet(net),
52  myNetworkVersion(0),
53  myEdgeBuilder(eb), myIgnoreInternal(ignoreInternal),
54  myCurrentName(), myCurrentEdge(nullptr), myCurrentStoppingPlace(nullptr),
55  myMinorPenalty(minorPenalty)
56 {}
57 
58 
60 
61 
62 void
64  const SUMOSAXAttributes& attrs) {
65  switch (element) {
66  case SUMO_TAG_LOCATION:
67  setLocation(attrs);
68  break;
69  case SUMO_TAG_NET: {
70  bool ok;
71  myNetworkVersion = attrs.get<double>(SUMO_ATTR_VERSION, nullptr, ok, false);
72  break;
73  }
74  case SUMO_TAG_EDGE:
75  // in the first step, we do need the name to allocate the edge
76  // in the second, we need it to know to which edge we have to add
77  // the following edges to
78  parseEdge(attrs);
79  break;
80  case SUMO_TAG_LANE:
81  parseLane(attrs);
82  break;
83  case SUMO_TAG_JUNCTION:
84  parseJunction(attrs);
85  break;
87  parseConnection(attrs);
88  break;
89  case SUMO_TAG_BUS_STOP:
93  parseStoppingPlace(attrs, (SumoXMLTag)element);
94  break;
95  case SUMO_TAG_ACCESS:
96  parseAccess(attrs);
97  break;
98  case SUMO_TAG_TAZ:
99  parseDistrict(attrs);
100  break;
101  case SUMO_TAG_TAZSOURCE:
102  parseDistrictEdge(attrs, true);
103  break;
104  case SUMO_TAG_TAZSINK:
105  parseDistrictEdge(attrs, false);
106  break;
107  case SUMO_TAG_TYPE: {
108  bool ok = true;
109  myCurrentTypeID = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
110  break;
111  }
112  case SUMO_TAG_RESTRICTION: {
113  bool ok = true;
114  const SUMOVehicleClass svc = getVehicleClassID(attrs.get<std::string>(SUMO_ATTR_VCLASS, myCurrentTypeID.c_str(), ok));
115  const double speed = attrs.get<double>(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok);
116  if (ok) {
117  myNet.addRestriction(myCurrentTypeID, svc, speed);
118  }
119  break;
120  }
121  case SUMO_TAG_PARAM:
122  addParam(attrs);
123  break;
124  default:
125  break;
126  }
127 }
128 
129 
130 void
132  switch (element) {
133  case SUMO_TAG_NET:
134  // build junction graph
135  for (std::set<std::string>::const_iterator it = myUnseenNodeIDs.begin(); it != myUnseenNodeIDs.end(); ++it) {
136  WRITE_ERROR("Unknown node '" + *it + "'.");
137  }
138  break;
139  default:
140  break;
141  }
142 }
143 
144 
145 void
147  bool ok = true;
148  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, ok);
149  // circumventing empty string test
150  const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
151  // add parameter in current created element, or in myLoadedParameterised
152  if (myCurrentEdge != nullptr) {
153  myCurrentEdge->setParameter(key, val);
154  }
155 }
156 
157 
158 void
160  // get the id, report an error if not given or empty...
161  bool ok = true;
162  myCurrentName = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
163  if (!ok) {
164  throw ProcessError();
165  }
166  const SumoXMLEdgeFunc func = attrs.getEdgeFunc(ok);
167  if (!ok) {
168  WRITE_ERROR("Edge '" + myCurrentName + "' has an unknown type.");
169  return;
170  }
171  // get the edge
172  std::string from;
173  std::string to;
174  int priority;
175  myCurrentEdge = nullptr;
176  if (func == EDGEFUNC_INTERNAL || func == EDGEFUNC_CROSSING || func == EDGEFUNC_WALKINGAREA) {
177  assert(myCurrentName[0] == ':');
178  const std::string junctionID = myCurrentName.substr(1, myCurrentName.rfind('_') - 1);
179  from = junctionID;
180  to = junctionID;
181  priority = 0;
182  } else {
183  from = attrs.get<std::string>(SUMO_ATTR_FROM, myCurrentName.c_str(), ok);
184  to = attrs.get<std::string>(SUMO_ATTR_TO, myCurrentName.c_str(), ok);
185  priority = attrs.get<int>(SUMO_ATTR_PRIORITY, myCurrentName.c_str(), ok);
186  if (!ok) {
187  return;
188  }
189  }
190  RONode* fromNode = myNet.getNode(from);
191  if (fromNode == nullptr) {
192  myUnseenNodeIDs.insert(from);
193  fromNode = new RONode(from);
194  myNet.addNode(fromNode);
195  }
196  RONode* toNode = myNet.getNode(to);
197  if (toNode == nullptr) {
198  myUnseenNodeIDs.insert(to);
199  toNode = new RONode(to);
200  myNet.addNode(toNode);
201  }
202  // build the edge
203  myCurrentEdge = myEdgeBuilder.buildEdge(myCurrentName, fromNode, toNode, priority);
204  // set the type
205  myCurrentEdge->setRestrictions(myNet.getRestrictions(attrs.getOpt<std::string>(SUMO_ATTR_TYPE, myCurrentName.c_str(), ok, "")));
206  myCurrentEdge->setFunction(func);
207 
208  if (myNet.addEdge(myCurrentEdge)) {
209  fromNode->addOutgoing(myCurrentEdge);
210  toNode->addIncoming(myCurrentEdge);
211  } else {
212  myCurrentEdge = nullptr;
213  }
214 }
215 
216 
217 void
219  if (myCurrentEdge == nullptr) {
220  // was an internal edge to skip or an error occurred
221  return;
222  }
223  bool ok = true;
224  // get the id, report an error if not given or empty...
225  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
226  if (!ok) {
227  return;
228  }
229  // get the speed
230  double maxSpeed = attrs.get<double>(SUMO_ATTR_SPEED, id.c_str(), ok);
231  double length = attrs.get<double>(SUMO_ATTR_LENGTH, id.c_str(), ok);
232  std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "");
233  std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
234  const PositionVector shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
235  if (!ok) {
236  return;
237  }
238  if (shape.size() < 2) {
239  WRITE_ERROR("Ignoring lane '" + id + "' with broken shape.");
240  return;
241  }
242  // get the length
243  // get the vehicle classes
244  SVCPermissions permissions = parseVehicleClasses(allow, disallow, myNetworkVersion);
245  if (permissions != SVCAll) {
247  }
248  // add when both values are valid
249  if (maxSpeed > 0 && length > 0 && id.length() > 0) {
250  myCurrentEdge->addLane(new ROLane(id, myCurrentEdge, length, maxSpeed, permissions, shape));
251  } else {
252  WRITE_WARNING("Ignoring lane '" + id + "' with speed " + toString(maxSpeed) + " and length " + toString(length));
253  }
254 }
255 
256 
257 void
259  bool ok = true;
260  // get the id, report an error if not given or empty...
261  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
262  if (attrs.getNodeType(ok) == NODETYPE_INTERNAL) {
263  return;
264  }
265  myUnseenNodeIDs.erase(id);
266  // get the position of the node
267  const double x = attrs.get<double>(SUMO_ATTR_X, id.c_str(), ok);
268  const double y = attrs.get<double>(SUMO_ATTR_Y, id.c_str(), ok);
269  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, id.c_str(), ok, 0.);
270  if (!ok) {
271  return;
272  }
273  RONode* n = myNet.getNode(id);
274  if (n == nullptr) {
275  WRITE_WARNING("Skipping isolated junction '" + id + "'.");
276  } else {
277  n->setPosition(Position(x, y, z));
278  }
279 }
280 
281 
282 void
284  bool ok = true;
285  std::string fromID = attrs.get<std::string>(SUMO_ATTR_FROM, nullptr, ok);
286  std::string toID = attrs.get<std::string>(SUMO_ATTR_TO, nullptr, ok);
287  const int fromLane = attrs.get<int>(SUMO_ATTR_FROM_LANE, nullptr, ok);
288  const int toLane = attrs.get<int>(SUMO_ATTR_TO_LANE, nullptr, ok);
289  std::string dir = attrs.get<std::string>(SUMO_ATTR_DIR, nullptr, ok);
290  std::string viaID = attrs.getOpt<std::string>(SUMO_ATTR_VIA, nullptr, ok, "");
291  ROEdge* from = myNet.getEdge(fromID);
292  ROEdge* to = myNet.getEdge(toID);
293  if (from == nullptr) {
294  throw ProcessError("unknown from-edge '" + fromID + "' in connection");
295  }
296  if (to == nullptr) {
297  throw ProcessError("unknown to-edge '" + toID + "' in connection");
298  }
299  if ((int)from->getLanes().size() <= fromLane) {
300  throw ProcessError("invalid fromLane '" + toString(fromLane) + "' in connection from '" + fromID + "'.");
301  }
302  if ((int)to->getLanes().size() <= toLane) {
303  throw ProcessError("invalid toLane '" + toString(toLane) + "' in connection to '" + toID + "'.");
304  }
305  if (myIgnoreInternal || viaID == "") {
306  from->getLanes()[fromLane]->addOutgoingLane(to->getLanes()[toLane]);
307  from->addSuccessor(to, nullptr, dir);
308  } else {
309  ROEdge* const via = myNet.getEdge(viaID.substr(0, viaID.rfind('_')));
310  if (via == nullptr) {
311  throw ProcessError("unknown via-edge '" + viaID + "' in connection");
312  }
313  from->getLanes()[fromLane]->addOutgoingLane(to->getLanes()[toLane], via);
314  from->addSuccessor(to, via, dir);
315  via->addSuccessor(to, nullptr, dir);
316  LinkState state = SUMOXMLDefinitions::LinkStates.get(attrs.get<std::string>(SUMO_ATTR_STATE, nullptr, ok));
317  if (state == LINKSTATE_MINOR || state == LINKSTATE_EQUAL || state == LINKSTATE_STOP || state == LINKSTATE_ALLWAY_STOP) {
319  }
320  }
321 }
322 
323 
324 void
326  bool ok = true;
328  // get the id, throw if not given or empty...
329  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, toString(element).c_str(), ok);
330  // get the lane
331  myCurrentStoppingPlace->lane = attrs.get<std::string>(SUMO_ATTR_LANE, toString(element).c_str(), ok);
332  if (!ok) {
333  throw ProcessError();
334  }
336  if (edge == nullptr) {
337  throw InvalidArgument("Unknown lane '" + myCurrentStoppingPlace->lane + "' for " + toString(element) + " '" + id + "'.");
338  }
339  // get the positions
340  myCurrentStoppingPlace->startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0.);
341  myCurrentStoppingPlace->endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, edge->getLength());
342  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
343  if (!ok || (SUMORouteHandler::checkStopPos(myCurrentStoppingPlace->startPos, myCurrentStoppingPlace->endPos, edge->getLength(), POSITION_EPS, friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
344  throw InvalidArgument("Invalid position for " + toString(element) + " '" + id + "'.");
345  }
346  // this is a hack: the busstop attribute is meant to hold the id within the simulation context but this is not used within the router context
347  myCurrentStoppingPlace->busstop = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
349 }
350 
351 
352 void
354  bool ok = true;
355  const std::string lane = attrs.get<std::string>(SUMO_ATTR_LANE, "access", ok);
356  const ROEdge* edge = myNet.getEdgeForLaneID(lane);
357  if (edge == nullptr) {
358  throw InvalidArgument("Unknown lane '" + lane + "' for access.");
359  }
360  if ((edge->getPermissions() & SVC_PEDESTRIAN) == 0) {
361  WRITE_WARNING("Ignoring invalid access from non-pedestrian edge '" + edge->getID() + "'.");
362  return;
363  }
364  double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, "access", ok, 0.);
365  const double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "access", ok, -1);
366  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "access", ok, false);
367  if (!ok || (SUMORouteHandler::checkStopPos(pos, pos, edge->getLength(), 0., friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
368  throw InvalidArgument("Invalid position " + toString(pos) + " for access on lane '" + lane + "'.");
369  }
370  if (!ok) {
371  throw ProcessError();
372  }
373  myCurrentStoppingPlace->accessPos.push_back(std::make_tuple(lane, pos, length));
374 }
375 
376 
377 void
379  myCurrentEdge = nullptr;
380  bool ok = true;
381  myCurrentName = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
382  if (!ok) {
383  return;
384  }
385  myNet.addDistrict(myCurrentName, myEdgeBuilder.buildEdge(myCurrentName + "-source", nullptr, nullptr, 0), myEdgeBuilder.buildEdge(myCurrentName + "-sink", nullptr, nullptr, 0));
386  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
387  std::vector<std::string> desc = attrs.getStringVector(SUMO_ATTR_EDGES);
388  for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
390  myNet.addDistrictEdge(myCurrentName, *i, false);
391  }
392  }
393 }
394 
395 
396 void
398  bool ok = true;
399  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, myCurrentName.c_str(), ok);
400  myNet.addDistrictEdge(myCurrentName, id, isSource);
401 }
402 
403 void
405  bool ok = true;
406  PositionVector s = attrs.get<PositionVector>(SUMO_ATTR_NET_OFFSET, nullptr, ok);
407  Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, nullptr, ok);
408  Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, nullptr, ok);
409  std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, nullptr, ok);
410  if (ok) {
411  Position networkOffset = s[0];
412  GeoConvHelper::init(proj, networkOffset, origBoundary, convBoundary);
413  }
414 }
415 
416 /****************************************************************************/
SUMO_TAG_TRAIN_STOP
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
Definition: SUMOXMLDefinitions.h:99
SUMO_ATTR_TYPE
@ SUMO_ATTR_TYPE
Definition: SUMOXMLDefinitions.h:381
SUMOSAXAttributes::getStringVector
const std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
Definition: SUMOSAXAttributes.cpp:113
EDGEFUNC_INTERNAL
@ EDGEFUNC_INTERNAL
Definition: SUMOXMLDefinitions.h:1085
SVC_PEDESTRIAN
@ SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
ToString.h
RONetHandler::myMinorPenalty
const double myMinorPenalty
time penalty for passing a minor link
Definition: RONetHandler.h:212
LINKSTATE_EQUAL
@ LINKSTATE_EQUAL
This is an uncontrolled, right-before-left link.
Definition: SUMOXMLDefinitions.h:1159
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.
getVehicleClassID
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
Definition: SUMOVehicleClass.cpp:200
SUMO_ATTR_DISALLOW
@ SUMO_ATTR_DISALLOW
Definition: SUMOXMLDefinitions.h:783
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
RONetHandler::myEdgeBuilder
ROAbstractEdgeBuilder & myEdgeBuilder
The object used to build of edges of the desired type.
Definition: RONetHandler.h:191
SUMOXMLDefinitions::LinkStates
static StringBijection< LinkState > LinkStates
link states
Definition: SUMOXMLDefinitions.h:1386
RONet::addDistrictEdge
bool addDistrictEdge(const std::string tazID, const std::string edgeID, const bool isSource)
Definition: RONet.cpp:168
RONet::getNode
RONode * getNode(const std::string &id) const
Retrieves an node from the network.
Definition: RONet.h:184
RONetHandler.h
SUMOSAXAttributes::getString
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMO_ATTR_LENGTH
@ SUMO_ATTR_LENGTH
Definition: SUMOXMLDefinitions.h:393
SUMOSAXHandler
SAX-handler base for SUMO-files.
Definition: SUMOSAXHandler.h:41
SUMOVehicleParameter::Stop::lane
std::string lane
The lane to stop at.
Definition: SUMOVehicleParameter.h:586
RONetHandler::myEndElement
virtual void myEndElement(int element)
Called when a closing tag occurs.
Definition: RONetHandler.cpp:131
EDGEFUNC_CROSSING
@ EDGEFUNC_CROSSING
Definition: SUMOXMLDefinitions.h:1083
ROEdge::setTimePenalty
void setTimePenalty(double value)
Definition: ROEdge.h:142
RONetHandler::parseAccess
void parseAccess(const SUMOSAXAttributes &attrs)
Definition: RONetHandler.cpp:353
SUMO_ATTR_NET_OFFSET
@ SUMO_ATTR_NET_OFFSET
Definition: SUMOXMLDefinitions.h:827
RONet::getEdge
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition: RONet.h:152
SUMO_TAG_PARAM
@ SUMO_TAG_PARAM
parameter associated to a certain key
Definition: SUMOXMLDefinitions.h:169
RONode.h
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
@ SUMO_ATTR_TO_LANE
Definition: SUMOXMLDefinitions.h:720
MsgHandler.h
SUMO_TAG_TAZSOURCE
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
Definition: SUMOXMLDefinitions.h:135
SUMO_TAG_CONTAINER_STOP
@ SUMO_TAG_CONTAINER_STOP
A container stop.
Definition: SUMOXMLDefinitions.h:105
SUMOVehicleParameter::Stop::busstop
std::string busstop
(Optional) bus stop if one is assigned to the stop
Definition: SUMOVehicleParameter.h:589
RONet::addNode
void addNode(RONode *node)
Definition: RONet.cpp:190
RONet::addEdge
virtual bool addEdge(ROEdge *edge)
Definition: RONet.cpp:137
SUMO_ATTR_Z
@ SUMO_ATTR_Z
Definition: SUMOXMLDefinitions.h:400
SUMOSAXHandler.h
RONetHandler::RONetHandler
RONetHandler(RONet &net, ROAbstractEdgeBuilder &eb, const bool ignoreInternal, const double minorPenalty)
Constructor.
Definition: RONetHandler.cpp:49
RONetHandler::parseConnection
void parseConnection(const SUMOSAXAttributes &attrs)
Definition: RONetHandler.cpp:283
SUMO_TAG_LANE
@ SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:49
RONetHandler::addParam
void addParam(const SUMOSAXAttributes &attrs)
assign arbitrary vehicle parameters
Definition: RONetHandler.cpp:146
RONetHandler::setLocation
void setLocation(const SUMOSAXAttributes &attrs)
Parses network location description.
Definition: RONetHandler.cpp:404
GeoConvHelper.h
NODETYPE_INTERNAL
@ NODETYPE_INTERNAL
Definition: SUMOXMLDefinitions.h:1068
SumoXMLEdgeFunc
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
Definition: SUMOXMLDefinitions.h:1079
ROLane
A single lane the router may use.
Definition: ROLane.h:50
RONet
The router's network representation.
Definition: RONet.h:63
SUMO_ATTR_SPEED
@ SUMO_ATTR_SPEED
Definition: SUMOXMLDefinitions.h:384
RONetHandler::parseStoppingPlace
void parseStoppingPlace(const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Definition: RONetHandler.cpp:325
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
ROEdge::getLanes
const std::vector< ROLane * > & getLanes() const
Returns this edge's lanes.
Definition: ROEdge.h:491
SUMO_ATTR_LANE
@ SUMO_ATTR_LANE
Definition: SUMOXMLDefinitions.h:637
SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ENDPOS
Definition: SUMOXMLDefinitions.h:798
PositionVector
A list of positions.
Definition: PositionVector.h:45
GeoConvHelper::init
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
Definition: GeoConvHelper.cpp:200
RONetHandler::parseLane
virtual void parseLane(const SUMOSAXAttributes &attrs)
Parses and builds a lane.
Definition: RONetHandler.cpp:218
SUMO_ATTR_DIR
@ SUMO_ATTR_DIR
The abstract direction of a link.
Definition: SUMOXMLDefinitions.h:706
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
RONet::addRestriction
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition: RONet.cpp:121
SUMO_ATTR_ORIG_BOUNDARY
@ SUMO_ATTR_ORIG_BOUNDARY
Definition: SUMOXMLDefinitions.h:829
SUMORouteHandler::checkStopPos
static StopPos checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
Definition: SUMORouteHandler.cpp:283
SUMO_ATTR_TO
@ SUMO_ATTR_TO
Definition: SUMOXMLDefinitions.h:640
SUMO_TAG_LOCATION
@ SUMO_TAG_LOCATION
Definition: SUMOXMLDefinitions.h:263
RONetHandler::myCurrentStoppingPlace
SUMOVehicleParameter::Stop * myCurrentStoppingPlace
The currently built stopping place.
Definition: RONetHandler.h:206
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
RONet::addStoppingPlace
void addStoppingPlace(const std::string &id, const SumoXMLTag category, SUMOVehicleParameter::Stop *stop)
Definition: RONet.cpp:199
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1137
RONetHandler::myCurrentName
std::string myCurrentName
The name of the edge/node that is currently processed.
Definition: RONetHandler.h:197
SUMO_TAG_TYPE
@ SUMO_TAG_TYPE
type
Definition: SUMOXMLDefinitions.h:210
SUMO_ATTR_STARTPOS
@ SUMO_ATTR_STARTPOS
Definition: SUMOXMLDefinitions.h:797
ROEdge::addSuccessor
virtual void addSuccessor(ROEdge *s, ROEdge *via=nullptr, std::string dir="")
Adds information about a connected edge.
Definition: ROEdge.cpp:104
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
EDGEFUNC_WALKINGAREA
@ EDGEFUNC_WALKINGAREA
Definition: SUMOXMLDefinitions.h:1084
RONet.h
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:97
ROEdge::setRestrictions
void setRestrictions(const std::map< SUMOVehicleClass, double > *restrictions)
Sets the vehicle class specific speed limits of the edge.
Definition: ROEdge.h:138
ROAbstractEdgeBuilder.h
RONetHandler::myUnseenNodeIDs
std::set< std::string > myUnseenNodeIDs
temporary data for checking node initialisation after network parsing is finished
Definition: RONetHandler.h:209
SUMO_ATTR_EDGES
@ SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
SUMO_TAG_PARKING_AREA
@ SUMO_TAG_PARKING_AREA
A parking area.
Definition: SUMOXMLDefinitions.h:107
SUMO_ATTR_ORIG_PROJ
@ SUMO_ATTR_ORIG_PROJ
Definition: SUMOXMLDefinitions.h:830
SUMO_TAG_EDGE
@ SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
RONetHandler::myStartElement
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
Definition: RONetHandler.cpp:63
ProcessError
Definition: UtilExceptions.h:39
RONetHandler::myIgnoreInternal
const bool myIgnoreInternal
whether to ignore junction internal edges
Definition: RONetHandler.h:194
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
UtilExceptions.h
SUMO_ATTR_Y
@ SUMO_ATTR_Y
Definition: SUMOXMLDefinitions.h:399
SUMOVehicleParameter::Stop::endPos
double endPos
The stopping position end.
Definition: SUMOVehicleParameter.h:604
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
LINKSTATE_MINOR
@ LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
Definition: SUMOXMLDefinitions.h:1157
RONetHandler::parseEdge
void parseEdge(const SUMOSAXAttributes &attrs)
Parses and builds an edge.
Definition: RONetHandler.cpp:159
SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_FRIENDLY_POS
Definition: SUMOXMLDefinitions.h:765
SUMO_ATTR_POSITION
@ SUMO_ATTR_POSITION
Definition: SUMOXMLDefinitions.h:660
RONetHandler::~RONetHandler
virtual ~RONetHandler()
Destructor.
Definition: RONetHandler.cpp:59
SUMO_ATTR_FROM_LANE
@ SUMO_ATTR_FROM_LANE
Definition: SUMOXMLDefinitions.h:719
SUMO_ATTR_FROM
@ SUMO_ATTR_FROM
Definition: SUMOXMLDefinitions.h:639
SUMOVehicleParameter::Stop::startPos
double startPos
The stopping position start.
Definition: SUMOVehicleParameter.h:601
SUMO_TAG_RESTRICTION
@ SUMO_TAG_RESTRICTION
begin/end of the description of an edge restriction
Definition: SUMOXMLDefinitions.h:61
RONode::addOutgoing
void addOutgoing(ROEdge *edge)
Definition: RONode.h:83
SUMO_TAG_TAZ
@ SUMO_TAG_TAZ
a traffic assignment zone
Definition: SUMOXMLDefinitions.h:133
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
SUMOVehicleParameter::Stop::accessPos
std::vector< std::tuple< std::string, double, double > > accessPos
lanes and positions connected to this stop (only used by duarouter where Stop is used to store stoppi...
Definition: SUMOVehicleParameter.h:646
StringUtils.h
SUMO_TAG_BUS_STOP
@ SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:97
SUMO_TAG_TAZSINK
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
Definition: SUMOXMLDefinitions.h:137
RONetHandler::myCurrentEdge
ROEdge * myCurrentEdge
The currently built edge.
Definition: RONetHandler.h:203
SUMO_ATTR_STATE
@ SUMO_ATTR_STATE
The state of a link.
Definition: SUMOXMLDefinitions.h:708
SUMO_ATTR_PRIORITY
@ SUMO_ATTR_PRIORITY
Definition: SUMOXMLDefinitions.h:382
SUMO_ATTR_VIA
@ SUMO_ATTR_VIA
Definition: SUMOXMLDefinitions.h:723
RONetHandler::parseDistrictEdge
void parseDistrictEdge(const SUMOSAXAttributes &attrs, bool isSource)
Definition: RONetHandler.cpp:397
SUMO_ATTR_CONV_BOUNDARY
@ SUMO_ATTR_CONV_BOUNDARY
Definition: SUMOXMLDefinitions.h:828
InvalidArgument
Definition: UtilExceptions.h:56
ROEdge::getLength
double getLength() const
Returns the length of the edge.
Definition: ROEdge.h:204
RONode::setPosition
void setPosition(const Position &p)
Sets the position of the node.
Definition: RONode.cpp:39
SUMO_TAG_NET
@ SUMO_TAG_NET
root element of a network file
Definition: SUMOXMLDefinitions.h:45
SUMO_ATTR_KEY
@ SUMO_ATTR_KEY
Definition: SUMOXMLDefinitions.h:408
SVCAll
const SVCPermissions SVCAll
all VClasses are allowed
Definition: SUMOVehicleClass.cpp:146
SUMORouteHandler.h
SUMO_ATTR_VALUE
@ SUMO_ATTR_VALUE
Definition: SUMOXMLDefinitions.h:779
RONet::addDistrict
bool addDistrict(const std::string id, ROEdge *source, ROEdge *sink)
Definition: RONet.cpp:151
ROEdge::addLane
virtual void addLane(ROLane *lane)
Adds a lane to the edge while loading.
Definition: ROEdge.cpp:91
SUMOSAXAttributes::getNodeType
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
RONet::setPermissionsFound
void setPermissionsFound()
Definition: RONet.cpp:698
SUMO_ATTR_ALLOW
@ SUMO_ATTR_ALLOW
Definition: SUMOXMLDefinitions.h:782
SUMO_TAG_CONNECTION
@ SUMO_TAG_CONNECTION
connectio between two lanes
Definition: SUMOXMLDefinitions.h:202
RONode::addIncoming
void addIncoming(ROEdge *edge)
Definition: RONode.h:79
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
SUMO_ATTR_VCLASS
@ SUMO_ATTR_VCLASS
Definition: SUMOXMLDefinitions.h:450
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:46
LINKSTATE_ALLWAY_STOP
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
Definition: SUMOXMLDefinitions.h:1163
config.h
ROLane.h
ROAbstractEdgeBuilder::buildEdge
virtual ROEdge * buildEdge(const std::string &name, RONode *from, RONode *to, const int priority)=0
Builds an edge with the given name.
StringTokenizer.h
RONetHandler::parseDistrict
void parseDistrict(const SUMOSAXAttributes &attrs)
Definition: RONetHandler.cpp:378
SUMO_ATTR_NAME
@ SUMO_ATTR_NAME
Definition: SUMOXMLDefinitions.h:380
SUMOSAXAttributes::getEdgeFunc
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
SUMO_TAG_ACCESS
@ SUMO_TAG_ACCESS
An access point for a train stop.
Definition: SUMOXMLDefinitions.h:103
RONetHandler::myCurrentTypeID
std::string myCurrentTypeID
The id of the currently processed edge type.
Definition: RONetHandler.h:200
RONet::getRestrictions
const std::map< SUMOVehicleClass, double > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
Definition: RONet.cpp:127
RONetHandler::parseJunction
void parseJunction(const SUMOSAXAttributes &attrs)
Parses a junction's position.
Definition: RONetHandler.cpp:258
RONode
Base class for nodes used by the router.
Definition: RONode.h:45
ROEdge::setFunction
void setFunction(SumoXMLEdgeFunc func)
Sets the function of the edge.
Definition: ROEdge.h:114
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
RONet::getEdgeForLaneID
ROEdge * getEdgeForLaneID(const std::string &laneID) const
Retrieves an edge from the network when the lane id is given.
Definition: RONet.h:162
SUMO_ATTR_SHAPE
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:690
SUMO_ATTR_X
@ SUMO_ATTR_X
Definition: SUMOXMLDefinitions.h:398
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
PositionVector.h
ROEdge.h
SUMO_ATTR_VERSION
@ SUMO_ATTR_VERSION
Definition: SUMOXMLDefinitions.h:876
SUMOXMLDefinitions.h
ROAbstractEdgeBuilder
Interface for building instances of router-edges.
Definition: ROAbstractEdgeBuilder.h:53
RONetHandler::myNet
RONet & myNet
The net to store the information into.
Definition: RONetHandler.h:185
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:572
SUMO_TAG_JUNCTION
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
Definition: SUMOXMLDefinitions.h:59
RONetHandler::myNetworkVersion
double myNetworkVersion
the loaded network version
Definition: RONetHandler.h:188
LINKSTATE_STOP
@ LINKSTATE_STOP
This is an uncontrolled, minor link, has to stop.
Definition: SUMOXMLDefinitions.h:1161