Eclipse SUMO - Simulation of Urban MObility
NIVissimConnectionCluster.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // -------------------
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <algorithm>
26 #include <iostream>
27 #include <cassert>
28 #include <iterator>
29 #include <utils/geom/Boundary.h>
30 #include <utils/geom/GeomHelper.h>
33 #include <utils/common/ToString.h>
34 #include "NIVissimConnection.h"
35 #include "NIVissimDisturbance.h"
36 #include "NIVissimNodeCluster.h"
37 #include "NIVissimNodeDef.h"
38 #include "NIVissimEdge.h"
39 #include "NIVissimTL.h"
41 
42 
43 // ===========================================================================
44 // static members
45 // ===========================================================================
49 
50 
51 
52 // ===========================================================================
53 // method definitions
54 // ===========================================================================
55 // ---------------------------------------------------------------------------
56 // NIVissimConnectionCluster::NodeSubCluster - methods
57 // ---------------------------------------------------------------------------
59  add(c);
60 }
61 
62 
64 
65 
66 void
69  myConnections.push_back(c);
70 }
71 
72 
73 void
75  for (ConnectionCont::const_iterator i = c.myConnections.begin(); i != c.myConnections.end(); i++) {
76  add(*i);
77  }
78 }
79 
80 
81 int
83  return (int)myConnections.size();
84 }
85 
86 
87 std::vector<int>
89  std::vector<int> ret;
91  for (ConnectionCont::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
92  ret.push_back((*i)->getID());
93  (*i)->setNodeCluster(id);
94  }
95  return ret;
96 }
97 
98 
99 bool
102  double offset) {
103  assert(myBoundary.xmax() >= myBoundary.xmin());
104  assert(c.myBoundary.xmax() >= c.myBoundary.xmin());
105  return myBoundary.overlapsWith(c.myBoundary, offset);
106 }
107 
108 
109 
110 // ---------------------------------------------------------------------------
111 // NIVissimConnectionCluster - methods
112 // ---------------------------------------------------------------------------
114  const std::vector<int>& connections, int nodeCluster, int edgeid)
115  : myConnections(connections), myNodeCluster(nodeCluster),
118  myClusters.push_back(this);
119  assert(edgeid > 0);
120  if (edgeid >= 0) {
121  myEdges.push_back(edgeid);
122  }
123  // add information about incoming and outgoing edges
124  for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
126  assert(c != 0);
127  myOutgoingEdges.push_back(c->getToEdgeID());
128  myIncomingEdges.push_back(c->getFromEdgeID());
129  assert(c->getFromEdgeID() == edgeid || c->getToEdgeID() == edgeid);
130  }
133 }
134 
135 
137  const std::vector<int>& connections, const Boundary& boundary,
138  int nodeCluster, const std::vector<int>& edges)
139  : myConnections(connections), myBoundary(boundary),
140  myNodeCluster(nodeCluster), myEdges(edges) {
141  myClusters.push_back(this);
143  assert(myBoundary.xmax() >= myBoundary.xmin());
144  // add information about incoming and outgoing edges
145  for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
147  assert(c != 0);
148  myOutgoingEdges.push_back(c->getToEdgeID());
149  myIncomingEdges.push_back(c->getFromEdgeID());
150  assert(find(edges.begin(), edges.end(), c->getFromEdgeID()) != edges.end()
151  ||
152  std::find(edges.begin(), edges.end(), c->getToEdgeID()) != edges.end());
153  }
156 }
157 
158 
160 
161 
162 
163 int
165  return myFirstFreeID++;
166 }
167 
168 
169 bool
171  double offset) const {
172  assert(myBoundary.xmax() >= myBoundary.xmin());
173  assert(c->myBoundary.xmax() >= c->myBoundary.xmin());
174  return c->myBoundary.overlapsWith(myBoundary, offset);
175 }
176 
177 
178 void
180  assert(myBoundary.xmax() >= myBoundary.xmin());
181  assert(c->myBoundary.xmax() >= c->myBoundary.xmin());
183  for (std::vector<int>::iterator i = c->myConnections.begin(); i != c->myConnections.end(); i++) {
184  myConnections.push_back(*i);
185  }
187  assert(myNodeCluster == -1 || c->myNodeCluster == -1);
188  if (myNodeCluster == -1) {
190  }
191  // inform edges about merging
192  // !!! merge should be done within one method
193  for (std::vector<int>::iterator j = c->myEdges.begin(); j != c->myEdges.end(); j++) {
194  NIVissimEdge::dictionary(*j)->mergedInto(c, this);
195  }
196  copy(c->myEdges.begin(), c->myEdges.end(), back_inserter(myEdges));
197  copy(c->myIncomingEdges.begin(), c->myIncomingEdges.end(),
198  back_inserter(myIncomingEdges));
199  copy(c->myOutgoingEdges.begin(), c->myOutgoingEdges.end(),
200  back_inserter(myOutgoingEdges));
204 }
205 
206 
207 
208 void
210  // !!! ...
211  // Further, we try to omit joining of overlaping nodes. This is done by holding
212  // the lists of incoming and outgoing edges and incrementally building the nodes
213  // regarding this information
214  std::vector<NIVissimConnectionCluster*> joinAble;
215  int pos = 0;
216  ContType::iterator i = myClusters.begin();
217  // step1 - faster but no complete
218  while (i != myClusters.end()) {
219  joinAble.clear();
220  ContType::iterator j = i + 1;
221 
222  // check whether every combination has been processed
223  while (j != myClusters.end()) {
224  // check whether the current clusters overlap
225  if ((*i)->joinable(*j, offset)) {
226  joinAble.push_back(*j);
227  }
228  j++;
229  }
230  for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
231  k != joinAble.end(); k++) {
232  // add the overlaping cluster
233  (*i)->add(*k);
234  // erase the overlaping cluster
235  delete *k;
236  myClusters.erase(find(myClusters.begin(), myClusters.end(), *k));
237  }
238  //
239  if (joinAble.size() > 0) {
240  i = myClusters.begin() + pos;
241  // clear temporary storages
242  joinAble.clear();
243  } else {
244  i++;
245  pos++;
246  }
247  }
248  //
249  pos = 0;
250  i = myClusters.begin();
251  while (i != myClusters.end()) {
252  ContType::iterator j = i + 1;
253  // check whether every combination has been processed
254  while (j != myClusters.end()) {
255  // check whether the current clusters overlap
256  if ((*i)->joinable(*j, offset)) {
257  joinAble.push_back(*j);
258  }
259  j++;
260  }
261  for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
262  k != joinAble.end(); k++) {
263  // add the overlaping cluster
264  (*i)->add(*k);
265  // erase the overlaping cluster
266  delete *k;
267  myClusters.erase(find(myClusters.begin(), myClusters.end(), *k));
268  }
269  //
270  if (joinAble.size() > 0) {
271  i = myClusters.begin();
272  // clear temporary storages
273  joinAble.clear();
274  pos = 0;
275  } else {
276  i++;
277  pos++;
278  }
279  }
280  // check for weak district connections
281  // (junctions made up by district connections, where prohibitions are not
282  // modelled properly)
283  pos = 0;
284  i = myClusters.begin();
285  while (i != myClusters.end()) {
286  ContType::iterator j = i + 1;
287  // check whether every combination has been processed
288  while (j != myClusters.end()) {
289  // check whether the current clusters overlap
290  if ((*i)->isWeakDistrictConnRealisation(*j)) {
291  joinAble.push_back(*j);
292  }
293  j++;
294  }
295  for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
296  k != joinAble.end(); k++) {
297  // add the overlaping cluster
298  (*i)->add(*k);
299  // erase the overlaping cluster
300  delete *k;
301  myClusters.erase(find(myClusters.begin(), myClusters.end(), *k));
302  }
303  //
304  if (joinAble.size() > 0) {
305  i = myClusters.begin();
306  // clear temporary storages
307  joinAble.clear();
308  pos = 0;
309  } else {
310  i++;
311  pos++;
312  }
313  }
314 }
315 
316 
317 bool
319  // join clusters which have at least one connection in common
321  return true;
322  }
323 
324  // connections shall overlap otherwise
325  if (!overlapsWith(c2, offset)) {
326  return false;
327  }
328 
329  // at least one of the clusters shall not be assigned to a node in previous (!!!??)
330  if (hasNodeCluster() && c2->hasNodeCluster()) {
331  return false;
332  }
333 
334  // join clusters which where connections do disturb each other
336  ||
338 
339  return true;
340  }
341 
342 
343  // join clusters which do share the same incoming or outgoing edges (not mutually)
344  std::vector<int> extendedOutgoing1;
345  std::vector<int> extendedIncoming1;
346  std::vector<int> extendedOutgoing2;
347  std::vector<int> extendedIncoming2;
348  if (myIncomingEdges.size() > 1 || c2->myIncomingEdges.size() > 1) {
349  extendedOutgoing1 =
351  extendedIncoming1 =
353  extendedOutgoing2 =
355  extendedIncoming2 =
357  } else {
358  extendedOutgoing1 = myIncomingEdges;
359  extendedIncoming1 = myOutgoingEdges;
360  extendedOutgoing2 = c2->myIncomingEdges;
361  extendedIncoming2 = c2->myOutgoingEdges;
362  }
363 
364  if (VectorHelper<int>::subSetExists(extendedOutgoing1, extendedOutgoing2)
365  ||
366  VectorHelper<int>::subSetExists(extendedIncoming1, extendedIncoming2)
367  ) {
368  return true;
369  }
370  return false;
371 }
372 
373 
374 bool
376  if ((myIncomingEdges.size() == 1 && myOutgoingEdges.size() == 1)) {
377  return false;
378  }
379  if ((c2->myIncomingEdges.size() == 1 && c2->myOutgoingEdges.size() == 1)) {
380  return false;
381  }
382 
383  // ok, may be the other way round
384  if (myIncomingEdges.size() == 1 && c2->myOutgoingEdges.size() == 1) {
385  return c2->isWeakDistrictConnRealisation(this);
386  }
387  // connections must cross
388  bool crosses = false;
389  for (std::vector<int>::const_iterator j1 = myConnections.begin(); j1 != myConnections.end() && !crosses; j1++) {
391  const PositionVector& g1 = c1->getGeometry();
392  for (std::vector<int>::const_iterator j2 = c2->myConnections.begin(); j2 != c2->myConnections.end() && !crosses; j2++) {
394  const PositionVector& g2 = c2->getGeometry();
395  if (g1.intersects(g2)) {
396  crosses = true;
397  }
398  }
399  }
400  if (!crosses) {
401  return false;
402  }
403  // ok, check for connection
404  if (myOutgoingEdges.size() != 1 || c2->myIncomingEdges.size() != 1) {
405  return false;
406  }
407  // check whether the connection is bidirectional
410  if (oe == nullptr || ie == nullptr) {
411  return false;
412  }
414 }
415 
416 
417 bool
419  //
420  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
422  for (std::vector<int>::iterator j = cc2->myConnections.begin(); j != cc2->myConnections.end(); j++) {
424  if (c1->getFromEdgeID() == c2->getFromEdgeID()) {
426  const PositionVector& g = e->getGeometry();
428  g.front(), g.back(), c1->getBoundary().getCenter());
430  g.front(), g.back(), c2->getBoundary().getCenter());
431  if (pos1 <= 5.0 && pos2 <= 5.0) {
432  return true;
433  }
434  }
435  if (c1->getToEdgeID() == c2->getToEdgeID()) {
437  const PositionVector& g = e->getGeometry();
439  g.front(), g.back(), c1->getBoundary().getCenter());
441  g.front(), g.back(), c2->getBoundary().getCenter());
442  if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
443  return true;
444  }
445  }
446  }
447  }
448  return false;
449 }
450 
451 
452 std::vector<int>
454  const std::vector<int>& iv2) const {
455  std::vector<int> ret(iv1);
456  for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
458  const std::vector<NIVissimEdge*> treatAsSame = e->getToTreatAsSame();
459  for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
460  if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
461  ret.push_back((*j)->getID());
462  }
463  }
464  }
465  return ret;
466 }
467 
468 std::vector<int>
470  std::vector<int> ret;
471  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
473  const std::vector<int>& disturbances = c->getDisturbances();
474  for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
476  ret.push_back(d->getEdgeID());
477  ret.push_back(d->getDisturbanceID());
478  }
479  }
480  return ret;
481 }
482 
483 
484 void
486  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
487  std::vector<int> disturbances;
488  std::vector<int> tls;
489  std::vector<int> nodes;
490  int tlsid = -1;
491  int nodeid = -1;
492  if ((*i)->myConnections.size() > 0) {
493  (*i)->recomputeBoundary();
494  disturbances = NIVissimDisturbance::getWithin((*i)->myBoundary);
495  }
496  nodes = (*i)->myNodes;//NIVissimTL::getWithin((*i)->myBoundary, 5.0);
497  if (nodes.size() > 1) {
498  WRITE_WARNING("NIVissimConnectionCluster:More than a single node");
499  // throw 1; // !!! eigentlich sollte hier nur eine Ampelanlage sein
500  }
501  if (nodes.size() > 0) {
502  nodeid = nodes[0];
503  }
504  //
505  //
507  nodeid, tlsid, (*i)->myConnections,
508  disturbances, (*i)->myIncomingEdges.size() < 2);
509  assert((*i)->myNodeCluster == id || (*i)->myNodeCluster < 0);
510  (*i)->myNodeCluster = id;
511  }
512 }
513 
514 
515 void
517  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
518  std::vector<int> connections = (*i)->myConnections;
519  for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
520  if (j != connections.begin()) {
521  into << ", ";
522  }
523  into << *j;
524  }
525  into << "(" << (*i)->myBoundary << ")" << std::endl;
526  }
527  into << "---------------------------" << std::endl;
528 }
529 
530 
531 
532 bool
534  return myNodeCluster != -1;
535 }
536 
537 
538 int
540  return (int)myClusters.size();
541 }
542 
543 
544 void
546  for (NodeSubCluster::ConnectionCont::const_iterator i = c.myConnections.begin(); i != c.myConnections.end(); i++) {
547  NIVissimConnection* conn = *i;
548  int connid = conn->getID();
549  std::vector<int>::iterator j = std::find(myConnections.begin(), myConnections.end(), connid);
550  if (j != myConnections.end()) {
551  myConnections.erase(j);
552  }
553  }
555 }
556 
557 
558 void
560  myBoundary = Boundary();
561  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
563  if (c != nullptr) {
566  if (c->getGeometry().size() != 0) {
568  }
569  }
570  }
571  assert(myBoundary.xmax() >= myBoundary.xmin());
572 }
573 
574 
575 NBNode*
577  return NIVissimNodeCluster::dictionary(myNodeCluster)->getNBNode();
578 }
579 
580 
581 bool
582 NIVissimConnectionCluster::around(const Position& p, double offset) const {
583  assert(myBoundary.xmax() >= myBoundary.xmin());
584  return myBoundary.around(p, offset);
585 }
586 
587 
588 
589 void
591  assert(myConnections.size() != 0);
592  // remove the cluster from all edges at first
593  std::vector<int>::iterator i;
594  for (i = myEdges.begin(); i != myEdges.end(); i++) {
596  edge->removeFromConnectionCluster(this);
597  }
598  // clear edge information
599  myEdges.clear();
600  // recheck which edges do still participate and add edges
601  for (i = myConnections.begin(); i != myConnections.end(); i++) {
603  assert(myBoundary.xmax() >= myBoundary.xmin());
604  if (myBoundary.around(c->getFromGeomPosition(), 5)) {
605  myEdges.push_back(c->getFromEdgeID());
606  }
607  assert(myBoundary.xmax() >= myBoundary.xmin());
608  if (myBoundary.around(c->getToGeomPosition(), 5)) {
609  myEdges.push_back(c->getToEdgeID());
610  }
611  }
612  // connect edges
613  for (i = myEdges.begin(); i != myEdges.end(); i++) {
615  edge->addToConnectionCluster(this);
616  }
617 }
618 
619 
620 double
622  // return the middle of the connections when there are any
623  if (myConnections.size() != 0) {
624  double sum = 0;
625  int part = 0;
626  std::vector<int>::const_iterator i;
627  for (i = myConnections.begin(); i != myConnections.end(); i++) {
629  if (c->getFromEdgeID() == edgeid) {
630  part++;
631  sum += c->getFromPosition();
632  }
633  if (c->getToEdgeID() == edgeid) {
634  part++;
635  sum += c->getToPosition();
636  }
637  }
638  if (part > 0) {
639  return sum / (double) part;
640  }
641  }
642  // use the position of the node if possible
643  if (myNodeCluster >= 0) {
644  // try to find the nearest point on the edge
645  // !!! only the main geometry is regarded
646  NIVissimNodeDef* node =
648  if (node != nullptr) {
649  double pos = node->getEdgePosition(edgeid);
650  if (pos >= 0) {
651  return pos;
652  }
653  }
654  /*
655  double try1 = GeomHelper::nearest_offset_on_line_to_point(
656  edge->getBegin2D(), edge->getEnd2D(), node->getPos());
657  if(try1>=0) {
658  return try1;
659  }
660  // try to use simple distance
661  double dist1 =
662  GeomHelper::distance(node->getPos(), edge->getBegin2D());
663  double dist2 =
664  GeomHelper::distance(node->getPos(), edge->getEnd2D());
665  return dist1<dist2
666  ? 0 : edge->getLength();
667  */
668  }
669  // what else?
670  WRITE_WARNING("NIVissimConnectionCluster: how to get an edge's position?");
671  // !!!
672  assert(myBoundary.xmin() <= myBoundary.xmax());
673  NIVissimEdge* edge = NIVissimEdge::dictionary(edgeid);
674  std::vector<int>::const_iterator i = std::find(myEdges.begin(), myEdges.end(), edgeid);
675  if (i == myEdges.end()) {
676  // edge does not exist!?
677  throw 1;
678  }
679  const PositionVector& edgeGeom = edge->getGeometry();
682  edgeGeom.front(), edgeGeom.back(), p);
683 }
684 
685 
686 
687 void
689  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
690  delete (*i);
691  }
692  myClusters.clear();
693  myFirstFreeID = 100000;
694 }
695 
696 
699  // collect connection where this edge is the incoming one
700  std::vector<NIVissimConnection*> edgeIsIncoming;
701  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
703  if (c->getFromEdgeID() == e->getID()) {
704  edgeIsIncoming.push_back(c);
705  }
706  }
707  //
708  if (edgeIsIncoming.size() == 0) {
709  return PositionVector();
710  }
711  // sort connected edges in same direction
712  sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
714  NIVissimConnection* c = *(edgeIsIncoming.begin());
715  return c->getGeometry();
716 }
717 
718 
719 
722  // collect connection where this edge is the incoming one
723  std::vector<NIVissimConnection*> edgeIsIncoming;
724  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
726  if (c->getFromEdgeID() == e->getID()) {
727  edgeIsIncoming.push_back(c);
728  }
729  }
730  //
731  if (edgeIsIncoming.size() == 0) {
732  return nullptr;
733  }
734  // sort connected edges in same direction
735  sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
737  return *(edgeIsIncoming.begin());
738 }
739 
740 
741 
744  // collect connection where this edge is the outgoing one
745  std::vector<NIVissimConnection*> edgeIsOutgoing;
746  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
748  if (c->getToEdgeID() == e->getID()) {
749  edgeIsOutgoing.push_back(c);
750  }
751  }
752  //
753  if (edgeIsOutgoing.size() == 0) {
754  return PositionVector();
755  }
756  // sort connected edges in same direction
757  sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
759  NIVissimConnection* c = *(edgeIsOutgoing.begin());
760  return c->getGeometry();
761 }
762 
763 
766  // collect connection where this edge is the outgoing one
767  std::vector<NIVissimConnection*> edgeIsOutgoing;
768  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
770  if (c->getToEdgeID() == e->getID()) {
771  edgeIsOutgoing.push_back(c);
772  }
773  }
774  //
775  if (edgeIsOutgoing.size() == 0) {
776  return nullptr;
777  }
778  // sort connected edges in same direction
779  sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
781  return *(edgeIsOutgoing.begin());
782 }
783 
784 
785 
786 /****************************************************************************/
787 
NIVissimConnectionCluster::myFirstFreeID
static int myFirstFreeID
Definition: NIVissimConnectionCluster.h:189
Boundary.h
VectorHelper::removeDouble
static void removeDouble(std::vector< T > &v)
Definition: VectorHelper.h:68
PositionVector::beginEndAngle
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position
Definition: PositionVector.cpp:808
NIVissimNodeDef::dictionary
static bool dictionary(int id, NIVissimNodeDef *o)
Definition: NIVissimNodeDef.cpp:51
ToString.h
NIVissimConnectionCluster::getNBNode
NBNode * getNBNode() const
Definition: NIVissimConnectionCluster.cpp:576
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
NIVissimEdge.h
NIVissimConnection::getBoundingBox
const Boundary & getBoundingBox() const
Definition: NIVissimConnection.cpp:298
NIVissimEdge
A temporary storage for edges imported from Vissim.
Definition: NIVissimEdge.h:53
NIVissimDisturbance::getWithin
static std::vector< int > getWithin(const AbstractPoly &poly)
Definition: NIVissimDisturbance.cpp:102
GeomHelper::angleDiff
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
Definition: GeomHelper.cpp:180
NIVissimConnectionCluster::add
void add(NIVissimConnectionCluster *c)
Adds the second cluster.
Definition: NIVissimConnectionCluster.cpp:179
NIVissimConnectionCluster::NodeSubCluster
Definition: NIVissimConnectionCluster.h:107
NIVissimConnection::getToPosition
double getToPosition() const
Definition: NIVissimConnection.cpp:174
NIVissimConnection::getToGeomPosition
Position getToGeomPosition() const
Definition: NIVissimConnection.cpp:187
NIVissimConnectionCluster::dictSize
static int dictSize()
Definition: NIVissimConnectionCluster.cpp:539
MsgHandler.h
NIVissimConnectionCluster::myOutgoingEdges
std::vector< int > myOutgoingEdges
Definition: NIVissimConnectionCluster.h:184
NIVissimConnectionCluster.h
NIVissimNodeDef::getEdgePosition
virtual double getEdgePosition(int edgeid) const =0
NIVissimDisturbance::dictionary
static bool dictionary(const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by)
Definition: NIVissimDisturbance.cpp:68
NIVissimConnectionCluster::~NIVissimConnectionCluster
~NIVissimConnectionCluster()
Destructor.
Definition: NIVissimConnectionCluster.cpp:159
NIVissimConnectionCluster::myConnections
std::vector< int > myConnections
List of connection-ids which participate within this cluster.
Definition: NIVissimConnectionCluster.h:169
Boundary::xmax
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:124
NIVissimConnectionCluster::myEdges
std::vector< int > myEdges
Definition: NIVissimConnectionCluster.h:178
Boundary::around
bool around(const Position &p, double offset=0) const
Returns whether the AbstractPoly the given coordinate.
Definition: Boundary.cpp:172
PositionVector::length
double length() const
Returns the length.
Definition: PositionVector.cpp:484
NIVissimConnectionCluster::same_direction_sorter
Definition: NIVissimConnectionCluster.h:123
GeomHelper::nearest_offset_on_line_to_point2D
static double nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
Definition: GeomHelper.cpp:89
PositionVector
A list of positions.
Definition: PositionVector.h:45
NIVissimConnectionCluster::getPositionForEdge
double getPositionForEdge(int edgeid) const
Definition: NIVissimConnectionCluster.cpp:621
NIVissimAbstractEdge::getID
int getID() const
Definition: NIVissimAbstractEdge.cpp:147
NIVissimNodeCluster::dictionary
static bool dictionary(int id, NIVissimNodeCluster *o)
Definition: NIVissimNodeCluster.cpp:65
NIVissimConnection::getToEdgeID
int getToEdgeID() const
Definition: NIVissimConnection.cpp:162
PositionVector::getBoxBoundary
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Definition: PositionVector.cpp:390
VectorHelper
Definition: VectorHelper.h:39
NIVissimEdge::dictionary
static bool dictionary(int id, const std::string &name, const std::string &type, int noLanes, double zuschlag1, double zuschlag2, double length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Adds the described item to the dictionary Builds the edge first.
Definition: NIVissimEdge.cpp:138
NIVissimConnection::getFromGeomPosition
Position getFromGeomPosition() const
Definition: NIVissimConnection.cpp:180
VectorHelper.h
NIVissimConnectionCluster::_debugOut
static void _debugOut(std::ostream &into)
Definition: NIVissimConnectionCluster.cpp:516
NIVissimDisturbance.h
NIVissimConnectionCluster::getIncomingContinuationGeometry
PositionVector getIncomingContinuationGeometry(NIVissimEdge *e) const
Definition: NIVissimConnectionCluster.cpp:698
PositionVector::intersects
bool intersects(const Position &p1, const Position &p2) const
Returns the information whether this list of points interesects the given line.
Definition: PositionVector.cpp:159
NIVissimConnectionCluster::getNextFreeNodeID
static int getNextFreeNodeID()
Definition: NIVissimConnectionCluster.cpp:164
NIVissimConnectionCluster::hasNodeCluster
bool hasNodeCluster() const
Definition: NIVissimConnectionCluster.cpp:533
NIVissimConnectionCluster::joinable
bool joinable(NIVissimConnectionCluster *c2, double offset)
Definition: NIVissimConnectionCluster.cpp:318
Boundary::xmin
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:118
NIVissimNodeDef.h
NIVissimConnectionCluster::around
bool around(const Position &p, double offset=0) const
Definition: NIVissimConnectionCluster.cpp:582
GeomHelper::crossPoint
static Position crossPoint(const Boundary &b, const PositionVector &v)
Definition: GeomHelper.cpp:129
NIVissimDisturbance::getDisturbanceID
int getDisturbanceID() const
Definition: NIVissimDisturbance.h:55
NIVissimConnectionCluster::myBlaID
int myBlaID
Definition: NIVissimConnectionCluster.h:191
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
NIVissimConnection
Definition: NIVissimConnection.h:47
NIVissimNodeDef
Definition: NIVissimNodeDef.h:33
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
NIVissimConnection::getFromPosition
double getFromPosition() const
Definition: NIVissimConnection.cpp:168
NIVissimConnectionCluster::NodeSubCluster::~NodeSubCluster
~NodeSubCluster()
Definition: NIVissimConnectionCluster.cpp:63
NIVissimAbstractEdge::getGeometry
const PositionVector & getGeometry() const
Definition: NIVissimAbstractEdge.cpp:161
NIVissimAbstractEdge::getDisturbances
const std::vector< int > & getDisturbances() const
Definition: NIVissimAbstractEdge.cpp:173
NIVissimConnectionCluster::liesOnSameEdgesEnd
bool liesOnSameEdgesEnd(NIVissimConnectionCluster *cc2)
Definition: NIVissimConnectionCluster.cpp:418
NIVissimConnectionCluster::getOutgoingContinuation
NIVissimConnection * getOutgoingContinuation(NIVissimEdge *e) const
Definition: NIVissimConnectionCluster.cpp:765
NIVissimConnectionCluster::isWeakDistrictConnRealisation
bool isWeakDistrictConnRealisation(NIVissimConnectionCluster *c2)
Definition: NIVissimConnectionCluster.cpp:375
NIVissimNodeCluster.h
NIVissimConnectionCluster::getDisturbanceParticipators
std::vector< int > getDisturbanceParticipators()
Definition: NIVissimConnectionCluster.cpp:469
NIVissimEdge::removeFromConnectionCluster
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
Definition: NIVissimEdge.cpp:808
NIVissimEdge::getToTreatAsSame
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
Definition: NIVissimEdge.cpp:968
DEG2RAD
#define DEG2RAD(x)
Definition: GeomHelper.h:37
NIVissimConnectionCluster::NodeSubCluster::overlapsWith
bool overlapsWith(const NodeSubCluster &c, double offset=0)
Definition: NIVissimConnectionCluster.cpp:100
NIVissimConnectionCluster::myIncomingEdges
std::vector< int > myIncomingEdges
Definition: NIVissimConnectionCluster.h:184
NIVissimConnectionCluster::getOutgoingContinuationGeometry
PositionVector getOutgoingContinuationGeometry(NIVissimEdge *e) const
Definition: NIVissimConnectionCluster.cpp:743
NIVissimDisturbance::getEdgeID
int getEdgeID() const
Definition: NIVissimDisturbance.h:52
NIVissimConnectionCluster::NodeSubCluster::add
void add(NIVissimConnection *c)
Definition: NIVissimConnectionCluster.cpp:67
NIVissimConnection.h
NIVissimConnectionCluster::myClusters
static ContType myClusters
Definition: NIVissimConnectionCluster.h:188
Boundary::getCenter
Position getCenter() const
Returns the center of the boundary.
Definition: Boundary.cpp:112
NIVissimTL.h
NIVissimConnectionCluster::recheckEdges
void recheckEdges()
Definition: NIVissimConnectionCluster.cpp:590
NIVissimConnectionCluster::NodeSubCluster::getConnectionIDs
std::vector< int > getConnectionIDs() const
Definition: NIVissimConnectionCluster.cpp:88
NIVissimConnectionCluster::NodeSubCluster::myConnections
ConnectionCont myConnections
Definition: NIVissimConnectionCluster.h:120
NIVissimConnectionCluster::ContType
std::vector< NIVissimConnectionCluster * > ContType
Definition: NIVissimConnectionCluster.h:187
NIVissimConnectionCluster::removeConnections
void removeConnections(const NodeSubCluster &c)
Definition: NIVissimConnectionCluster.cpp:545
NIVissimConnectionCluster::extendByToTreatAsSame
std::vector< int > extendByToTreatAsSame(const std::vector< int > &iv1, const std::vector< int > &iv2) const
Definition: NIVissimConnectionCluster.cpp:453
NIVissimConnectionCluster::overlapsWith
bool overlapsWith(NIVissimConnectionCluster *c, double offset=0) const
Returns the information whether the given cluster overlaps the current.
Definition: NIVissimConnectionCluster.cpp:170
NIVissimConnectionCluster::NodeSubCluster::myBoundary
Boundary myBoundary
Definition: NIVissimConnectionCluster.h:118
NIVissimConnectionCluster::buildNodeClusters
static void buildNodeClusters()
Definition: NIVissimConnectionCluster.cpp:485
config.h
NIVissimConnectionCluster::getIncomingContinuation
NIVissimConnection * getIncomingContinuation(NIVissimEdge *e) const
Definition: NIVissimConnectionCluster.cpp:721
NIVissimConnection::dictionary
static bool dictionary(int id, NIVissimConnection *o)
Definition: NIVissimConnection.cpp:77
GeomHelper.h
NIVissimConnectionCluster::NodeSubCluster::NodeSubCluster
NodeSubCluster(NIVissimConnection *c)
Definition: NIVissimConnectionCluster.cpp:58
NIVissimConnection::getFromEdgeID
int getFromEdgeID() const
Definition: NIVissimConnection.cpp:156
NIVissimDisturbance
Definition: NIVissimDisturbance.h:43
NIVissimConnectionCluster::myBoundary
Boundary myBoundary
The boundary of the cluster.
Definition: NIVissimConnectionCluster.h:172
NIVissimBoundedClusterObject::getBoundary
const Boundary & getBoundary() const
Definition: NIVissimBoundedClusterObject.cpp:70
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NIVissimEdge::addToConnectionCluster
void addToConnectionCluster(NIVissimConnectionCluster *c)
Definition: NIVissimEdge.cpp:817
NIVissimConnectionCluster::NodeSubCluster::size
int size() const
Definition: NIVissimConnectionCluster.cpp:82
NIVissimConnectionCluster::recomputeBoundary
void recomputeBoundary()
Definition: NIVissimConnectionCluster.cpp:559
NIVissimConnectionCluster::NIVissimConnectionCluster
NIVissimConnectionCluster(const std::vector< int > &connections, int nodeCluster, int edgeid)
Constructor Build the boundary; The boundary includes both incoming and outgoing nodes.
Definition: NIVissimConnectionCluster.cpp:113
NIVissimConnectionCluster::clearDict
static void clearDict()
Definition: NIVissimConnectionCluster.cpp:688
NIVissimConnectionCluster::myStaticBlaID
static int myStaticBlaID
Definition: NIVissimConnectionCluster.h:190
NIVissimConnectionCluster::myNodeCluster
int myNodeCluster
The node the cluster is assigned to.
Definition: NIVissimConnectionCluster.h:175
NIVissimConnectionCluster::joinBySameEdges
static void joinBySameEdges(double offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap.
Definition: NIVissimConnectionCluster.cpp:209
NIVissimConnectionCluster
Definition: NIVissimConnectionCluster.h:52
Boundary::overlapsWith
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
Definition: Boundary.cpp:181