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