Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
RONetHandler.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-2023 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>
37#include "ROEdge.h"
38#include "ROLane.h"
39#include "RONode.h"
40#include "RONet.h"
41#include "RONetHandler.h"
43
44
45// ===========================================================================
46// method definitions
47// ===========================================================================
48RONetHandler::RONetHandler(RONet& net, ROAbstractEdgeBuilder& eb, const bool ignoreInternal, const double minorPenalty) :
49 SUMOSAXHandler("sumo-network"),
50 myNet(net),
51 myNetworkVersion(0, 0),
52 myEdgeBuilder(eb), myIgnoreInternal(ignoreInternal),
53 myCurrentName(), myCurrentEdge(nullptr), myCurrentStoppingPlace(nullptr),
54 myMinorPenalty(minorPenalty)
55{}
56
57
59
60
61void
63 const SUMOSAXAttributes& attrs) {
64 switch (element) {
66 setLocation(attrs);
67 break;
68 case SUMO_TAG_NET: {
69 bool ok;
70 myNetworkVersion = StringUtils::toVersion(attrs.get<std::string>(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;
83 parseJunction(attrs);
84 break;
86 parseConnection(attrs);
87 break;
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;
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 }
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) {
119 }
120 break;
121 }
122 case SUMO_TAG_PARAM:
123 addParam(attrs);
124 break;
125 default:
126 break;
127 }
128}
129
130
131void
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_ERRORF(TL("Unknown node '%'."), *it);
138 }
139 break;
140 default:
141 break;
142 }
143}
144
145
146void
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
159void
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 }
168 if (!ok) {
169 return;
170 }
171 // get the edge
172 std::string from;
173 std::string to;
174 int priority;
175 myCurrentEdge = nullptr;
177 assert(myCurrentName[0] == ':');
179 from = junctionID;
180 to = junctionID;
181 priority = -1;
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
207
209 fromNode->addOutgoing(myCurrentEdge);
210 toNode->addIncoming(myCurrentEdge);
211 const std::string bidi = attrs.getOpt<std::string>(SUMO_ATTR_BIDI, myCurrentName.c_str(), ok, "");
212 if (bidi != "") {
214 }
215 } else {
216 myCurrentEdge = nullptr;
217 }
218}
219
220
221void
223 if (myCurrentEdge == nullptr) {
224 // was an internal edge to skip or an error occurred
225 return;
226 }
227 bool ok = true;
228 // get the id, report an error if not given or empty...
229 std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
230 if (!ok) {
231 return;
232 }
233 // get the speed
234 double maxSpeed = attrs.get<double>(SUMO_ATTR_SPEED, id.c_str(), ok);
235 double length = attrs.get<double>(SUMO_ATTR_LENGTH, id.c_str(), ok);
236 std::string allow = attrs.getOpt<std::string>(SUMO_ATTR_ALLOW, id.c_str(), ok, "");
237 std::string disallow = attrs.getOpt<std::string>(SUMO_ATTR_DISALLOW, id.c_str(), ok, "");
238 const PositionVector shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok);
239 if (!ok) {
240 return;
241 }
242 if (shape.size() < 2) {
243 WRITE_ERRORF(TL("Ignoring lane '%' with broken shape."), id);
244 return;
245 }
246 // get the length
247 // get the vehicle classes
248 SVCPermissions permissions = parseVehicleClasses(allow, disallow, myNetworkVersion);
249 if (permissions != SVCAll) {
251 }
252 // add when both values are valid
253 if (maxSpeed > 0 && length > 0 && id.length() > 0) {
254 myCurrentEdge->addLane(new ROLane(id, myCurrentEdge, length, maxSpeed, permissions, shape));
255 } else {
256 WRITE_WARNING("Ignoring lane '" + id + "' with speed " + toString(maxSpeed) + " and length " + toString(length));
257 }
258}
259
260
261void
263 bool ok = true;
264 // get the id, report an error if not given or empty...
265 std::string id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, ok);
266 const SumoXMLNodeType type = attrs.get<SumoXMLNodeType>(SUMO_ATTR_TYPE, id.c_str(), ok);
267 if (type == 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_WARNINGF(TL("Skipping isolated junction '%'."), id);
281 } else {
282 n->setPosition(Position(x, y, z));
283 }
284}
285
286
287void
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(TLF("unknown from-edge '%' in connection", fromID));
300 }
301 if (to == nullptr) {
302 throw ProcessError(TLF("unknown to-edge '%' in connection", toID));
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(TLF("unknown via-edge '%' in connection", viaID));
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
329void
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);
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
359void
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_WARNINGF(TL("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
390void
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 ROEdge* const sink = myEdgeBuilder.buildEdge(myCurrentName + "-sink", nullptr, nullptr, 0);
399 ROEdge* const source = myEdgeBuilder.buildEdge(myCurrentName + "-source", nullptr, nullptr, 0);
400 myNet.addDistrict(myCurrentName, source, sink);
401 if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
402 const std::vector<std::string>& desc = attrs.get<std::vector<std::string> >(SUMO_ATTR_EDGES, myCurrentName.c_str(), ok);
403 for (const std::string& eID : desc) {
406 }
407 }
408}
409
410
411void
413 bool ok = true;
414 std::string id = attrs.get<std::string>(SUMO_ATTR_ID, myCurrentName.c_str(), ok);
415 myNet.addDistrictEdge(myCurrentName, id, isSource);
416}
417
418void
420 bool ok = true;
421 PositionVector s = attrs.get<PositionVector>(SUMO_ATTR_NET_OFFSET, nullptr, ok);
422 Boundary convBoundary = attrs.get<Boundary>(SUMO_ATTR_CONV_BOUNDARY, nullptr, ok);
423 Boundary origBoundary = attrs.get<Boundary>(SUMO_ATTR_ORIG_BOUNDARY, nullptr, ok);
424 std::string proj = attrs.get<std::string>(SUMO_ATTR_ORIG_PROJ, nullptr, ok);
425 if (ok) {
426 Position networkOffset = s[0];
427 GeoConvHelper::init(proj, networkOffset, origBoundary, convBoundary);
428 }
429}
430
431
432/****************************************************************************/
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:271
#define WRITE_ERRORF(...)
Definition MsgHandler.h:280
#define WRITE_WARNING(msg)
Definition MsgHandler.h:270
#define TL(string)
Definition MsgHandler.h:287
#define TLF(string,...)
Definition MsgHandler.h:288
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
connectioon 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.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
@ 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_FUNCTION
@ 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:244
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:96
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:215
virtual void addSuccessor(ROEdge *s, ROEdge *via=nullptr, std::string dir="")
Adds information about a connected edge.
Definition ROEdge.cpp:111
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
virtual void myEndElement(int element)
Called when a closing tag occurs.
MMVersion myNetworkVersion
the loaded network version
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.
void addParam(const SUMOSAXAttributes &attrs)
assign arbitrary vehicle parameters
ROEdge * myCurrentEdge
The currently built edge.
std::string myCurrentTypeID
The id of the currently processed edge type.
void parseStoppingPlace(const SUMOSAXAttributes &attrs, const SumoXMLTag element)
const bool myIgnoreInternal
whether to ignore junction internal edges
void parseConnection(const SUMOSAXAttributes &attrs)
std::map< ROEdge *, std::string > myBidiEdges
temporary storage for bidi attributes (to be resolved after loading all edges)
ROAbstractEdgeBuilder & myEdgeBuilder
The object used to build of edges of the desired type.
virtual void parseLane(const SUMOSAXAttributes &attrs)
Parses and builds a lane.
SUMOVehicleParameter::Stop * myCurrentStoppingPlace
The currently built stopping place.
RONet & myNet
The net to store the information into.
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
void setLocation(const SUMOSAXAttributes &attrs)
Parses network location description.
The router's network representation.
Definition RONet.h:62
void setPermissionsFound()
Definition RONet.cpp:869
RONode * getNode(const std::string &id) const
Retrieves an node from the network.
Definition RONet.h:193
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:150
void addStoppingPlace(const std::string &id, const SumoXMLTag category, SUMOVehicleParameter::Stop *stop)
Definition RONet.cpp:277
bool addDistrictEdge(const std::string tazID, const std::string edgeID, const bool isSource)
Definition RONet.cpp:197
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
Definition RONet.h:157
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
Definition RONet.cpp:144
virtual bool addEdge(ROEdge *edge)
Definition RONet.cpp:160
ROLane * getLane(const std::string &laneID) const
Retrieves a lane rom the network given it's id.
Definition RONet.cpp:811
void addNode(RONode *node)
Definition RONet.cpp:268
ROEdge * getEdgeForLaneID(const std::string &laneID) const
Retrieves an edge from the network when the lane id is given.
Definition RONet.cpp:805
bool addDistrict(const std::string id, ROEdge *source, ROEdge *sink)
Definition RONet.cpp:174
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.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
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
static MMVersion toVersion(const std::string &sData)
to version