Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2026 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#include <fx3d.h>
31#include "TrackerValueDesc.h"
32
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
40class GUIParameterTracker : public FXMainWindow {
41 FXDECLARE(GUIParameterTracker)
42public:
44 enum {
46 MID_AGGREGATIONINTERVAL = FXMainWindow::ID_LAST,
53 };
54
55
60 GUIParameterTracker(GUIMainWindow& app, const std::string& name);
61
62
65
66
68 void create();
69
70
77 TrackerValueDesc* newTracked);
78
79
82
84 long onConfigure(FXObject*, FXSelector, void*);
85
87 long onPaint(FXObject*, FXSelector, void*);
88
90 long onSimStep(FXObject*, FXSelector, void*);
91
93 long onMultiPlot(FXObject*, FXSelector, void*);
94
96 long onCmdChangeAggregation(FXObject*, FXSelector, void*);
97
99 long onCmdSave(FXObject*, FXSelector, void*);
101
102
104 static bool addTrackedMultiplot(GUIGlObject& o, ValueSource<double>* src, TrackerValueDesc* newTracked);
105
106public:
113 class GUIParameterTrackerPanel : public FXGLCanvas {
114 FXDECLARE(GUIParameterTrackerPanel)
115 public:
121 GUIParameterTrackerPanel(FXComposite* c, GUIMainWindow& app,
122 GUIParameterTracker& parent);
123
126
129
130
133
135 long onConfigure(FXObject*, FXSelector, void*);
136
138 long onPaint(FXObject*, FXSelector, void*);
139
141 long onMouseMove(FXObject*, FXSelector, void*);
142
144
145
146 private:
149 void drawValues();
150
155 void drawValue(TrackerValueDesc& desc, const RGBColor& col, int index);
156
157 private:
160
163
165 double myMouseX;
166
167 protected:
168 FOX_CONSTRUCTOR(GUIParameterTrackerPanel)
169 };
170
171public:
174
175private:
177 void buildToolBar();
178
179protected:
182
184 std::vector<TrackerValueDesc*> myTracked;
185
188
190 std::vector<GLObjectValuePassConnector<double>*> myValuePassers;
191
193 FXToolBarShell* myToolBarDrag;
194
197
200
202 FXToolBar* myToolBar;
203
205 FXCheckButton* myMultiPlot;
206
208 static std::set<GUIParameterTracker*> myMultiPlots;
209 static std::vector<RGBColor> myColors;
210
211protected:
212 FOX_CONSTRUCTOR(GUIParameterTracker)
213
214};
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.
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.
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.
FXToolBarShell * myToolBarDrag
for some menu detaching fun
@ MID_SAVE
Save the current values.
@ MID_MULTIPLOT
toggle multiplot
@ MID_AGGREGATIONINTERVAL
Change aggregation interval.
Representation of a timeline of floats with their names and moments.