|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Base class for additional objects (detectors etc.) 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 00020 00021 // =========================================================================== 00022 // included modules 00023 // =========================================================================== 00024 #ifdef _MSC_VER 00025 #include <windows_config.h> 00026 #else 00027 #include <config.h> 00028 #endif 00029 00030 #include "GUIGlObject_AbstractAdd.h" 00031 #include <cassert> 00032 #include <iostream> 00033 #include <utils/gui/div/GLHelper.h> 00034 #include <foreign/polyfonts/polyfonts.h> 00035 00036 #ifdef CHECK_MEMORY_LEAKS 00037 #include <foreign/nvwa/debug_new.h> 00038 #endif // CHECK_MEMORY_LEAKS 00039 00040 00041 // =========================================================================== 00042 // static member definitions 00043 // =========================================================================== 00044 std::map<std::string, GUIGlObject_AbstractAdd*> GUIGlObject_AbstractAdd::myObjects; 00045 std::vector<GUIGlObject_AbstractAdd*> GUIGlObject_AbstractAdd::myObjectList; 00046 00047 00048 // =========================================================================== 00049 // method definitions 00050 // =========================================================================== 00051 GUIGlObject_AbstractAdd::GUIGlObject_AbstractAdd(const std::string& prefix, GUIGlObjectType type, const std::string& id) : 00052 GUIGlObject(prefix, type, id) { 00053 myObjects[getFullName()] = this; 00054 myObjectList.push_back(this); 00055 } 00056 00057 00058 GUIGlObject_AbstractAdd::~GUIGlObject_AbstractAdd() throw() {} 00059 00060 00061 void 00062 GUIGlObject_AbstractAdd::clearDictionary() { 00063 std::map<std::string, GUIGlObject_AbstractAdd*>::iterator i; 00064 for (i=myObjects.begin(); i!=myObjects.end(); i++) { 00066 } 00067 myObjects.clear(); 00068 myObjectList.clear(); 00069 } 00070 00071 00072 GUIGlObject_AbstractAdd* 00073 GUIGlObject_AbstractAdd::get(const std::string& name) { 00074 std::map<std::string, GUIGlObject_AbstractAdd*>::iterator i = myObjects.find(name); 00075 if (i==myObjects.end()) { 00076 return 0; 00077 } 00078 return (*i).second; 00079 } 00080 00081 00082 const std::vector<GUIGlObject_AbstractAdd*> & 00083 GUIGlObject_AbstractAdd::getObjectList() { 00084 return myObjectList; 00085 } 00086 00087 00088 std::vector<GUIGlID> 00089 GUIGlObject_AbstractAdd::getIDList() { 00090 std::vector<GUIGlID> ret; 00091 for (std::vector<GUIGlObject_AbstractAdd*>::iterator i=myObjectList.begin(); i!=myObjectList.end(); ++i) { 00092 ret.push_back((*i)->getGlID()); 00093 } 00094 return ret; 00095 } 00096 00097 /****************************************************************************/ 00098