Eclipse SUMO - Simulation of Urban MObility
NBNodeCont Class Reference

Container for nodes during the netbuilding process. More...

#include <NBNodeCont.h>

Collaboration diagram for NBNodeCont:
[legend]

Public Types

typedef std::pair< NBNode *, double > NodeAndDist
 
typedef std::vector< NodeSetNodeClusters
 Definition of a node cluster container. More...
 

Public Member Functions

void analyzeCluster (NodeSet cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type, SumoXMLNodeType &nodeType)
 
void clear ()
 deletes all nodes More...
 
void computeLanes2Lanes ()
 divides the incoming lanes on outgoing lanes More...
 
void computeLogics (const NBEdgeCont &ec)
 build the list of outgoing edges and lanes More...
 
void computeLogics2 (const NBEdgeCont &ec, OptionsCont &oc)
 compute right-of-way logic for all lane-to-lane connections More...
 
void computeNodeShapes (double mismatchThreshold=-1)
 Compute the junction shape for this node. More...
 
void discardRailSignals ()
 
void discardTrafficLights (NBTrafficLightLogicCont &tlc, bool geometryLike, bool guessSignals)
 
std::vector< std::string > getAllNames () const
 get all node names More...
 
std::string getFreeID ()
 generates a new node ID More...
 
const std::vector< std::set< std::string > > & getJoinedClusters () const
 gets all joined clusters (see doc for myClusters2Join) More...
 
int guessFringe ()
 guess and mark fringe nodes More...
 
void markAsNotTLS (const NBNode *node)
 mark a node as explicitly not controlled by a TLS More...
 
void markAsSplit (const NBNode *node)
 mark a node as being created form a split More...
 
 NBNodeCont ()
 Constructor. More...
 
void printBuiltNodesStatistics () const
 Prints statistics about built nodes. More...
 
void registerJoinedCluster (const NodeSet &cluster)
 gets all joined clusters (see doc for myClusters2Join) More...
 
int remapIDs (bool numericaIDs, bool reservedIDs, const std::string &prefix, NBTrafficLightLogicCont &tlc)
 remap node IDs accoring to options –numerical-ids and –reserved-ids More...
 
void rename (NBNode *node, const std::string &newID)
 Renames the node. Throws exception if newID already exists. More...
 
int size () const
 Returns the number of nodes stored in this container. More...
 
bool wasRemoved (std::string id) const
 Returns whether the node with the id was deleted explicitly. More...
 
 ~NBNodeCont ()
 Destructor. More...
 
Insertion/removal/retrieval of nodes
bool insert (const std::string &id, const Position &position, NBDistrict *district=0)
 Inserts a node into the map. More...
 
bool insert (NBNode *node)
 Inserts a node into the map. More...
 
bool erase (NBNode *node)
 Removes the given node, deleting it. More...
 
bool extract (NBNode *node, bool remember=false)
 Removes the given node but does not delete it. More...
 
NBNoderetrieve (const std::string &id) const
 Returns the node with the given name. More...
 
NBNoderetrieve (const Position &position, const double offset=0.) const
 Returns the node with the given coordinates. More...
 
std::map< std::string, NBNode * >::const_iterator begin () const
 Returns the pointer to the begin of the stored nodes. More...
 
std::map< std::string, NBNode * >::const_iterator end () const
 Returns the pointer to the end of the stored nodes. More...
 
