|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Builds trigger objects for microsim 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 NLTriggerBuilder_h 00020 #define NLTriggerBuilder_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 <vector> 00034 00035 00036 // =========================================================================== 00037 // class declarations 00038 // =========================================================================== 00039 class MSTrigger; 00040 class MSNet; 00041 class MSLaneSpeedTrigger; 00042 class NLHandler; 00043 class MSTriggeredRerouter; 00044 class MSLane; 00045 class MSEdge; 00046 class MSBusStop; 00047 00048 #ifdef HAVE_MESOSIM 00049 class METriggeredCalibrator; 00050 #endif 00051 00052 00053 // =========================================================================== 00054 // class definitions 00055 // =========================================================================== 00064 class NLTriggerBuilder { 00065 public: 00067 NLTriggerBuilder() throw(); 00068 00069 00071 virtual ~NLTriggerBuilder() throw(); 00072 00073 00078 void setHandler(NLHandler* handler) throw(); 00079 00080 00090 void buildVaporizer(const SUMOSAXAttributes& attrs) throw(); 00091 00092 00097 00098 00113 void parseAndBuildLaneSpeedTrigger(MSNet& net, const SUMOSAXAttributes& attrs, 00114 const std::string& base) throw(InvalidArgument); 00115 00116 00124 void parseAndBuildRerouter(MSNet& net, const SUMOSAXAttributes& attrs, 00125 const std::string& base) throw(InvalidArgument); 00126 00127 00134 void parseAndBuildBusStop(MSNet& net, const SUMOSAXAttributes& attrs) throw(InvalidArgument); 00135 00136 00137 #ifdef HAVE_MESOSIM 00138 00145 void parseAndBuildCalibrator(MSNet& net, const SUMOSAXAttributes& attrs, 00146 const std::string& base) throw(InvalidArgument); 00147 #endif 00148 00149 00150 00151 protected: 00160 00161 00173 virtual MSLaneSpeedTrigger* buildLaneSpeedTrigger(MSNet& net, 00174 const std::string& id, const std::vector<MSLane*> &destLanes, 00175 const std::string& file) throw(ProcessError); 00176 00177 00190 virtual void buildBusStop(MSNet& net, 00191 const std::string& id, const std::vector<std::string> &lines, 00192 MSLane* lane, SUMOReal frompos, SUMOReal topos) throw(InvalidArgument); 00193 00194 00195 #ifdef HAVE_MESOSIM 00196 00207 METriggeredCalibrator* buildCalibrator(MSNet& net, 00208 const std::string& id, const MSEdge* edge, SUMOReal pos, 00209 const std::string& file, const std::string& outfile, 00210 const SUMOTime freq) throw(); 00211 #endif 00212 00213 00224 virtual void buildRerouter(MSNet& net, 00225 const std::string& id, std::vector<MSEdge*> &edges, 00226 SUMOReal prob, const std::string& file, bool off) throw(); 00228 00229 00230 protected: 00233 00245 std::string getFileName(const SUMOSAXAttributes& attrs, 00246 const std::string& base, 00247 const bool allowEmpty=false) throw(InvalidArgument); 00248 00249 00261 MSLane* getLane(const SUMOSAXAttributes& attrs, 00262 const std::string& tt, const std::string& tid) throw(InvalidArgument); 00263 00264 00278 SUMOReal getPosition(const SUMOSAXAttributes& attrs, 00279 MSLane* lane, const std::string& tt, const std::string& tid) throw(InvalidArgument); 00281 00282 00283 protected: 00285 NLHandler* myHandler; 00286 00287 bool myHaveWarnedAboutDeprecatedFriendlyPos; 00288 00289 }; 00290 00291 00292 #endif 00293 00294 /****************************************************************************/ 00295