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-2012 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This file is part of SUMO. 00014 // SUMO is free software: you can redistribute it and/or modify 00015 // it under the terms of the GNU General Public License as published by 00016 // the Free Software Foundation, either version 3 of the License, or 00017 // (at your option) any later version. 00018 // 00019 /****************************************************************************/ 00020 #ifndef NIXMLTrafficLightsHandler_h 00021 #define NIXMLTrafficLightsHandler_h 00022 00023 00024 // =========================================================================== 00025 // included modules 00026 // =========================================================================== 00027 #ifdef _MSC_VER 00028 #include <windows_config.h> 00029 #else 00030 #include <config.h> 00031 #endif 00032 00033 #include <utils/xml/SUMOSAXHandler.h> 00034 #include <netbuild/NBConnection.h> 00035 00036 00037 // =========================================================================== 00038 // class declarations 00039 // =========================================================================== 00040 class NBEdge; 00041 class NBEdgeCont; 00042 class MsgHandler; 00043 class NBLoadedSUMOTLDef; 00044 class NBTrafficLightLogicCont; 00045 00046 00047 // =========================================================================== 00048 // class definitions 00049 // =========================================================================== 00057 class NIXMLTrafficLightsHandler : public SUMOSAXHandler { 00058 public: 00062 NIXMLTrafficLightsHandler(NBTrafficLightLogicCont& tlCont, NBEdgeCont& ec) ; 00063 00064 00066 ~NIXMLTrafficLightsHandler() ; 00067 00068 00069 protected: 00071 00072 00080 void myStartElement(int element, const SUMOSAXAttributes& attrs) ; 00081 00082 00089 void myEndElement(int element) ; 00091 00092 00093 00094 private: 00096 NBTrafficLightLogicCont& myTLLCont; 00097 00099 NBEdgeCont& myEdgeCont; 00100 00102 NBLoadedSUMOTLDef* myCurrentTL; 00103 00105 bool myResetPhases; 00106 00111 NBLoadedSUMOTLDef* initTrafficLightLogic(const SUMOSAXAttributes& attrs, NBLoadedSUMOTLDef* currentTL); 00112 00114 void addTlConnection(const SUMOSAXAttributes& attrs); 00115 00117 void removeTlConnection(const SUMOSAXAttributes& attrs); 00118 00120 NBEdge* retrieveEdge(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, bool& ok); 00121 00123 int retrieveLaneIndex(const SUMOSAXAttributes& attrs, SumoXMLAttr attr, NBEdge* edge, bool& ok); 00124 00125 00126 00127 private: 00129 NIXMLTrafficLightsHandler(const NIXMLTrafficLightsHandler& s); 00130 00132 NIXMLTrafficLightsHandler& operator=(const NIXMLTrafficLightsHandler& s); 00133 00134 00135 }; 00136 00137 00138 #endif 00139 00140 /****************************************************************************/ 00141