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.dev/sumo
3 // Copyright (C) 2001-2024 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>
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,
58  ID_LAST
59  };
60 
61 
66  GUIParameterTracker(GUIMainWindow& app, const std::string& name);
67 
68 
71 
72 
74  void create();
75 
76 
83  TrackerValueDesc* newTracked);
84 
85 
88 
90  long onConfigure(FXObject*, FXSelector, void*);
91 
93  long onPaint(FXObject*, FXSelector, void*);
94 
96  long onSimStep(FXObject*, FXSelector, void*);
97 
99  long onMultiPlot(FXObject*, FXSelector, void*);
100 
102  long onCmdChangeAggregation(FXObject*, FXSelector, void*);
103 
105  long onCmdSave(FXObject*, FXSelector, void*);
107 
108 
110  static bool addTrackedMultiplot(GUIGlObject& o, ValueSource<double>* src, TrackerValueDesc* newTracked);
111 
112 public:
119  class GUIParameterTrackerPanel : public FXGLCanvas {
120  FXDECLARE(GUIParameterTrackerPanel)
121  public:
127  GUIParameterTrackerPanel(FXComposite* c, GUIMainWindow& app,
128  GUIParameterTracker& parent);
129 
132 
134  friend class GUIParameterTracker;
135 
136 
139 
141  long onConfigure(FXObject*, FXSelector, void*);
142 
144  long onPaint(FXObject*, FXSelector, void*);
145 
147  long onMouseMove(FXObject*, FXSelector, void*);
148 
150 
151 
152  private:
155  void drawValues();
156 
161  void drawValue(TrackerValueDesc& desc, const RGBColor& col, int index);
162 
163  private:
166 
169 
171  double myMouseX;
172 
173  protected:
174  FOX_CONSTRUCTOR(GUIParameterTrackerPanel)
175  };
176 
177 public:
180 
181 private:
183  void buildToolBar();
184 
185 protected:
188 
190  std::vector<TrackerValueDesc*> myTracked;
191 
194 
196  std::vector<GLObjectValuePassConnector<double>*> myValuePassers;
197 
199  FXToolBarShell* myToolBarDrag;
200 
203 
206 
208  FXToolBar* myToolBar;
209 
211  FXCheckButton* myMultiPlot;
212 
214  static std::set<GUIParameterTracker*> myMultiPlots;
215  static std::vector<RGBColor> myColors;
216 
217 protected:
218  FOX_CONSTRUCTOR(GUIParameterTracker)
219 
220 };
GUIParameterTrackerPanel(FXComposite *c, GUIMainWindow &app, GUIParameterTracker &parent)
Constructor.
long onMouseMove(FXObject *, FXSelector, void *)
called on mouse movement (for updating moused value)
void drawValue(TrackerValueDesc &desc, const RGBColor &col, int index)
Draws a single value.
GUIParameterTracker * myParent
The parent window.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
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)
static std::vector< RGBColor > myColors
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)
GUIMainWindow * myApplication
The main application.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
FXCheckButton * myMultiPlot
Whether phase names shall be printed instead of indices.
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.
static std::set< GUIParameterTracker * > myMultiPlots
all trackers that are opened for plotting multiple values
std::vector< GLObjectValuePassConnector< double > * > myValuePassers
The value sources.
@ MID_SAVE
Save the current values.
@ MID_MULTIPLOT
toggle multiplot
@ MID_AGGREGATIONINTERVAL
Change aggregation interval.
MFXComboBoxIcon * myAggregationInterval
A combo box to select an aggregation interval.
static bool addTrackedMultiplot(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
all value source to multiplot trackers
long onMultiPlot(FXObject *, FXSelector, void *)
Called on a simulation step.
void buildToolBar()
Builds the tool bar.
~GUIParameterTracker()
Destructor.
FXToolBarShell * myToolBarDrag
for some menu detaching fun
ComboBox with icon.
Representation of a timeline of floats with their names and moments.