|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Importer for traffic lights stored in XML 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 NIXMLTrafficLightsHandler_h 00020 #define NIXMLTrafficLightsHandler_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 <utils/xml/SUMOSAXHandler.h> 00033 #include <netbuild/NBConnection.h> 00034 00035 00036 // =========================================================================== 00037 // class declarations 00038 // =========================================================================== 00039 class NBEdge; 00040 class NBEdgeCont; 00041 class MsgHandler; 00042 class NBLoadedSUMOTLDef; 00043 class NBTrafficLightLogicCont; 00044 00045 00046 // =========================================================================== 00047 // class definitions 00048 // =========================================================================== 00056 class NIXMLTrafficLightsHandler : public SUMOSAXHandler { 00057 public: 00061 NIXMLTrafficLightsHandler(NBTrafficLightLogicCont& tlCont, NBEdgeCont& ec) throw(); 00062 00063 00065 ~NIXMLTrafficLightsHandler() throw(); 00066 00067 00068 protected: 00070 00071 00079 void myStartElement(int element, const SUMOSAXAttributes& attrs) throw(ProcessError); 00080 00081 00088 void myEndElement(int element) throw(ProcessError); 00090 00091 00092 00093 private: 00095 NBTrafficLightLogicCont& myTLLCont; 00096 00098 NBEdgeCont& myEdgeCont; 00099 00101 NBLoadedSUMOTLDef* myCurrentTL; 00102 00104 bool myResetPhases; 00105 00110 NBLoadedSUMOTLDef* initTrafficLightLogic(const SUMOSAXAttributes& attrs, NBLoadedSUMOTLDef* currentTL); 00111 00113 void addTlConnection(const SUMOSAXAttributes& attrs); 00114 00116 void removeTlConnection(const SUMOSAXAttributes& attrs); 00117 00119 NBEdge* retrieveEdge(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, bool& ok); 00120 00122 int retrieveLaneIndex(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, NBEdge* edge, bool& ok); 00123 00124 00125 00126 private: 00128 NIXMLTrafficLightsHandler(const NIXMLTrafficLightsHandler& s); 00129 00131 NIXMLTrafficLightsHandler& operator=(const NIXMLTrafficLightsHandler& s); 00132 00133 00134 }; 00135 00136 00137 #endif 00138 00139 /****************************************************************************/ 00140