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-2017 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 // fx3d includes windows.h so we need to guard against macro pollution
41 #ifdef WIN32
42 #define NOMINMAX
43 #endif
44 #include <fx3d.h>
45 #ifdef WIN32
46 #undef NOMINMAX
47 #endif
53 #include <utils/common/SUMOTime.h>
55 
56 
57 // ===========================================================================
58 // class declarations
59 // ===========================================================================
60 class GUIMainWindow;
63 class MFXMutex;
64 
65 
66 // ===========================================================================
67 // class definitions
68 // ===========================================================================
74  : public FXMainWindow,
75  public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
77 public:
86  ValueSource<std::pair<SUMOTime, MSPhaseDefinition> >* src);
87 
88 
96  GUIMainWindow& app,
98  const MSSimpleTrafficLightLogic::Phases& phases);
99 
100 
103 
104 
106  void create();
107 
108 
112  void addValue(std::pair<SUMOTime, MSPhaseDefinition> def);
113 
114 
118  void setBeginTime(SUMOTime time);
119 
120 
123 
125  long onConfigure(FXObject* sender, FXSelector sel, void* data);
126 
128  long onPaint(FXObject* sender, FXSelector sel, void* data);
129 
131  long onSimStep(FXObject* sender, FXSelector sel, void* data);
133 
134 
135 public:
137  typedef std::vector<MSPhaseDefinition> PhasesVector;
138 
140  typedef std::vector<SUMOTime> DurationsVector;
141 
142 
149  class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
151  public:
157  GUITLLogicPhasesTrackerPanel(FXComposite* c,
159 
162 
165 
166 
169 
171  long onConfigure(FXObject*, FXSelector, void*);
172 
174  long onPaint(FXObject*, FXSelector, void*);
176 
177 
178  private:
181 
182  protected:
185 
186  };
187 
188 
193 
194 
195 private:
198 
201 
203  PhasesVector myPhases;
204 
206  DurationsVector myDurations;
207 
210 
213 
217  std::vector<std::string> myLinkNames;
218 
221 
224 
227 
230 
233 
236 
239 
241  FXToolBarShell* myToolBarDrag;
242 
244  FXToolBar* myToolBar;
245 
247  FXRealSpinDial* myBeginOffset;
248 
249 
250 protected:
253 
254 
255 };
256 
257 
258 #endif
259 
260 /****************************************************************************/
261 
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:52
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.