|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // A popup-menu for dynamic patameter table entries 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 <iostream> 00031 #include <string> 00032 #include "GUIParameterTableWindow.h" 00033 #include <utils/gui/globjects/GUIGlObject.h> 00034 #include "GUIParam_PopupMenu.h" 00035 #include <utils/gui/tracker/GUIParameterTracker.h> 00036 #include <utils/gui/tracker/TrackerValueDesc.h> 00037 #include <utils/gui/windows/GUIAppEnum.h> 00038 #include <utils/gui/windows/GUIMainWindow.h> 00039 00040 #ifdef CHECK_MEMORY_LEAKS 00041 #include <foreign/nvwa/debug_new.h> 00042 #endif // CHECK_MEMORY_LEAKS 00043 00044 00045 // =========================================================================== 00046 // FOX callback mapping 00047 // =========================================================================== 00048 FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]= { 00049 FXMAPFUNC(SEL_COMMAND, MID_OPENTRACKER, GUIParam_PopupMenuInterface::onCmdOpenTracker), 00050 }; 00051 00052 // Object implementation 00053 FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap)) 00054 00055 00056 // =========================================================================== 00057 // method definitions 00058 // =========================================================================== 00059 GUIParam_PopupMenuInterface::GUIParam_PopupMenuInterface(GUIMainWindow& app, 00060 GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName, 00061 ValueSource<SUMOReal> *src) throw() 00062 : FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow), 00063 myApplication(&app), myVarName(varName), mySource(src) { 00064 } 00065 00066 00067 GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface() throw() { 00068 delete mySource; 00069 } 00070 00071 00072 long 00073 GUIParam_PopupMenuInterface::onCmdOpenTracker(FXObject*,FXSelector,void*) { 00074 std::string trackerName = myVarName + " from " + myObject->getFullName(); 00075 GUIParameterTracker* tr = new GUIParameterTracker(*myApplication, trackerName); 00076 TrackerValueDesc* newTracked = new TrackerValueDesc(myVarName, RGBColor(0, 0, 0), myApplication->getCurrentSimTime()); 00077 tr->addTracked(*myObject, mySource->copy(), newTracked); 00078 tr->create(); 00079 tr->show(); 00080 return 1; 00081 } 00082 00083 00084 /****************************************************************************/ 00085