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-2016 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 int
95  return (int)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  int 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  }
426 }
427 
428 
429 bool
431  //
432  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
434  for (std::vector<int>::iterator j = cc2->myConnections.begin(); j != cc2->myConnections.end(); j++) {
436  if (c1->getFromEdgeID() == c2->getFromEdgeID()) {
438  const PositionVector& g = e->getGeometry();
440  g.front(), g.back(), c1->getBoundary().getCenter());
442  g.front(), g.back(), c2->getBoundary().getCenter());
443  if (pos1 <= 5.0 && pos2 <= 5.0) {
444  return true;
445  }
446  }
447  if (c1->getToEdgeID() == c2->getToEdgeID()) {
449  const PositionVector& g = e->getGeometry();
451  g.front(), g.back(), c1->getBoundary().getCenter());
453  g.front(), g.back(), c2->getBoundary().getCenter());
454  if (pos1 >= g.length() - 5.0 && pos2 >= g.length() - 5.0) {
455  return true;
456  }
457  }
458  }
459  }
460  return false;
461 }
462 
463 
464 std::vector<int>
466  const std::vector<int>& iv2) const {
467  std::vector<int> ret(iv1);
468  for (std::vector<int>::const_iterator i = iv1.begin(); i != iv1.end(); i++) {
470  const std::vector<NIVissimEdge*> treatAsSame = e->getToTreatAsSame();
471  for (std::vector<NIVissimEdge*>::const_iterator j = treatAsSame.begin(); j != treatAsSame.end(); j++) {
472  if (find(iv2.begin(), iv2.end(), (*j)->getID()) == iv2.end()) {
473  ret.push_back((*j)->getID());
474  }
475  }
476  }
477  return ret;
478 }
479 
480 std::vector<int>
482  std::vector<int> ret;
483  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
485  const std::vector<int>& disturbances = c->getDisturbances();
486  for (std::vector<int>::const_iterator j = disturbances.begin(); j != disturbances.end(); j++) {
488  ret.push_back(d->getEdgeID());
489  ret.push_back(d->getDisturbanceID());
490  }
491  }
492  return ret;
493 }
494 
495 
496 void
498  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
499  std::vector<int> disturbances;
500  std::vector<int> tls;
501  std::vector<int> nodes;
502  int tlsid = -1;
503  int nodeid = -1;
504  if ((*i)->myConnections.size() > 0) {
505  (*i)->recomputeBoundary();
506  disturbances = NIVissimDisturbance::getWithin((*i)->myBoundary);
507  }
508  nodes = (*i)->myNodes;//NIVissimTL::getWithin((*i)->myBoundary, 5.0);
509  if (nodes.size() > 1) {
510  WRITE_WARNING("NIVissimConnectionCluster:More than a single node");
511  // throw 1; // !!! eigentlich sollte hier nur eine Ampelanlage sein
512  }
513  if (nodes.size() > 0) {
514  nodeid = nodes[0];
515  }
516  //
517  //
519  nodeid, tlsid, (*i)->myConnections,
520  disturbances, (*i)->myIncomingEdges.size() < 2);
521  assert((*i)->myNodeCluster == id || (*i)->myNodeCluster < 0);
522  (*i)->myNodeCluster = id;
523  }
524 }
525 
526 
527 void
529  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
530  std::vector<int> connections = (*i)->myConnections;
531  for (std::vector<int>::iterator j = connections.begin(); j != connections.end(); j++) {
532  if (j != connections.begin()) {
533  into << ", ";
534  }
535  into << *j;
536  }
537  into << "(" << (*i)->myBoundary << ")" << std::endl;
538  }
539  into << "---------------------------" << std::endl;
540 }
541 
542 
543 
544 bool
546  return myNodeCluster != -1;
547 }
548 
549 
550 int
552  return (int)myClusters.size();
553 }
554 
555 
556 void
558  for (NodeSubCluster::ConnectionCont::const_iterator i = c.myConnections.begin(); i != c.myConnections.end(); i++) {
559  NIVissimConnection* conn = *i;
560  int connid = conn->getID();
561  std::vector<int>::iterator j = find(myConnections.begin(), myConnections.end(), connid);
562  if (j != myConnections.end()) {
563  myConnections.erase(j);
564  }
565  }
567 }
568 
569 
570 void
572  myBoundary = Boundary();
573  for (std::vector<int>::iterator i = myConnections.begin(); i != myConnections.end(); i++) {
575  if (c != 0) {
578  if (c->getGeometry().size() != 0) {
580  }
581  }
582  }
583  assert(myBoundary.xmax() >= myBoundary.xmin());
584 }
585 
586 
587 NBNode*
589  return NIVissimNodeCluster::dictionary(myNodeCluster)->getNBNode();
590 }
591 
592 
593 bool
595  assert(myBoundary.xmax() >= myBoundary.xmin());
596  return myBoundary.around(p, offset);
597 }
598 
599 
600 
601 void
603  assert(myConnections.size() != 0);
604  // remove the cluster from all edges at first
605  std::vector<int>::iterator i;
606  for (i = myEdges.begin(); i != myEdges.end(); i++) {
608  edge->removeFromConnectionCluster(this);
609  }
610  // clear edge information
611  myEdges.clear();
612  // recheck which edges do still participate and add edges
613  for (i = myConnections.begin(); i != myConnections.end(); i++) {
615  assert(myBoundary.xmax() >= myBoundary.xmin());
616  if (myBoundary.around(c->getFromGeomPosition(), 5)) {
617  myEdges.push_back(c->getFromEdgeID());
618  }
619  assert(myBoundary.xmax() >= myBoundary.xmin());
620  if (myBoundary.around(c->getToGeomPosition(), 5)) {
621  myEdges.push_back(c->getToEdgeID());
622  }
623  }
624  // connect edges
625  for (i = myEdges.begin(); i != myEdges.end(); i++) {
627  edge->addToConnectionCluster(this);
628  }
629 }
630 
631 
632 SUMOReal
634  // return the middle of the connections when there are any
635  if (myConnections.size() != 0) {
636  SUMOReal sum = 0;
637  int part = 0;
638  std::vector<int>::const_iterator i;
639  for (i = myConnections.begin(); i != myConnections.end(); i++) {
641  if (c->getFromEdgeID() == edgeid) {
642  part++;
643  sum += c->getFromPosition();
644  }
645  if (c->getToEdgeID() == edgeid) {
646  part++;
647  sum += c->getToPosition();
648  }
649  }
650  if (part > 0) {
651  return sum / (SUMOReal) part;
652  }
653  }
654  // use the position of the node if possible
655  if (myNodeCluster >= 0) {
656  // try to find the nearest point on the edge
657  // !!! only the main geometry is regarded
658  NIVissimNodeDef* node =
660  if (node != 0) {
661  SUMOReal pos = node->getEdgePosition(edgeid);
662  if (pos >= 0) {
663  return pos;
664  }
665  }
666  /*
667  SUMOReal try1 = GeomHelper::nearest_offset_on_line_to_point(
668  edge->getBegin2D(), edge->getEnd2D(), node->getPos());
669  if(try1>=0) {
670  return try1;
671  }
672  // try to use simple distance
673  SUMOReal dist1 =
674  GeomHelper::distance(node->getPos(), edge->getBegin2D());
675  SUMOReal dist2 =
676  GeomHelper::distance(node->getPos(), edge->getEnd2D());
677  return dist1<dist2
678  ? 0 : edge->getLength();
679  */
680  }
681  // what else?
682  WRITE_WARNING("NIVissimConnectionCluster: how to get an edge's position?");
683  // !!!
684  assert(myBoundary.xmin() <= myBoundary.xmax());
685  NIVissimEdge* edge = NIVissimEdge::dictionary(edgeid);
686  std::vector<int>::const_iterator i = find(myEdges.begin(), myEdges.end(), edgeid);
687  if (i == myEdges.end()) {
688  // edge does not exist!?
689  throw 1;
690  }
691  const PositionVector& edgeGeom = edge->getGeometry();
694  edgeGeom.front(), edgeGeom.back(), p);
695 }
696 
697 
698 
699 void
701  for (ContType::iterator i = myClusters.begin(); i != myClusters.end(); i++) {
702  delete(*i);
703  }
704  myClusters.clear();
705  myFirstFreeID = 100000;
706 }
707 
708 
711  // collect connection where this edge is the incoming one
712  std::vector<NIVissimConnection*> edgeIsIncoming;
713  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
715  if (c->getFromEdgeID() == e->getID()) {
716  edgeIsIncoming.push_back(c);
717  }
718  }
719  //
720  if (edgeIsIncoming.size() == 0) {
721  return PositionVector();
722  }
723  // sort connected edges in same direction
724  sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
726  NIVissimConnection* c = *(edgeIsIncoming.begin());
727  return c->getGeometry();
728 }
729 
730 
731 
734  // collect connection where this edge is the incoming one
735  std::vector<NIVissimConnection*> edgeIsIncoming;
736  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
738  if (c->getFromEdgeID() == e->getID()) {
739  edgeIsIncoming.push_back(c);
740  }
741  }
742  //
743  if (edgeIsIncoming.size() == 0) {
744  return 0;
745  }
746  // sort connected edges in same direction
747  sort(edgeIsIncoming.begin(), edgeIsIncoming.end(),
749  return *(edgeIsIncoming.begin());
750 }
751 
752 
753 
756  // collect connection where this edge is the outgoing one
757  std::vector<NIVissimConnection*> edgeIsOutgoing;
758  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
760  if (c->getToEdgeID() == e->getID()) {
761  edgeIsOutgoing.push_back(c);
762  }
763  }
764  //
765  if (edgeIsOutgoing.size() == 0) {
766  return PositionVector();
767  }
768  // sort connected edges in same direction
769  sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
771  NIVissimConnection* c = *(edgeIsOutgoing.begin());
772  return c->getGeometry();
773 }
774 
775 
778  // collect connection where this edge is the outgoing one
779  std::vector<NIVissimConnection*> edgeIsOutgoing;
780  for (std::vector<int>::const_iterator i = myConnections.begin(); i != myConnections.end(); i++) {
782  if (c->getToEdgeID() == e->getID()) {
783  edgeIsOutgoing.push_back(c);
784  }
785  }
786  //
787  if (edgeIsOutgoing.size() == 0) {
788  return 0;
789  }
790  // sort connected edges in same direction
791  sort(edgeIsOutgoing.begin(), edgeIsOutgoing.end(),
793  return *(edgeIsOutgoing.begin());
794 }
795 
796 
797 
798 /****************************************************************************/
799 
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
Returns the information whether this list of points interesects the given line.
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
returns the angle in radians of the line connecting the first and the last position ...
static Position crossPoint(const Boundary &b, const PositionVector &v)
Definition: GeomHelper.cpp:127
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
Definition: GeomHelper.cpp:178
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.
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
virtual SUMOReal getEdgePosition(int edgeid) const =0
static bool dictionary(int id, NIVissimNodeDef *o)
#define DEG2RAD(x)
Definition: GeomHelper.h:45
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 SUMOReal nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
Definition: GeomHelper.cpp:100
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:74
SUMOReal getPositionForEdge(int edgeid) const
#define SUMOReal
Definition: config.h:213
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)