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-2022 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:
94  parseStoppingPlace(attrs, (SumoXMLTag)element);
95  break;
96  case SUMO_TAG_ACCESS:
97  parseAccess(attrs);
98  break;
99  case SUMO_TAG_TAZ:
100  parseDistrict(attrs);
101  break;
102  case SUMO_TAG_TAZSOURCE:
103  parseDistrictEdge(attrs, true);
104  break;
105  case SUMO_TAG_TAZSINK:
106  parseDistrictEdge(attrs, false);
107  break;
108  case SUMO_TAG_TYPE: {
109  bool ok = true;
110  myCurrentTypeID = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
111  break;
112  }
113  case SUMO_TAG_RESTRICTION: {
114  bool ok = true;
115  const SUMOVehicleClass svc = getVehicleClassID(attrs.get<std::string>(SUMO_ATTR_VCLASS, myCurrentTypeID.c_str(), ok));
116  const double speed = attrs.get<double>(SUMO_ATTR_SPEED, myCurrentTypeID.c_str(), ok);
117  if (ok) {
118  myNet.addRestriction(myCurrentTypeID, svc, speed);
119  }
120  break;
121  }
122  case SUMO_TAG_PARAM:
123  addParam(attrs);
124  break;
125  default:
126  break;
127  }
128 }
129 
130 
131 void
133  switch (element) {
134  case SUMO_TAG_NET:
135  // build junction graph
136  for (std::set<std::string>::const_iterator it = myUnseenNodeIDs.begin(); it != myUnseenNodeIDs.end(); ++it) {
137  WRITE_ERROR("Unknown node '" + *it + "'.");
138  }
139  break;
140  default:
141  break;
142  }
143 }
144 
145 
146 void
148  bool ok = true;
149  const std::string key = attrs.get<std::string>(SUMO_ATTR_KEY, nullptr, ok);
150  // circumventing empty string test
151  const std::string val = attrs.hasAttribute(SUMO_ATTR_VALUE) ? attrs.getString(SUMO_ATTR_VALUE) : "";
152  // add parameter in current created element, or in myLoadedParameterised
153  if (myCurrentEdge != nullptr) {
154  myCurrentEdge->setParameter(key, val);
155  }
156 }
157 
158 
159 void
161  // get the id, report an error if not given or empty...
162  bool ok = true;
163  myCurrentName = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
164  if (!ok) {
165  throw ProcessError();
166  }
167  const SumoXMLEdgeFunc func = attrs.getEdgeFunc(ok);
168  if (!ok) {
169  WRITE_ERROR("Edge '" + myCurrentName + "' has an unknown type.");
170  return;
171  }
172  // get the edge
173  std::string from;
174  std::string to;
175  int priority;
176  myCurrentEdge = nullptr;
178  assert(myCurrentName[0] == ':');
180  from = junctionID;
181  to = junctionID;
182  priority = -1;
183  } else {
184  from = attrs.get<std::string>(SUMO_ATTR_FROM, myCurrentName.c_str(), ok);
185  to = attrs.get<std::string>(SUMO_ATTR_TO, myCurrentName.c_str(), ok);
186  priority = attrs.get<int>(SUMO_ATTR_PRIORITY, myCurrentName.c_str(), ok);
187  if (!ok) {
188  return;
189  }
190  }
191  RONode* fromNode = myNet.getNode(from);
192  if (fromNode == nullptr) {
193  myUnseenNodeIDs.insert(from);
194  fromNode = new RONode(from);
195  myNet.addNode(fromNode);
196  }
197  RONode* toNode = myNet.getNode(to);
198  if (toNode == nullptr) {
199  myUnseenNodeIDs.insert(to);
200  toNode = new RONode(to);
201  myNet.addNode(toNode);
202  }
203  // build the edge
204  myCurrentEdge = myEdgeBuilder.buildEdge(myCurrentName, fromNode, toNode, priority);
205  // set the type
206  myCurrentEdge->setRestrictions(myNet.getRestrictions(attrs.getOpt<std::string>(SUMO_ATTR_TYPE, myCurrentName.c_str(), ok, "")));
207  myCurrentEdge->setFunction(func);
208 
209  if (myNet.addEdge(myCurrentEdge)) {
210  fromNode->addOutgoing(myCurrentEdge);
211  toNode->addIncoming(myCurrentEdge);
212  const std::string bidi = attrs.getOpt<std::string>(SUMO_ATTR_BIDI, myCurrentName.c_str(), ok, "");
213  if (bidi != "") {
214  myBidiEdges[myCurrentEdge] = bidi;
215  }
216  } else {
217  myCurrentEdge = nullptr;
218  }
219 }
220 
221 
222 void
224  if (myCurrentEdge == nullptr) {
225  // was an internal edge to skip or an error occurred
226  return;
227  }
228  bool ok = true;
229  // get the id, report an error if not given or empty...
230  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
231  if (!ok) {
232  return;
233  }
234  // get the speed
235  double maxSpeed = attrs.get<double>(SUMO_ATTR_SPEED, id.c_str(), ok);
236  double length = attrs.get<double>(SUMO_ATTR_LENGTH, id.c_str(), ok);
237  std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "");
238  std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
239  const PositionVector shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
240  if (!ok) {
241  return;
242  }
243  if (shape.size() < 2) {
244  WRITE_ERROR("Ignoring lane '" + id + "' with broken shape.");
245  return;
246  }
247  // get the length
248  // get the vehicle classes
249  SVCPermissions permissions = parseVehicleClasses(allow, disallow, myNetworkVersion);
250  if (permissions != SVCAll) {
252  }
253  // add when both values are valid
254  if (maxSpeed > 0 && length > 0 && id.length() > 0) {
255  myCurrentEdge->addLane(new ROLane(id, myCurrentEdge, length, maxSpeed, permissions, shape));
256  } else {
257  WRITE_WARNING("Ignoring lane '" + id + "' with speed " + toString(maxSpeed) + " and length " + toString(length));
258  }
259 }
260 
261 
262 void
264  bool ok = true;
265  // get the id, report an error if not given or empty...
266  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
267  if (attrs.getNodeType(ok) == SumoXMLNodeType::INTERNAL) {
268  return;
269  }
270  myUnseenNodeIDs.erase(id);
271  // get the position of the node
272  const double x = attrs.get<double>(SUMO_ATTR_X, id.c_str(), ok);
273  const double y = attrs.get<double>(SUMO_ATTR_Y, id.c_str(), ok);
274  const double z = attrs.getOpt<double>(SUMO_ATTR_Z, id.c_str(), ok, 0.);
275  if (!ok) {
276  return;
277  }
278  RONode* n = myNet.getNode(id);
279  if (n == nullptr) {
280  WRITE_WARNING("Skipping isolated junction '" + id + "'.");
281  } else {
282  n->setPosition(Position(x, y, z));
283  }
284 }
285 
286 
287 void
289  bool ok = true;
290  std::string fromID = attrs.get<std::string>(SUMO_ATTR_FROM, nullptr, ok);
291  std::string toID = attrs.get<std::string>(SUMO_ATTR_TO, nullptr, ok);
292  const int fromLane = attrs.get<int>(SUMO_ATTR_FROM_LANE, nullptr, ok);
293  const int toLane = attrs.get<int>(SUMO_ATTR_TO_LANE, nullptr, ok);
294  std::string dir = attrs.get<std::string>(SUMO_ATTR_DIR, nullptr, ok);
295  std::string viaID = attrs.getOpt<std::string>(SUMO_ATTR_VIA, nullptr, ok, "");
296  ROEdge* from = myNet.getEdge(fromID);
297  ROEdge* to = myNet.getEdge(toID);
298  if (from == nullptr) {
299  throw ProcessError("unknown from-edge '" + fromID + "' in connection");
300  }
301  if (to == nullptr) {
302  throw ProcessError("unknown to-edge '" + toID + "' in connection");
303  }
304  if ((int)from->getLanes().size() <= fromLane) {
305  throw ProcessError("invalid fromLane '" + toString(fromLane) + "' in connection from '" + fromID + "'.");
306  }
307  if ((int)to->getLanes().size() <= toLane) {
308  throw ProcessError("invalid toLane '" + toString(toLane) + "' in connection to '" + toID + "'.");
309  }
310  if (myIgnoreInternal || viaID == "") {
311  from->getLanes()[fromLane]->addOutgoingLane(to->getLanes()[toLane]);
312  from->addSuccessor(to, nullptr, dir);
313  } else {
315  if (via == nullptr) {
316  throw ProcessError("unknown via-edge '" + viaID + "' in connection");
317  }
318  from->getLanes()[fromLane]->addOutgoingLane(to->getLanes()[toLane], via);
319  from->addSuccessor(to, via, dir);
320  via->addSuccessor(to, nullptr, dir);
321  LinkState state = SUMOXMLDefinitions::LinkStates.get(attrs.get<std::string>(SUMO_ATTR_STATE, nullptr, ok));
322  if (state == LINKSTATE_MINOR || state == LINKSTATE_EQUAL || state == LINKSTATE_STOP || state == LINKSTATE_ALLWAY_STOP) {
324  }
325  }
326 }
327 
328 
329 void
331  bool ok = true;
333  // get the id, throw if not given or empty...
334  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, toString(element).c_str(), ok);
335  // get the lane
336  myCurrentStoppingPlace->lane = attrs.get<std::string>(SUMO_ATTR_LANE, toString(element).c_str(), ok);
337  if (!ok) {
338  throw ProcessError();
339  }
341  if (edge == nullptr) {
342  throw InvalidArgument("Unknown lane '" + myCurrentStoppingPlace->lane + "' for " + toString(element) + " '" + id + "'.");
343  }
344  // get the positions
345  myCurrentStoppingPlace->startPos = attrs.getOpt<double>(SUMO_ATTR_STARTPOS, id.c_str(), ok, 0.);
346  myCurrentStoppingPlace->endPos = attrs.getOpt<double>(SUMO_ATTR_ENDPOS, id.c_str(), ok, edge->getLength());
347  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, id.c_str(), ok, false);
348  if (!ok || (SUMORouteHandler::checkStopPos(myCurrentStoppingPlace->startPos, myCurrentStoppingPlace->endPos, edge->getLength(), POSITION_EPS, friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
349  throw InvalidArgument("Invalid position for " + toString(element) + " '" + id + "'.");
350  }
351  // 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
352  myCurrentStoppingPlace->busstop = attrs.getOpt<std::string>(SUMO_ATTR_NAME, id.c_str(), ok, "");
353  // this is a hack: the actType is not used when using this to encode a stopping place
356 }
357 
358 
359 void
361  bool ok = true;
362  const std::string lane = attrs.get<std::string>(SUMO_ATTR_LANE, "access", ok);
363  const ROEdge* edge = myNet.getEdgeForLaneID(lane);
364  if (edge == nullptr) {
365  throw InvalidArgument("Unknown lane '" + lane + "' for access.");
366  }
367  if ((edge->getPermissions() & SVC_PEDESTRIAN) == 0) {
368  WRITE_WARNING("Ignoring invalid access from non-pedestrian edge '" + edge->getID() + "'.");
369  return;
370  }
371  double pos = attrs.getOpt<double>(SUMO_ATTR_POSITION, "access", ok, 0.);
372  double length = attrs.getOpt<double>(SUMO_ATTR_LENGTH, "access", ok, -1);
373  const bool friendlyPos = attrs.getOpt<bool>(SUMO_ATTR_FRIENDLY_POS, "access", ok, false);
374  if (!ok || (SUMORouteHandler::checkStopPos(pos, pos, edge->getLength(), 0., friendlyPos) != SUMORouteHandler::StopPos::STOPPOS_VALID)) {
375  throw InvalidArgument("Invalid position " + toString(pos) + " for access on lane '" + lane + "'.");
376  }
377  if (!ok) {
378  throw ProcessError();
379  }
380  if (length < 0) {
381  const Position accPos = myNet.getLane(lane)->geometryPositionAtOffset(pos);
382  const double stopCenter = (myCurrentStoppingPlace->startPos + myCurrentStoppingPlace->endPos) / 2;
384  length = accPos.distanceTo(stopPos);
385  }
386  myCurrentStoppingPlace->accessPos.push_back(std::make_tuple(lane, pos, length));
387 }
388 
389 
390 void
392  myCurrentEdge = nullptr;
393  bool ok = true;
394  myCurrentName = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
395  if (!ok) {
396  return;
397  }
398  myNet.addDistrict(myCurrentName, myEdgeBuilder.buildEdge(myCurrentName + "-source", nullptr, nullptr, 0), myEdgeBuilder.buildEdge(myCurrentName + "-sink", nullptr, nullptr, 0));
399  if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
400  std::vector<std::string> desc = attrs.getStringVector(SUMO_ATTR_EDGES);
401  for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
403  myNet.addDistrictEdge(myCurrentName, *i, false);
404  }
405  }
406 }
407 
408 
409 void
411  bool ok = true;
412  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, myCurrentName.c_str(), ok);
413  myNet.addDistrictEdge(myCurrentName, id, isSource);
414 }
415 
416 void
418  bool ok = true;
419  PositionVector s = attrs.get<PositionVector>(SUMO_ATTR_NET_OFFSET, nullptr, ok);
420  Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, nullptr, ok);
421  Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, nullptr, ok);
422  std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, nullptr, ok);
423  if (ok) {
424  Position networkOffset = s[0];
425  GeoConvHelper::init(proj, networkOffset, origBoundary, convBoundary);
426  }
427 }
428 
429 
430 /****************************************************************************/
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:288
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
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_CHARGING_STATION
A Charging Station.
@ 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_OVERHEAD_WIRE_SEGMENT
An overhead wire segment.
@ 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:46
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:37
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:242
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:520
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:109
void setTimePenalty(double value)
Definition: ROEdge.h:140
A single lane the router may use.
Definition: ROLane.h:48
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: ROLane.h:127
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:815
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:137
void addStoppingPlace(const std::string &id, const SumoXMLTag category, SUMOVehicleParameter::Stop *stop)
Definition: RONet.cpp:256
bool addDistrictEdge(const std::string tazID, const std::string edgeID, const bool isSource)
Definition: RONet.cpp:180
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition: RONet.cpp:131
virtual bool addEdge(ROEdge *edge)
Definition: RONet.cpp:147
RONode * getNode(const std::string &id) const
Retrieves an node from the network.
Definition: RONet.h:193
ROLane * getLane(const std::string &laneID) const
Retrieves a lane rom the network given it's id.
Definition: RONet.cpp:758
void addNode(RONode *node)
Definition: RONet.cpp:247
ROEdge * getEdgeForLaneID(const std::string &laneID) const
Retrieves an edge from the network when the lane id is given.
Definition: RONet.cpp:753
bool addDistrict(const std::string id, ROEdge *source, ROEdge *sink)
Definition: RONet.cpp:161
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.
std::string actType
act Type (only used by Persons) (used by NETEDIT)
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 std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
static StringBijection< LinkState > LinkStates
link states
static std::string getJunctionIDFromInternalEdge(const std::string internalEdge)
return the junction id when given an edge of type internal, crossing or WalkingArea
T get(const std::string &str) const