00001 /****************************************************************************/ 00007 // Instance responsible for building networks 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 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 "NBJunctionLogicCont.h" 00042 #include "NBDistrictCont.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 // =========================================================================== 00060 class NBNetBuilder { 00061 public: 00063 NBNetBuilder() throw(); 00064 00066 ~NBNetBuilder() throw(); 00067 00068 00077 void applyOptions(OptionsCont &oc) throw(ProcessError); 00078 00079 00084 void buildLoaded() throw(IOError); 00085 00086 00087 00090 00094 NBEdgeCont &getEdgeCont() throw() { 00095 return myEdgeCont; 00096 } 00097 00098 00102 NBNodeCont &getNodeCont() throw() { 00103 return myNodeCont; 00104 } 00105 00106 00110 NBTypeCont &getTypeCont() throw() { 00111 return myTypeCont; 00112 } 00113 00114 00118 NBTrafficLightLogicCont &getTLLogicCont() throw() { 00119 return myTLLCont; 00120 } 00121 00122 00126 NBJunctionLogicCont &getJunctionLogicCont() throw() { 00127 return myJunctionLogicCont; 00128 } 00129 00130 00134 NBDistrictCont &getDistrictCont() throw() { 00135 return myDistrictCont; 00136 } 00138 00139 00140 00145 static void insertNetBuildOptions(OptionsCont &oc); 00146 00147 00148 protected: 00157 void compute(OptionsCont &oc) throw(ProcessError); 00158 00159 00165 void inform(int &step, const std::string &about) throw(); 00166 00167 00168 00171 00189 void save(OutputDevice &device, OptionsCont &oc) throw(IOError); 00191 00192 00193 00198 class by_id_sorter { 00199 public: 00201 explicit by_id_sorter() { } 00202 00203 int operator()(const NBNode *n1, const NBNode *n2) const { 00204 return n1->getID()<n2->getID(); 00205 } 00206 00207 }; 00208 00209 protected: 00211 NBEdgeCont myEdgeCont; 00212 00214 NBNodeCont myNodeCont; 00215 00217 NBTypeCont myTypeCont; 00218 00220 NBTrafficLightLogicCont myTLLCont; 00221 00223 NBJunctionLogicCont myJunctionLogicCont; 00224 00226 NBDistrictCont myDistrictCont; 00227 00229 std::vector<std::set<NBEdge*> > myRoundabouts; 00230 00231 00232 private: 00234 NBNetBuilder(const NBNetBuilder &s); 00235 00237 NBNetBuilder &operator=(const NBNetBuilder &s); 00238 00239 }; 00240 00241 00242 #endif 00243 00244 /****************************************************************************/ 00245
1.5.6