SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NBEdgeCont.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Storage for edges, including some functionality operating on multiple edges
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef NBEdgeCont_h
23 #define NBEdgeCont_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <map>
36 #include <iostream>
37 #include <string>
38 #include <vector>
39 #include <set>
40 #include "NBCont.h"
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
49 class NBNodeCont;
50 class NBTypeCont;
51 class NBEdge;
52 class NBNode;
53 class OptionsCont;
54 class NBDistrictCont;
56 class OutputDevice;
57 
58 
59 // ===========================================================================
60 // class definitions
61 // ===========================================================================
66 class NBEdgeCont {
67 public:
72 
73 
75  ~NBEdgeCont();
76 
77 
86  void applyOptions(OptionsCont& oc);
87 
88 
90  void clear();
91 
92 
93 
94 
97 
111  bool insert(NBEdge* edge, bool ignorePrunning = false);
112 
113 
122  NBEdge* retrieve(const std::string& id, bool retrieveExtracted = false) const;
123 
124 
137  NBEdge* retrievePossiblySplit(const std::string& id, const std::string& hint, bool incoming) const;
138 
139 
150  NBEdge* retrievePossiblySplit(const std::string& id, SUMOReal pos) const;
151 
152 
159  void erase(NBDistrictCont& dc, NBEdge* edge);
160 
161 
171  void extract(NBDistrictCont& dc, NBEdge* edge, bool remember = false);
172 
173 
177  std::map<std::string, NBEdge*>::const_iterator begin() const {
178  return myEdges.begin();
179  }
180 
181 
185  std::map<std::string, NBEdge*>::const_iterator end() const {
186  return myEdges.end();
187  }
189 
190 
191 
194 
208  bool splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node);
209 
210 
231  bool splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node,
232  const std::string& firstEdgeName, const std::string& secondEdgeName,
233  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge);
234 
235 
248  bool splitAt(NBDistrictCont& dc, NBEdge* edge, SUMOReal edgepos, NBNode* node,
249  const std::string& firstEdgeName, const std::string& secondEdgeName,
250  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge);
252 
253 
254 
257 
261  unsigned int size() const {
262  return (unsigned int) myEdges.size();
263  }
264 
265 
270  std::vector<std::string> getAllNames() const;
271 
272 
276  unsigned int getNoEdgeSplits() const {
277  return myEdgesSplit;
278  }
280 
281 
282 
285 
291 
292 
301  void splitGeometry(NBNodeCont& nc);
302 
303 
308  void reduceGeometries(const SUMOReal minDist);
310 
311 
312 
315 
324 
325 
334  void computeEdge2Edges(bool noLeftMovers);
335 
336 
344  void computeLanes2Edges();
345 
346 
354  void recheckLanes();
355 
356 
365  void appendTurnarounds(bool noTLSControlled);
366 
367 
374  void appendTurnarounds(const std::set<std::string>& ids, bool noTLSControlled);
375 
376 
385  void computeEdgeShapes();
386 
387 
396  void computeLaneShapes();
397 
398 
401  void clearControllingTLInformation() const;
402 
403 
412  NBTrafficLightLogicCont& tlc, EdgeVector edges);
413 
414 
419  void recheckLaneSpread();
421 
422 
423 
427  void guessRoundabouts(std::vector<EdgeVector>& marked);
428 
429 
433  bool isLeftHanded() const {
434  return myAmLeftHanded;
435  }
436 
437 
441  bool wasIgnored(std::string id) const {
442  return myIgnoredEdges.count(id) != 0;
443  }
444 
445 
448  bool wasRemoved(std::string id) const {
449  return myExtractedEdges.count(id) != 0;
450  }
451 
454  void rename(NBEdge* edge, const std::string& newID);
455 
456 
457 
460 
468  void addPostProcessConnection(const std::string& from, int fromLane, const std::string& to, int toLane, bool mayDefinitelyPass);
469 
470 
475 
477  void generateStreetSigns();
478 
479 private:
486  EdgeVector getGeneratedFrom(const std::string& id) const;
487 
488 
490  bool ignoreFilterMatch(NBEdge* edge);
491 
492 
493 private:
498  public:
506  PostProcessConnection(const std::string& from_, int fromLane_, const std::string& to_, int toLane_, bool mayDefinitelyPass_)
507  : from(from_), fromLane(fromLane_), to(to_), toLane(toLane_), mayDefinitelyPass(mayDefinitelyPass_)
508  { }
510  std::string from;
512  int fromLane;
514  std::string to;
516  int toLane;
519  };
520 
522  std::vector<PostProcessConnection> myConnections;
523 
524 
526  typedef std::map<std::string, NBEdge*> EdgeCont;
527 
530 
533 
535  std::set<std::string> myIgnoredEdges;
536 
538  unsigned int myEdgesSplit;
539 
542 
543 
546 
549 
552 
554  std::set<std::string> myEdges2Keep;
555 
557  std::set<std::string> myEdges2Remove;
558 
561 
564 
566  std::set<std::string> myTypes2Keep;
567 
569  std::set<std::string> myTypes2Remove;
570 
574 
575 
578 
579 
580 private:
582  NBEdgeCont(const NBEdgeCont& s);
583 
585  NBEdgeCont& operator=(const NBEdgeCont& s);
586 
587 
588 };
589 
590 
591 #endif
592 
593 /****************************************************************************/
594