SUMO - Simulation of Urban MObility
NBEdgeCont.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // Storage for edges, including some functionality operating on multiple edges
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef NBEdgeCont_h
00023 #define NBEdgeCont_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <map>
00036 #include <iostream>
00037 #include <string>
00038 #include <vector>
00039 #include <set>
00040 #include "NBCont.h"
00041 #include <utils/common/SUMOVehicleClass.h>
00042 #include <utils/common/UtilExceptions.h>
00043 #include <utils/geom/PositionVector.h>
00044 
00045 
00046 // ===========================================================================
00047 // class declarations
00048 // ===========================================================================
00049 class NBNodeCont;
00050 class NBTypeCont;
00051 class NBEdge;
00052 class NBNode;
00053 class OptionsCont;
00054 class NBDistrictCont;
00055 class NBTrafficLightLogicCont;
00056 class OutputDevice;
00057 
00058 
00059 // ===========================================================================
00060 // class definitions
00061 // ===========================================================================
00066 class NBEdgeCont {
00067 public:
00071     NBEdgeCont(NBTypeCont& tc) ;
00072 
00073 
00075     ~NBEdgeCont() ;
00076 
00077 
00086     void applyOptions(OptionsCont& oc);
00087 
00088 
00090     void clear() ;
00091 
00092 
00093 
00094 
00097 
00111     bool insert(NBEdge* edge, bool ignorePrunning = false) ;
00112 
00113 
00122     NBEdge* retrieve(const std::string& id, bool retrieveExtracted = false) const ;
00123 
00124 
00137     NBEdge* retrievePossiblySplitted(const std::string& id,
00138                                      const std::string& hint, bool incoming) const ;
00139 
00140 
00151     NBEdge* retrievePossiblySplitted(const std::string& id, SUMOReal pos) const ;
00152 
00153 
00160     void erase(NBDistrictCont& dc, NBEdge* edge) ;
00161 
00162 
00171     void extract(NBDistrictCont& dc, NBEdge* edge, bool remember = false);
00172 
00173 
00177     std::map<std::string, NBEdge*>::const_iterator begin() const {
00178         return myEdges.begin();
00179     }
00180 
00181 
00185     std::map<std::string, NBEdge*>::const_iterator end() const {
00186         return myEdges.end();
00187     }
00189 
00190 
00191 
00194 
00208     bool splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node) ;
00209 
00210 
00231     bool splitAt(NBDistrictCont& dc, NBEdge* edge, NBNode* node,
00232                  const std::string& firstEdgeName, const std::string& secondEdgeName,
00233                  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge) ;
00234 
00235 
00248     bool splitAt(NBDistrictCont& dc, NBEdge* edge, SUMOReal edgepos, NBNode* node,
00249                  const std::string& firstEdgeName, const std::string& secondEdgeName,
00250                  unsigned int noLanesFirstEdge, unsigned int noLanesSecondEdge) ;
00252 
00253 
00254 
00257 
00261     unsigned int size() const {
00262         return (unsigned int) myEdges.size();
00263     }
00264 
00265 
00270     std::vector<std::string> getAllNames() const ;
00271 
00272 
00276     unsigned int getNoEdgeSplits() const {
00277         return myEdgesSplit;
00278     }
00280 
00281 
00282 
00285 
00290     void removeUnwishedEdges(NBDistrictCont& dc);
00291 
00292 
00301     void splitGeometry(NBNodeCont& nc);
00303 
00304 
00305 
00308 
00316     void sortOutgoingLanesConnections() ;
00317 
00318 
00327     void computeEdge2Edges(bool noLeftMovers) ;
00328 
00329 
00337     void computeLanes2Edges() ;
00338 
00339 
00347     void recheckLanes() ;
00348 
00349 
00358     void appendTurnarounds(bool noTLSControlled) ;
00359 
00360 
00367     void appendTurnarounds(const std::set<std::string> &ids, bool noTLSControlled);
00368 
00369 
00378     void computeEdgeShapes() ;
00379 
00380 
00389     void recomputeLaneShapes() ;
00390 
00391 
00394     void clearControllingTLInformation() const;
00395 
00396 
00404     void joinSameNodeConnectingEdges(NBDistrictCont& dc,
00405                                      NBTrafficLightLogicCont& tlc, EdgeVector edges) ;
00406 
00407 
00412     void recheckLaneSpread() ;
00414 
00415 
00416 
00420     void guessRoundabouts(std::vector<std::set<NBEdge*> > &marked) ;
00421 
00422 
00426     bool isLeftHanded() const {
00427         return myAmLeftHanded;
00428     }
00429 
00430 
00434     bool wasIgnored(std::string id) const {
00435         return myIgnoredEdges.count(id) != 0;
00436     }
00437 
00438 
00441     bool wasRemoved(std::string id) const {
00442         return myExtractedEdges.count(id) != 0;
00443     }
00444 
00447     void rename(NBEdge* edge, const std::string& newID);
00448 
00449 
00450 private:
00457     EdgeVector getGeneratedFrom(const std::string& id) const ;
00458 
00459 
00461     bool ignoreFilterMatch(NBEdge *edge);
00462 
00463 
00464 private:
00466     typedef std::map<std::string, NBEdge*> EdgeCont;
00467 
00469     EdgeCont myEdges;
00470 
00472     EdgeCont myExtractedEdges;
00473 
00475     std::set<std::string> myIgnoredEdges;
00476 
00478     unsigned int myEdgesSplit;
00479 
00481     bool myAmLeftHanded;
00482 
00483 
00486 
00488     SUMOReal myEdgesMinSpeed;
00489 
00491     bool myRemoveEdgesAfterJoining;
00492 
00494     std::set<std::string> myEdges2Keep;
00495 
00497     std::set<std::string> myEdges2Remove;
00498 
00500     SVCPermissions myVehicleClasses2Keep;
00501 
00503     SVCPermissions myVehicleClasses2Remove;
00504 
00506     std::set<std::string> myTypes2Keep;
00507 
00509     std::set<std::string> myTypes2Remove;
00510 
00512     PositionVector myPrunningBoundary;
00513 
00515 
00516 
00518     NBTypeCont& myTypeCont;
00519 
00520 
00521 private:
00523     NBEdgeCont(const NBEdgeCont& s);
00524 
00526     NBEdgeCont& operator=(const NBEdgeCont& s);
00527 
00528 
00529 };
00530 
00531 
00532 #endif
00533 
00534 /****************************************************************************/
00535 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines