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 
183  void drawValues(GUITLLogicPhasesTrackerPanel& caller);
184 
185 
186 private:
189 
192 
195 
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 /****************************************************************************/
GUITLLogicPhasesTrackerWindow::myApplication
GUIMainWindow * myApplication
The main application.
Definition: GUITLLogicPhasesTrackerWindow.h:188
GUITLLogicPhasesTrackerWindow::DurationsVector
std::vector< SUMOTime > DurationsVector
Definition of a storage for durations.
Definition: GUITLLogicPhasesTrackerWindow.h:131
GUITLLogicPhasesTrackerWindow::myBeginOffset
FXRealSpinner * myBeginOffset
The offset changer (tracking mode)
Definition: GUITLLogicPhasesTrackerWindow.h:238
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel
The canvas for the visualisation of phases.
Definition: GUITLLogicPhasesTrackerWindow.h:140
SUMOTime.h
MSTLLogicControl.h
GUITLLogicPhasesTrackerWindow::~GUITLLogicPhasesTrackerWindow
~GUITLLogicPhasesTrackerWindow()
Destructor.
Definition: GUITLLogicPhasesTrackerWindow.cpp:210
GUITLLogicPhasesTrackerWindow::myAmInTrackingMode
bool myAmInTrackingMode
Information whether the tracking mode is on.
Definition: GUITLLogicPhasesTrackerWindow.h:229
GUITLLogicPhasesTrackerWindow::myLinkNames
std::vector< std::string > myLinkNames
The names of links.
Definition: GUITLLogicPhasesTrackerWindow.h:208
GUITLLogicPhasesTrackerWindow
This window displays a phase diagram for a chosen tl-logic.
Definition: GUITLLogicPhasesTrackerWindow.h:64
MSTrafficLightLogic::Phases
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Definition: MSTrafficLightLogic.h:62
GUITLLogicPhasesTrackerWindow::onSimStep
long onSimStep(FXObject *sender, FXSelector sel, void *data)
called on a simulation step
Definition: GUITLLogicPhasesTrackerWindow.cpp:481
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
GUITLLogicPhasesTrackerWindow::create
void create()
Creates the window (FOX-Toolkit)
Definition: GUITLLogicPhasesTrackerWindow.cpp:222
GUITLLogicPhasesTrackerWindow::onConfigure
long onConfigure(FXObject *sender, FXSelector sel, void *data)
called on size change
Definition: GUITLLogicPhasesTrackerWindow.cpp:465
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::myParent
GUITLLogicPhasesTrackerWindow * myParent
}
Definition: GUITLLogicPhasesTrackerWindow.h:171
GUITLLogicPhasesTrackerWindow::myFirstPhase2Show
int myFirstPhase2Show
The index of the first phase that fits into the window.
Definition: GUITLLogicPhasesTrackerWindow.h:211
GUITLLogicPhasesTrackerWindow::myPhases
PhasesVector myPhases
The list of phases.
Definition: GUITLLogicPhasesTrackerWindow.h:194
GUITLLogicPhasesTrackerWindow::drawValues
void drawValues(GUITLLogicPhasesTrackerPanel &caller)
Draws all values.
Definition: GUITLLogicPhasesTrackerWindow.cpp:231
MSSimpleTrafficLightLogic.h
GUITLLogicPhasesTrackerWindow::myDurations
DurationsVector myDurations
The list of phase durations.
Definition: GUITLLogicPhasesTrackerWindow.h:197
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::onConfigure
long onConfigure(FXObject *, FXSelector, void *)
called on size change
Definition: GUITLLogicPhasesTrackerWindow.cpp:75
GLObjectValuePassConnector
Class passing values from a GUIGlObject to another object.
Definition: GLObjectValuePassConnector.h:60
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::onPaint
long onPaint(FXObject *, FXSelector, void *)
called if the widget shall be repainted
Definition: GUITLLogicPhasesTrackerWindow.cpp:98
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::GUITLLogicPhasesTrackerPanel
GUITLLogicPhasesTrackerPanel()
protected constructor for FOX
Definition: GUITLLogicPhasesTrackerWindow.h:175
GUITLLogicPhasesTrackerWindow::myLock
FXMutex myLock
A lock to avoid addition of new values while drawing.
Definition: GUITLLogicPhasesTrackerWindow.h:203
GUITLLogicPhasesTrackerWindow::myFirstTime2Show
SUMOTime myFirstTime2Show
The time the diagram begins at.
Definition: GUITLLogicPhasesTrackerWindow.h:217
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:56
GUITLLogicPhasesTrackerWindow::PhasesVector
std::vector< MSPhaseDefinition > PhasesVector
}
Definition: GUITLLogicPhasesTrackerWindow.h:128
GUITLLogicPhasesTrackerWindow::myToolBarDrag
FXToolBarShell * myToolBarDrag
The tool bar drag (tracking mode)
Definition: GUITLLogicPhasesTrackerWindow.h:232
GUITLLogicPhasesTrackerWindow::addValue
void addValue(std::pair< SUMOTime, MSPhaseDefinition > def)
Adds a further phase definition.
Definition: GUITLLogicPhasesTrackerWindow.cpp:443
GUITLLogicPhasesTrackerWindow::myConnector
GLObjectValuePassConnector< std::pair< SUMOTime, MSPhaseDefinition > > * myConnector
The connector for retrieval of further phases.
Definition: GUITLLogicPhasesTrackerWindow.h:226
ValueRetriever
Definition: ValueRetriever.h:33
ValueRetriever.h
GLObjectValuePassConnector.h
FunctionBinding.h
GUIMainWindow
Definition: GUIMainWindow.h:47
GUITLLogicPhasesTrackerWindow::myLastTime
SUMOTime myLastTime
The last time a phase was added at.
Definition: GUITLLogicPhasesTrackerWindow.h:223
GUITLLogicPhasesTrackerWindow::myToolBar
FXToolBar * myToolBar
The tool bar (tracking mode)
Definition: GUITLLogicPhasesTrackerWindow.h:235
GUITrafficLightLogicWrapper
Definition: GUITrafficLightLogicWrapper.h:48
GUITLLogicPhasesTrackerWindow::myTLLogic
MSTrafficLightLogic * myTLLogic
The logic to display.
Definition: GUITLLogicPhasesTrackerWindow.h:191
GUITLLogicPhasesTrackerWindow::onPaint
long onPaint(FXObject *sender, FXSelector sel, void *data)
called if the widget shall be repainted
Definition: GUITLLogicPhasesTrackerWindow.cpp:473
GUITLLogicPhasesTrackerWindow::myFirstPhaseOffset
SUMOTime myFirstPhaseOffset
The offset to draw the first phase (left offset)
Definition: GUITLLogicPhasesTrackerWindow.h:214
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::~GUITLLogicPhasesTrackerPanel
~GUITLLogicPhasesTrackerPanel()
Destructor.
Definition: GUITLLogicPhasesTrackerWindow.cpp:71
config.h
ValueSource
Definition: ValueSource.h:33
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
Definition: GUITLLogicPhasesTrackerWindow.h:243
GUITLLogicPhasesTrackerWindow::setBeginTime
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
Definition: GUITLLogicPhasesTrackerWindow.cpp:489
GUITLLogicPhasesTrackerWindow::myPanel
GUITLLogicPhasesTrackerPanel * myPanel
The panel to draw on.
Definition: GUITLLogicPhasesTrackerWindow.h:200
GUITLLogicPhasesTrackerWindow::myBeginTime
SUMOTime myBeginTime
The first time a phase was added at.
Definition: GUITLLogicPhasesTrackerWindow.h:220