|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Instance responsible for building networks 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 #ifndef NBNetBuilder_h 00020 #define NBNetBuilder_h 00021 00022 00023 // =========================================================================== 00024 // included modules 00025 // =========================================================================== 00026 #ifdef _MSC_VER 00027 #include <windows_config.h> 00028 #else 00029 #include <config.h> 00030 #endif 00031 00032 #include <string> 00033 #include <iostream> 00034 #include <vector> 00035 #include <set> 00036 #include "NBEdgeCont.h" 00037 #include "NBTypeCont.h" 00038 #include "NBNodeCont.h" 00039 #include "NBNode.h" 00040 #include "NBTrafficLightLogicCont.h" 00041 #include "NBDistrictCont.h" 00042 #include "NBJoinedEdgesMap.h" 00043 #include <utils/common/UtilExceptions.h> 00044 00045 00046 // =========================================================================== 00047 // class declarations 00048 // =========================================================================== 00049 class OptionsCont; 00050 class OutputDevice; 00051 00052 00053 // =========================================================================== 00054 // class definitions 00055 // =========================================================================== 00108 class NBNetBuilder { 00109 friend class GNENet; // for triggering intermediate build steps 00110 00111 public: 00113 NBNetBuilder() throw(); 00114 00116 ~NBNetBuilder() throw(); 00117 00118 00127 void applyOptions(OptionsCont& oc) throw(ProcessError); 00128 00129 00137 void compute(OptionsCont& oc, 00138 const std::set<std::string> &explicitTurnarounds=std::set<std::string>(), 00139 bool removeUnwishedNodes=true); 00140 00141 00142 00145 00149 NBEdgeCont& getEdgeCont() throw() { 00150 return myEdgeCont; 00151 } 00152 00153 00157 NBNodeCont& getNodeCont() throw() { 00158 return myNodeCont; 00159 } 00160 00161 00165 NBTypeCont& getTypeCont() throw() { 00166 return myTypeCont; 00167 } 00168 00169 00173 NBTrafficLightLogicCont& getTLLogicCont() throw() { 00174 return myTLLCont; 00175 } 00176 00177 00181 NBDistrictCont& getDistrictCont() throw() { 00182 return myDistrictCont; 00183 } 00184 00185 00189 const std::vector<std::set<NBEdge*> > &getRoundabouts() const { 00190 return myRoundabouts; 00191 } 00192 00193 00197 const NBJoinedEdgesMap& getJoinedEdgesMap() const { 00198 return myJoinedEdges; 00199 } 00201 00202 00203 protected: 00208 class by_id_sorter { 00209 public: 00211 explicit by_id_sorter() { } 00212 00213 int operator()(const NBNode* n1, const NBNode* n2) const { 00214 return n1->getID()<n2->getID(); 00215 } 00216 00217 }; 00218 00219 protected: 00221 NBNodeCont myNodeCont; 00222 00224 NBTypeCont myTypeCont; 00225 00227 NBEdgeCont myEdgeCont; 00228 00230 NBTrafficLightLogicCont myTLLCont; 00231 00233 NBDistrictCont myDistrictCont; 00234 00236 std::vector<std::set<NBEdge*> > myRoundabouts; 00237 00239 NBJoinedEdgesMap myJoinedEdges; 00240 00241 00242 private: 00244 NBNetBuilder(const NBNetBuilder& s); 00245 00247 NBNetBuilder& operator=(const NBNetBuilder& s); 00248 00249 }; 00250 00251 00252 #endif 00253 00254 /****************************************************************************/ 00255