SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // Builds trigger objects for microsim 00011 /****************************************************************************/ 00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00014 /****************************************************************************/ 00015 // 00016 // This file is part of SUMO. 00017 // SUMO is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation, either version 3 of the License, or 00020 // (at your option) any later version. 00021 // 00022 /****************************************************************************/ 00023 #ifndef NLTriggerBuilder_h 00024 #define NLTriggerBuilder_h 00025 00026 00027 // =========================================================================== 00028 // included modules 00029 // =========================================================================== 00030 #ifdef _MSC_VER 00031 #include <windows_config.h> 00032 #else 00033 #include <config.h> 00034 #endif 00035 00036 #include <string> 00037 #include <vector> 00038 00039 00040 // =========================================================================== 00041 // class declarations 00042 // =========================================================================== 00043 class MSTrigger; 00044 class MSNet; 00045 class MSLaneSpeedTrigger; 00046 class NLHandler; 00047 class MSTriggeredRerouter; 00048 class MSLane; 00049 class MSEdge; 00050 class MSBusStop; 00051 00052 #ifdef HAVE_MESOSIM 00053 class METriggeredCalibrator; 00054 #endif 00055 00056 00057 // =========================================================================== 00058 // class definitions 00059 // =========================================================================== 00068 class NLTriggerBuilder { 00069 public: 00071 NLTriggerBuilder() ; 00072 00073 00075 virtual ~NLTriggerBuilder() ; 00076 00077 00082 void setHandler(NLHandler* handler) ; 00083 00084 00094 void buildVaporizer(const SUMOSAXAttributes& attrs) ; 00095 00096 00101 00102 00117 void parseAndBuildLaneSpeedTrigger(MSNet& net, const SUMOSAXAttributes& attrs, 00118 const std::string& base) throw(InvalidArgument); 00119 00120 00128 void parseAndBuildRerouter(MSNet& net, const SUMOSAXAttributes& attrs, 00129 const std::string& base) throw(InvalidArgument); 00130 00131 00138 void parseAndBuildBusStop(MSNet& net, const SUMOSAXAttributes& attrs) throw(InvalidArgument); 00139 00140 00141 #ifdef HAVE_MESOSIM 00142 00149 void parseAndBuildCalibrator(MSNet& net, const SUMOSAXAttributes& attrs, 00150 const std::string& base) throw(InvalidArgument); 00151 #endif 00152 00153 00154 00155 protected: 00164 00165 00177 virtual MSLaneSpeedTrigger* buildLaneSpeedTrigger(MSNet& net, 00178 const std::string& id, const std::vector<MSLane*> &destLanes, 00179 const std::string& file) ; 00180 00181 00194 virtual void buildBusStop(MSNet& net, 00195 const std::string& id, const std::vector<std::string> &lines, 00196 MSLane* lane, SUMOReal frompos, SUMOReal topos) throw(InvalidArgument); 00197 00198 00199 #ifdef HAVE_MESOSIM 00200 00211 METriggeredCalibrator* buildCalibrator(MSNet& net, 00212 const std::string& id, const MSEdge* edge, SUMOReal pos, 00213 const std::string& file, const std::string& outfile, 00214 const SUMOTime freq) ; 00215 #endif 00216 00217 00228 virtual MSTriggeredRerouter* buildRerouter(MSNet& net, 00229 const std::string& id, std::vector<MSEdge*> &edges, 00230 SUMOReal prob, const std::string& file, bool off) ; 00232 00233 00234 protected: 00237 00249 std::string getFileName(const SUMOSAXAttributes& attrs, 00250 const std::string& base, 00251 const bool allowEmpty = false) throw(InvalidArgument); 00252 00253 00265 MSLane* getLane(const SUMOSAXAttributes& attrs, 00266 const std::string& tt, const std::string& tid) throw(InvalidArgument); 00267 00268 00282 SUMOReal getPosition(const SUMOSAXAttributes& attrs, 00283 MSLane* lane, const std::string& tt, const std::string& tid) throw(InvalidArgument); 00285 00286 00287 protected: 00289 NLHandler* myHandler; 00290 00291 bool myHaveWarnedAboutDeprecatedFriendlyPos; 00292 00293 }; 00294 00295 00296 #endif 00297 00298 /****************************************************************************/ 00299