74 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*) 0, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y),
83 FXObject*, FXSelector,
void*) {
85 int widthInPixels = getWidth();
86 int heightInPixels = getHeight();
87 if (widthInPixels != 0 && heightInPixels != 0) {
88 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
89 glClearColor(0, 0, 0, 1);
90 glDisable(GL_DEPTH_TEST);
91 glDisable(GL_LIGHTING);
92 glDisable(GL_LINE_SMOOTH);
94 glEnable(GL_ALPHA_TEST);
95 glDisable(GL_COLOR_MATERIAL);
97 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
106 FXObject*, FXSelector,
void*) {
111 int widthInPixels = getWidth();
112 int heightInPixels = getHeight();
113 if (widthInPixels != 0 && heightInPixels != 0) {
114 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
115 glClearColor(0, 0, 0, 1);
116 glDisable(GL_DEPTH_TEST);
117 glDisable(GL_LIGHTING);
118 glDisable(GL_LINE_SMOOTH);
120 glEnable(GL_ALPHA_TEST);
121 glDisable(GL_COLOR_MATERIAL);
123 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
125 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
156 : FXMainWindow(app.getApp(), "TLS-Tracker", NULL, NULL, DECOR_ALL,
169 new FXLabel(
myToolBar,
"(s)", 0, LAYOUT_CENTER_Y);
173 app.addChild(
this,
true);
177 FXVerticalFrame* glcanvasFrame =
178 new FXVerticalFrame(
this,
179 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
180 0, 0, 0, 0, 0, 0, 0, 0);
183 setTitle((logic.getID() +
" - " + logic.getProgramID() +
" - tracker").c_str());
193 : FXMainWindow(app.getApp(),
"TLS-Tracker", NULL, NULL, DECOR_ALL,
199 setTitle(
"TLS-Tracker");
204 FXVerticalFrame* glcanvasFrame =
205 new FXVerticalFrame(
this,
206 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
207 0, 0, 0, 0, 0, 0, 0, 0);
229 FXMainWindow::create();
248 MSSimpleTrafficLightLogic::Phases::const_iterator j;
251 for (j = phases.begin(); j != phases.end(); ++j) {
257 WRITE_ERROR(
"Overflow in time computation occured.");
268 DurationsVector::reverse_iterator i =
myDurations.rbegin();
270 if (durs + (*i) > beginOffset) {
283 leftOffset = beginOffset - durs;
288 glMatrixMode(GL_PROJECTION);
290 glMatrixMode(GL_MODELVIEW);
292 glTranslated(-1, -1, 0);
294 glDisable(GL_TEXTURE_2D);
298 const double height = (double) caller.getHeight();
299 const double width = (double) caller.getWidth();
300 pfSetScaleXY((
double)(.08 * 300. / width), (
double)(.08 * 300. / height));
301 const double h4 = ((double) 4 / height);
302 const double h9 = ((double) 9 / height);
303 const double h10 = ((double) 10 / height);
304 const double h11 = ((double) 11 / height);
305 const double h16 = ((double) 16 / height);
306 const double h20 = ((double) 20 / height);
308 double h = (double)(1.0 - h10);
314 glVertex2d((
double)(30. / width), h);
318 glRotated(180, 1, 0, 0);
320 glTranslated(0.0, -h + h20 - h4, 0);
322 glTranslated(-0.0, h - h20 + h4, 0);
323 glRotated(-180, 1, 0, 0);
329 glVertex2d(0, h + h20);
330 glVertex2d(1.0, h + h20);
334 h += (double) 20 / height;
337 glVertex2d((
double) 30 / width, 1.0);
338 glVertex2d((
double) 30 / width, h);
346 double x = ((double) 31. / width);
347 double ta = (double) leftOffset / width;
362 h = (double)(1.0 - h10);
363 double a = (double) duration / width;
365 const double x2 = x + a;
378 glVertex2d(x, h - h11);
379 glVertex2d(x, h - h9);
380 glVertex2d(x2, h - h9);
381 glVertex2d(x2, h - h11);
387 glVertex2d(x, h - h16);
388 glVertex2d(x, h - h4);
389 glVertex2d(x2, h - h4);
390 glVertex2d(x2, h - h16);
412 while (t > (width - 31.) / 4.) {
414 t -= (double)((width - 31.) / 4.);
420 pfSetScaleXY((
double)(.05 * 300. / width), (
double)(.05 * 300. / height));
424 double glpos = (double) pos / width;
425 while (pos < width + 50) {
428 glRotated(180, 1, 0, 0);
430 glTranslated(glpos - w / 2., -glh + h20 - h4, 0);
432 glTranslated(-glpos + w / 2., glh - h20 + h4, 0);
433 glRotated(-180, 1, 0, 0);
436 glVertex2d(glpos, glh);
437 glVertex2d(glpos, glh - h4);
443 currTime += tickDist;
473 FXSelector sel,
void* data) {
475 return FXMainWindow::onConfigure(sender, sel, data);
481 FXSelector sel,
void* data) {
483 return FXMainWindow::onPaint(sender, sel, data);
int pfDrawString(const char *c)
bool myAmInTrackingMode
Information whether the tracking mode is on.
GUIMainWindow * myApplication
The main application.
GUITLLogicPhasesTrackerPanel()
protected constructor for FOX
long onSimStep(FXObject *sender, FXSelector sel, void *data)
called on a simulation step
void create()
Creates the window (FOX-Toolkit)
std::string time2string(SUMOTime t)
std::vector< std::string > myLinkNames
The names of links.
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
int myFirstPhase2Show
The index of the first phase that fits into the window.
PhasesVector myPhases
The list of phases.
void pfSetPosition(double x, double y)
const std::string & getID() const
Returns the id.
DurationsVector myDurations
The list of phase durations.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
long onConfigure(FXObject *sender, FXSelector sel, void *data)
called on size change
FXDEFMAP(GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel) GUITLLogicPhasesTrackerPanelMap[]
A fixed traffic light logic.
void drawValues(GUITLLogicPhasesTrackerPanel &caller)
Draws all values.
~GUITLLogicPhasesTrackerPanel()
Destructor.
void addChild(FXMDIChild *child, bool updateOnSimStep=true)
Adds a further child window to the list.
SUMOTime myFirstTime2Show
The time the diagram begins at.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
const std::string & getProgramID() const
Returns this tl-logic's id.
long onConfigure(FXObject *, FXSelector, void *)
called on size change
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
FXRealSpinDial * myBeginOffset
The offset changer (tracking mode)
FXToolBarShell * myToolBarDrag
The tool bar drag (tracking mode)
void removeChild(FXMDIChild *child)
removes the given child window from the list
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.
void unlock()
release mutex lock
double pfdkGetStringWidth(const char *c)
The link has red light (must brake)
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.
The canvas for the visualisation of phases.
MFXMutex myLock
A lock to avoid addition of new values while drawing.
FXToolBar * myToolBar
The tool bar (tracking mode)
GUITLLogicPhasesTrackerWindow * myParent
}
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
#define GUIDesignToolBarShell3
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
A Simulation step was performed.
long onPaint(FXObject *, FXSelector, void *)
called if the widget shall be repainted
The definition of a single phase of a tls logic.
static const RGBColor & getLinkColor(const LinkState &ls)
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
The link has red light (must brake) but indicates upcoming green.
SUMOTime myBeginTime
The first time a phase was added at.
void pfSetScaleXY(double sx, double sy)
~GUITLLogicPhasesTrackerWindow()
Destructor.
Class passing values from a GUIGlObject to another object.