SUMO - Simulation of Urban MObility
NIVissimConnectionCluster.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // -------------------
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <algorithm>
34 #include <iostream>
35 #include <cassert>
36 #include <iterator>
37 #include <utils/geom/Boundary.h>
38 #include <utils/geom/GeomHelper.h>
41 #include <utils/common/ToString.h>
42 #include "NIVissimConnection.h"
43 #include "NIVissimDisturbance.h"
44 #include "NIVissimNodeCluster.h"
45 #include "NIVissimNodeDef.h"
46 #include "NIVissimEdge.h"
47 #include "NIVissimTL.h"
49 
50 #ifdef CHECK_MEMORY_LEAKS
51 #include <foreign/nvwa/debug_new.h>
52 #endif // CHECK_MEMORY_LEAKS
53 
54 
55 // ===========================================================================
56 // static members
57 // ===========================================================================
61 
62 
63 
64 // ===========================================================================
65 // method definitions
66 // ===========================================================================
67 // ---------------------------------------------------------------------------
68 // NIVissimConnectionCluster::NodeSubCluster - methods
69 // ---------------------------------------------------------------------------
71  add(c);
72 }
73 
74 
76 
77 
78 void
81  myConnections.push_back(c);
82 }
83 
84 
85 void
87  for (ConnectionCont::const_iterator i = c.myConnections.begin(); i != c.myConnections.end(); i++) {
88  add(*i);
89  }
90 }
91 
92 
93 size_t
95  return myConnections.size();
96 }
97 
98 
99 std::vector<int>
101  std::vector<int> ret;
103  for (ConnectionCont::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
104  ret.push_back((*i)->getID());
105  (*i)->setNodeCluster(id);
106  }
107  return ret;
108 }
109 
110 
111 bool
114  SUMOReal offset) {
115  assert(myBoundary.xmax() >= myBoundary.xmin());
116  assert(c.myBoundary.xmax() >= c.myBoundary.xmin());
117  return myBoundary.overlapsWith(c.myBoundary, offset);
118 }
119 
120 
121 
122 // ---------------------------------------------------------------------------
123 // NIVissimConnectionCluster - methods
124 // ---------------------------------------------------------------------------
126  const std::vector<int>& connections, int nodeCluster, int edgeid)
127  : myConnections(connections), myNodeCluster(nodeCluster),
130  myClusters.push_back(this);
131  assert(edgeid > 0);
132  if (edgeid >= 0) {
133  myEdges.push_back(edgeid);
134  }
135  // add information about incoming and outgoing edges
136  for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
138  assert(c != 0);
139  myOutgoingEdges.push_back(c->getToEdgeID());
140  myIncomingEdges.push_back(c->getFromEdgeID());
141  assert(c->getFromEdgeID() == edgeid || c->getToEdgeID() == edgeid);
142  }
145 }
146 
147 
149  const std::vector<int>& connections, const Boundary& boundary,
150  int nodeCluster, const std::vector<int>& edges)
151  : myConnections(connections), myBoundary(boundary),
152  myNodeCluster(nodeCluster), myEdges(edges) {
153  myClusters.push_back(this);
155  assert(myBoundary.xmax() >= myBoundary.xmin());
156  // add information about incoming and outgoing edges
157  for (std::vector<int>::const_iterator i = connections.begin(); i != connections.end(); i++) {
159  assert(c != 0);
160  myOutgoingEdges.push_back(c->getToEdgeID());
161  myIncomingEdges.push_back(c->getFromEdgeID());
162  assert(find(edges.begin(), edges.end(), c->getFromEdgeID()) != edges.end()
163  ||
164  find(edges.begin(), edges.end(), c->getToEdgeID()) != edges.end());
165  }
168 }
169 
170 
172 
173 
174 
175 int
177  return myFirstFreeID++;
178 }
179 
180 
181 bool
183  SUMOReal offset) const {
184  assert(myBoundary.xmax() >= myBoundary.xmin());
185  assert(c->myBoundary.xmax() >= c->myBoundary.xmin());
186  return c->myBoundary.overlapsWith(myBoundary, offset);
187 }
188 
189 
190 void
192  assert(myBoundary.xmax() >= myBoundary.xmin());
193  assert(c->myBoundary.xmax() >= c->myBoundary.xmin());
195  for (std::vector<int>::iterator i = c->myConnections.begin(); i != c->myConnections.end(); i++) {
196  myConnections.push_back(*i);
197  }
199  assert(myNodeCluster == -1 || c->myNodeCluster == -1);
200  if (myNodeCluster == -1) {
202  }
203  // inform edges about merging
204  // !!! merge should be done within one method
205  for (std::vector<int>::iterator j = c->myEdges.begin(); j != c->myEdges.end(); j++) {
206  NIVissimEdge::dictionary(*j)->mergedInto(c, this);
207  }
208  copy(c->myEdges.begin(), c->myEdges.end(), back_inserter(myEdges));
209  copy(c->myIncomingEdges.begin(), c->myIncomingEdges.end(),
210  back_inserter(myIncomingEdges));
211  copy(c->myOutgoingEdges.begin(), c->myOutgoingEdges.end(),
212  back_inserter(myOutgoingEdges));
216 }
217 
218 
219 
220 void
222  // !!! ...
223  // Further, we try to omit joining of overlaping nodes. This is done by holding
224  // the lists of incoming and outgoing edges and incrementally building the nodes
225  // regarding this information
226  std::vector<NIVissimConnectionCluster*> joinAble;
227  size_t pos = 0;
228  ContType::iterator i = myClusters.begin();
229  // step1 - faster but no complete
230  while (i != myClusters.end()) {
231  joinAble.clear();
232  ContType::iterator j = i + 1;
233 
234  // check whether every combination has been processed
235  while (j != myClusters.end()) {
236  // check whether the current clusters overlap
237  if ((*i)->joinable(*j, offset)) {
238  joinAble.push_back(*j);
239  }
240  j++;
241  }
242  for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
243  k != joinAble.end(); k++) {
244  // add the overlaping cluster
245  (*i)->add(*k);
246  // erase the overlaping cluster
247  delete *k;
248  myClusters.erase(find(myClusters.begin(), myClusters.end(), *k));
249  }
250  //
251  if (joinAble.size() > 0) {
252  i = myClusters.begin() + pos;
253  // clear temporary storages
254  joinAble.clear();
255  } else {
256  i++;
257  pos++;
258  }
259  }
260  //
261  pos = 0;
262  i = myClusters.begin();
263  while (i != myClusters.end()) {
264  ContType::iterator j = i + 1;
265  // check whether every combination has been processed
266  while (j != myClusters.end()) {
267  // check whether the current clusters overlap
268  if ((*i)->joinable(*j, offset)) {
269  joinAble.push_back(*j);
270  }
271  j++;
272  }
273  for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
274  k != joinAble.end(); k++) {
275  // add the overlaping cluster
276  (*i)->add(*k);
277  // erase the overlaping cluster
278  delete *k;
279  myClusters.erase(find(myClusters.begin(), myClusters.end(), *k));
280  }
281  //
282  if (joinAble.size() > 0) {
283  i = myClusters.begin();
284  // clear temporary storages
285  joinAble.clear();
286  pos = 0;
287  } else {
288  i++;
289  pos++;
290  }
291  }
292  // check for weak district connections
293  // (junctions made up by district connections, where prohibitions are not
294  // modelled properly)
295  pos = 0;
296  i = myClusters.begin();
297  while (i != myClusters.end()) {
298  ContType::iterator j = i + 1;
299  // check whether every combination has been processed
300  while (j != myClusters.end()) {
301  // check whether the current clusters overlap
302  if ((*i)->isWeakDistrictConnRealisation(*j)) {
303  joinAble.push_back(*j);
304  }
305  j++;
306  }
307  for (std::vector<NIVissimConnectionCluster*>::iterator k = joinAble.begin();
308  k != joinAble.end(); k++) {
309  // add the overlaping cluster
310  (*i)->add(*k);
311  // erase the overlaping cluster
312  delete *k;
313  myClusters.erase(find(myClusters.begin(), myClusters.end(), *k));
314  }
315  //
316  if (joinAble.size() > 0) {
317  i = myClusters.begin();
318  // clear temporary storages
319  joinAble.clear();
320  pos = 0;
321  } else {
322  i++;
323  pos++;
324  }
325  }
326 }
327 
328 
329 bool
331  // join clusters which have at least one connection in common
333  return true;
334  }
335 
336  // connections shall overlap otherwise
337  if (!overlapsWith(c2, offset)) {
338  return false;
339  }
340 
341  // at least one of the clusters shall not be assigned to a node in previous (!!!??)
342  if (hasNodeCluster() && c2->hasNodeCluster()) {
343  return false;
344  }
345 
346  // join clusters which where connections do disturb each other
348  ||
350 
351  return true;
352  }
353 
354 
355  // join clusters which do share the same incoming or outgoing edges (not mutually)
356  std::vector<int> extendedOutgoing1;
357  std::vector<int> extendedIncoming1;
358  std::vector<int> extendedOutgoing2;
359  std::vector<int> extendedIncoming2;
360  if (myIncomingEdges.size() > 1 || c2->myIncomingEdges.size() > 1) {
361  extendedOutgoing1 =
363  extendedIncoming1 =
365  extendedOutgoing2 =
367  extendedIncoming2 =
369  } else {
370  extendedOutgoing1 = myIncomingEdges;
371  extendedIncoming1 = myOutgoingEdges;
372  extendedOutgoing2 = c2->myIncomingEdges;
373  extendedIncoming2 = c2->myOutgoingEdges;
374  }
375 
376  if (VectorHelper<int>::subSetExists(extendedOutgoing1, extendedOutgoing2)
377  ||
378  VectorHelper<int>::subSetExists(extendedIncoming1, extendedIncoming2)
379  ) {
380  return true;
381  }
382  return false;
383 }
384 
385 
386 bool
388  if ((myIncomingEdges.size() == 1 && myOutgoingEdges.size() == 1)) {
389  return false;
390  }
391  if ((c2->myIncomingEdges.size() == 1 && c2->myOutgoingEdges.size() == 1)) {
392  return false;
393  }
394 
395  // ok, may be the other way round
396  if (myIncomingEdges.size() == 1 && c2->myOutgoingEdges.size() == 1) {
397  return c2->isWeakDistrictConnRealisation(this);
398  }
399  // connections must cross
400  bool crosses = false;
401  for (std::vector<int>::const_iterator j1 = myConnections.begin(); j1 != myConnections.end() && !crosses; j1++) {
403  const PositionVector& g1 = c1->getGeometry();
404  for (std::vector<int>::const_iterator j2 = c2->myConnections.begin(); j2 != c2->myConnections.end() && !crosses; j2++) {
406  const PositionVector& g2 = c2->getGeometry();
407  if (g1.intersects(g2)) {
408  crosses = true;
409  }
410  }
411  }
412  if (!crosses) {
413  return false;
414  }
415  // ok, check for connection
416  if (myOutgoingEdges.size() != 1 || c2->myIncomingEdges.size() != 1) {
417  return false;
418  }
419  // check whether the connection is bidirectional
422  if (oe == 0 || ie == 0) {
423  return false;
424  }
425  Line l1(oe->getGeometry().front(), oe->getGeometry().back());
426  Line l2(ie->getGeometry().back(), ie->getGeometry().front());
427  SUMOReal a1 = l1.atan2DegreeAngle();
428  SUMOReal a2 = l2.atan2DegreeAngle();
429  return fabs(a1 - a2) < 5;
430 }
431 
432 
433 bool
435  //
436  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
438  for (std::vector<int>::iterator j = cc2->myConnections.begin(); j != cc2->myConnections.end(); j++) {
440  if (c1->getFromEdgeID() == c2->getFromEdgeID()) {
442  const PositionVector& g = e->getGeometry();
444  g.front(), g.back(), c1->getBoundary().getCenter());
446  g.front(), g.back(), c2->getBoundary().getCenter());
447  if (pos1 <= 5.0 && pos2 <= 5.0) {
448  return true;
449  }
450  }
451  if (c1->getToEdgeID() == c2->getToEdgeID()) {
453  const PositionVector& g = e->getGeometry();
455  g.front(), g.back(), c1->getBoundary().getCenter());
457  g.front(), g.back(), c2->getBoundary().getCenter());
458  if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
459  return true;
460  }
461  }
462  }
463  }
464  return false;
465 }
466 
467 
468 std::vector<int>
470  const std::vector<int>& iv2) const {
471  std::vector<int> ret(iv1);
472  for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
474  const std::vector<NIVissimEdge*> treatAsSame = e->getToTreatAsSame();
475  for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
476  if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
477  ret.push_back((*j)->getID());
478  }
479  }
480  }
481  return ret;
482 }
483 
484 std::vector<int>
486  std::vector<int> ret;
487  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
489  const std::vector<int>& disturbances = c->getDisturbances();
490  for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
492  ret.push_back(d->getEdgeID());
493  ret.push_back(d->getDisturbanceID());
494  }
495  }
496  return ret;
497 }
498 
499 
500 void
502  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
503  std::vector<int> disturbances;
504  std::vector<int> tls;
505  std::vector<int> nodes;
506  int tlsid = -1;
507  int nodeid = -1;
508  if ((*i)->myConnections.size() > 0) {
509  (*i)->recomputeBoundary();
510  disturbances = NIVissimDisturbance::getWithin((*i)->myBoundary);
511  }
512  nodes = (*i)->myNodes;//NIVissimTL::getWithin((*i)->myBoundary, 5.0);
513  if (nodes.size() > 1) {
514  WRITE_WARNING("NIVissimConnectionCluster:More than a single node");
515  // throw 1; // !!! eigentlich sollte hier nur eine Ampelanlage sein
516  }
517  if (nodes.size() > 0) {
518  nodeid = nodes[0];
519  }
520  //
521  //
523  nodeid, tlsid, (*i)->myConnections,
524  disturbances, (*i)->myIncomingEdges.size() < 2);
525  assert((*i)->myNodeCluster == id || (*i)->myNodeCluster < 0);
526  (*i)->myNodeCluster = id;
527  }
528 }
529 
530 
531 void
533  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
534  std::vector<int> connections = (*i)->myConnections;
535  for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
536  if (j != connections.begin()) {
537  into << ", ";
538  }
539  into << *j;
540  }
541  into << "(" << (*i)->myBoundary << ")" << std::endl;
542  }
543  into << "---------------------------" << std::endl;
544 }
545 
546 
547 
548 bool
550  return myNodeCluster != -1;
551 }
552 
553 
554 size_t
556  return myClusters.size();
557 }
558 
559 
560 void
562  for (NodeSubCluster::ConnectionCont::const_iterator i = c.myConnections.begin(); i != c.myConnections.end(); i++) {
563  NIVissimConnection* conn = *i;
564  int connid = conn->getID();
565  std::vector<int>::iterator j = find(myConnections.begin(), myConnections.end(), connid);
566  if (j != myConnections.end()) {
567  myConnections.erase(j);
568  }
569  }
571 }
572 
573 
574 void
576  myBoundary = Boundary();
577  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
579  if (c != 0) {
582  if (c->getGeometry().size() != 0) {
584  }
585  }
586  }
587  assert(myBoundary.xmax() >= myBoundary.xmin());
588 }
589 
590 
591 NBNode*
593  return NIVissimNodeCluster::dictionary(myNodeCluster)->getNBNode();
594 }
595 
596 
597 bool
599  assert(myBoundary.xmax() >= myBoundary.xmin());
600  return myBoundary.around(p, offset);
601 }
602 
603 
604 
605 void
607  assert(myConnections.size() != 0);
608  // remove the cluster from all edges at first
609  std::vector<int>::iterator i;
610  for (i = myEdges.begin(); i != myEdges.end(); i++) {
612  edge->removeFromConnectionCluster(this);
613  }
614  // clear edge information
615  myEdges.clear();
616  // recheck which edges do still participate and add edges
617  for (i = myConnections.begin(); i != myConnections.end(); i++) {
619  assert(myBoundary.xmax() >= myBoundary.xmin());
620  if (myBoundary.around(c->getFromGeomPosition(), 5)) {
621  myEdges.push_back(c->getFromEdgeID());
622  }
623  assert(myBoundary.xmax() >= myBoundary.xmin());
624  if (myBoundary.around(c->getToGeomPosition(), 5)) {
625  myEdges.push_back(c->getToEdgeID());
626  }
627  }
628  // connect edges
629  for (i = myEdges.begin(); i != myEdges.end(); i++) {
631  edge->addToConnectionCluster(this);
632  }
633 }
634 
635 
636 SUMOReal
638  // return the middle of the connections when there are any
639  if (myConnections.size() != 0) {
640  SUMOReal sum = 0;
641  size_t part = 0;
642  std::vector<int>::const_iterator i;
643  for (i = myConnections.begin(); i != myConnections.end(); i++) {
645  if (c->getFromEdgeID() == edgeid) {
646  part++;
647  sum += c->getFromPosition();
648  }
649  if (c->getToEdgeID() == edgeid) {
650  part++;
651  sum += c->getToPosition();
652  }
653  }
654  if (part > 0) {
655  return sum / (SUMOReal) part;
656  }
657  }
658  // use the position of the node if possible
659  if (myNodeCluster >= 0) {
660  // try to find the nearest point on the edge
661  // !!! only the main geometry is regarded
662  NIVissimNodeDef* node =
664  if (node != 0) {
665  SUMOReal pos = node->getEdgePosition(edgeid);
666  if (pos >= 0) {
667  return pos;
668  }
669  }
670  /*
671  SUMOReal try1 = GeomHelper::nearest_offset_on_line_to_point(
672  edge->getBegin2D(), edge->getEnd2D(), node->getPos());
673  if(try1>=0) {
674  return try1;
675  }
676  // try to use simple distance
677  SUMOReal dist1 =
678  GeomHelper::distance(node->getPos(), edge->getBegin2D());
679  SUMOReal dist2 =
680  GeomHelper::distance(node->getPos(), edge->getEnd2D());
681  return dist1<dist2
682  ? 0 : edge->getLength();
683  */
684  }
685  // what else?
686  WRITE_WARNING("NIVissimConnectionCluster: how to get an edge's position?");
687  // !!!
688  assert(myBoundary.xmin() <= myBoundary.xmax());
689  NIVissimEdge* edge = NIVissimEdge::dictionary(edgeid);
690  std::vector<int>::const_iterator i = find(myEdges.begin(), myEdges.end(), edgeid);
691  if (i == myEdges.end()) {
692  // edge does not exist!?
693  throw 1;
694  }
695  const PositionVector& edgeGeom = edge->getGeometry();
698  edgeGeom.front(), edgeGeom.back(), p);
699 }
700 
701 
702 
703 void
705  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
706  delete(*i);
707  }
708  myClusters.clear();
709  myFirstFreeID = 100000;
710 }
711 
712 
715  // collect connection where this edge is the incoming one
716  std::vector<NIVissimConnection*> edgeIsIncoming;
717  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
719  if (c->getFromEdgeID() == e->getID()) {
720  edgeIsIncoming.push_back(c);
721  }
722  }
723  //
724  if (edgeIsIncoming.size() == 0) {
725  return PositionVector();
726  }
727  // sort connected edges in same direction
728  sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
730  NIVissimConnection* c = *(edgeIsIncoming.begin());
731  return c->getGeometry();
732 }
733 
734 
735 
738  // collect connection where this edge is the incoming one
739  std::vector<NIVissimConnection*> edgeIsIncoming;
740  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
742  if (c->getFromEdgeID() == e->getID()) {
743  edgeIsIncoming.push_back(c);
744  }
745  }
746  //
747  if (edgeIsIncoming.size() == 0) {
748  return 0;
749  }
750  // sort connected edges in same direction
751  sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
753  return *(edgeIsIncoming.begin());
754 }
755 
756 
757 
760  // collect connection where this edge is the outgoing one
761  std::vector<NIVissimConnection*> edgeIsOutgoing;
762  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
764  if (c->getToEdgeID() == e->getID()) {
765  edgeIsOutgoing.push_back(c);
766  }
767  }
768  //
769  if (edgeIsOutgoing.size() == 0) {
770  return PositionVector();
771  }
772  // sort connected edges in same direction
773  sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
775  NIVissimConnection* c = *(edgeIsOutgoing.begin());
776  return c->getGeometry();
777 }
778 
779 
782  // collect connection where this edge is the outgoing one
783  std::vector<NIVissimConnection*> edgeIsOutgoing;
784  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
786  if (c->getToEdgeID() == e->getID()) {
787  edgeIsOutgoing.push_back(c);
788  }
789  }
790  //
791  if (edgeIsOutgoing.size() == 0) {
792  return 0;
793  }
794  // sort connected edges in same direction
795  sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
797  return *(edgeIsOutgoing.begin());
798 }
799 
800 
801 
802 /****************************************************************************/
803 
SUMOReal getFromPosition() const
bool joinable(NIVissimConnectionCluster *c2, SUMOReal offset)
std::vector< NIVissimConnectionCluster * > ContType
int myNodeCluster
The node the cluster is assigned to.
int getDisturbanceID() const
Position getCenter() const
Returns the center of the boundary.
Definition: Boundary.cpp:106
std::vector< int > myConnections
List of connection-ids which participate within this cluster.
bool around(const Position &p, SUMOReal offset=0) const
Returns whether the boundary contains the given coordinate.
Definition: Boundary.cpp:148
static void joinBySameEdges(SUMOReal offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap...
static std::vector< int > getWithin(const AbstractPoly &poly)
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
SUMOReal xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:112
NIVissimConnection * getOutgoingContinuation(NIVissimEdge *e) const
bool intersects(const Position &p1, const Position &p2) const
static bool dictionary(const std::string &name, const NIVissimExtendedEdgePoint &edge, const NIVissimExtendedEdgePoint &by)
bool overlapsWith(NIVissimConnectionCluster *c, SUMOReal offset=0) const
Returns the information whether the given cluster overlaps the current.
void addToConnectionCluster(NIVissimConnectionCluster *c)
static bool dictionary(int id, NIVissimNodeCluster *o)
static bool dictionary(int id, NIVissimConnection *o)
SUMOReal beginEndAngle() const
static Position crossPoint(const Boundary &b, const PositionVector &v)
Definition: GeomHelper.cpp:340
SUMOReal xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:118
const PositionVector & getGeometry() const
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
bool overlapsWith(const NodeSubCluster &c, SUMOReal offset=0)
Position getToGeomPosition() const
std::vector< int > getDisturbanceParticipators()
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
A temporary storage for edges imported from Vissim.
Definition: NIVissimEdge.h:61
bool overlapsWith(const AbstractPoly &poly, SUMOReal offset=0) const
Returns whether the boundary overlaps with the given polygon.
Definition: Boundary.cpp:156
void add(NIVissimConnectionCluster *c)
Adds the second cluster.
static SUMOReal nearest_offset_on_line_to_point2D(const Position &l1, const Position &l2, const Position &p, bool perpendicular=true)
Definition: GeomHelper.cpp:261
SUMOReal getToPosition() const
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
static void _debugOut(std::ostream &into)
A list of positions.
NIVissimConnection * getIncomingContinuation(NIVissimEdge *e) const
std::vector< int > extendByToTreatAsSame(const std::vector< int > &iv1, const std::vector< int > &iv2) const
static void removeDouble(std::vector< T > &v)
Definition: VectorHelper.h:77
Definition: Line.h:51
virtual SUMOReal getEdgePosition(int edgeid) const =0
static bool dictionary(int id, NIVissimNodeDef *o)
const Boundary & getBoundingBox() const
bool around(const Position &p, SUMOReal offset=0) const
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:76
void removeConnections(const NodeSubCluster &c)
PositionVector getIncomingContinuationGeometry(NIVissimEdge *e) const
static bool dictionary(int id, const std::string &name, const std::string &type, int noLanes, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Adds the described item to the dictionary Builds the edge first.
Boundary myBoundary
The boundary of the cluster.
Represents a single node (junction) during network building.
Definition: NBNode.h:75
SUMOReal getPositionForEdge(int edgeid) const
#define SUMOReal
Definition: config.h:218
const std::vector< int > & getDisturbances() const
bool liesOnSameEdgesEnd(NIVissimConnectionCluster *cc2)
bool isWeakDistrictConnRealisation(NIVissimConnectionCluster *c2)
NIVissimConnectionCluster(const std::vector< int > &connections, int nodeCluster, int edgeid)
Constructor Build the boundary; The boundary includes both incoming and outgoing nodes.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position getFromGeomPosition() const
PositionVector getOutgoingContinuationGeometry(NIVissimEdge *e) const
void removeFromConnectionCluster(NIVissimConnectionCluster *c)