54 myHaveWarnedAboutDeprecatedLanes(false),
55 myErrorMsgHandler(
OptionsCont::getOptions().getBool(
"ignore-errors.connections") ?
58 myLastParameterised(nullptr) {
126 const std::string::size_type div = def.find(
"->");
127 if (div == std::string::npos) {
131 std::string fromDef = def.substr(0, div);
132 std::string toDef = def.substr(div + 2);
138 if (fromE ==
nullptr) {
142 if (toE ==
nullptr) {
166 " in connection from '%' to '%'.", fromLane, from->
getID(), to->
getID());
171 " in connection from '%' to '%'.", toLane, from->
getID(), to->
getID());
179 if (existing.size() > 0) {
180 assert(existing.size() == 1);
181 defaultCon = existing.front();
208 if (allow ==
"" && disallow ==
"") {
228 keepClear, contPos, visibility, speed, friction, length, customShape, uncontrolled, permissions, indirectLeft, edgeType, changeLeft, changeRight)) {
234 speed, friction, length, customShape, uncontrolled,
false, permissions, indirectLeft, edgeType, changeLeft, changeRight);
243 int* fromLane,
int* toLane) {
255 int* fromLane,
int* toLane) {
266 if (!ok || st.size() != 2) {
268 from->
getID() +
"' to '" + to->
getID() +
"'.");
303 if (fromEdge ==
nullptr) {
307 if (toEdge ==
nullptr) {
312 WRITE_WARNINGF(
TL(
"Target edge '%' is not connected with '%'; the connection cannot be reset."), toEdge->
getID(), fromEdge->
getID());
320 if (!
parseLaneInfo(attrs, fromEdge, toEdge, &fromLane, &toLane)) {
344 if (fromEdge ==
nullptr) {
348 if (toEdge ==
nullptr && to.length() != 0) {
368 WRITE_ERROR(
"No additional connection attributes are permitted in connection from edge '" + fromEdge->
getID() +
"' unless '"
384 if (node ==
nullptr) {
392 node->discardAllCrossings(
true);
395 WRITE_ERRORF(
TL(
"No edges specified for crossing at node '%'."), nodeID);
399 for (
const std::string&
id : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES, nodeID.c_str(), ok)) {
401 if (edge ==
nullptr) {
403 WRITE_ERRORF(
TL(
"Edge '%' for crossing at node '%' is not known."),
id, nodeID);
411 WRITE_ERRORF(
TL(
"Edge '%' does not touch node '%'."),
id, nodeID);
416 edges.push_back(edge);
422 if (node->isTLControlled() && !priority) {
424 WRITE_WARNINGF(
TL(
"Crossing at controlled node '%' must be prioritized"), nodeID);
429 WRITE_ERRORF(
TL(
"Unable to project shape for crossing at node '%'."), node->getID());
432 node->removeCrossing(edges);
434 if (node->checkCrossingDuplicated(edges)) {
447 width = existing->
width;
458 node->removeCrossing(edges);
461 NBNode::Crossing* c = node->addCrossing(edges, width, priority, tlIndex, tlIndex2, customShape);
473 std::vector<std::string> edgeIDs;
475 WRITE_ERRORF(
TL(
"No edges specified for walkingArea at node '%'."), nodeID);
478 for (
const std::string&
id : attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES, nodeID.c_str(), ok)) {
480 if (edge ==
nullptr) {
481 WRITE_ERRORF(
TL(
"Edge '%' for walkingArea at node '%' is not known."),
id, nodeID);
484 if (node ==
nullptr) {
490 WRITE_ERRORF(
TL(
"Edge '%' does not touch node '%'."),
id, nodeID);
495 WRITE_ERRORF(
TL(
"Edge '%' does not touch node '%'."),
id, nodeID);
499 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_CONNECTIONS
root element of connections file
@ 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_PARAM
parameter associated to a certain key
@ 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)
const std::string & getFileName() const
returns the current file name
static GeoConvHelper * getLoadedPlain(const std::string &plainFile, const std::string &suffix=".edg.xml")
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.
NBNode * getToNode() const
Returns the destination node of the edge.
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.
@ 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.
const std::string & getID() const
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.
NBNode * getFromNode() const
Returns the origin node of the edge.
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.
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.
static GeoConvHelper * loadLocation(const SUMOSAXAttributes &attrs, bool setLoaded=true)
Parses network location description and registers it with GeoConveHelper::setLoaded.
void delConnection(const SUMOSAXAttributes &attrs)
Parses a delete element that specifies a connection to delete.
MsgHandler *const myErrorMsgHandler
the handler for loading errors
void parseConnection(const SUMOSAXAttributes &attrs)
Parses a connection and adds it to the referenced edge.
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.
void addProhibition(const SUMOSAXAttributes &attrs)
Parses a prohibition and updates the referenced node.
NBEdgeCont & myEdgeCont
The edge container to fill.
void myEndElement(int element)
Called when a closing tag occurs.
void addWalkingArea(const SUMOSAXAttributes &attrs)
Parses a walkingArea and updates the referenced node.
Parameterised * myLastParameterised
last item the could receive parameters
NBConnection parseConnectionDef(const std::string &defRole, const std::string &def)
Returns the connection described by def.
NBNodeCont & myNodeCont
The edge container to fill.
~NIXMLConnectionsHandler()
Destructor.
GeoConvHelper * myLocation
The coordinate transformation which was used compute the custom shape coordinates for connections and...
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)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
static const PositionVector EMPTY
empty Vector
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.
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