SUMO - Simulation of Urban MObility
GUITLLogicPhasesTrackerWindow.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A window displaying the phase diagram of a tl-logic
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GUITLLogicPhasesTrackerWindow_h
23 #define GUITLLogicPhasesTrackerWindow_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <string>
37 #include <bitset>
38 #include <utility>
39 #include <fx.h>
40 #include <fx3d.h>
46 #include <utils/common/SUMOTime.h>
48 
49 
50 // ===========================================================================
51 // class declarations
52 // ===========================================================================
53 class GUIMainWindow;
56 class MFXMutex;
57 
58 
59 // ===========================================================================
60 // class definitions
61 // ===========================================================================
67  : public FXMainWindow,
68  public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
70 public:
79  ValueSource<std::pair<SUMOTime, MSPhaseDefinition> >* src);
80 
81 
89  GUIMainWindow& app,
91  const MSSimpleTrafficLightLogic::Phases& phases);
92 
93 
96 
97 
99  void create();
100 
101 
105  void addValue(std::pair<SUMOTime, MSPhaseDefinition> def);
106 
107 
111  void setBeginTime(SUMOTime time);
112 
113 
116 
118  long onConfigure(FXObject* sender, FXSelector sel, void* data);
119 
121  long onPaint(FXObject* sender, FXSelector sel, void* data);
122 
124  long onSimStep(FXObject* sender, FXSelector sel, void* data);
126 
127 
128 public:
130  typedef std::vector<MSPhaseDefinition> PhasesVector;
131 
133  typedef std::vector<SUMOTime> DurationsVector;
134 
135 
142  class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
144  public:
150  GUITLLogicPhasesTrackerPanel(FXComposite* c,
152 
155 
158 
159 
162 
164  long onConfigure(FXObject*, FXSelector, void*);
165 
167  long onPaint(FXObject*, FXSelector, void*);
169 
170 
171  private:
174 
175  protected:
178 
179  };
180 
181 
186 
187 
188 private:
191 
194 
196  PhasesVector myPhases;
197 
199  DurationsVector myDurations;
200 
203 
206 
210  std::vector<std::string> myLinkNames;
211 
214 
217 
220 
223 
226 
229 
232 
234  FXToolBarShell* myToolBarDrag;
235 
237  FXToolBar* myToolBar;
238 
240  FXRealSpinDial* myBeginOffset;
241 
242 
243 protected:
246 
247 
248 };
249 
250 
251 #endif
252 
253 /****************************************************************************/
254 
std::vector< SUMOTime > DurationsVector
Definition of a storage for durations.
long long int SUMOTime
Definition: SUMOTime.h:43
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.
SUMOTime myFirstTime2Show
The time the diagram begins at.
long onConfigure(FXObject *, FXSelector, void *)
called on size change
FXRealSpinDial * myBeginOffset
The offset changer (tracking mode)
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.
MFXMutex myLock
A lock to avoid addition of new values while drawing.
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
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.