93 ret.push_back((*i)->getID());
94 (*i)->setNodeCluster(
id);
115 const std::vector<int>& connections,
int nodeCluster,
int edgeid)
125 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
138 const std::vector<int>& connections,
const Boundary& boundary,
139 int nodeCluster,
const std::vector<int>& edges)
140 : myConnections(connections), myBoundary(boundary),
141 myNodeCluster(nodeCluster), myEdges(edges) {
146 for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
151 assert(find(edges.begin(), edges.end(), c->
getFromEdgeID()) != edges.end()
153 std::find(edges.begin(), edges.end(), c->
getToEdgeID()) != edges.end());
172 double offset)
const {
194 for (std::vector<int>::iterator j = c->
myEdges.begin(); j != c->
myEdges.end(); j++) {
215 std::vector<NIVissimConnectionCluster*> joinAble;
221 ContType::iterator j = i + 1;
226 if ((*i)->joinable(*j, offset)) {
227 joinAble.push_back(*j);
231 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
232 k != joinAble.end(); k++) {
240 if (joinAble.size() > 0) {
253 ContType::iterator j = i + 1;
257 if ((*i)->joinable(*j, offset)) {
258 joinAble.push_back(*j);
262 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
263 k != joinAble.end(); k++) {
271 if (joinAble.size() > 0) {
287 ContType::iterator j = i + 1;
291 if ((*i)->isWeakDistrictConnRealisation(*j)) {
292 joinAble.push_back(*j);
296 for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
297 k != joinAble.end(); k++) {
305 if (joinAble.size() > 0) {
345 std::vector<int> extendedOutgoing1;
346 std::vector<int> extendedIncoming1;
347 std::vector<int> extendedOutgoing2;
348 std::vector<int> extendedIncoming2;
389 bool crosses =
false;
411 if (oe ==
nullptr || ie ==
nullptr) {
432 if (pos1 <= 5.0 && pos2 <= 5.0) {
443 if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
455 const std::vector<int>& iv2)
const {
456 std::vector<int> ret(iv1);
457 for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
460 for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
461 if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
462 ret.push_back((*j)->getID());
471 std::vector<int> ret;
475 for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
488 std::vector<int> disturbances;
489 std::vector<int> tls;
490 std::vector<int> nodes;
493 if ((*i)->myConnections.size() > 0) {
494 (*i)->recomputeBoundary();
497 nodes = (*i)->myNodes;
498 if (nodes.size() > 1) {
499 WRITE_WARNING(
"NIVissimConnectionCluster:More than a single node");
502 if (nodes.size() > 0) {
508 nodeid, tlsid, (*i)->myConnections,
509 disturbances, (*i)->myIncomingEdges.size() < 2);
510 assert((*i)->myNodeCluster ==
id || (*i)->myNodeCluster < 0);
511 (*i)->myNodeCluster = id;
519 std::vector<int> connections = (*i)->myConnections;
520 for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
521 if (j != connections.begin()) {
526 into <<
"(" << (*i)->myBoundary <<
")" << std::endl;
528 into <<
"---------------------------" << std::endl;
549 int connid = conn->
getID();
594 std::vector<int>::iterator i;
627 std::vector<int>::const_iterator i;
640 return sum / (double) part;
649 if (node !=
nullptr) {
671 WRITE_WARNING(
"NIVissimConnectionCluster: how to get an edge's position?");
675 std::vector<int>::const_iterator i = std::find(
myEdges.begin(),
myEdges.end(), edgeid);
683 edgeGeom.front(), edgeGeom.back(), p);
701 std::vector<NIVissimConnection*> edgeIsIncoming;
705 edgeIsIncoming.push_back(c);
709 if (edgeIsIncoming.size() == 0) {
713 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
724 std::vector<NIVissimConnection*> edgeIsIncoming;
728 edgeIsIncoming.push_back(c);
732 if (edgeIsIncoming.size() == 0) {
736 sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
738 return *(edgeIsIncoming.begin());
746 std::vector<NIVissimConnection*> edgeIsOutgoing;
750 edgeIsOutgoing.push_back(c);
754 if (edgeIsOutgoing.size() == 0) {
758 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
768 std::vector<NIVissimConnection*> edgeIsOutgoing;
772 edgeIsOutgoing.push_back(c);
776 if (edgeIsOutgoing.size() == 0) {
780 sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
782 return *(edgeIsOutgoing.begin());