52 myHaveWarnedAboutDeprecatedLanes(false),
53 myErrorMsgHandler(
OptionsCont::getOptions().getBool(
"ignore-errors.connections") ?
76 if (fromEdge ==
nullptr) {
80 if (toEdge ==
nullptr) {
85 WRITE_WARNINGF(
TL(
"Target edge '%' is not connected with '%'; the connection cannot be reset."), toEdge->
getID(), fromEdge->
getID());
93 if (!
parseLaneInfo(attrs, fromEdge, toEdge, &fromLane, &toLane)) {
116 if (fromEdge ==
nullptr) {
120 if (toEdge ==
nullptr && to.length() != 0) {
140 WRITE_ERROR(
"No additional connection attributes are permitted in connection from edge '" + fromEdge->
getID() +
"' unless '"
173 const std::string::size_type div = def.find(
"->");
174 if (div == std::string::npos) {
178 std::string fromDef = def.substr(0, div);
179 std::string toDef = def.substr(div + 2);
185 if (fromE ==
nullptr) {
189 if (toE ==
nullptr) {
213 " in connection from '%' to '%'.", fromLane, from->
getID(), to->
getID());
218 " in connection from '%' to '%'.", toLane, from->
getID(), to->
getID());
226 if (existing.size() > 0) {
227 assert(existing.size() == 1);
228 defaultCon = existing.front();
252 if (allow ==
"" && disallow ==
"") {
273 keepClear, contPos, visibility, speed, friction, length, customShape, uncontrolled, permissions, indirectLeft, edgeType, changeLeft, changeRight)) {
279 speed, friction, length, customShape, uncontrolled,
false, permissions, indirectLeft, edgeType, changeLeft, changeRight);
288 int* fromLane,
int* toLane) {
300 int* fromLane,
int* toLane) {
311 if (!ok || st.size() != 2) {
313 from->
getID() +
"' to '" + to->
getID() +
"'.");
345 if (node ==
nullptr) {
353 node->discardAllCrossings(
true);
356 WRITE_ERRORF(
TL(
"No edges specified for crossing at node '%'."), nodeID);
360 for (
const std::string&
id : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES, nodeID.c_str(), ok)) {
362 if (edge ==
nullptr) {
364 WRITE_ERRORF(
TL(
"Edge '%' for crossing at node '%' is not known."),
id, nodeID);
372 WRITE_ERRORF(
TL(
"Edge '%' does not touch node '%'."),
id, nodeID);
377 edges.push_back(edge);
383 if (node->isTLControlled() && !priority) {
385 WRITE_WARNINGF(
TL(
"Crossing at controlled node '%' must be prioritized"), nodeID);
390 WRITE_ERRORF(
TL(
"Unable to project shape for crossing at node '%'."), node->getID());
393 node->removeCrossing(edges);
395 if (node->checkCrossingDuplicated(edges)) {
408 width = existing->
width;
419 node->removeCrossing(edges);
422 node->addCrossing(edges, width, priority, tlIndex, tlIndex2, customShape);
433 std::vector<std::string> edgeIDs;
435 WRITE_ERRORF(
TL(
"No edges specified for walkingArea at node '%'."), nodeID);
438 for (
const std::string&
id : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES, nodeID.c_str(), ok)) {
440 if (edge ==
nullptr) {
441 WRITE_ERRORF(
TL(
"Edge '%' for walkingArea at node '%' is not known."),
id, nodeID);
444 if (node ==
nullptr) {
450 WRITE_ERRORF(
TL(
"Edge '%' does not touch node '%'."),
id, nodeID);
455 WRITE_ERRORF(
TL(
"Edge '%' does not touch node '%'."),
id, nodeID);
459 edges.push_back(edge);
#define WRITE_WARNINGF(...)
#define WRITE_ERRORF(...)
#define WRITE_WARNING(msg)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
KeepClear
keepClear status of connections
const SVCPermissions SVC_UNSPECIFIED
permissions not specified
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SUMO_TAG_PROHIBITION
prohibition of circulation between two edges
@ SUMO_TAG_CONNECTION
connectioon between two lanes
@ SUMO_TAG_WALKINGAREA
walking area for pedestrians
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_TAG_DEL
delete certain element (note: DELETE is a macro)
@ SUMO_ATTR_TLLINKINDEX2
link: the index of the opposite direction link of a pedestrian crossing
@ SUMO_ATTR_INDIRECT
Whether this connection is an indirect (left) turn.
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_VISIBILITY_DISTANCE
foe visibility distance of a link
@ SUMO_ATTR_TLLINKINDEX
link: the index of the link within the traffic light
@ SUMO_ATTR_KEEP_CLEAR
Whether vehicles must keep the junction clear.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
void informf(const std::string &format, T value, Targs... Fargs)
adds a new formatted message
NBEdge * getFrom() const
returns the from-edge (start of the connection)
static const NBConnection InvalidConnection
Storage for edges, including some functionality operating on multiple edges.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
void addPostProcessConnection(const std::string &from, int fromLane, const std::string &to, int toLane, bool mayDefinitelyPass, KeepClear keepClear, double contPos, double visibility, double speed, double friction, double length, const PositionVector &customShape, bool uncontrolled, bool warnOnly, SVCPermissions permissions=SVC_UNSPECIFIED, bool indirectLeft=false, const std::string &edgeType="", SVCPermissions changeLeft=SVC_UNSPECIFIED, SVCPermissions changeRight=SVC_UNSPECIFIED)
Adds a connection which could not be set during loading.
bool wasIgnored(std::string id) const
Returns whether the edge with the id was ignored during parsing.
bool wasRemoved(std::string id) const
Returns whether the edge with the id was deleted explicitly.
The representation of a single edge during network building.
EdgeBuildingStep getStep() const
The building step of this edge.
bool addEdge2EdgeConnection(NBEdge *dest, bool overrideRemoval=false, SVCPermissions permission=SVC_UNSPECIFIED)
Adds a connection to another edge.
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, KeepClear keepClear=KEEPCLEAR_UNSPECIFIED, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, double friction=UNSPECIFIED_FRICTION, double length=myDefaultConnectionLength, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions permissions=SVC_UNSPECIFIED, const bool indirectLeft=false, const std::string &edgeType="", SVCPermissions changeLeft=SVC_UNSPECIFIED, SVCPermissions changeRight=SVC_UNSPECIFIED, bool postProcess=false)
Adds a connection between the specified this edge's lane and an approached one.
const std::string & getID() const
NBNode * getToNode() const
Returns the destination node of the edge.
@ EDGE2EDGES
The relationships between edges are computed/loaded.
@ LANES2EDGES
Lanes to edges - relationships are computed/loaded.
@ LANES2LANES_USER
Lanes to lanes - relationships are loaded; no recheck is necessary/wished.
std::vector< Connection > getConnectionsFromLane(int lane, const NBEdge *to=nullptr, int toLane=-1) const
Returns connections from a given lane.
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false, const bool keepPossibleTurns=false)
Removes the specified connection(s)
bool isConnectedTo(const NBEdge *e, const bool ignoreTurnaround=false) const
Returns the information whethe a connection to the given edge has been added (or computed)
std::string getLaneID(int lane) const
get lane ID
@ USER
The connection was given by the user.
static const double UNSPECIFIED_WIDTH
unspecified lane width
bool hasConnectionTo(const NBEdge *destEdge, int destLane, int fromLane=-1) const
Retrieves info about a connection to a certain lane of a certain edge.
NBNode * getFromNode() const
Returns the origin node of the edge.
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
A definition of a pedestrian crossing.
int customTLIndex
the custom traffic light index of this crossing (if controlled)
bool priority
whether the pedestrians have priority
double width
This crossing's width.
Container for nodes during the netbuilding process.
bool wasRemoved(std::string id) const
Returns whether the node with the id was deleted explicitly.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Represents a single node (junction) during network building.
void addWalkingAreaShape(EdgeVector edges, const PositionVector &shape, double width)
add custom shape for walkingArea
void invalidateTLS(NBTrafficLightLogicCont &tlCont, bool removedConnections, bool addedConnections)
causes the traffic light to be computed anew
void addSortedLinkFoes(const NBConnection &mayDrive, const NBConnection &mustStop)
add shorted link FOES
A container for traffic light definitions and built programs.
MsgHandler *const myErrorMsgHandler
the handler for loading errors
bool parseLaneInfo(const SUMOSAXAttributes &attributes, NBEdge *fromEdge, NBEdge *toEdge, int *fromLane, int *toLane)
Parses information about lane-2-lane connection when it describes a lane-2-lane relationship.
bool parseLaneDefinition(const SUMOSAXAttributes &attributes, int *fromLane, int *toLane)
Parses information about lane-2-lane connection.
bool myHaveWarnedAboutDeprecatedLanes
Information whether we have a deprecated attribute.
NIXMLConnectionsHandler(NBEdgeCont &ec, NBNodeCont &nc, NBTrafficLightLogicCont &tlc)
Constructor.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to (when invalidating tls)
bool parseDeprecatedLaneDefinition(const SUMOSAXAttributes &attributes, NBEdge *fromEdge, NBEdge *toEdge, int *fromLane, int *toLane)
Parses information about lane-2-lane connection in deprecated format.
NBEdgeCont & myEdgeCont
The edge container to fill.
NBConnection parseConnection(const std::string &defRole, const std::string &def)
Returns the connection described by def.
void addWalkingArea(const SUMOSAXAttributes &attrs)
Parses a walkingArea and updates the referenced node.
NBNodeCont & myNodeCont
The edge container to fill.
~NIXMLConnectionsHandler()
Destructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void parseLaneBound(const SUMOSAXAttributes &attrs, NBEdge *from, NBEdge *to)
Parses a connection when it describes a lane-2-lane relationship.
void addCrossing(const SUMOSAXAttributes &attrs)
Parses a crossing and updates the referenced node.
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
static OptionsCont & getOptions()
Retrieves the options.
static const PositionVector EMPTY
empty Vector
Encapsulated SAX-Attributes.
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.
static int toIntSecure(const std::string &sData, int def)
converts a string into the integer value described by it
A structure which describes a connection between edges or lanes.
double speed
custom speed for connection
KeepClear keepClear
whether the junction must be kept clear when using this connection
double customLength
custom length for connection
bool uncontrolled
check if Connection is uncontrolled
PositionVector customShape
custom shape for connection
bool mayDefinitelyPass
Information about being definitely free to drive (on-ramps)
double contPos
custom position for internal junction on this connection
double visibility
custom foe visiblity for connection