GUIParameterTracker.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A window which displays the time line of one (or more) value(s)
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 GUIParameterTracker_h
00020 #define GUIParameterTracker_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 <fx.h>
00034 #include <fx3d.h>
00035 #include <utils/gui/globjects/GUIGlObject.h>
00036 #include "TrackerValueDesc.h"
00037 #include <guisim/GLObjectValuePassConnector.h>
00038 
00039 #ifdef _WIN32
00040 #include <windows.h>
00041 #include <GL/gl.h>      /* OpenGL header file */
00042 #endif // _WIN32
00043 
00044 
00045 // ===========================================================================
00046 // class definitions
00047 // ===========================================================================
00051 class GUIParameterTracker : public FXMainWindow {
00052     FXDECLARE(GUIParameterTracker)
00053 public:
00054     enum {
00055         MID_AGGREGATIONINTERVAL = FXMainWindow::ID_LAST,
00056         MID_SAVE,
00057         ID_LAST
00058     };
00060     GUIParameterTracker(GUIMainWindow &app, const std::string &name,
00061                         GUIGlObject &o, int xpos, int ypos);
00062 
00064     GUIParameterTracker(GUIMainWindow &app, const std::string &name);
00065 
00067     ~GUIParameterTracker();
00068 
00070     void create();
00071 
00073     void addTracked(GUIGlObject &o, ValueSource<SUMOReal> *src,
00074                     TrackerValueDesc *newTracked);
00075 
00077     long onConfigure(FXObject*,FXSelector,void*);
00078 
00080     long onPaint(FXObject*,FXSelector,void*);
00081 
00083     long onSimStep(FXObject*,FXSelector,void*);
00084 
00086     long onCmdChangeAggregation(FXObject*,FXSelector,void*);
00087 
00089     long onCmdSave(FXObject*,FXSelector,void*);
00090 
00091 
00092 protected:
00094     void addVariable(GUIGlObject *o, const std::string &name, size_t recordBegin);
00095 
00096 public:
00103     class GUIParameterTrackerPanel : public FXGLCanvas {
00104         FXDECLARE(GUIParameterTrackerPanel)
00105     public:
00107         GUIParameterTrackerPanel(FXComposite *c, GUIMainWindow &app,
00108                                  GUIParameterTracker &parent);
00109 
00111         ~GUIParameterTrackerPanel();
00112 
00114         friend class GUIParameterTracker;
00115 
00117         long onConfigure(FXObject*,FXSelector,void*);
00118 
00120         long onPaint(FXObject*,FXSelector,void*);
00121 
00123         long onSimStep(FXObject*sender,FXSelector,void*);
00124 
00125     private:
00127         void drawValues();
00128 
00130         void drawValue(TrackerValueDesc &desc, SUMOReal namePos);
00131 
00133         SUMOReal patchHeightVal(TrackerValueDesc &desc, SUMOReal d);
00134 
00135     private:
00137         GUIParameterTracker *myParent;
00138 
00140         int myWidthInPixels, myHeightInPixels;
00141 
00143         GUIMainWindow *myApplication;
00144 
00145     protected:
00147         GUIParameterTrackerPanel() { }
00148     };
00149 
00150 public:
00152     friend class GUIParameterTrackerPanel;
00153 
00154 private:
00156     void buildToolBar();
00157 
00158 
00159 protected:
00161     GUIMainWindow *myApplication;
00162 
00164     typedef std::vector<TrackerValueDesc*> TrackedVarsVector;
00165 
00167     TrackedVarsVector myTracked;
00168 
00170     GUIParameterTrackerPanel *myPanel;
00171 
00173     typedef std::vector<GLObjectValuePassConnector<SUMOReal>*> ValuePasserVector;
00174 
00176     ValuePasserVector myValuePassers;
00177 
00179     FXToolBarShell *myToolBarDrag;
00180 
00182     FXComboBox *myAggregationInterval;
00183 
00185     FXdouble myAggregationDelay;
00186 
00188     FXToolBar *myToolBar;
00189 
00190 protected:
00192     GUIParameterTracker() { }
00193 
00194 };
00195 
00196 
00197 #endif
00198 
00199 /****************************************************************************/
00200 

Generated on Wed May 5 00:06:30 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6