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 /****************************************************************************/
16 // A window displaying the phase diagram of a tl-logic
17 /****************************************************************************/
18 #ifndef GUITLLogicPhasesTrackerWindow_h
19 #define GUITLLogicPhasesTrackerWindow_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
28 #include <string>
29 #include <bitset>
30 #include <utility>
31 #include <fx.h>
32 // fx3d includes windows.h so we need to guard against macro pollution
33 #ifdef WIN32
34 #define NOMINMAX
35 #endif
36 #include <fx3d.h>
37 #ifdef WIN32
38 #undef NOMINMAX
39 #endif
45 #include <utils/common/SUMOTime.h>
46 
47 
48 // ===========================================================================
49 // class declarations
50 // ===========================================================================
51 class GUIMainWindow;
54 
55 
56 // ===========================================================================
57 // class definitions
58 // ===========================================================================
64  : public FXMainWindow,
65  public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
67 public:
76  ValueSource<std::pair<SUMOTime, MSPhaseDefinition> >* src);
77 
78 
86  GUIMainWindow& app,
88  const MSSimpleTrafficLightLogic::Phases& phases);
89 
90 
93 
94 
96  void create();
97 
98 
102  void addValue(std::pair<SUMOTime, MSPhaseDefinition> def);
103 
104 
108  void setBeginTime(SUMOTime time);
109 
110 
113 
115  long onConfigure(FXObject* sender, FXSelector sel, void* data);
116 
118  long onPaint(FXObject* sender, FXSelector sel, void* data);
119 
121  long onSimStep(FXObject* sender, FXSelector sel, void* data);
123 
124 
125 public:
127  typedef std::vector<MSPhaseDefinition> PhasesVector;
128 
130  typedef std::vector<SUMOTime> DurationsVector;
131 
132 
139  class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
141  public:
147  GUITLLogicPhasesTrackerPanel(FXComposite* c,
149 
152 
155 
156 
159 
161  long onConfigure(FXObject*, FXSelector, void*);
162 
164  long onPaint(FXObject*, FXSelector, void*);
166 
167 
168  private:
171 
172  protected:
175 
176  };
177 
178 
182  void drawValues(GUITLLogicPhasesTrackerPanel& caller);
183 
184 
185 private:
188 
191 
194 
197 
200 
202  FXMutex myLock;
203 
207  std::vector<std::string> myLinkNames;
208 
211 
214 
217 
220 
223 
226 
229 
231  FXToolBarShell* myToolBarDrag;
232 
234  FXToolBar* myToolBar;
235 
237  FXRealSpinner* myBeginOffset;
238 
239 
240 protected:
243 
244 
245 };
246 
247 
248 #endif
249 
250 /****************************************************************************/
GUITLLogicPhasesTrackerWindow::myApplication
GUIMainWindow * myApplication
The main application.
Definition: GUITLLogicPhasesTrackerWindow.h:187
GUITLLogicPhasesTrackerWindow::DurationsVector
std::vector< SUMOTime > DurationsVector
Definition of a storage for durations.
Definition: GUITLLogicPhasesTrackerWindow.h:130
GUITLLogicPhasesTrackerWindow::myBeginOffset
FXRealSpinner * myBeginOffset
The offset changer (tracking mode)
Definition: GUITLLogicPhasesTrackerWindow.h:237
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel
The canvas for the visualisation of phases.
Definition: GUITLLogicPhasesTrackerWindow.h:139
SUMOTime.h
MSTLLogicControl.h
GUITLLogicPhasesTrackerWindow::~GUITLLogicPhasesTrackerWindow
~GUITLLogicPhasesTrackerWindow()
Destructor.
Definition: GUITLLogicPhasesTrackerWindow.cpp:211
GUITLLogicPhasesTrackerWindow::myAmInTrackingMode
bool myAmInTrackingMode
Information whether the tracking mode is on.
Definition: GUITLLogicPhasesTrackerWindow.h:228
GUITLLogicPhasesTrackerWindow::myLinkNames
std::vector< std::string > myLinkNames
The names of links.
Definition: GUITLLogicPhasesTrackerWindow.h:207
GUITLLogicPhasesTrackerWindow
This window displays a phase diagram for a chosen tl-logic.
Definition: GUITLLogicPhasesTrackerWindow.h:65
MSTrafficLightLogic::Phases
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
Definition: MSTrafficLightLogic.h:61
GUITLLogicPhasesTrackerWindow::onSimStep
long onSimStep(FXObject *sender, FXSelector sel, void *data)
called on a simulation step
Definition: GUITLLogicPhasesTrackerWindow.cpp:484
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GUITLLogicPhasesTrackerWindow::create
void create()
Creates the window (FOX-Toolkit)
Definition: GUITLLogicPhasesTrackerWindow.cpp:223
GUITLLogicPhasesTrackerWindow::onConfigure
long onConfigure(FXObject *sender, FXSelector sel, void *data)
called on size change
Definition: GUITLLogicPhasesTrackerWindow.cpp:468
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::myParent
GUITLLogicPhasesTrackerWindow * myParent
}
Definition: GUITLLogicPhasesTrackerWindow.h:170
GUITLLogicPhasesTrackerWindow::myFirstPhase2Show
int myFirstPhase2Show
The index of the first phase that fits into the window.
Definition: GUITLLogicPhasesTrackerWindow.h:210
GUITLLogicPhasesTrackerWindow::myPhases
PhasesVector myPhases
The list of phases.
Definition: GUITLLogicPhasesTrackerWindow.h:193
GUITLLogicPhasesTrackerWindow::drawValues
void drawValues(GUITLLogicPhasesTrackerPanel &caller)
Draws all values.
Definition: GUITLLogicPhasesTrackerWindow.cpp:232
MSSimpleTrafficLightLogic.h
GUITLLogicPhasesTrackerWindow::myDurations
DurationsVector myDurations
The list of phase durations.
Definition: GUITLLogicPhasesTrackerWindow.h:196
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::onConfigure
long onConfigure(FXObject *, FXSelector, void *)
called on size change
Definition: GUITLLogicPhasesTrackerWindow.cpp:74
GLObjectValuePassConnector
Class passing values from a GUIGlObject to another object.
Definition: GLObjectValuePassConnector.h:59
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::onPaint
long onPaint(FXObject *, FXSelector, void *)
called if the widget shall be repainted
Definition: GUITLLogicPhasesTrackerWindow.cpp:97
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::GUITLLogicPhasesTrackerPanel
GUITLLogicPhasesTrackerPanel()
protected constructor for FOX
Definition: GUITLLogicPhasesTrackerWindow.h:174
GUITLLogicPhasesTrackerWindow::myLock
FXMutex myLock
A lock to avoid addition of new values while drawing.
Definition: GUITLLogicPhasesTrackerWindow.h:202
GUITLLogicPhasesTrackerWindow::myFirstTime2Show
SUMOTime myFirstTime2Show
The time the diagram begins at.
Definition: GUITLLogicPhasesTrackerWindow.h:216
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:55
GUITLLogicPhasesTrackerWindow::PhasesVector
std::vector< MSPhaseDefinition > PhasesVector
}
Definition: GUITLLogicPhasesTrackerWindow.h:127
GUITLLogicPhasesTrackerWindow::myToolBarDrag
FXToolBarShell * myToolBarDrag
The tool bar drag (tracking mode)
Definition: GUITLLogicPhasesTrackerWindow.h:231
GUITLLogicPhasesTrackerWindow::addValue
void addValue(std::pair< SUMOTime, MSPhaseDefinition > def)
Adds a further phase definition.
Definition: GUITLLogicPhasesTrackerWindow.cpp:446
GUITLLogicPhasesTrackerWindow::myConnector
GLObjectValuePassConnector< std::pair< SUMOTime, MSPhaseDefinition > > * myConnector
The connector for retrieval of further phases.
Definition: GUITLLogicPhasesTrackerWindow.h:225
ValueRetriever
Definition: ValueRetriever.h:32
ValueRetriever.h
GLObjectValuePassConnector.h
FunctionBinding.h
GUIMainWindow
Definition: GUIMainWindow.h:46
GUITLLogicPhasesTrackerWindow::myLastTime
SUMOTime myLastTime
The last time a phase was added at.
Definition: GUITLLogicPhasesTrackerWindow.h:222
GUITLLogicPhasesTrackerWindow::myToolBar
FXToolBar * myToolBar
The tool bar (tracking mode)
Definition: GUITLLogicPhasesTrackerWindow.h:234
GUITrafficLightLogicWrapper
Definition: GUITrafficLightLogicWrapper.h:47
GUITLLogicPhasesTrackerWindow::myTLLogic
MSTrafficLightLogic * myTLLogic
The logic to display.
Definition: GUITLLogicPhasesTrackerWindow.h:190
GUITLLogicPhasesTrackerWindow::onPaint
long onPaint(FXObject *sender, FXSelector sel, void *data)
called if the widget shall be repainted
Definition: GUITLLogicPhasesTrackerWindow.cpp:476
GUITLLogicPhasesTrackerWindow::myFirstPhaseOffset
SUMOTime myFirstPhaseOffset
The offset to draw the first phase (left offset)
Definition: GUITLLogicPhasesTrackerWindow.h:213
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel::~GUITLLogicPhasesTrackerPanel
~GUITLLogicPhasesTrackerPanel()
Destructor.
Definition: GUITLLogicPhasesTrackerWindow.cpp:70
config.h
ValueSource
Definition: ValueSource.h:32
GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerWindow
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
Definition: GUITLLogicPhasesTrackerWindow.h:242
GUITLLogicPhasesTrackerWindow::setBeginTime
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
Definition: GUITLLogicPhasesTrackerWindow.cpp:492
GUITLLogicPhasesTrackerWindow::myPanel
GUITLLogicPhasesTrackerPanel * myPanel
The panel to draw on.
Definition: GUITLLogicPhasesTrackerWindow.h:199
GUITLLogicPhasesTrackerWindow::myBeginTime
SUMOTime myBeginTime
The first time a phase was added at.
Definition: GUITLLogicPhasesTrackerWindow.h:219