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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // A window displaying the phase diagram of a tl-logic
20 /****************************************************************************/
21 #ifndef GUITLLogicPhasesTrackerWindow_h
22 #define GUITLLogicPhasesTrackerWindow_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <string>
36 #include <bitset>
37 #include <utility>
38 #include <fx.h>
39 // fx3d includes windows.h so we need to guard against macro pollution
40 #ifdef WIN32
41 #define NOMINMAX
42 #endif
43 #include <fx3d.h>
44 #ifdef WIN32
45 #undef NOMINMAX
46 #endif
52 #include <utils/common/SUMOTime.h>
54 
55 
56 // ===========================================================================
57 // class declarations
58 // ===========================================================================
59 class GUIMainWindow;
62 class MFXMutex;
63 
64 
65 // ===========================================================================
66 // class definitions
67 // ===========================================================================
73  : public FXMainWindow,
74  public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
76 public:
85  ValueSource<std::pair<SUMOTime, MSPhaseDefinition> >* src);
86 
87 
95  GUIMainWindow& app,
97  const MSSimpleTrafficLightLogic::Phases& phases);
98 
99 
102 
103 
105  void create();
106 
107 
111  void addValue(std::pair<SUMOTime, MSPhaseDefinition> def);
112 
113 
117  void setBeginTime(SUMOTime time);
118 
119 
122 
124  long onConfigure(FXObject* sender, FXSelector sel, void* data);
125 
127  long onPaint(FXObject* sender, FXSelector sel, void* data);
128 
130  long onSimStep(FXObject* sender, FXSelector sel, void* data);
132 
133 
134 public:
136  typedef std::vector<MSPhaseDefinition> PhasesVector;
137 
139  typedef std::vector<SUMOTime> DurationsVector;
140 
141 
148  class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
150  public:
156  GUITLLogicPhasesTrackerPanel(FXComposite* c,
158 
161 
164 
165 
168 
170  long onConfigure(FXObject*, FXSelector, void*);
171 
173  long onPaint(FXObject*, FXSelector, void*);
175 
176 
177  private:
180 
181  protected:
184 
185  };
186 
187 
192 
193 
194 private:
197 
200 
202  PhasesVector myPhases;
203 
205  DurationsVector myDurations;
206 
209 
212 
216  std::vector<std::string> myLinkNames;
217 
220 
223 
226 
229 
232 
235 
238 
240  FXToolBarShell* myToolBarDrag;
241 
243  FXToolBar* myToolBar;
244 
246  FXRealSpinDial* myBeginOffset;
247 
248 
249 protected:
252 
253 
254 };
255 
256 
257 #endif
258 
259 /****************************************************************************/
260 
std::vector< SUMOTime > DurationsVector
Definition of a storage for durations.
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)
long long int SUMOTime
Definition: TraCIDefs.h:51
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.