SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NIVissimConnectionCluster.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // -------------------
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2013 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/Position.h>
38 #include <utils/geom/Boundary.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 size_t 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  size_t 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;
129  };
130 
132  private:
134 
135  public:
138  : myAngle(angle) { }
139 
140  public:
143  return
144  fabs(c1->getGeometry().beginEndAngle() - myAngle)
145  <
146  fabs(c2->getGeometry().beginEndAngle() - myAngle);
147  }
148  };
149 
150 
151 
152 private:
155 
156  void removeConnections(const NodeSubCluster& c);
157 
158  void recomputeBoundary();
159 
160  void recheckEdges();
161 
162  bool joinable(NIVissimConnectionCluster* c2, SUMOReal offset);
163 
164 
165  std::vector<int> getDisturbanceParticipators();
166 
167  std::vector<int> extendByToTreatAsSame(const std::vector<int>& iv1,
168  const std::vector<int>& iv2) const;
169 
171 
173 
174 
175 
176 private:
178  std::vector<int> myConnections;
179 
182 
185 
186  // The edge which holds the cluster
187  std::vector<int> myEdges;
188 
189  std::vector<int> myNodes;
190 
191  std::vector<int> myTLs;
192 
193  std::vector<int> myOutgoingEdges, myIncomingEdges;
194 
195 private:
196  typedef std::vector<NIVissimConnectionCluster*> ContType;
198  static int myFirstFreeID;
199  static int myStaticBlaID;
200  int myBlaID;
201 };
202 
203 
204 #endif
205 
206 /****************************************************************************/
207 
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
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:221
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