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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // A window displaying the phase diagram of a tl-logic
18 /****************************************************************************/
19 #ifndef GUITLLogicPhasesTrackerWindow_h
20 #define GUITLLogicPhasesTrackerWindow_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <string>
30 #include <bitset>
31 #include <utility>
32 #include <fx.h>
33 // fx3d includes windows.h so we need to guard against macro pollution
34 #ifdef WIN32
35 #define NOMINMAX
36 #endif
37 #include <fx3d.h>
38 #ifdef WIN32
39 #undef NOMINMAX
40 #endif
46 #include <utils/common/SUMOTime.h>
47 
48 
49 // ===========================================================================
50 // class declarations
51 // ===========================================================================
52 class GUIMainWindow;
55 
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
65  : public FXMainWindow,
66  public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
68 public:
77  ValueSource<std::pair<SUMOTime, MSPhaseDefinition> >* src);
78 
79 
87  GUIMainWindow& app,
89  const MSSimpleTrafficLightLogic::Phases& phases);
90 
91 
94 
95 
97  void create();
98 
99 
103  void addValue(std::pair<SUMOTime, MSPhaseDefinition> def);
104 
105 
109  void setBeginTime(SUMOTime time);
110 
111 
114 
116  long onConfigure(FXObject* sender, FXSelector sel, void* data);
117 
119  long onPaint(FXObject* sender, FXSelector sel, void* data);
120 
122  long onSimStep(FXObject* sender, FXSelector sel, void* data);
124 
125 
126 public:
128  typedef std::vector<MSPhaseDefinition> PhasesVector;
129 
131  typedef std::vector<SUMOTime> DurationsVector;
132 
133 
140  class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
142  public:
148  GUITLLogicPhasesTrackerPanel(FXComposite* c,
150 
153 
156 
157 
160 
162  long onConfigure(FXObject*, FXSelector, void*);
163 
165  long onPaint(FXObject*, FXSelector, void*);
167 
168 
169  private:
172 
173  protected:
176 
177  };
178 
179 
184 
185 
186 private:
189 
192 
194  PhasesVector myPhases;
195 
197  DurationsVector myDurations;
198 
201 
203  FXMutex myLock;
204 
208  std::vector<std::string> myLinkNames;
209 
212 
215 
218 
221 
224 
227 
230 
232  FXToolBarShell* myToolBarDrag;
233 
235  FXToolBar* myToolBar;
236 
238  FXRealSpinner* myBeginOffset;
239 
240 
241 protected:
244 
245 
246 };
247 
248 
249 #endif
250 
251 /****************************************************************************/
std::vector< SUMOTime > DurationsVector
Definition of a storage for durations.
long long int SUMOTime
Definition: SUMOTime.h:35
bool myAmInTrackingMode
Information whether the tracking mode is on.
GUIMainWindow * myApplication
The main application.
long onSimStep(FXObject *sender, FXSelector sel, void *data)
called on a simulation step
void create()
Creates the window (FOX-Toolkit)
std::vector< std::string > myLinkNames
The names of links.
int myFirstPhase2Show
The index of the first phase that fits into the window.
PhasesVector myPhases
The list of phases.
DurationsVector myDurations
The list of phase durations.
long onConfigure(FXObject *sender, FXSelector sel, void *data)
called on size change
void drawValues(GUITLLogicPhasesTrackerPanel &caller)
Draws all values.
FXMutex myLock
A lock to avoid addition of new values while drawing.
SUMOTime myFirstTime2Show
The time the diagram begins at.
long onConfigure(FXObject *, FXSelector, void *)
called on size change
FXToolBarShell * myToolBarDrag
The tool bar drag (tracking mode)
SUMOTime myLastTime
The last time a phase was added at.
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.
SUMOTime myFirstPhaseOffset
The offset to draw the first phase (left offset)
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
std::vector< MSPhaseDefinition > PhasesVector
}
MSTrafficLightLogic * myTLLogic
The logic to display.
long onPaint(FXObject *sender, FXSelector sel, void *data)
called if the widget shall be repainted
GUITLLogicPhasesTrackerPanel * myPanel
The panel to draw on.
This window displays a phase diagram for a chosen tl-logic.
The parent class for traffic light logics.
FXToolBar * myToolBar
The tool bar (tracking mode)
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
FXRealSpinner * myBeginOffset
The offset changer (tracking mode)
long onPaint(FXObject *, FXSelector, void *)
called if the widget shall be repainted
SUMOTime myBeginTime
The first time a phase was added at.
Class passing values from a GUIGlObject to another object.