|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // A storage for loaded polygons and pois 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 PCPolyContainer_h 00020 #define PCPolyContainer_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 <map> 00034 #include <vector> 00035 #include <utils/shapes/Polygon.h> 00036 #include <utils/shapes/PointOfInterest.h> 00037 #include <utils/geom/Boundary.h> 00038 #include <utils/common/UtilExceptions.h> 00039 00040 00041 // =========================================================================== 00042 // class definitions 00043 // =========================================================================== 00048 class PCPolyContainer { 00049 public: 00055 PCPolyContainer(bool prune, const Boundary& prunningBoundary, 00056 const std::vector<std::string> &removeByNames) throw(); 00057 00058 00060 ~PCPolyContainer() throw(); 00061 00062 00078 bool insert(const std::string& id, Polygon* poly, int layer, 00079 bool ignorePrunning=false) throw(); 00080 00081 00097 bool insert(const std::string& id, PointOfInterest* poi, int layer, 00098 bool ignorePrunning=false) throw(); 00099 00100 00104 unsigned int getNoPolygons() throw() { 00105 return (unsigned int) myPolyCont.size(); 00106 } 00107 00108 00112 unsigned int getNoPOIs() throw() { 00113 return (unsigned int) myPOICont.size(); 00114 } 00115 00116 00121 void clear() throw(); 00122 00123 00125 void report() throw(); 00126 00127 00132 bool containsPolygon(const std::string& kidey) throw(); 00133 00134 00139 void save(const std::string& file) throw(IOError); 00140 00141 00150 int getEnumIDFor(const std::string& key) throw(); 00151 00152 00153 public: 00155 typedef std::map<std::string, Polygon*> PolyCont; 00157 PolyCont myPolyCont; 00158 00160 typedef std::map<std::string, PointOfInterest*> POICont; 00162 POICont myPOICont; 00163 00165 std::map<std::string, int> myIDEnums; 00166 00168 std::map<Polygon*, int> myPolyLayerMap; 00169 00171 std::map<PointOfInterest*, int> myPOILayerMap; 00172 00173 00175 Boundary myPrunningBoundary; 00176 00178 bool myDoPrunne; 00179 00181 std::vector<std::string> myRemoveByNames; 00182 00183 00184 private: 00186 PCPolyContainer(const PCPolyContainer& s); 00187 00189 PCPolyContainer& operator=(const PCPolyContainer& s); 00190 00191 00192 }; 00193 00194 00195 #endif 00196 00197 /****************************************************************************/ 00198