Eclipse SUMO - Simulation of Urban MObility
GUITLLogicPhasesTrackerWindow.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 displaying the phase diagram of a tl-logic
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <vector>
26 #include <string>
27 #include <bitset>
28 #include <utility>
29 #include <fx.h>
30 // fx3d includes windows.h so we need to guard against macro pollution
31 #ifdef WIN32
32 #define NOMINMAX
33 #endif
34 #include <fx3d.h>
35 #ifdef WIN32
36 #undef NOMINMAX
37 #endif
43 #include <utils/common/SUMOTime.h>
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
49 class GUIMainWindow;
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
62  : public FXMainWindow,
63  public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
65 public:
74  ValueSource<std::pair<SUMOTime, MSPhaseDefinition> >* src);
75 
76 
84  GUIMainWindow& app,
86  const MSSimpleTrafficLightLogic::Phases& phases);
87 
88 
91 
92 
94  void create();
95 
96 
100  void addValue(std::pair<SUMOTime, MSPhaseDefinition> def);
101 
102 
106  void setBeginTime(SUMOTime time);
107 
108 
111 
113  long onConfigure(FXObject* sender, FXSelector sel, void* ptr);
114 
116  long onPaint(FXObject* sender, FXSelector sel, void* ptr);
117 
119  long onSimStep(FXObject* sender, FXSelector sel, void* ptr);
121 
122 
123 public:
125  typedef std::vector<MSPhaseDefinition> PhasesVector;
126 
128  typedef std::vector<SUMOTime> DurationsVector;
129 
130 
137  class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
139  public:
145  GUITLLogicPhasesTrackerPanel(FXComposite* c,
147 
150 
153 
154 
157 
159  long onConfigure(FXObject*, FXSelector, void*);
160 
162  long onPaint(FXObject*, FXSelector, void*);
164 
165 
166  private:
169 
170  protected:
173 
174  };
175 
176 
180  void drawValues(GUITLLogicPhasesTrackerPanel& caller);
181 
182 
183 private:
186 
189 
192 
195 
198 
200  FXMutex myLock;
201 
205  std::vector<std::string> myLinkNames;
206 
209 
212 
215 
218 
221 
224 
227 
229  FXToolBarShell* myToolBarDrag;
230 
232  FXToolBar* myToolBar;
233 
235  FXRealSpinner* myBeginOffset;
236 
237 
238 protected:
241 
242 
243 };
long long int SUMOTime
Definition: SUMOTime.h:31
Class passing values from a GUIGlObject to another object.
long onConfigure(FXObject *, FXSelector, void *)
called on size change
long onPaint(FXObject *, FXSelector, void *)
called if the widget shall be repainted
This window displays a phase diagram for a chosen tl-logic.
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
FXMutex myLock
A lock to avoid addition of new values while drawing.
SUMOTime myBeginTime
The first time a phase was added at.
std::vector< std::string > myLinkNames
The names of links.
FXRealSpinner * myBeginOffset
The offset changer (tracking mode)
long onSimStep(FXObject *sender, FXSelector sel, void *ptr)
called on a simulation step
GUITLLogicPhasesTrackerPanel * myPanel
The panel to draw on.
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
FXToolBarShell * myToolBarDrag
The tool bar drag (tracking mode)
FXToolBar * myToolBar
The tool bar (tracking mode)
PhasesVector myPhases
The list of phases.
SUMOTime myFirstPhaseOffset
The offset to draw the first phase (left offset)
void addValue(std::pair< SUMOTime, MSPhaseDefinition > def)
Adds a further phase definition.
GLObjectValuePassConnector< std::pair< SUMOTime, MSPhaseDefinition > > * myConnector
The connector for retrieval of further phases.
int myFirstPhase2Show
The index of the first phase that fits into the window.
long onPaint(FXObject *sender, FXSelector sel, void *ptr)
called if the widget shall be repainted
long onConfigure(FXObject *sender, FXSelector sel, void *ptr)
called on size change
SUMOTime myLastTime
The last time a phase was added at.
void create()
Creates the window (FOX-Toolkit)
MSTrafficLightLogic * myTLLogic
The logic to display.
std::vector< SUMOTime > DurationsVector
Definition of a storage for durations.
SUMOTime myFirstTime2Show
The time the diagram begins at.
GUIMainWindow * myApplication
The main application.
std::vector< MSPhaseDefinition > PhasesVector
}
bool myAmInTrackingMode
Information whether the tracking mode is on.
void drawValues(GUITLLogicPhasesTrackerPanel &caller)
Draws all values.
DurationsVector myDurations
The list of phase durations.
The parent class for traffic light logics.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.