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-sim.org/
12 // Copyright (C) 2001-2014 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 
135  NBEdge* retrievePossiblySplit(const std::string& id, bool downstream) const;
136 
137 
150  NBEdge* retrievePossiblySplit(const std::string& id, const std::string& hint, bool incoming) const;
151 
152 
163  NBEdge* retrievePossiblySplit(const std::string& id, SUMOReal pos) const;
164 
165 
172  void erase(NBDistrictCont& dc, NBEdge* edge);
173 
174 
184  void extract(NBDistrictCont& dc, NBEdge* edge, bool remember = false);
185 
186 
190  std::map<std::string, NBEdge*>::const_iterator begin() const {
191  return myEdges.begin();
192  }
193 
194 
198  std::map<std::string, NBEdge*>::const_iterator end() const {
199  return myEdges.end();
200  }
202 
203 
204 
207 
221  bool splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node);
222 
223 
244  bool splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node,
245  const std::string& firstEdgeName, const std::string& secondEdgeName,
246  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge);
247 
248 
261  bool splitAt(NBDistrictCont& dc, NBEdge* edge, SUMOReal edgepos, NBNode* node,
262  const std::string& firstEdgeName, const std::string& secondEdgeName,
263  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge);
265 
266 
267 
270 
274  unsigned int size() const {
275  return (unsigned int) myEdges.size();
276  }
277 
278 
283  std::vector<std::string> getAllNames() const;
284 
285 
289  unsigned int getNoEdgeSplits() const {
290  return myEdgesSplit;
291  }
293 
294 
295 
298 
304 
305 
314  void splitGeometry(NBNodeCont& nc);
315 
316 
321  void reduceGeometries(const SUMOReal minDist);
322 
323 
330  void checkGeometries(const SUMOReal maxAngle, const SUMOReal minRadius, bool fix);
332 
333 
334 
337 
346 
347 
356  void computeEdge2Edges(bool noLeftMovers);
357 
358 
366  void computeLanes2Edges(const bool buildCrossingsAndWalkingAreas);
367 
368 
376  void recheckLanes(const bool buildCrossingsAndWalkingAreas);
377 
378 
387  void appendTurnarounds(bool noTLSControlled);
388 
389 
396  void appendTurnarounds(const std::set<std::string>& ids, bool noTLSControlled);
397 
398 
407  void computeEdgeShapes();
408 
409 
418  void computeLaneShapes();
419 
420 
423  void clearControllingTLInformation() const;
424 
425 
434  NBTrafficLightLogicCont& tlc, EdgeVector edges);
435 
436 
441  void recheckLaneSpread();
443 
444 
445 
449  void guessRoundabouts(std::vector<EdgeVector>& marked);
450 
451 
455  bool isLeftHanded() const {
456  return myAmLeftHanded;
457  }
458 
459 
463  bool wasIgnored(std::string id) const {
464  return myIgnoredEdges.count(id) != 0;
465  }
466 
467 
470  bool wasRemoved(std::string id) const {
471  return myExtractedEdges.count(id) != 0;
472  }
473 
476  void rename(NBEdge* edge, const std::string& newID);
477 
478 
479 
482 
490  void addPostProcessConnection(const std::string& from, int fromLane, const std::string& to, int toLane, bool mayDefinitelyPass);
491 
492 
497 
499  void generateStreetSigns();
500 
502  int guessSidewalks(SUMOReal width, SUMOReal minSpeed, SUMOReal maxSpeed);
503 
504 
505 private:
512  EdgeVector getGeneratedFrom(const std::string& id) const;
513 
514 
516  bool ignoreFilterMatch(NBEdge* edge);
517 
518 
519 private:
522 
527  public:
535  PostProcessConnection(const std::string& from_, int fromLane_, const std::string& to_, int toLane_, bool mayDefinitelyPass_)
536  : from(from_), fromLane(fromLane_), to(to_), toLane(toLane_), mayDefinitelyPass(mayDefinitelyPass_)
537  { }
539  std::string from;
541  int fromLane;
543  std::string to;
545  int toLane;
548  };
549 
551  std::vector<PostProcessConnection> myConnections;
552 
553 
555  typedef std::map<std::string, NBEdge*> EdgeCont;
556 
559 
562 
564  std::set<std::string> myIgnoredEdges;
565 
567  unsigned int myEdgesSplit;
568 
571 
572 
575 
578 
581 
583  std::set<std::string> myEdges2Keep;
584 
586  std::set<std::string> myEdges2Remove;
587 
590 
593 
595  std::set<std::string> myTypes2Keep;
596 
598  std::set<std::string> myTypes2Remove;
599 
602 
606 
607 
608 private:
610  NBEdgeCont(const NBEdgeCont& s);
611 
613  NBEdgeCont& operator=(const NBEdgeCont& s);
614 
615 
616 };
617 
618 
619 #endif
620 
621 /****************************************************************************/
622