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-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 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