Eclipse SUMO - Simulation of Urban MObility
GUIParameterTracker.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 // A window which displays the time line of one (or more) value(s)
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <vector>
26 #include <fx.h>
27 // fx3d includes windows.h so we need to guard against macro pollution
28 #ifdef WIN32
29 #define NOMINMAX
30 #endif
31 #include <fx3d.h>
32 #ifdef WIN32
33 #undef NOMINMAX
34 #endif
37 #include "TrackerValueDesc.h"
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
46 class GUIParameterTracker : public FXMainWindow {
47  FXDECLARE(GUIParameterTracker)
48 public:
50  enum {
52  MID_AGGREGATIONINTERVAL = FXMainWindow::ID_LAST,
56  ID_LAST
57  };
58 
59 
64  GUIParameterTracker(GUIMainWindow& app, const std::string& name);
65 
66 
69 
70 
72  void create();
73 
74 
81  TrackerValueDesc* newTracked);
82 
83 
86 
88  long onConfigure(FXObject*, FXSelector, void*);
89 
91  long onPaint(FXObject*, FXSelector, void*);
92 
94  long onSimStep(FXObject*, FXSelector, void*);
95 
97  long onCmdChangeAggregation(FXObject*, FXSelector, void*);
98 
100  long onCmdSave(FXObject*, FXSelector, void*);
102 
103 
104 public:
111  class GUIParameterTrackerPanel : public FXGLCanvas {
112  FXDECLARE(GUIParameterTrackerPanel)
113  public:
119  GUIParameterTrackerPanel(FXComposite* c, GUIMainWindow& app,
120  GUIParameterTracker& parent);
121 
124 
126  friend class GUIParameterTracker;
127 
128 
131 
133  long onConfigure(FXObject*, FXSelector, void*);
134 
136  long onPaint(FXObject*, FXSelector, void*);
137 
139  long onSimStep(FXObject* sender, FXSelector, void*);
141 
142 
143  private:
146  void drawValues();
147 
152  void drawValue(TrackerValueDesc& desc, double namePos);
153 
154 
155  private:
158 
161 
164 
165  protected:
166  FOX_CONSTRUCTOR(GUIParameterTrackerPanel)
167  };
168 
169 public:
172 
173 private:
175  void buildToolBar();
176 
177 
178 protected:
181 
183  std::vector<TrackerValueDesc*> myTracked;
184 
187 
189  std::vector<GLObjectValuePassConnector<double>*> myValuePassers;
190 
192  FXToolBarShell* myToolBarDrag;
193 
196 
199 
201  FXToolBar* myToolBar;
202 
203 protected:
204  FOX_CONSTRUCTOR(GUIParameterTracker)
205 
206 };
GUIParameterTrackerPanel(FXComposite *c, GUIMainWindow &app, GUIParameterTracker &parent)
Constructor.
long onSimStep(FXObject *sender, FXSelector, void *)
Called on a simulation step.
void drawValue(TrackerValueDesc &desc, double namePos)
Draws a single value.
GUIParameterTracker * myParent
The parent window.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
GUIMainWindow * myApplication
The main application.
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
A window which displays the time line of one (or more) value(s)
long onCmdChangeAggregation(FXObject *, FXSelector, void *)
Called when the aggregation interval (combo) has been changed.
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
GUIParameterTrackerPanel * myPanel
The panel to display the values in.
void create()
Creates the window.
FXdouble myAggregationDelay
The simulation delay.
GUIParameterTracker(GUIMainWindow &app, const std::string &name)
Constructor (the tracker is empty)
FXComboBox * myAggregationInterval
A combo box to select an aggregation interval.
GUIMainWindow * myApplication
The main application.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
std::vector< TrackerValueDesc * > myTracked
The list of tracked values.
long onSimStep(FXObject *, FXSelector, void *)
Called on a simulation step.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the data shall be saved.
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
FXToolBar * myToolBar
The tracker tool bar.
@ MID_SAVE
Save the current values.
@ MID_AGGREGATIONINTERVAL
Change aggregation interval.
std::vector< GLObjectValuePassConnector< double > * > myValuePassers
The value sources.
void buildToolBar()
Builds the tool bar.
~GUIParameterTracker()
Destructor.
FXToolBarShell * myToolBarDrag
for some menu detaching fun
Representation of a timeline of floats with their names and moments.