00001 /****************************************************************************/ 00007 // Storage for "selected" objects 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 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 GUISelectedStorage_h 00020 #define GUISelectedStorage_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 <vector> 00033 #include <string> 00034 #include <fstream> 00035 #include <utils/common/UtilExceptions.h> 00036 #include <utils/gui/globjects/GUIGlObjectTypes.h> 00037 00038 #ifdef _WIN32 00039 #include <windows.h> 00040 #endif 00041 00042 #include <GL/gl.h> 00043 00044 00045 // =========================================================================== 00046 // class declarations 00047 // =========================================================================== 00048 class GUIDialog_GLChosenEditor; 00049 class OutputDevice; 00050 00051 00052 // =========================================================================== 00053 // class definitions 00054 // =========================================================================== 00079 class GUISelectedStorage { 00080 public: 00082 GUISelectedStorage() throw(); 00083 00084 00086 ~GUISelectedStorage() throw(); 00087 00088 00105 bool isSelected(int type, GLuint id) throw(ProcessError); 00106 00107 00127 void select(int type, GLuint id, bool update=true) throw(ProcessError); 00128 00129 00149 void deselect(int type, GLuint id) throw(ProcessError); 00150 00151 00166 void toggleSelection(GLuint id) throw(ProcessError); 00167 00168 00175 const std::vector<GLuint> &getSelected() const throw(); 00176 00177 00190 const std::vector<GLuint> &getSelected(GUIGlObjectType type) const throw(ProcessError); 00191 00192 00199 void clear() throw(); 00200 00201 00210 void load(int type, const std::string &filename) throw(IOError); 00211 00212 00221 void save(int type, const std::string &filename) throw(IOError); 00222 00223 00230 void add2Update(GUIDialog_GLChosenEditor *ed) throw(); 00231 00232 00239 void remove2Update(GUIDialog_GLChosenEditor *ed) throw(); 00240 00241 00242 00247 class SingleTypeSelections { 00248 public: 00250 SingleTypeSelections() throw(); 00251 00253 ~SingleTypeSelections() throw(); 00254 00255 00260 bool isSelected(GLuint id) throw(); 00261 00262 00266 void select(GLuint id) throw(); 00267 00268 00272 void deselect(GLuint id) throw(); 00273 00274 00276 void clear() throw(); 00277 00278 00285 void load(const std::string &filename) throw(IOError); 00286 00287 00294 void save(const std::string &filename) throw(IOError); 00295 00296 00300 const std::vector<GLuint> &getSelected() const throw(); 00301 00302 private: 00304 std::vector<GLuint> mySelected; 00305 00306 }; 00307 00308 00309 private: 00311 SingleTypeSelections mySelectedVehicles; 00312 00314 SingleTypeSelections mySelectedLanes; 00315 00317 SingleTypeSelections mySelectedEdges; 00318 00320 SingleTypeSelections mySelectedJunctions; 00321 00323 SingleTypeSelections mySelectedEmitters; 00324 00326 SingleTypeSelections mySelectedDetectors; 00327 00329 SingleTypeSelections mySelectedTLLogics; 00330 00332 SingleTypeSelections mySelectedTriggers; 00333 00335 SingleTypeSelections mySelectedShapes; 00336 00338 std::vector<GLuint> mySelected; 00339 00341 GUIDialog_GLChosenEditor *my2Update; 00342 00343 }; 00344 00345 00346 #endif 00347 00348 /****************************************************************************/ 00349
1.5.6