SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Base class for additional objects (detectors etc.) 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 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 "GUIGlObject_AbstractAdd.h" 00034 #include <cassert> 00035 #include <iostream> 00036 #include <utils/gui/div/GLHelper.h> 00037 #include <foreign/polyfonts/polyfonts.h> 00038 00039 #ifdef CHECK_MEMORY_LEAKS 00040 #include <foreign/nvwa/debug_new.h> 00041 #endif // CHECK_MEMORY_LEAKS 00042 00043 00044 // =========================================================================== 00045 // static member definitions 00046 // =========================================================================== 00047 std::map<std::string, GUIGlObject_AbstractAdd*> GUIGlObject_AbstractAdd::myObjects; 00048 std::vector<GUIGlObject_AbstractAdd*> GUIGlObject_AbstractAdd::myObjectList; 00049 00050 00051 // =========================================================================== 00052 // method definitions 00053 // =========================================================================== 00054 GUIGlObject_AbstractAdd::GUIGlObject_AbstractAdd(const std::string& prefix, GUIGlObjectType type, const std::string& id) : 00055 GUIGlObject(prefix, type, id) { 00056 myObjects[getFullName()] = this; 00057 myObjectList.push_back(this); 00058 } 00059 00060 00061 GUIGlObject_AbstractAdd::~GUIGlObject_AbstractAdd() {} 00062 00063 00064 void 00065 GUIGlObject_AbstractAdd::clearDictionary() { 00066 std::map<std::string, GUIGlObject_AbstractAdd*>::iterator i; 00067 for (i = myObjects.begin(); i != myObjects.end(); i++) { 00069 } 00070 myObjects.clear(); 00071 myObjectList.clear(); 00072 } 00073 00074 00075 GUIGlObject_AbstractAdd* 00076 GUIGlObject_AbstractAdd::get(const std::string& name) { 00077 std::map<std::string, GUIGlObject_AbstractAdd*>::iterator i = myObjects.find(name); 00078 if (i == myObjects.end()) { 00079 return 0; 00080 } 00081 return (*i).second; 00082 } 00083 00084 00085 const std::vector<GUIGlObject_AbstractAdd*> & 00086 GUIGlObject_AbstractAdd::getObjectList() { 00087 return myObjectList; 00088 } 00089 00090 00091 std::vector<GUIGlID> 00092 GUIGlObject_AbstractAdd::getIDList() { 00093 std::vector<GUIGlID> ret; 00094 for (std::vector<GUIGlObject_AbstractAdd*>::iterator i = myObjectList.begin(); i != myObjectList.end(); ++i) { 00095 ret.push_back((*i)->getGlID()); 00096 } 00097 return ret; 00098 } 00099 00100 /****************************************************************************/ 00101