SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
11 // Copyright (C) 2001-2014 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;
50 class NBDistribution;
51 class NBDistrictCont;
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
62  : public NIVissimAbstractEdge {
63 public:
65  NIVissimEdge(int id, const std::string& name,
66  const std::string& type, int noLanes, SUMOReal zuschlag1,
67  SUMOReal zuschlag2, SUMOReal length,
68  const PositionVector& geom,
69  const NIVissimClosedLanesVector& clv);
70 
72  ~NIVissimEdge();
73 
74  void setNodeCluster(int nodeid);
75  void buildGeom();
76 
78  void addIncomingConnection(int id);
79 
81  void addOutgoingConnection(int id);
82 
85  NBNode* getNodeAt(const Position& p, NBNode* other = 0);
86 
88  Position getBegin2D() const;
89 
91  Position getEnd2D() const;
92 
94  SUMOReal getLength() const;
95 
97 
100 
103  void setSpeed(size_t lane, int speedDist);
105 
107  const std::vector<NIVissimEdge*>& getToTreatAsSame() const;
108 
109 
113  bool wasWithinAJunction() const {
114  return myAmWithinJunction;
115  }
116 
117  NIVissimEdge* getBestIncoming() const;
118  NIVissimEdge* getBestOutgoing() const;
119 
120  friend class NIVissimNodeDef_Edges;
121  friend class NIVissimNodeDef_Poly;
122 
123 public:
126  static bool dictionary(int id, const std::string& name,
127  const std::string& type, int noLanes, SUMOReal zuschlag1,
128  SUMOReal zuschlag2, SUMOReal length,
129  const PositionVector& geom,
130  const NIVissimClosedLanesVector& clv);
131 
133  static bool dictionary(int id, NIVissimEdge* o);
134 
136  static NIVissimEdge* dictionary(int id);
137 
146  static void buildConnectionClusters();
147 
149  static void dict_buildNBEdges(NBDistrictCont& dc, NBNodeCont& nc,
150  NBEdgeCont& ec, SUMOReal offset);
151 
152  static void dict_propagateSpeeds(/* NBDistribution &dc */);
153 
154  static void dict_checkEdges2Join();
155 
156 
165  static void reportUnsetSpeeds();
166 
167 
168 private:
170  typedef std::vector<NIVissimConnectionCluster*> ConnectionClusters;
171 
172 private:
181  void buildNBEdge(NBDistrictCont& dc, NBNodeCont& nc,
182  NBEdgeCont& ec, SUMOReal sameNodesOffset);
183 
185  std::pair<NIVissimConnectionCluster*, NBNode*>
186  getFromNode(NBNodeCont& nc, ConnectionClusters& clusters);
187 
189  std::pair<NIVissimConnectionCluster*, NBNode*>
190  getToNode(NBNodeCont& nc, ConnectionClusters& clusters);
191 
193  std::pair<NBNode*, NBNode*> resolveSameNode(NBNodeCont& nc,
194  SUMOReal offset, NBNode* prevFrom, NBNode* prevTo);
195 
196 // SUMOReal recheckSpeedPatches();
197 
198  std::vector<NIVissimConnection*> getOutgoingConnected(int lane) const;
199 
200  void propagateSpeed(/* NBDistribution &dc */SUMOReal speed, std::vector<int> forLanes);
201 
202 
203  void setDistrictSpeed(/* NBDistribution &dc */);
204  SUMOReal getRealSpeed(/* NBDistribution &dc */int distNo);
205  void checkUnconnectedLaneSpeeds(/* NBDistribution &dc */);
206  void propagateOwn(/* NBDistribution &dc */);
207 
208 
209 
210 private:
211  static NBNode* getNodeSecure(int nodeid, const Position& pos,
212  const std::string& possibleName);
213 
214  std::pair<NBNode*, NBNode*>
217  NBNode* fromNode, NBNode* toNode);
218 
219 private:
225  public:
227  explicit connection_position_sorter(int edgeid);
228 
230  int operator()(int c1id, int c2id) const;
231 
232  private:
234  int myEdgeID;
235 
236  };
237 
238 
244  public:
246  explicit connection_cluster_position_sorter(int edgeid);
247 
250  NIVissimConnectionCluster* cc2) const;
251 
252  private:
254  int myEdgeID;
255 
256  };
257 
258 private:
260  std::string myName;
261 
263  std::string myType;
264 
266  unsigned int myNoLanes;
267 
270 
273 
276 
278  std::vector<int> myIncomingConnections;
279 
281  std::vector<int> myOutgoingConnections;
282 
283  std::vector<SUMOReal> myDistrictConnections;
284 
285  std::vector<int> myPatchedSpeeds;
286 
287  std::vector<SUMOReal> myLaneSpeeds;
288 
289  std::vector<NIVissimEdge*> myToTreatAsSame;
290 
293 
294 private:
296  typedef std::map<int, NIVissimEdge*> DictType;
297 
299  static DictType myDict;
300 
302  static int myMaxID;
303 
304  static std::vector<std::string> myLanesWithMissingSpeeds;
305 
306 };
307 
308 
309 #endif
310 
311 /****************************************************************************/
312 
static int myMaxID
The current maximum id; needed for further id assignment.
Definition: NIVissimEdge.h:302
std::vector< SUMOReal > myLaneSpeeds
Definition: NIVissimEdge.h:287
Position getBegin2D() const
int operator()(int c1id, int c2id) const
comparing operation
~NIVissimEdge()
Destructor.
The base class for statistical distribution descriptions.
std::string myName
The name of the edge.
Definition: NIVissimEdge.h:260
static void dict_checkEdges2Join()
std::map< int, NIVissimEdge * > DictType
Definition of the dictionary type.
Definition: NIVissimEdge.h:296
std::vector< int > myPatchedSpeeds
Definition: NIVissimEdge.h:285
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.
const std::vector< NIVissimEdge * > & getToTreatAsSame() const
std::vector< NIVissimConnection * > getOutgoingConnected(int lane) const
std::vector< NIVissimClosedLaneDef * > NIVissimClosedLanesVector
ConnectionClusters myConnectionClusters
List of connection clusters along this edge.
Definition: NIVissimEdge.h:275
A container for districts.
void checkDistrictConnectionExistanceAt(SUMOReal pos)
void addToConnectionCluster(NIVissimConnectionCluster *c)
void setNodeCluster(int nodeid)
void buildNBEdge(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, SUMOReal sameNodesOffset)
Builds the NBEdge from this VissimEdge.
void setSpeed(size_t lane, int speedDist)
std::pair< NBNode *, NBNode * > resolveSameNode(NBNodeCont &nc, SUMOReal offset, NBNode *prevFrom, NBNode *prevTo)
Tries to resolve the problem that the same node has been returned as origin and destination node...
bool wasWithinAJunction() const
Returns whether this edge was found to be within a junction.
Definition: NIVissimEdge.h:113
A temporary storage for edges imported from Vissim.
Definition: NIVissimEdge.h:61
std::vector< SUMOReal > myDistrictConnections
Definition: NIVissimEdge.h:283
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:292
static void dict_propagateSpeeds()
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
SUMOReal myZuschlag2
Definition: NIVissimEdge.h:269
A list of positions.
NIVissimEdge * getBestOutgoing() const
std::vector< int > myIncomingConnections
List of connections incoming to this edge.
Definition: NIVissimEdge.h:278
std::string myType
The tape of the edge.
Definition: NIVissimEdge.h:263
void setDistrictSpeed()
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
connection_cluster_position_sorter(int edgeid)
constructor
connection_position_sorter(int edgeid)
constructor
void checkUnconnectedLaneSpeeds()
void addOutgoingConnection(int id)
Adds a connection where this edge is the source.
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...
NIVissimConnection * getConnectionTo(NIVissimEdge *e)
std::pair< NIVissimConnectionCluster *, NBNode * > getToNode(NBNodeCont &nc, ConnectionClusters &clusters)
Returns the destination node.
SUMOReal getRealSpeed(int distNo)
static void buildConnectionClusters()
Clusters connections of each edge.
std::vector< NIVissimEdge * > myToTreatAsSame
Definition: NIVissimEdge.h:289
bool addToTreatAsSame(NIVissimEdge *e)
Position getEnd2D() const
Returns the end position of the edge.
SUMOReal myZuschlag1
Additional load values for this edge.
Definition: NIVissimEdge.h:269
NIVissimEdge(int id, const std::string &name, const std::string &type, int noLanes, SUMOReal zuschlag1, SUMOReal zuschlag2, SUMOReal length, const PositionVector &geom, const NIVissimClosedLanesVector &clv)
Constructor.
unsigned int myNoLanes
The number of lanes the edge has.
Definition: NIVissimEdge.h:266
static std::vector< std::string > myLanesWithMissingSpeeds
Definition: NIVissimEdge.h:304
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.
NIVissimClosedLanesVector myClosedLanes
List of lanes closed on this edge.
Definition: NIVissimEdge.h:272
std::vector< NIVissimConnectionCluster * > ConnectionClusters
The definition for a container for connection clusters.
Definition: NIVissimEdge.h:170
Represents a single node (junction) during network building.
Definition: NBNode.h:75
void propagateOwn()
SUMOReal getLength() const
Returns the length of the node.
NIVissimEdge * getBestIncoming() const
#define SUMOReal
Definition: config.h:215
void propagateSpeed(SUMOReal speed, std::vector< int > forLanes)
static DictType myDict
The dictionary.
Definition: NIVissimEdge.h:299
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:64
void mergedInto(NIVissimConnectionCluster *old, NIVissimConnectionCluster *act)
std::vector< int > myOutgoingConnections
List of connections outgoing from this edge.
Definition: NIVissimEdge.h:281
static void dict_buildNBEdges(NBDistrictCont &dc, NBNodeCont &nc, NBEdgeCont &ec, SUMOReal offset)
Builds NBEdges from the VissimEdges within the dictionary.
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)
int operator()(NIVissimConnectionCluster *cc1, NIVissimConnectionCluster *cc2) const
comparing operation