SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NIVissimConnectionCluster.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // -------------------
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef NIVissimConnectionCluster_h
22 #define NIVissimConnectionCluster_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 
35 #include <iostream>
36 #include <vector>
37 #include <utils/geom/Boundary.h>
38 #include <utils/geom/GeomHelper.h>
39 #include "NIVissimConnection.h"
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class NBNode;
46 class NIVissimEdge;
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
61 public:
64  NIVissimConnectionCluster(const std::vector<int>& connections, int nodeCluster,
65  int edgeid);
66 
67  NIVissimConnectionCluster(const std::vector<int>& connections,
68  const Boundary& boundary, int nodeCluster, const std::vector<int>& edges);
69 
72 
74  bool overlapsWith(NIVissimConnectionCluster* c, SUMOReal offset = 0) const;
75 
76  bool hasNodeCluster() const;
77 
78  NBNode* getNBNode() const;
79 
80  bool around(const Position& p, SUMOReal offset = 0) const;
81 
82  SUMOReal getPositionForEdge(int edgeid) const;
83 
84  friend class NIVissimEdge; // !!! debug
85 
86  const std::vector<int>& getConnections() const {
87  return myConnections;
88  }
89 
94 
95 
96 public:
99  static void joinBySameEdges(SUMOReal offset);
100 
101  static void joinByDisturbances(SUMOReal offset);
102 
103  static void buildNodeClusters();
104 
105  static void _debugOut(std::ostream& into);
106 
107  static int dictSize();
108 
109 
110  static int getNextFreeNodeID();
111 
112  static void clearDict();
113 
114 private:
116  public:
118  ~NodeSubCluster();
119  void add(NIVissimConnection* c);
120  void add(const NodeSubCluster& c);
121  int size() const;
122  bool overlapsWith(const NodeSubCluster& c, SUMOReal offset = 0);
123  std::vector<int> getConnectionIDs() const;
125  public:
127  typedef std::vector<NIVissimConnection*> ConnectionCont;
128  ConnectionCont myConnections;
129  };
130 
132  private:
134 
135  public:
138  : myAngle(angle) { }
139 
140  public:
144  <
146  }
147  };
148 
149 
150 
151 private:
154 
155  void removeConnections(const NodeSubCluster& c);
156 
157  void recomputeBoundary();
158 
159  void recheckEdges();
160 
161  bool joinable(NIVissimConnectionCluster* c2, SUMOReal offset);
162 
163 
164  std::vector<int> getDisturbanceParticipators();
165 
166  std::vector<int> extendByToTreatAsSame(const std::vector<int>& iv1,
167  const std::vector<int>& iv2) const;
168 
170 
172 
173 
174 
175 private:
177  std::vector<int> myConnections;
178 
181 
184 
185  // The edge which holds the cluster
186  std::vector<int> myEdges;
187 
188  std::vector<int> myNodes;
189 
190  std::vector<int> myTLs;
191 
192  std::vector<int> myOutgoingEdges, myIncomingEdges;
193 
194 private:
195  typedef std::vector<NIVissimConnectionCluster*> ContType;
196  static ContType myClusters;
197  static int myFirstFreeID;
198  static int myStaticBlaID;
199  int myBlaID;
200 };
201 
202 
203 #endif
204 
205 /****************************************************************************/
206 
bool joinable(NIVissimConnectionCluster *c2, SUMOReal offset)
std::vector< NIVissimConnectionCluster * > ContType
int operator()(NIVissimConnection *c1, NIVissimConnection *c2) const
comparing operation
int myNodeCluster
The node the cluster is assigned to.
std::vector< int > myConnections
List of connection-ids which participate within this cluster.
static void joinBySameEdges(SUMOReal offset)
Tries to joind clusters participating within a node This is done by joining clusters which overlap...
NIVissimConnection * getOutgoingContinuation(NIVissimEdge *e) const
const std::vector< int > & getConnections() const
bool overlapsWith(NIVissimConnectionCluster *c, SUMOReal offset=0) const
Returns the information whether the given cluster overlaps the current.
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
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
const PositionVector & getGeometry() const
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
bool overlapsWith(const NodeSubCluster &c, SUMOReal offset=0)
std::vector< int > getDisturbanceParticipators()
A temporary storage for edges imported from Vissim.
Definition: NIVissimEdge.h:61
void add(NIVissimConnectionCluster *c)
Adds the second cluster.
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
std::vector< NIVissimConnection * > ConnectionCont
bool around(const Position &p, SUMOReal offset=0) const
void removeConnections(const NodeSubCluster &c)
PositionVector getIncomingContinuationGeometry(NIVissimEdge *e) const
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:214
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.
static void joinByDisturbances(SUMOReal offset)
PositionVector getOutgoingContinuationGeometry(NIVissimEdge *e) const