SUMO - Simulation of Urban MObility
NIVissimEdge.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A temporary storage for edges imported from Vissim
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2017 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 NIVissimEdge_h
22 #define NIVissimEdge_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 
35 #include <vector>
36 #include <string>
37 #include <map>
38 #include <netbuild/NBEdge.h>
41 #include "NIVissimAbstractEdge.h"
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class NBNode;
49 class NBDistrictCont;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
61  : public NIVissimAbstractEdge {
62 public:
64  NIVissimEdge(int id, const std::string& name,
65  const std::string& type, int noLanes, double zuschlag1,
66  double zuschlag2, double length,
67  const PositionVector& geom,
68  const NIVissimClosedLanesVector& clv);
69 
71  ~NIVissimEdge();
72 
73  void setNodeCluster(int nodeid);
74  void buildGeom();
75 
77  void addIncomingConnection(int id);
78 
80  void addOutgoingConnection(int id);
81 
84  NBNode* getNodeAt(const Position& p, NBNode* other = 0);
85 
87  Position getBegin2D() const;
88 
90  Position getEnd2D() const;
91 
93  double getLength() const;
94 
95  void checkDistrictConnectionExistanceAt(double pos);
96 
99 
102  void setSpeed(int lane, int speedDist);
104 
106  const std::vector<NIVissimEdge*>& getToTreatAsSame() const;
107 
108 
112  bool wasWithinAJunction() const {
113  return myAmWithinJunction;
114  }
115 
116  NIVissimEdge* getBestIncoming() const;
117  NIVissimEdge* getBestOutgoing() const;
118 
119  friend class NIVissimNodeDef_Edges;
120  friend class NIVissimNodeDef_Poly;
121 
122 public:
125  static bool dictionary(int id, const std::string& name,
126  const std::string& type, int noLanes, double zuschlag1,
127  double zuschlag2, double length,
128  const PositionVector& geom,
129  const NIVissimClosedLanesVector& clv);
130 
132  static bool dictionary(int id, NIVissimEdge* o);
133 
135  static NIVissimEdge* dictionary(int id);
136 
145  static void buildConnectionClusters();
146 
148  static void dict_buildNBEdges(NBDistrictCont& dc, NBNodeCont& nc,
149  NBEdgeCont& ec, double offset);
150 
151  static void dict_propagateSpeeds();
152 
153  static void dict_checkEdges2Join();
154 
155 
164  static void reportUnsetSpeeds();
165 
166 
167 private:
169  typedef std::vector<NIVissimConnectionCluster*> ConnectionClusters;
170 
171 private:
180  void buildNBEdge(NBDistrictCont& dc, NBNodeCont& nc,
181  NBEdgeCont& ec, double sameNodesOffset);
182 
184  std::pair<NIVissimConnectionCluster*, NBNode*>
185  getFromNode(NBNodeCont& nc, ConnectionClusters& clusters);
186 
188  std::pair<NIVissimConnectionCluster*, NBNode*>
189  getToNode(NBNodeCont& nc, ConnectionClusters& clusters);
190 
192  std::pair<NBNode*, NBNode*> resolveSameNode(NBNodeCont& nc,
193  double offset, NBNode* prevFrom, NBNode* prevTo);
194 
195 // double recheckSpeedPatches();
196 
197  std::vector<NIVissimConnection*> getOutgoingConnected(int lane) const;
198 
199  void propagateSpeed(double speed, std::vector<int> forLanes);
200 
201 
202  void setDistrictSpeed();
203  double getRealSpeed(int distNo);
205  void propagateOwn();
206 
207 
208 
209 private:
210  static NBNode* getNodeSecure(int nodeid, const Position& pos,
211  const std::string& possibleName);
212 
213  std::pair<NBNode*, NBNode*>
216  NBNode* fromNode, NBNode* toNode);
217 
218 private:
224  public:
226  explicit connection_position_sorter(int edgeid);
227 
229  int operator()(int c1id, int c2id) const;
230 
231  private:
233  int myEdgeID;
234 
235  };
236 
237 
243  public:
245  explicit connection_cluster_position_sorter(int edgeid);
246 
249  NIVissimConnectionCluster* cc2) const;
250 
251  private:
253  int myEdgeID;
254 
255  };
256 
257 private:
259  std::string myName;
260 
262  std::string myType;
263 
266 
269 
272 
274  ConnectionClusters myConnectionClusters;
275 
277  std::vector<int> myIncomingConnections;
278 
280  std::vector<int> myOutgoingConnections;
281 
282  std::vector<double> myDistrictConnections;
283 
284  std::vector<int> myPatchedSpeeds;
285 
286  std::vector<double> myLaneSpeeds;
287 
288  std::vector<NIVissimEdge*> myToTreatAsSame;
289 
292 
293 private:
295  typedef std::map<int, NIVissimEdge*> DictType;
296 
298  static DictType myDict;
299 
301  static int myMaxID;
302 
303  static std::vector<std::string> myLanesWithMissingSpeeds;
304 
305 };
306 
307 
308 #endif
309 
310 /****************************************************************************/
311 
std::vector< NIVissimConnection * > getOutgoingConnected(int lane) const
static int myMaxID
The current maximum id; needed for further id assignment.
Definition: NIVissimEdge.h:301
NIVissimEdge(int id, const std::string &name, const std::string &type, int noLanes, double zuschlag1, double zuschlag2, double length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Constructor.
std::vector< double > myDistrictConnections
Definition: NIVissimEdge.h:282
~NIVissimEdge()
Destructor.
std::string myName
The name of the edge.
Definition: NIVissimEdge.h:259
static void dict_checkEdges2Join()
std::map< int, NIVissimEdge * > DictType
Definition of the dictionary type.
Definition: NIVissimEdge.h:295
std::vector< int > myPatchedSpeeds
Definition: NIVissimEdge.h:284
std::pair< NBNode *, NBNode * > remapOneOfNodes(NBNodeCont &nc, NIVissimDistrictConnection *d, NBNode *fromNode, NBNode *toNode)
static void reportUnsetSpeeds()
Writes edges with unset speeds to the warnings message log instance.
std::vector< NIVissimClosedLaneDef * > NIVissimClosedLanesVector
ConnectionClusters myConnectionClusters
List of connection clusters along this edge.
Definition: NIVissimEdge.h:274
std::vector< double > myLaneSpeeds
Definition: NIVissimEdge.h:286
double myZuschlag2
Definition: NIVissimEdge.h:268
A container for districts.
static void dict_buildNBEdges(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, double offset)
Builds NBEdges from the VissimEdges within the dictionary.
void addToConnectionCluster(NIVissimConnectionCluster *c)
void setNodeCluster(int nodeid)
NIVissimEdge * getBestIncoming() const
A temporary storage for edges imported from Vissim.
Definition: NIVissimEdge.h:60
Position getBegin2D() const
void propagateSpeed(double speed, std::vector< int > forLanes)
NIVissimEdge * getBestOutgoing() const
int myNoLanes
The number of lanes the edge has.
Definition: NIVissimEdge.h:265
double myZuschlag1
Additional load values for this edge.
Definition: NIVissimEdge.h:268
double getRealSpeed(int distNo)
void setSpeed(int lane, int speedDist)
void addIncomingConnection(int id)
Adds a connection where this edge is the destination.
bool myAmWithinJunction
Information whether this edge was not build due to being within a junction.
Definition: NIVissimEdge.h:291
static void dict_propagateSpeeds()
int operator()(int c1id, int c2id) const
comparing operation
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
std::vector< int > myIncomingConnections
List of connections incoming to this edge.
Definition: NIVissimEdge.h:277
double getLength() const
Returns the length of the node.
void checkDistrictConnectionExistanceAt(double pos)
std::string myType
The type of the edge.
Definition: NIVissimEdge.h:262
void setDistrictSpeed()
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
connection_position_sorter(int edgeid)
constructor
void checkUnconnectedLaneSpeeds()
void addOutgoingConnection(int id)
Adds a connection where this edge is the source.
void buildNBEdge(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, double sameNodesOffset)
Builds the NBEdge from this VissimEdge.
NBNode * getNodeAt(const Position &p, NBNode *other=0)
Returns the node at the given position As this may be ambigous, a second node not to return may be su...
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.
NIVissimConnection * getConnectionTo(NIVissimEdge *e)
std::pair< NIVissimConnectionCluster *, NBNode * > getToNode(NBNodeCont &nc, ConnectionClusters &clusters)
Returns the destination node.
static void buildConnectionClusters()
Clusters connections of each edge.
std::vector< NIVissimEdge * > myToTreatAsSame
Definition: NIVissimEdge.h:288
bool addToTreatAsSame(NIVissimEdge *e)
Position getEnd2D() const
Returns the end position of the edge.
bool wasWithinAJunction() const
Returns whether this edge was found to be within a junction.
Definition: NIVissimEdge.h:112
std::pair< NBNode *, NBNode * > resolveSameNode(NBNodeCont &nc, double offset, NBNode *prevFrom, NBNode *prevTo)
Tries to resolve the problem that the same node has been returned as origin and destination node...
static std::vector< std::string > myLanesWithMissingSpeeds
Definition: NIVissimEdge.h:303
NIVissimClosedLanesVector myClosedLanes
List of lanes closed on this edge.
Definition: NIVissimEdge.h:271
std::vector< NIVissimConnectionCluster * > ConnectionClusters
The definition for a container for connection clusters.
Definition: NIVissimEdge.h:169
Represents a single node (junction) during network building.
Definition: NBNode.h:75
void propagateOwn()
static DictType myDict
The dictionary.
Definition: NIVissimEdge.h:298
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
void mergedInto(NIVissimConnectionCluster *old, NIVissimConnectionCluster *act)
std::vector< int > myOutgoingConnections
List of connections outgoing from this edge.
Definition: NIVissimEdge.h:280
std::pair< NIVissimConnectionCluster *, NBNode * > getFromNode(NBNodeCont &nc, ConnectionClusters &clusters)
Returns the origin node.
void removeFromConnectionCluster(NIVissimConnectionCluster *c)
static NBNode * getNodeSecure(int nodeid, const Position &pos, const std::string &possibleName)