59 #ifdef CHECK_MEMORY_LEAKS
61 #endif // CHECK_MEMORY_LEAKS
81 NodeCont::iterator i =
myNodes.find(
id);
87 const float pos[2] = {(float)position.
x(), (float)position.
y()};
95 std::string
id = node->
getID();
96 NodeCont::iterator i =
myNodes.find(
id);
109 NodeCont::const_iterator i =
myNodes.find(
id);
120 const float cmin[2] = {(float)(position.
x() - extOffset), (
float)(position.
y() - extOffset)};
121 const float cmax[2] = {(float)(position.
x() + extOffset), (
float)(position.
y() + extOffset)};
122 std::set<std::string> into;
125 for (std::set<std::string>::const_iterator i = into.begin(); i != into.end(); i++) {
169 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
170 no += (*i).second->removeSelfLoops(dc, ec, tc);
184 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
186 std::map<NBNode*, EdgeVector> connectionCount;
187 const EdgeVector& outgoing = (*i).second->getOutgoingEdges();
188 for (EdgeVector::const_iterator j = outgoing.begin(); j != outgoing.end(); j++) {
191 if (connectionCount.find(connected) == connectionCount.end()) {
194 connectionCount[connected].push_back(e);
197 std::map<NBNode*, EdgeVector>::iterator k;
198 for (k = connectionCount.begin(); k != connectionCount.end(); k++) {
200 if ((*k).second.size() < 2) {
206 const NBEdge*
const first = ev.front();
207 EdgeVector::const_iterator jci;
208 for (jci = ev.begin() + 1; jci != ev.end(); ++jci) {
211 (relativeLengthDifference > lengthThreshold) ||
212 (first->
getSpeed() != (*jci)->getSpeed())
220 if (jci == ev.end()) {
233 const std::vector<std::string>& edgeNames = ec.
getAllNames();
234 for (std::vector<std::string>::const_iterator it = edgeNames.begin(); it != edgeNames.end(); ++it) {
243 if (outgoingEdges.size() != 1) {
248 if (incomingEdges.size() > 1) {
251 }
else if (incomingEdges.size() == 1) {
252 NBNode* fromNodeOfIncomingEdge = incomingEdges[0]->getFromNode();
253 NBNode* toNodeOfOutgoingEdge = outgoingEdges[0]->getToNode();
254 if (fromNodeOfIncomingEdge != toNodeOfOutgoingEdge) {
262 bool hasJunction =
false;
266 std::set<NBNode*> adjacentNodes;
274 adjacentNodes.clear();
275 for (EdgeVector::const_iterator itOfOutgoings = outgoingEdgesOfToNode.begin(); itOfOutgoings != outgoingEdgesOfToNode.end(); ++itOfOutgoings) {
276 if ((*itOfOutgoings)->getToNode() != from
277 && (*itOfOutgoings)->getToNode() != to
281 adjacentNodes.insert((*itOfOutgoings)->getToNode());
283 for (EdgeVector::const_iterator itOfIncomings = incomingEdgesOfToNode.begin(); itOfIncomings != incomingEdgesOfToNode.end(); ++itOfIncomings) {
284 adjacentNodes.insert((*itOfIncomings)->getFromNode());
286 adjacentNodes.erase(to);
287 if (adjacentNodes.size() > 2) {
290 }
while (!hasJunction && eOld != e);
292 edgeCounter += int(road.size());
293 std::string warningString =
"Removed a road without junctions: ";
294 for (EdgeVector::iterator roadIt = road.begin(); roadIt != road.end(); ++roadIt) {
295 if (roadIt == road.begin()) {
296 warningString += (*roadIt)->getID();
298 warningString +=
", " + (*roadIt)->getID();
301 NBNode* fromNode = (*roadIt)->getFromNode();
302 NBNode* toNode = (*roadIt)->getToNode();
303 ec.
erase(dc, *roadIt);
317 WRITE_WARNING(
"Detected isolated roads. Use the option --remove-edges.isolated to get a list of all affected edges.");
325 bool removeGeometryNodes) {
327 std::vector<NBNode*> toRemove;
328 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
329 NBNode* current = (*i).second;
331 std::vector<std::pair<NBEdge*, NBEdge*> > toJoin;
338 if (removeGeometryNodes) {
354 for (std::vector<std::pair<NBEdge*, NBEdge*> >::iterator j = toJoin.begin(); j != toJoin.end(); j++) {
356 NBEdge* continuation = (*j).second;
357 begin->
append(continuation);
361 ec.
erase(dc, continuation);
363 toRemove.push_back(current);
367 for (std::vector<NBNode*>::iterator j = toRemove.begin(); j != toRemove.end(); ++j) {
376 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
377 (*i).second->avoidOverlap();
384 std::set<NBNode*> visited;
385 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
386 std::vector<NBNode*> toProc;
387 if (visited.find((*i).second) != visited.end()) {
390 toProc.push_back((*i).second);
392 while (!toProc.empty()) {
393 NBNode* n = toProc.back();
395 if (visited.find(n) != visited.end()) {
401 for (EdgeVector::const_iterator j = edges.begin(); j != edges.end(); ++j) {
409 if (visited.find(s) != visited.end()) {
427 for (std::vector<std::string>::const_iterator it = ids.begin(); it != ids.end(); it++) {
431 WRITE_WARNING(
"Ignoring join exclusion for node '" + *it +
"' since it already occured in a list of nodes to be joined");
432 }
else if (check &&
retrieve(*it) == 0) {
433 WRITE_WARNING(
"Ignoring join exclusion for unknown node '" + *it +
"'");
444 for (std::set<std::string>::const_iterator it = cluster.begin(); it != cluster.end(); it++) {
446 WRITE_WARNING(
"Ignoring join-cluster because node '" + *it +
"' was already excluded from joining");
448 }
else if (
myJoined.count(*it) > 0) {
449 WRITE_WARNING(
"Ignoring join-cluster because node '" + *it +
"' already occured in another join-cluster");
464 std::set<NBNode*> cluster;
465 for (std::set<std::string>::iterator it_id = it->begin(); it_id != it->end(); it_id++) {
468 WRITE_WARNING(
"Ignoring unknown node '" + *it_id +
"' while joining");
470 cluster.insert(node);
473 if (cluster.size() > 1) {
474 clusters.push_back(cluster);
479 return (
int)clusters.size();
488 for (NodeClusters::iterator i = cands.begin(); i != cands.end(); ++i) {
489 std::set<NBNode*> cluster = (*i);
491 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end();) {
492 std::set<NBNode*>::iterator check = j;
495 cluster.erase(check);
499 bool pruneFringe =
true;
500 while (pruneFringe) {
502 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end();) {
503 std::set<NBNode*>::iterator check = j;
508 std::set<NBNode*> neighbors;
509 std::set<NBNode*> clusterNeigbors;
511 NBNode* neighbor = (*it_edge)->getToNode();
512 if (cluster.count(neighbor) == 0) {
513 neighbors.insert(neighbor);
515 clusterNeigbors.insert(neighbor);
519 NBNode* neighbor = (*it_edge)->getFromNode();
520 if (cluster.count(neighbor) == 0) {
521 neighbors.insert(neighbor);
523 clusterNeigbors.insert(neighbor);
526 if (neighbors.size() <= 1 && clusterNeigbors.size() == 1) {
527 cluster.erase(check);
533 std::set<NBNode*> toRemove;
534 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end(); ++j) {
537 for (EdgeVector::const_iterator it_edge = edges.begin(); it_edge != edges.end(); ++it_edge) {
546 for (std::set<NBNode*>::iterator j = toRemove.begin(); j != toRemove.end(); ++j) {
549 if (cluster.size() > 1) {
552 std::map<std::string, SUMOReal> finalIncomingAngles;
553 std::map<std::string, SUMOReal> finalOutgoingAngles;
554 std::vector<std::string> nodeIDs;
555 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
556 nodeIDs.push_back((*j)->getID());
557 for (EdgeVector::const_iterator it_edge = (*j)->getIncomingEdges().begin(); it_edge != (*j)->getIncomingEdges().end(); ++it_edge) {
564 for (EdgeVector::const_iterator it_edge = (*j)->getOutgoingEdges().begin(); it_edge != (*j)->getOutgoingEdges().end(); ++it_edge) {
566 if (cluster.count(edge->
getToNode()) == 0) {
573 if (finalIncomingAngles.size() > 4) {
574 std::sort(nodeIDs.begin(), nodeIDs.end());
578 const SUMOReal PARALLEL_INCOMING_THRESHOLD = 10.0;
579 bool foundParallel =
false;
580 for (std::map<std::string, SUMOReal>::const_iterator j = finalIncomingAngles.begin(); j != finalIncomingAngles.end() && !foundParallel; ++j) {
581 std::map<std::string, SUMOReal>::const_iterator k = j;
582 for (++k; k != finalIncomingAngles.end() && !foundParallel; ++k) {
583 if (fabs(j->second - k->second) < PARALLEL_INCOMING_THRESHOLD) {
585 + j->first +
"," + k->first +
")");
586 foundParallel =
true;
591 for (std::map<std::string, SUMOReal>::const_iterator j = finalOutgoingAngles.begin(); j != finalOutgoingAngles.end() && !foundParallel; ++j) {
592 std::map<std::string, SUMOReal>::const_iterator k = j;
593 for (++k; k != finalOutgoingAngles.end() && !foundParallel; ++k) {
594 if (fabs(j->second - k->second) < PARALLEL_INCOMING_THRESHOLD) {
596 + j->first +
"," + k->first +
")");
597 foundParallel =
true;
601 if (!foundParallel && cluster.size() > 1) {
605 for (std::set<NBNode*>::iterator j = cluster.begin(); j != cluster.end(); ++j) {
607 std::set<NBNode*> newComp;
610 newComp.insert(current);
611 for (NodeClusters::iterator it_comp = components.begin(); it_comp != components.end();) {
612 NodeClusters::iterator check = it_comp;
614 bool connected =
false;
615 for (std::set<NBNode*>::iterator k = (*check).begin(); k != (*check).end(); ++k) {
616 if (current->
getConnectionTo(*k) != 0 || (*k)->getConnectionTo(current) != 0) {
618 newComp.insert((*check).begin(), (*check).end());
619 it_comp = components.erase(check);
629 components.push_back(newComp);
631 for (NodeClusters::iterator it_comp = components.begin(); it_comp != components.end(); ++it_comp) {
632 if ((*it_comp).size() > 1) {
634 clusters.push_back(*it_comp);
642 return (
int)clusters.size();
649 for (NodeClusters::iterator i = clusters.begin(); i != clusters.end(); ++i) {
650 std::set<NBNode*> cluster = *i;
651 assert(cluster.size() > 1);
668 throw ProcessError(
"Could not allocate tls '" +
id +
"'.");
672 std::set<NBEdge*> allEdges;
673 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
675 allEdges.insert(edges.begin(), edges.end());
679 for (std::set<NBEdge*>::iterator j = allEdges.begin(); j != allEdges.end();) {
683 if (cluster.count(from) > 0 && cluster.count(to) > 0) {
684 for (std::set<NBEdge*>::iterator l = allEdges.begin(); l != allEdges.end(); ++l) {
697 for (std::set<NBEdge*>::iterator j = allEdges.begin(); j != allEdges.end(); ++j) {
700 const bool outgoing = cluster.count(e->
getFromNode()) > 0;
706 for (std::vector<NBEdge::Connection>::iterator k = conns.begin(); k != conns.end(); ++k) {
712 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); ++j) {
721 std::set<std::string> ids;
722 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); j++) {
723 ids.insert((*j)->getID());
734 std::vector<std::string> member_ids;
735 bool ambiguousType =
false;
736 for (std::set<NBNode*>::const_iterator j = cluster.begin(); j != cluster.end(); j++) {
737 member_ids.push_back((*j)->getID());
738 pos.
add((*j)->getPosition());
740 if ((*j)->isTLControlled()) {
743 type = (*(*j)->getControllingTLS().begin())->getType();
744 }
else if (type != (*(*j)->getControllingTLS().begin())->getType()) {
745 ambiguousType =
true;
750 pos.
mul(1.0 / cluster.size());
752 sort(member_ids.begin(), member_ids.end());
753 for (std::vector<std::string>::iterator j = member_ids.begin(); j != member_ids.end(); j++) {
754 id =
id +
"_" + (*j);
758 WRITE_WARNING(
"Ambiguous traffic light type for node cluster '" +
id +
"' set to '" +
toString(type) +
"'");
766 unsigned int noIncoming = 0;
767 unsigned int noOutgoing = 0;
768 bool tooFast =
false;
770 std::set<NBEdge*> seen;
771 for (std::set<NBNode*>::const_iterator j = c.begin(); j != c.end(); ++j) {
773 for (EdgeVector::const_iterator k = edges.begin(); k != edges.end(); ++k) {
774 if (c.find((*k)->getFromNode()) != c.end() && c.find((*k)->getToNode()) != c.end()) {
777 if ((*j)->hasIncoming(*k)) {
779 f += (
SUMOReal)(*k)->getNumLanes() * (*k)->getLaneSpeed(0);
783 if ((*k)->getLaneSpeed(0) * 3.6 > 79) {
788 return !tooFast && f >= 150. / 3.6 && c.size() != 0;
795 std::vector<NBNode*> ncontrolled;
796 if (oc.
isSet(
"tls.unset")) {
797 std::vector<std::string> notTLControlledNodes = oc.
getStringVector(
"tls.unset");
798 for (std::vector<std::string>::const_iterator i = notTLControlledNodes.begin(); i != notTLControlledNodes.end(); ++i) {
801 throw ProcessError(
" The node '" + *i +
"' to set as not-controlled is not known.");
804 for (std::set<NBTrafficLightDefinition*>::const_iterator j = tls.begin(); j != tls.end(); ++j) {
808 ncontrolled.push_back(n);
815 if (oc.
exists(
"tls.taz-nodes") && oc.
getBool(
"tls.taz-nodes")) {
816 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
817 NBNode* cur = (*i).second;
818 if (cur->
isNearDistrict() && find(ncontrolled.begin(), ncontrolled.end(), cur) == ncontrolled.end()) {
826 if (oc.
exists(
"tls.guess-signals") && oc.
getBool(
"tls.guess-signals")) {
829 for (std::map<std::string, NBNode*>::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
830 NBNode* node = (*i).second;
833 for (EdgeVector::const_iterator it_o = outgoing.begin(); it_o != outgoing.end(); ++it_o) {
834 (*it_o)->setSignalOffset((*it_o)->getLength());
839 for (std::map<std::string, NBNode*>::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
843 std::vector<NBNode*> signals;
845 for (EdgeVector::const_iterator it_i = incoming.begin(); it_i != incoming.end(); ++it_i) {
846 const NBEdge* inEdge = *it_i;
856 for (std::vector<NBNode*>::iterator j = signals.begin(); j != signals.end(); ++j) {
857 std::set<NBTrafficLightDefinition*> tls = (*j)->getControllingTLS();
858 (*j)->removeTrafficLights();
859 for (std::set<NBTrafficLightDefinition*>::iterator k = tls.begin(); k != tls.end(); ++k) {
877 if (!oc.
getBool(
"tls.guess")) {
884 std::vector<std::set<NBNode*> > cands;
887 for (std::vector<std::set<NBNode*> >::iterator i = cands.begin(); i != cands.end();) {
888 std::set<NBNode*>& c = (*i);
891 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end();) {
892 if ((*j)->isTLControlled() || find(ncontrolled.begin(), ncontrolled.end(), *j) != ncontrolled.end()) {
906 unsigned int index = 0;
907 for (std::vector<std::set<NBNode*> >::iterator i = cands.begin(); i != cands.end(); ++i) {
908 std::vector<NBNode*> nodes;
909 for (std::set<NBNode*>::iterator j = (*i).begin(); j != (*i).end(); j++) {
912 std::string
id =
"joinedG_" +
toString(index++);
924 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
925 NBNode* cur = (*i).second;
931 if (find(ncontrolled.begin(), ncontrolled.end(), cur) != ncontrolled.end()) {
946 std::vector<std::set<NBNode*> > cands;
948 unsigned int index = 0;
949 for (std::vector<std::set<NBNode*> >::iterator i = cands.begin(); i != cands.end(); ++i) {
950 std::set<NBNode*>& c = (*i);
951 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end();) {
952 if (!(*j)->isTLControlled()) {
967 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end(); ++j) {
968 std::set<NBTrafficLightDefinition*> tls = (*j)->getControllingTLS();
969 (*j)->removeTrafficLights();
970 for (std::set<NBTrafficLightDefinition*>::iterator k = tls.begin(); k != tls.end(); ++k) {
974 std::string
id =
"joinedS_" +
toString(index++);
975 std::vector<NBNode*> nodes;
976 for (std::set<NBNode*>::iterator j = c.begin(); j != c.end(); j++) {
999 WRITE_WARNING(
"Building a tl-logic for node '" +
id +
"' twice is not possible.");
1009 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1010 (*i).second->computeLanes2Lanes(buildCrossingsAndWalkingAreas);
1018 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1019 (*i).second->computeLogic(ec, oc);
1026 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1027 delete((*i).second);
1040 std::string ret =
"SUMOGenerated" + toString<int>(
size());
1048 for (NodeCont::iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1049 (*i).second->computeNodeShape(leftHand, mismatchThreshold);
1056 int numUnregulatedJunctions = 0;
1057 int numDeadEndJunctions = 0;
1058 int numPriorityJunctions = 0;
1059 int numRightBeforeLeftJunctions = 0;
1060 int numAllWayStopJunctions = 0;
1061 int numRailSignals = 0;
1062 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); i++) {
1063 switch ((*i).second->getType()) {
1066 ++numUnregulatedJunctions;
1069 ++numDeadEndJunctions;
1074 ++numPriorityJunctions;
1077 ++numRightBeforeLeftJunctions;
1080 ++numAllWayStopJunctions;
1083 ++numRightBeforeLeftJunctions;
1096 if (numDeadEndJunctions > 0) {
1101 if (numAllWayStopJunctions > 0) {
1104 if (numRailSignals > 0) {
1110 std::vector<std::string>
1112 std::vector<std::string> ret;
1113 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
1114 ret.push_back((*i).first);
1122 if (
myNodes.count(newID) != 0) {
1123 throw ProcessError(
"Attempt to rename node using existing id '" + newID +
"'");
1133 for (NodeCont::const_iterator i =
myNodes.begin(); i !=
myNodes.end(); ++i) {
1134 NBNode* node = i->second;
1141 for (EdgeVector::const_iterator it_o = outgoing.begin(); it_o != outgoing.end(); ++it_o) {
1142 (*it_o)->setSignalOffset((*it_o)->getLength());
1145 for (std::set<NBTrafficLightDefinition*>::const_iterator it = tldefs.begin(); it != tldefs.end(); ++it) {
std::set< std::string > myJoinExclusions
NodeCont myNodes
The map of names to nodes.
void Insert(const float a_min[2], const float a_max[2], Named *const &a_data)
Insert entry.
void joinSimilarEdges(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins edges connecting the same nodes.
void replaceIncoming(NBEdge *which, NBEdge *by, unsigned int laneOff)
Replaces occurences of the first edge within the list of incoming by the second Connections are remap...
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges.
void removeSelfLoops(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes self-loop edges (edges where the source and the destination node are the same) ...
void computeNodeShapes(bool leftHand, SUMOReal mismatchThreshold=-1)
Compute the junction shape for this node.
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
static const SUMOReal UNSPECIFIED_SIGNAL_OFFSET
unspecified signal offset
void addJoinExclusion(const std::vector< std::string > &ids, bool check=false)
void add(const Position &pos)
Adds the given position to this one.
unsigned int removeUnwishedNodes(NBDistrictCont &dc, NBEdgeCont &ec, NBJoinedEdgesMap &je, NBTrafficLightLogicCont &tlc, bool removeGeometryNodes)
Removes "unwished" nodes.
A container for traffic light definitions and built programs.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
unsigned int joinJunctions(SUMOReal maxDist, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins junctions that are very close together.
std::vector< std::set< std::string > > myJoinedClusters
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
void reinitNodes(NBNode *from, NBNode *to)
Resets nodes but keeps all other values the same (used when joining)
A container for districts.
The base class for traffic light logic definitions.
bool addLane2LaneConnection(unsigned int fromLane, NBEdge *dest, unsigned int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false)
Adds a connection between the specified this edge's lane and an approached one.
NamedRTree myRTree
node positions for faster lookup
void guessTLs(OptionsCont &oc, NBTrafficLightLogicCont &tlc)
Guesses which junctions or junction clusters shall be controlled by tls.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
void avoidOverlap()
fix overlap
bool checkIsRemovable() const
void removeTrafficLight(NBTrafficLightDefinition *tlDef)
Removes the given traffic light from this node.
void extract(NBTrafficLightDefinition *definition)
Extracts a traffic light definition from myDefinitions but keeps it in myExtracted for eventual * del...
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
SUMOReal x() const
Returns the x-position.
#define UNUSED_PARAMETER(x)
#define WRITE_WARNING(msg)
void computeLanes2Lanes(const bool buildCrossingsAndWalkingAreas)
divides the incoming lanes on outgoing lanes
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
static OptionsCont & getOptions()
Retrieves the options.
void computeLogics(const NBEdgeCont &ec, OptionsCont &oc)
build the list of outgoing edges and lanes
void generateNodeClusters(SUMOReal maxDist, NodeClusters &into) const
Builds node clusters.
A class representing a single district.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges.
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
const std::string & getID() const
Returns the id.
void Remove(const float a_min[2], const float a_max[2], Named *const &a_data)
Remove entry.
unsigned int size() const
Returns the number of known nodes.
const Position & getPosition() const
Returns the position of this node.
const std::set< NBTrafficLightDefinition * > & getControllingTLS() const
Returns the traffic lights that were assigned to this node.
void joinTLS(NBTrafficLightLogicCont &tlc, SUMOReal maxdist)
Builds clusters of tls-controlled junctions and joins the control if possible.
static StringBijection< TrafficLightType > TrafficLightTypes
A point in 2D or 3D with translation and scaling methods.
unsigned int joinLoadedClusters(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
Joins loaded junction clusters (see NIXMLNodesHandler)
bool geometryLike() const
whether this is structurally similar to a geometry node
void removeTrafficLights()
Removes all references to traffic lights that control this tls.
const EdgeVector & getEdges() const
Returns all edges which participate in this node.
Storage for edges, including some functionality operating on multiple edges.
void joinNodeClusters(NodeClusters clusters, NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tlc)
std::set< NBNode * > myExtractedNodes
The extracted nodes which are kept for reference.
std::vector< std::string > getAllNames() const
get all node names
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
The connection was given by the user.
SUMOReal getSignalOffset() const
Returns the offset of a traffic signal from the end of this edge.
NBEdge * getConnectionTo(NBNode *n) const
bool shouldBeTLSControlled(const std::set< NBNode * > &c) const
Returns whethe the given node cluster should be controlled by a tls.
void rename(NBNode *node, const std::string &newID)
Renames the node. Throws exception if newID already exists.
std::vector< std::pair< NBEdge *, NBEdge * > > getEdgesToJoin() const
void joinSameNodeConnectingEdges(NBDistrictCont &dc, NBTrafficLightLogicCont &tlc, EdgeVector edges)
Joins the given edges because they connect the same nodes.
void setAsTLControlled(NBNode *node, NBTrafficLightLogicCont &tlc, TrafficLightType type, std::string id="")
Sets the given node as being controlled by a tls.
Allows to store the object; used as context while traveling the rtree in TraCI.
NBNode * getToNode() const
Returns the destination node of the edge.
bool isNearDistrict() const
void setID(const std::string &newID)
resets the id
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
void addCluster2Join(std::set< std::string > cluster)
add ids of nodes which shall be joined into a single node
A structure storing information about which edges were joined.
std::vector< NBEdge * > EdgeVector
void analyzeCluster(std::set< NBNode * > cluster, std::string &id, Position &pos, bool &hasTLS, TrafficLightType &type)
void removeIsolatedRoads(NBDistrictCont &dc, NBEdgeCont &ec, NBTrafficLightLogicCont &tc)
Removes sequences of edges that are not connected with a junction. Simple roads without junctions som...
std::set< std::string > myJoined
ids found in loaded join clusters used for error checking
SUMOReal y() const
Returns the y-position.
A storage for options typed value containers)
std::vector< std::set< NBNode * > > NodeClusters
Definition of a node cluster container.
void erase(NBDistrictCont &dc, NBEdge *edge)
Removes the given edge from the container (deleting it)
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
void mul(SUMOReal val)
Multiplies both positions with the given value.
void append(NBEdge *continuation)
std::vector< std::set< std::string > > myClusters2Join
void discardTrafficLights(NBTrafficLightLogicCont &tlc, bool geometryLike, bool guessSignals)
Represents a single node (junction) during network building.
T get(const std::string &str) const
bool removeFully(const std::string id)
Removes a logic definition (and all programs) from the dictionary.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
bool isNearEnough2BeJoined2(NBEdge *e, SUMOReal threshold) const
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
SUMOReal getSpeed() const
Returns the speed allowed on this edge.
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
void replaceRemoved(NBEdge *removed, int removedLane, NBEdge *by, int byLane)
Replaces occurences of the removed edge/lane in all definitions by the given edge.
A traffic light logics which must be computed (only nodes/edges are given)
void appended(const std::string &to, const std::string &what)
Informs the map that two edges have been joined.
bool extract(NBNode *node, bool remember=false)
Removes the given node but does not delete it.
int Search(const float a_min[2], const float a_max[2], const Named::StoringVisitor &c) const
Find all within search rectangle.
#define WRITE_MESSAGE(msg)
bool erase(NBNode *node)
Removes the given node, deleting it.
const std::vector< Connection > & getConnections() const
Returns the connections.
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
SUMOReal getLength() const
Returns the computed length of the edge.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
SUMOReal getAngleAtNode(const NBNode *const node) const
Returns the angle of the edge's geometry at the given node.
void registerJoinedCluster(const std::set< NBNode * > &cluster)
gets all joined clusters (see doc for myClusters2Join)
NBNode * getFromNode() const
Returns the origin node of the edge.