|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Importer for network nodes 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 NIXMLNodesHandler_h 00020 #define NIXMLNodesHandler_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 <utils/geom/Position.h> 00034 00035 00036 // =========================================================================== 00037 // class declarations 00038 // =========================================================================== 00039 class OptionsCont; 00040 class NBNode; 00041 class NBNodeCont; 00042 class NBTrafficLightLogicCont; 00043 00044 00045 // =========================================================================== 00046 // class definitions 00047 // =========================================================================== 00056 class NIXMLNodesHandler : public SUMOSAXHandler { 00057 00058 public: 00067 NIXMLNodesHandler(NBNodeCont& nc, NBTrafficLightLogicCont& tlc, 00068 OptionsCont& options); 00069 00070 00072 ~NIXMLNodesHandler() throw(); 00073 00074 00075 protected: 00077 00078 00089 void myStartElement(int element, 00090 const SUMOSAXAttributes& attrs) throw(ProcessError); 00092 00093 00094 private: 00095 /* 00096 * @brief Parses node information 00097 * Tries to parse a node. If the node can be parsed, it is stored within 00098 * "myNodeCont". Otherwise an error is generated. Then, if given 00099 * the tls information is parsed and inserted into "myTLLogicCont". 00100 */ 00101 void addNode(const SUMOSAXAttributes& attrs); 00102 00103 /* 00104 * @brief Parses node deletion information 00105 */ 00106 void deleteNode(const SUMOSAXAttributes& attrs); 00107 00108 /* 00109 * @brief Parses a cluster of nodes to be joined 00110 */ 00111 void addJoinCluster(const SUMOSAXAttributes& attrs); 00112 00113 /* 00114 * @brief Parses a list of nodes to be excluded from joining 00115 */ 00116 void addJoinExclusion(const SUMOSAXAttributes& attrs); 00117 00123 void processTrafficLightDefinitions(const SUMOSAXAttributes& attrs, 00124 NBNode* currentNode); 00125 00126 00127 private: 00129 OptionsCont& myOptions; 00130 00132 std::string myID; 00133 00135 Position myPosition; 00136 00138 NBNodeCont& myNodeCont; 00139 00141 NBTrafficLightLogicCont& myTLLogicCont; 00142 00143 00144 private: 00146 NIXMLNodesHandler(const NIXMLNodesHandler& s); 00147 00149 NIXMLNodesHandler& operator=(const NIXMLNodesHandler& s); 00150 00151 }; 00152 00153 00154 #endif 00155 00156 /****************************************************************************/ 00157