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-2018 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 class MFXMutex;
56 
57 
58 // ===========================================================================
59 // class definitions
60 // ===========================================================================
66  : public FXMainWindow,
67  public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
69 public:
78  ValueSource<std::pair<SUMOTime, MSPhaseDefinition> >* src);
79 
80 
88  GUIMainWindow& app,
90  const MSSimpleTrafficLightLogic::Phases& phases);
91 
92 
95 
96 
98  void create();
99 
100 
104  void addValue(std::pair<SUMOTime, MSPhaseDefinition> def);
105 
106 
110  void setBeginTime(SUMOTime time);
111 
112 
115 
117  long onConfigure(FXObject* sender, FXSelector sel, void* data);
118 
120  long onPaint(FXObject* sender, FXSelector sel, void* data);
121 
123  long onSimStep(FXObject* sender, FXSelector sel, void* data);
125 
126 
127 public:
129  typedef std::vector<MSPhaseDefinition> PhasesVector;
130 
132  typedef std::vector<SUMOTime> DurationsVector;
133 
134 
141  class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
143  public:
149  GUITLLogicPhasesTrackerPanel(FXComposite* c,
151 
154 
157 
158 
161 
163  long onConfigure(FXObject*, FXSelector, void*);
164 
166  long onPaint(FXObject*, FXSelector, void*);
168 
169 
170  private:
173 
174  protected:
177 
178  };
179 
180 
185 
186 
187 private:
190 
193 
195  PhasesVector myPhases;
196 
198  DurationsVector myDurations;
199 
202 
205 
209  std::vector<std::string> myLinkNames;
210 
213 
216 
219 
222 
225 
228 
231 
233  FXToolBarShell* myToolBarDrag;
234 
236  FXToolBar* myToolBar;
237 
239  FXRealSpinner* myBeginOffset;
240 
241 
242 protected:
245 
246 
247 };
248 
249 
250 #endif
251 
252 /****************************************************************************/
253 
std::vector< SUMOTime > DurationsVector
Definition of a storage for durations.
long long int SUMOTime
Definition: SUMOTime.h:36
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
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
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.