Adapting the input
void removeSelfLoops (NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
 Removes self-loop edges (edges where the source and the destination node are the same) More...
 
void joinSimilarEdges (NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, bool removeDuplicates)
 Joins edges connecting the same nodes. More...
 
void avoidOverlap ()
 fix overlap More...
 
void removeIsolatedRoads (NBDistrictCont &dc, NBEdgeCont &ec)
 Removes sequences of edges that are not connected with a junction. Simple roads without junctions sometimes remain when converting from OpenStreetMap, but they make no sense. Remaining empty nodes are also deleted. More...
 
void removeComponents (NBDistrictCont &dc, NBEdgeCont &ec, const int numKeep, bool hasPTStops)
 Checks the network for weak connectivity and removes all but the largest components. The connectivity check is done regardless of edge direction and vclass. More...
 
void removeRailComponents (NBDistrictCont &dc, NBEdgeCont &ec, NBPTStopCont &sc)
 remove rail components after ptstops are built More...
 
int removeUnwishedNodes (NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, NBPTStopCont &sc, NBPTLineCont &lc, NBParkingCont &pc, bool removeGeometryNodes)
 Removes "unwished" nodes. More...
 
Methods for guessing/computing traffic lights
void guessTLs (OptionsCont &oc, NBTrafficLightLogicCont &tlc)
 Guesses which junctions or junction clusters shall be controlled by tls. More...
 
void recheckGuessedTLS (NBTrafficLightLogicCont &tlc)
 recheck myGuessedTLS after node logics are computed More...
 
void computeKeepClear ()
 compute keepClear status for all connections More...
 
void joinTLS (NBTrafficLightLogicCont &tlc, double maxdist)
 Builds clusters of tls-controlled junctions and joins the control if possible. More...
 
void setAsTLControlled (NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
 Sets the given node as being controlled by a tls. More...
 

Private Types

typedef std::map< std::string, NBNode * > NodeCont
 Definition of the map of names to nodes. More...
 

Private Member Functions

 NBNodeCont (const NBNodeCont &s)
 invalidated copy constructor More...
 
NBNodeContoperator= (const NBNodeCont &s)
 invalidated assignment operator More...
 
void paretoCheck (NBNode *node, NodeSet &frontier, int xSign, int ySign)
 update pareto frontier with the given node More...
 
Helper methods for guessing/computing traffic lights
bool shouldBeTLSControlled (const NodeSet &c, double laneSpeedThreshold) const
 Returns whethe the given node cluster should be controlled by a tls. More...
 
bool onlyCrossings (const NodeSet &c) const
 check wheter the set of nodes only contains pedestrian crossings More...
 
bool customTLID (const NodeSet &c) const
 check wheter the set of nodes contains traffic lights with custom id More...
 

Private Attributes

std::vector< std::pair< std::set< std::string >, NBNode * > > myClusters2Join
 loaded sets of node ids to join (cleared after use) More...
 
NodeCont myExtractedNodes
 The extracted nodes which are kept for reference. More...
 
std::set< NBNode * > myGuessedTLS
 nodes that received a traffic light due to guessing (–tls.guess) More...
 
int myInternalID
 The running internal id. More...
 
std::set< std::string > myJoined
 ids found in loaded join clusters used for error checking More...
 
std::vector< std::set< std::string > > myJoinedClusters
 sets of node ids which were joined More...
 
std::set< std::string > myJoinExclusions
 set of node ids which should not be joined More...
 
NodeCont myNodes
 The map of names to nodes. More...
 
std::vector< std::vector< std::string > > myRailComponents
 network components that must be removed if not connected to the road network via stop access More...
 
NamedRTree myRTree
 node positions for faster lookup More...
 
std::set< const NBNode * > mySplit
 nodes that were created when splitting an edge More...
 
std::set< const NBNode * > myUnsetTLS
 nodes that are excluded from tls-guessing More...
 

Methods for joining nodes

void addJoinExclusion (const std::vector< std::string > &ids)
 
std::string createClusterId (const NodeSet &cluster, const std::string &prefix="cluster_")
 generate id from cluster node ids More...
 
std::string createClusterId (const std::set< std::string > &cluster, const std::string &prefix="cluster_")
 generate id from cluster node ids More...
 
void addCluster2Join (const std::set< std::string > &cluster, NBNode *node)
 add ids of nodes which shall be joined into a single node More...
 
int joinLoadedClusters (NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
 Joins loaded junction clusters (see NIXMLNodesHandler) More...
 
int joinJunctions (double maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, NBPTStopCont &sc)
 Joins junctions that are very close together. More...
 
int joinSameJunctions (NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
 Joins junctions with the same coordinates regardless of topology. More...
 
bool maybeSlipLaneStart (const NBNode *n, EdgeVector &outgoing, double &inAngle) const
 check whether the given node maybe the start of a slip lane More...
 
bool maybeSlipLaneEnd (const NBNode *n, EdgeVector &incoming, double &outAngle) const
 check whether the given node maybe the end of a slip lane More...
 
bool reduceToCircle (NodeSet &cluster, int circleSize, NodeSet startNodes, std::vector< NBNode * > cands=std::vector< NBNode * >()) const
 try to find a joinable subset (recursively) More...
 
NBEdgeshortestEdge (const NodeSet &cluster, const NodeSet &startNodes, const std::vector< NBNode * > &exclude) const
 find closest neighbor for building circle More...
 
static NodeSet getClusterNeighbors (const NBNode *n, NodeSet &cluster)
 return all cluster neighbors for the given node More...
 

Helper methods for for joining nodes

void generateNodeClusters (double maxDist, NodeClusters &into) const
 Builds node clusters. More...
 
void pruneClusterFringe (NodeSet &cluster) const
 remove geometry-like fringe nodes from cluster More...
 
void pruneSlipLaneNodes (NodeSet &cluster) const
 remove nodes that form a slip lane from cluster More...
 
bool feasibleCluster (const NodeSet &cluster, const std::map< const NBNode *, std::vector< NBNode * > > &ptStopEnds, std::string &reason) const
 determine wether the cluster is not too complex for joining More...
 
void joinNodeClusters (NodeClusters clusters, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, bool resetConnections=false)
 joins the given node clusters More...
 
void joinNodeCluster (NodeSet clusters, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc, NBNode *predefined=nullptr, bool resetConnections=false)
 
static int pruneLongEdges (NodeSet &cluster, double maxDist, const bool dryRun=false)
 avoid removal of long edges when joining junction clusters More...
 

Detailed Description

Container for nodes during the netbuilding process.

Definition at line 58 of file NBNodeCont.h.

Member Typedef Documentation

◆ NodeAndDist

typedef std::pair<NBNode*, double> NBNodeCont::NodeAndDist

Definition at line 62 of file NBNodeCont.h.

◆ NodeClusters

typedef std::vector<NodeSet> NBNodeCont::NodeClusters

Definition of a node cluster container.

Definition at line 61 of file NBNodeCont.h.

◆ NodeCont

typedef std::map<std::string, NBNode*> NBNodeCont::NodeCont
private

Definition of the map of names to nodes.

Definition at line 419 of file NBNodeCont.h.

Constructor & Destructor Documentation

◆ NBNodeCont() [1/2]

NBNodeCont::NBNodeCont ( )

Constructor.

Definition at line 79 of file NBNodeCont.cpp.

◆ ~NBNodeCont()

NBNodeCont::~NBNodeCont ( )

Destructor.

Definition at line 84 of file NBNodeCont.cpp.

References clear().

◆ NBNodeCont() [2/2]

NBNodeCont::NBNodeCont ( const NBNodeCont s)
private

invalidated copy constructor

Member Function Documentation

◆ addCluster2Join()

void NBNodeCont::addCluster2Join ( const std::set< std::string > &  cluster,
NBNode node 
)

add ids of nodes which shall be joined into a single node

Parameters
[in]clusterThe cluster to add

Definition at line 691 of file NBNodeCont.cpp.

References Named::getID(), myClusters2Join, myJoined, myJoinExclusions, retrieve(), TL, WRITE_ERROR, and WRITE_WARNINGF.

Referenced by NIXMLNodesHandler::addJoinCluster().

Here is the caller graph for this function:

◆ addJoinExclusion()

void NBNodeCont::addJoinExclusion ( const std::vector< std::string > &  ids)

Definition at line 658 of file NBNodeCont.cpp.

References myJoined, myJoinExclusions, TL, and WRITE_WARNINGF.

Referenced by NIXMLNodesHandler::addJoinExclusion(), and NBNetBuilder::compute().

Here is the caller graph for this function:

◆ analyzeCluster()

void NBNodeCont::analyzeCluster ( NodeSet  cluster,
std::string &  id,
Position pos,
bool &  hasTLS,
TrafficLightType type,
SumoXMLNodeType nodeType 
)

Definition at line 1826 of file NBNodeCont.cpp.

References Position::add(), createClusterId(), StringBijection< T >::get(), OptionsCont::getOptions(), Position::mul(), NOJUNCTION, PRIORITY, TL, toString(), TRAFFIC_LIGHT, SUMOXMLDefinitions::TrafficLightTypes, UNKNOWN, and WRITE_WARNINGF.

Referenced by joinNodeCluster(), GNENet::joinSelectedJunctions(), and joinTLS().

Here is the caller graph for this function:

◆ avoidOverlap()

void NBNodeCont::avoidOverlap ( )

fix overlap

Definition at line 537 of file NBNodeCont.cpp.

References myNodes.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ begin()

◆ clear()

void NBNodeCont::clear ( )

deletes all nodes

Definition at line 2312 of file NBNodeCont.cpp.

References myExtractedNodes, and myNodes.

Referenced by ~NBNodeCont().

Here is the caller graph for this function:

◆ computeKeepClear()

void NBNodeCont::computeKeepClear ( )

compute keepClear status for all connections

Definition at line 2206 of file NBNodeCont.cpp.

References myNodes.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ computeLanes2Lanes()

void NBNodeCont::computeLanes2Lanes ( )

divides the incoming lanes on outgoing lanes

Definition at line 2275 of file NBNodeCont.cpp.

References myNodes.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ computeLogics()

void NBNodeCont::computeLogics ( const NBEdgeCont ec)

build the list of outgoing edges and lanes

Definition at line 2284 of file NBNodeCont.cpp.

References myNodes.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ computeLogics2()

void NBNodeCont::computeLogics2 ( const NBEdgeCont ec,
OptionsCont oc 
)

compute right-of-way logic for all lane-to-lane connections

Definition at line 2292 of file NBNodeCont.cpp.

References OptionsCont::getBool(), NBEdgeCont::getRoundabouts(), and myNodes.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ computeNodeShapes()

void NBNodeCont::computeNodeShapes ( double  mismatchThreshold = -1)

Compute the junction shape for this node.

Parameters
[in]mismatchThresholdThe threshold for warning about shapes which are away from myPosition

Definition at line 2339 of file NBNodeCont.cpp.

References myNodes.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ createClusterId() [1/2]

std::string NBNodeCont::createClusterId ( const NodeSet cluster,
const std::string &  prefix = "cluster_" 
)
inline

generate id from cluster node ids

Parameters
[in]clusterThe cluster ids
[in]prefixThe cluster prefix
Returns
the generated id

Definition at line 136 of file NBNodeCont.h.

References createClusterId().

Referenced by NIXMLNodesHandler::addJoinCluster(), analyzeCluster(), createClusterId(), guessTLs(), and NIImporter_OpenDrive::loadNetwork().

Here is the caller graph for this function:

◆ createClusterId() [2/2]

std::string NBNodeCont::createClusterId ( const std::set< std::string > &  cluster,
const std::string &  prefix = "cluster_" 
)

generate id from cluster node ids

Parameters
[in]clusterThe cluster ids
[in]prefixThe cluster prefix
Returns
the generated id

Definition at line 672 of file NBNodeCont.cpp.

References OptionsCont::getInt(), OptionsCont::getOptions(), joinToString(), and toString().

◆ customTLID()

bool NBNodeCont::customTLID ( const NodeSet c) const
private

check wheter the set of nodes contains traffic lights with custom id

Definition at line 1920 of file NBNodeCont.cpp.

References Named::getID(), NBTrafficLightDefinition::getNodes(), and StringUtils::startsWith().

Referenced by joinTLS().

Here is the caller graph for this function:

◆ discardRailSignals()

void NBNodeCont::discardRailSignals ( )

Definition at line 2498 of file NBNodeCont.cpp.

References NBNode::getPosition(), NBNode::getType(), myNodes, PRIORITY, RAIL_SIGNAL, and NBNode::reinit().

Referenced by NILoader::load().

Here is the caller graph for this function:

◆ discardTrafficLights()

void NBNodeCont::discardTrafficLights ( NBTrafficLightLogicCont tlc,
bool  geometryLike,
bool  guessSignals 
)

Definition at line 2466 of file NBNodeCont.cpp.

References NBTrafficLightLogicCont::extract(), NBNode::geometryLike(), NBNode::getControllingTLS(), Named::getID(), NBNode::getOutgoingEdges(), NBNode::getPosition(), NBNodeTypeComputer::isRailwayNode(), NBNode::isTLControlled(), myNodes, RAIL_SIGNAL, NBNode::reinit(), NBNode::removeTrafficLight(), and UNKNOWN.

Referenced by NILoader::load(), and main().

Here is the caller graph for this function:

◆ end()

◆ erase()

bool NBNodeCont::erase ( NBNode node)

Removes the given node, deleting it.

Parameters
[in]nodeThe node to delete and remove
Returns
Whether the node could be removed (existed)

Definition at line 150 of file NBNodeCont.cpp.

References extract().

Referenced by joinNodeCluster(), NIVissimEdge::remapOneOfNodes(), removeComponents(), removeIsolatedRoads(), and removeRailComponents().

Here is the caller graph for this function:

◆ extract()

bool NBNodeCont::extract ( NBNode node,
bool  remember = false 
)

Removes the given node but does not delete it.

Parameters
[in]nodeThe node to delete and remove
[in]rememberWhether to keep the node for future reference
Returns
Whether the node could be removed (existed)

Definition at line 161 of file NBNodeCont.cpp.

References Named::getID(), NBNode::getPosition(), myExtractedNodes, myNodes, myRTree, NamedRTree::Remove(), NBNode::removeTrafficLights(), Position::x(), and Position::y().

Referenced by NIXMLNodesHandler::deleteNode(), erase(), NIImporter_OpenDrive::loadNetwork(), and removeUnwishedNodes().

Here is the caller graph for this function:

◆ feasibleCluster()

bool NBNodeCont::feasibleCluster ( const NodeSet cluster,
const std::map< const NBNode *, std::vector< NBNode * > > &  ptStopEnds,
std::string &  reason 
) const
private

determine wether the cluster is not too complex for joining

Definition at line 1350 of file NBNodeCont.cpp.

References DEBUGCOND, NBEdge::getAngleAtNode(), NBNode::getEdges(), NBEdge::getFromNode(), NBEdge::getID(), NBEdge::getIncomingEdges(), NBEdge::getLoadedLength(), NBEdge::getPermissions(), NBEdge::getToNode(), joinNamedToString(), joinToString(), SVC_PASSENGER, and toString().

Referenced by joinJunctions().

Here is the caller graph for this function:

◆ generateNodeClusters()

void NBNodeCont::generateNodeClusters ( double  maxDist,
NodeClusters into 
) const
private

Builds node clusters.

A node cluster is made up from nodes which are near by (distance<maxDist) and connected.

Parameters
[in]maxDistThe maximum distance between two nodes for clustering
[in,filled]into The container to store the clusters in

Definition at line 546 of file NBNodeCont.cpp.

References DEBUGCOND, Position::distanceTo2D(), NBNode::geometryLike(), NBNode::getEdges(), Named::getID(), NBNode::getIncomingEdges(), NBNode::getPosition(), NBNode::getType(), NBNode::hasIncoming(), joinNamedToString(), myNodes, RAIL_CROSSING, SUMO_const_laneWidth, SVC_PASSENGER, SVC_PEDESTRIAN, SVC_RAIL_CLASSES, and SVC_TRAM.

Referenced by guessTLs(), joinJunctions(), and joinTLS().

Here is the caller graph for this function:

◆ getAllNames()

std::vector< std::string > NBNodeCont::getAllNames ( ) const

get all node names

Definition at line 2445 of file NBNodeCont.cpp.

References myNodes.

Referenced by GNENet::initJunctionsAndEdges(), remapIDs(), and NWWriter_DlrNavteq::writeNodesUnsplitted().

Here is the caller graph for this function:

◆ getClusterNeighbors()

NodeSet NBNodeCont::getClusterNeighbors ( const NBNode n,
NodeSet cluster 
)
static

return all cluster neighbors for the given node

Definition at line 1063 of file NBNodeCont.cpp.

References NBNode::getEdges().

Referenced by pruneLongEdges().

Here is the caller graph for this function:

◆ getFreeID()

std::string NBNodeCont::getFreeID ( )

generates a new node ID

Definition at line 2325 of file NBNodeCont.cpp.

References retrieve().

◆ getJoinedClusters()

const std::vector< std::set< std::string > > & NBNodeCont::getJoinedClusters ( ) const
inline

gets all joined clusters (see doc for myClusters2Join)

Definition at line 334 of file NBNodeCont.h.

References myJoinedClusters.

Referenced by NWWriter_XML::writeJoinedJunctions().

Here is the caller graph for this function:

◆ guessFringe()

int NBNodeCont::guessFringe ( )

guess and mark fringe nodes

Definition at line 2578 of file NBNodeCont.cpp.

References NBNode::getEdges(), OptionsCont::getFloat(), OptionsCont::getOptions(), myNodes, OUTER, paretoCheck(), and NBNode::setFringeType().

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ guessTLs()

void NBNodeCont::guessTLs ( OptionsCont oc,
NBTrafficLightLogicCont tlc 
)

Guesses which junctions or junction clusters shall be controlled by tls.

Parameters
[in]ocThe options that steer the guessing process
[filled]tlc The traffic lights control into which new traffic light definitions shall be stored
Todo:
Recheck exception handling

Definition at line 1942 of file NBNodeCont.cpp.

References createClusterId(), DEBUGCOND, OptionsCont::exists(), generateNodeClusters(), NBNode::geometryLike(), StringBijection< T >::get(), OptionsCont::getBool(), NBNode::getControllingTLS(), OptionsCont::getFloat(), NBEdge::getID(), Named::getID(), NBNode::getIncomingEdges(), OptionsCont::getOptions(), NBNode::getOutgoingEdges(), NBEdge::getPermissions(), NBNode::getPosition(), NBEdge::getSignalNode(), NBEdge::getSignalOffset(), NBEdge::getSignalPosition(), OptionsCont::getStringVector(), NBEdge::getToNode(), NBNode::getType(), NBTrafficLightLogicCont::insert(), Position::INVALID, NBNode::isNearDistrict(), NBNodeTypeComputer::isRailwayNode(), OptionsCont::isSet(), NBNode::isTLControlled(), MIN2(), myGuessedTLS, myNodes, myUnsetTLS, PRIORITY, RAIL_CROSSING, NBTrafficLightLogicCont::removeFully(), NBNode::removeTrafficLights(), retrieve(), setAsTLControlled(), shouldBeTLSControlled(), SVC_TRAM, TL, SUMOXMLDefinitions::TrafficLightTypes, NBEdge::UNSPECIFIED_SIGNAL_OFFSET, NBNode::updateSurroundingGeometry(), WRITE_WARNING, and WRITE_WARNINGF.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ insert() [1/2]

bool NBNodeCont::insert ( const std::string &  id,
const Position position,
NBDistrict district = 0 
)

◆ insert() [2/2]

bool NBNodeCont::insert ( NBNode node)

Inserts a node into the map.

Parameters
[in]nodeThe node to insert
Returns
Whether the node could be added (no other with the same id or position is stored)

Definition at line 106 of file NBNodeCont.cpp.

References Named::getID(), NBNode::getPosition(), NamedRTree::Insert(), myNodes, myRTree, Position::x(), and Position::y().

◆ joinJunctions()

int NBNodeCont::joinJunctions ( double  maxDist,
NBDistrictCont dc,
NBEdgeCont ec,
NBTrafficLightLogicCont tlc,
NBPTStopCont sc 
)

Joins junctions that are very close together.

Definition at line 744 of file NBNodeCont.cpp.

References NBPTStopCont::begin(), DEBUGCOND, NBPTStopCont::end(), feasibleCluster(), gDebugFlag1, generateNodeClusters(), NBEdge::getFromNode(), NBEdge::getToNode(), joinNamedToString(), joinNodeClusters(), myJoinExclusions, pruneClusterFringe(), pruneLongEdges(), pruneSlipLaneNodes(), reduceToCircle(), NBEdgeCont::retrieve(), TL, and WRITE_WARNINGF.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ joinLoadedClusters()

int NBNodeCont::joinLoadedClusters ( NBDistrictCont dc,
NBEdgeCont ec,
NBTrafficLightLogicCont tlc 
)

Joins loaded junction clusters (see NIXMLNodesHandler)

Definition at line 719 of file NBNodeCont.cpp.

References joinNodeCluster(), myClusters2Join, myJoinExclusions, retrieve(), and WRITE_ERROR.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ joinNodeCluster()

◆ joinNodeClusters()

void NBNodeCont::joinNodeClusters ( NodeClusters  clusters,
NBDistrictCont dc,
NBEdgeCont ec,
NBTrafficLightLogicCont tlc,
bool  resetConnections = false 
)
private

joins the given node clusters

Definition at line 1608 of file NBNodeCont.cpp.

References joinNodeCluster().

Referenced by joinJunctions(), and joinSameJunctions().

Here is the caller graph for this function:

◆ joinSameJunctions()

int NBNodeCont::joinSameJunctions ( NBDistrictCont dc,
NBEdgeCont ec,
NBTrafficLightLogicCont tlc 
)

Joins junctions with the same coordinates regardless of topology.

Definition at line 879 of file NBNodeCont.cpp.

References Named::getID(), gPrecision, joinNodeClusters(), myJoinExclusions, myNodes, OutputDevice::realString(), Position::x(), Position::y(), and Position::z().

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ joinSimilarEdges()

void NBNodeCont::joinSimilarEdges ( NBDistrictCont dc,
NBEdgeCont ec,
NBTrafficLightLogicCont tlc,
bool  removeDuplicates 
)

Joins edges connecting the same nodes.

Parameters
[in,opt.changed] dc The districts container to update
[in,opt.changed] ec The edge container to remove the edges from
[in,opt.changed] tc The traffic lights container to update
Postcondition
No two edges with same geometry connecting same nodes exist

Definition at line 191 of file NBNodeCont.cpp.

References NBEdgeCont::extract(), NBEdge::getLoadedLength(), NBEdge::getPermissions(), NBEdge::getSpeed(), NBEdge::isNearEnough2BeJoined2(), NBEdgeCont::joinSameNodeConnectingEdges(), and myNodes.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ joinTLS()

void NBNodeCont::joinTLS ( NBTrafficLightLogicCont tlc,
double  maxdist 
)

Builds clusters of tls-controlled junctions and joins the control if possible.

Parameters
[changed]tlc The traffic lights control for adding/removing new/prior tls
[in]maxdistThe maximum distance between nodes for clustering
Todo:
Recheck exception handling

Definition at line 2214 of file NBNodeCont.cpp.

References analyzeCluster(), customTLID(), generateNodeClusters(), NBTrafficLightLogicCont::insert(), onlyCrossings(), NBTrafficLightLogicCont::removeFully(), TL, UNKNOWN, and WRITE_WARNING.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ markAsNotTLS()

void NBNodeCont::markAsNotTLS ( const NBNode node)
inline

mark a node as explicitly not controlled by a TLS

Definition at line 353 of file NBNodeCont.h.

References myUnsetTLS.

Referenced by NIXMLNodesHandler::processNodeType().

Here is the caller graph for this function:

◆ markAsSplit()

void NBNodeCont::markAsSplit ( const NBNode node)
inline

mark a node as being created form a split

Definition at line 348 of file NBNodeCont.h.

References mySplit.

Referenced by NBEdgeCont::processSplits().

Here is the caller graph for this function:

◆ maybeSlipLaneEnd()

bool NBNodeCont::maybeSlipLaneEnd ( const NBNode n,
EdgeVector incoming,
double &  outAngle 
) const

check whether the given node maybe the end of a slip lane

Definition at line 1315 of file NBNodeCont.cpp.

References NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), and NBHelpers::relAngle().

Referenced by pruneSlipLaneNodes().

Here is the caller graph for this function:

◆ maybeSlipLaneStart()

bool NBNodeCont::maybeSlipLaneStart ( const NBNode n,
EdgeVector outgoing,
double &  inAngle 
) const

check whether the given node maybe the start of a slip lane

Definition at line 1279 of file NBNodeCont.cpp.

References NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), and NBHelpers::relAngle().

Referenced by pruneSlipLaneNodes().

Here is the caller graph for this function:

◆ onlyCrossings()

bool NBNodeCont::onlyCrossings ( const NodeSet c) const
private

check wheter the set of nodes only contains pedestrian crossings

Definition at line 1890 of file NBNodeCont.cpp.

References NBEdge::getIncomingEdges(), and SVC_PEDESTRIAN.

Referenced by joinTLS().

Here is the caller graph for this function:

◆ operator=()

NBNodeCont & NBNodeCont::operator= ( const NBNodeCont s)
private

invalidated assignment operator

◆ paretoCheck()

void NBNodeCont::paretoCheck ( NBNode node,
NodeSet frontier,
int  xSign,
int  ySign 
)
private

update pareto frontier with the given node

Definition at line 2623 of file NBNodeCont.cpp.

References fn, NBNode::getPosition(), Position::x(), and Position::y().

Referenced by guessFringe().

Here is the caller graph for this function:

◆ printBuiltNodesStatistics()

void NBNodeCont::printBuiltNodesStatistics ( ) const

Prints statistics about built nodes.

Goes through stored nodes, computes the numbers of unregulated, priority and right-before-left junctions and prints them.

Definition at line 2347 of file NBNodeCont.cpp.

References ALLWAY_STOP, DEAD_END, DISTRICT, GeoConvHelper::getConvBoundary(), GeoConvHelper::getOffsetBase(), GeoConvHelper::getOrigBoundary(), GeoConvHelper::getProcessing(), LEFT_BEFORE_RIGHT, myNodes, NOJUNCTION, PRIORITY, PRIORITY_STOP, RAIL_CROSSING, RAIL_SIGNAL, RIGHT_BEFORE_LEFT, TL, toString(), TRAFFIC_LIGHT, TRAFFIC_LIGHT_NOJUNCTION, TRAFFIC_LIGHT_RIGHT_ON_RED, UNKNOWN, WRITE_MESSAGE, and ZIPPER.

Referenced by main().

Here is the caller graph for this function:

◆ pruneClusterFringe()

void NBNodeCont::pruneClusterFringe ( NodeSet cluster) const
private

remove geometry-like fringe nodes from cluster

Definition at line 909 of file NBNodeCont.cpp.

References Position::distanceTo2D(), gDebugFlag1, NBNode::getEdges(), Named::getID(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBNode::getPosition(), isRailway(), NBNode::isTLControlled(), joinNamedToString(), MIN2(), SUMO_const_laneWidth, and SVC_PASSENGER.

Referenced by joinJunctions(), pruneSlipLaneNodes(), and reduceToCircle().

Here is the caller graph for this function:

◆ pruneLongEdges()

int NBNodeCont::pruneLongEdges ( NodeSet cluster,
double  maxDist,
const bool  dryRun = false 
)
staticprivate

avoid removal of long edges when joining junction clusters

Definition at line 988 of file NBNodeCont.cpp.

References NBEdge::filterByPermissions(), gDebugFlag1, NBNode::geometryLike(), getClusterNeighbors(), NBNode::getIncomingEdges(), NBEdge::getLoadedLength(), NBNode::getOutgoingEdges(), NBEdge::getStraightContinuation(), NBEdge::getToNode(), MAX2(), SUMO_const_laneWidth, SVC_PASSENGER, and toString().

Referenced by joinJunctions().

Here is the caller graph for this function:

◆ pruneSlipLaneNodes()

void NBNodeCont::pruneSlipLaneNodes ( NodeSet cluster) const
private

remove nodes that form a slip lane from cluster

Definition at line 1076 of file NBNodeCont.cpp.

References gDebugFlag1, NBEdge::getFromNode(), Named::getID(), NBNode::getIncomingEdges(), NBEdge::getLength(), NBNode::getOutgoingEdges(), NBEdge::getToNode(), joinNamedToString(), MAX_SLIPLANE_LENGTH, maybeSlipLaneEnd(), maybeSlipLaneStart(), pruneClusterFringe(), NBHelpers::relAngle(), SVC_PASSENGER, and toString().

Referenced by joinJunctions().

Here is the caller graph for this function:

◆ recheckGuessedTLS()

void NBNodeCont::recheckGuessedTLS ( NBTrafficLightLogicCont tlc)

recheck myGuessedTLS after node logics are computed

Definition at line 2181 of file NBNodeCont.cpp.

References NBTrafficLightLogicCont::computeSingleLogic(), NBEdge::getIncomingEdges(), OptionsCont::getOptions(), myGuessedTLS, and NBTrafficLightLogicCont::removeFully().

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ reduceToCircle()

bool NBNodeCont::reduceToCircle ( NodeSet cluster,
int  circleSize,
NodeSet  startNodes,
std::vector< NBNode * >  cands = std::vector<NBNode*>() 
) const

try to find a joinable subset (recursively)

Definition at line 1532 of file NBNodeCont.cpp.

References NBEdge::getFromNode(), NBEdge::getToNode(), pruneClusterFringe(), reduceToCircle(), and shortestEdge().

Referenced by joinJunctions(), and reduceToCircle().

Here is the caller graph for this function:

◆ registerJoinedCluster()

void NBNodeCont::registerJoinedCluster ( const NodeSet cluster)

gets all joined clusters (see doc for myClusters2Join)

Definition at line 1816 of file NBNodeCont.cpp.

References myJoinedClusters.

Referenced by joinNodeCluster(), and GNENet::joinSelectedJunctions().

Here is the caller graph for this function:

◆ remapIDs()

int NBNodeCont::remapIDs ( bool  numericaIDs,
bool  reservedIDs,
const std::string &  prefix,
NBTrafficLightLogicCont tlc 
)

remap node IDs accoring to options –numerical-ids and –reserved-ids

Definition at line 2509 of file NBNodeCont.cpp.

References getAllNames(), OptionsCont::getBool(), IDSupplier::getNext(), OptionsCont::getOptions(), OptionsCont::isDefault(), NBHelpers::loadPrefixedIDsFomFile(), myNodes, rename(), NBTrafficLightLogicCont::rename(), StringUtils::startsWith(), SUMO_PARAM_ORIGID, StringUtils::toLong(), and toString().

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ removeComponents()

void NBNodeCont::removeComponents ( NBDistrictCont dc,
NBEdgeCont ec,
const int  numKeep,
bool  hasPTStops 
)

Checks the network for weak connectivity and removes all but the largest components. The connectivity check is done regardless of edge direction and vclass.

Parameters
[in,opt.changed] dc The district container needed if edges shall be removed
[in,opt.changed] ec The container with the edge to be tested
[in]numKeepThe number of components to keep

Definition at line 330 of file NBNodeCont.cpp.

References NBEdgeCont::begin(), NBEdgeCont::end(), NBEdgeCont::erase(), erase(), NBEdgeCont::getByID(), NBEdge::getFromNode(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBEdge::getPermissions(), NBEdge::getToNode(), isRailway(), isWaterway(), myRailComponents, NBEdgeCont::removeRoundaboutEdges(), toString(), and WRITE_MESSAGE.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ removeIsolatedRoads()

void NBNodeCont::removeIsolatedRoads ( NBDistrictCont dc,
NBEdgeCont ec 
)

Removes sequences of edges that are not connected with a junction. Simple roads without junctions sometimes remain when converting from OpenStreetMap, but they make no sense. Remaining empty nodes are also deleted.

Parameters
[in,opt.changed] dc The district container needed if edges shall be removed
[in,opt.changed] ec The container with the edge to be tested

Definition at line 242 of file NBNodeCont.cpp.

References NBEdgeCont::erase(), erase(), NBEdgeCont::getAllNames(), NBEdge::getFromNode(), NBEdge::getID(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBEdge::getToNode(), NBEdgeCont::retrieve(), TL, and WRITE_WARNINGF.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ removeRailComponents()

void NBNodeCont::removeRailComponents ( NBDistrictCont dc,
NBEdgeCont ec,
NBPTStopCont sc 
)

remove rail components after ptstops are built

Definition at line 416 of file NBNodeCont.cpp.

References NBEdgeCont::erase(), erase(), NBEdge::getFromNode(), NBNode::getIncomingEdges(), NBNode::getOutgoingEdges(), NBPTStopCont::getStops(), NBEdge::getToNode(), myRailComponents, NBEdgeCont::retrieve(), toString(), and WRITE_MESSAGE.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ removeSelfLoops()

void NBNodeCont::removeSelfLoops ( NBDistrictCont dc,
NBEdgeCont ec,
NBTrafficLightLogicCont tc 
)

Removes self-loop edges (edges where the source and the destination node are the same)

Parameters
[in,opt.changed] dc The districts container to update
[in,opt.changed] ec The edge container to remove the edges from
[in,opt.changed] tc The traffic lights container to update
Postcondition
Each edge is a uni-directional connection between two different nodes

Definition at line 179 of file NBNodeCont.cpp.

References myNodes, toString(), and WRITE_WARNING.

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ removeUnwishedNodes()

int NBNodeCont::removeUnwishedNodes ( NBDistrictCont dc,
NBEdgeCont ec,
NBTrafficLightLogicCont tlc,
NBPTStopCont sc,
NBPTLineCont lc,
NBParkingCont pc,
bool  removeGeometryNodes 
)

Removes "unwished" nodes.

Removes nodes if a) no incoming/outgoing edges exist or b) if the node is a "geometry" node. In the second case, edges that participate at the node will be joined. Whether the node is a geometry node or not, is determined by a call to NBNode::checkIsRemovable. The node is removed from the list of tls-controlled nodes.

Parameters
[in,opt.changed] dc The district container needed if a node shall be removed
[in,opt.changed] ec The edge container needed for joining edges
[in,opt.changed] tlc The traffic lights container to remove nodes from
[in,opt.changed] sc The pt stops container to update stop edges
[in,opt.changed] pc The pt stops container to update stop edges
[in]removeGeometryNodesWhether geometry nodes shall also be removed
Returns
The number of removed nodes

Definition at line 457 of file NBNodeCont.cpp.

References NBParkingCont::addEdges2Keep(), NBPTStopCont::addEdges2Keep(), NBEdgeCont::begin(), begin(), NBNode::checkIsRemovable(), NBEdgeCont::end(), OptionsCont::exists(), NBEdgeCont::extract(), extract(), OptionsCont::getBool(), NBNode::getControllingTLS(), NBNode::getEdges(), NBNode::getEdgesToJoin(), NBEdge::getID(), OptionsCont::getOptions(), OptionsCont::getString(), OptionsCont::getStringVector(), NBEdge::getToNode(), OptionsCont::isSet(), NBNode::isTLControlled(), NBHelpers::loadEdgesFromFile(), myNodes, mySplit, NBPTLineCont::replaceEdge(), NBPTStopCont::replaceEdge(), NBNode::replaceIncoming(), and NBTrafficLightDefinition::replaceRemoved().

Referenced by NBNetBuilder::compute().

Here is the caller graph for this function:

◆ rename()

void NBNodeCont::rename ( NBNode node,
const std::string &  newID 
)

Renames the node. Throws exception if newID already exists.

Definition at line 2455 of file NBNodeCont.cpp.

References Named::getID(), myNodes, and Named::setID().

Referenced by remapIDs().

Here is the caller graph for this function:

◆ retrieve() [1/2]

NBNode * NBNodeCont::retrieve ( const Position position,
const double  offset = 0. 
) const

Returns the node with the given coordinates.

Parameters
[in]positionThe position at which the node to retrieve lies
[in]offsetAn offset which can be applied in the case positions are blurred
Returns
The node at the given position, or 0 if no such node exists

Definition at line 130 of file NBNodeCont.cpp.

References NBNode::getPosition(), myRTree, NamedRTree::Search(), Position::x(), and Position::y().

◆ retrieve() [2/2]

NBNode * NBNodeCont::retrieve ( const std::string &  id) const

◆ setAsTLControlled()

void NBNodeCont::setAsTLControlled ( NBNode node,
NBTrafficLightLogicCont tlc,
TrafficLightType  type,
std::string  id = "" 
)

Sets the given node as being controlled by a tls.

Parameters
[in]nodeThe node that shall be controlled by a tls
[in]tlcThe traffic lights control into which the new traffic light definition shall be stored
[in]typeThe type of the new tls
[in]idThe id of the tls to add
Todo:
Recheck exception handling

Definition at line 2258 of file NBNodeCont.cpp.

References Named::getID(), NBTrafficLightLogicCont::insert(), TL, and WRITE_WARNINGF.

Referenced by NBNetBuilder::compute(), and guessTLs().

Here is the caller graph for this function:

◆ shortestEdge()

NBEdge * NBNodeCont::shortestEdge ( const NodeSet cluster,
const NodeSet startNodes,
const std::vector< NBNode * > &  exclude 
) const

find closest neighbor for building circle

Definition at line 1587 of file NBNodeCont.cpp.

References Position::distanceTo2D(), and NBNode::getPosition().

Referenced by reduceToCircle().

Here is the caller graph for this function:

◆ shouldBeTLSControlled()

bool NBNodeCont::shouldBeTLSControlled ( const NodeSet c,
double  laneSpeedThreshold 
) const
private

Returns whethe the given node cluster should be controlled by a tls.

Parameters
[in]cThe node cluster
[in]laneSpeedThresholdthreshold for determining whether a node or cluster should be tls controlled
Returns
Whether this node cluster shall be controlled by a tls

Definition at line 1867 of file NBNodeCont.cpp.

Referenced by guessTLs().

Here is the caller graph for this function:

◆ size()

int NBNodeCont::size ( ) const
inline

Returns the number of nodes stored in this container.

Definition at line 295 of file NBNodeCont.h.

References myNodes.

Referenced by NILoader::load(), main(), NWWriter_OpenDrive::writeNetwork(), and NWWriter_DlrNavteq::writeNodesUnsplitted().

Here is the caller graph for this function:

◆ wasRemoved()

bool NBNodeCont::wasRemoved ( std::string  id) const
inline

Returns whether the node with the id was deleted explicitly.

Definition at line 277 of file NBNodeCont.h.

References myExtractedNodes.

Referenced by NIXMLConnectionsHandler::addCrossing().

Here is the caller graph for this function:

Field Documentation

◆ myClusters2Join

std::vector<std::pair<std::set<std::string>, NBNode*> > NBNodeCont::myClusters2Join
private

loaded sets of node ids to join (cleared after use)

Definition at line 431 of file NBNodeCont.h.

Referenced by addCluster2Join(), and joinLoadedClusters().

◆ myExtractedNodes

NodeCont NBNodeCont::myExtractedNodes
private

The extracted nodes which are kept for reference.

Definition at line 425 of file NBNodeCont.h.

Referenced by clear(), extract(), and wasRemoved().

◆ myGuessedTLS

std::set<NBNode*> NBNodeCont::myGuessedTLS
private

nodes that received a traffic light due to guessing (–tls.guess)

Definition at line 443 of file NBNodeCont.h.

Referenced by guessTLs(), and recheckGuessedTLS().

◆ myInternalID

int NBNodeCont::myInternalID
private

The running internal id.

Definition at line 416 of file NBNodeCont.h.

◆ myJoined

std::set<std::string> NBNodeCont::myJoined
private

ids found in loaded join clusters used for error checking

Definition at line 437 of file NBNodeCont.h.

Referenced by addCluster2Join(), and addJoinExclusion().

◆ myJoinedClusters

std::vector<std::set<std::string> > NBNodeCont::myJoinedClusters
private

sets of node ids which were joined

Definition at line 434 of file NBNodeCont.h.

Referenced by getJoinedClusters(), and registerJoinedCluster().

◆ myJoinExclusions

std::set<std::string> NBNodeCont::myJoinExclusions
private

set of node ids which should not be joined

Definition at line 428 of file NBNodeCont.h.

Referenced by addCluster2Join(), addJoinExclusion(), joinJunctions(), joinLoadedClusters(), and joinSameJunctions().

◆ myNodes

◆ myRailComponents

std::vector<std::vector<std::string> > NBNodeCont::myRailComponents
private

network components that must be removed if not connected to the road network via stop access

Definition at line 452 of file NBNodeCont.h.

Referenced by removeComponents(), and removeRailComponents().

◆ myRTree

NamedRTree NBNodeCont::myRTree
private

node positions for faster lookup

Definition at line 449 of file NBNodeCont.h.

Referenced by extract(), insert(), and retrieve().

◆ mySplit

std::set<const NBNode*> NBNodeCont::mySplit
private

nodes that were created when splitting an edge

Definition at line 440 of file NBNodeCont.h.

Referenced by markAsSplit(), and removeUnwishedNodes().

◆ myUnsetTLS

std::set<const NBNode*> NBNodeCont::myUnsetTLS
private

nodes that are excluded from tls-guessing

Definition at line 446 of file NBNodeCont.h.

Referenced by guessTLs(), and markAsNotTLS().


The documentation for this class was generated from the following files: