65 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*)
nullptr, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y),
74 FXObject*, FXSelector,
void*) {
76 int widthInPixels = getWidth();
77 int heightInPixels = getHeight();
78 if (widthInPixels != 0 && heightInPixels != 0) {
79 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
80 glClearColor(0, 0, 0, 1);
81 glDisable(GL_DEPTH_TEST);
82 glDisable(GL_LIGHTING);
83 glDisable(GL_LINE_SMOOTH);
85 glEnable(GL_ALPHA_TEST);
86 glDisable(GL_COLOR_MATERIAL);
88 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
97 FXObject*, FXSelector,
void*) {
102 int widthInPixels = getWidth();
103 int heightInPixels = getHeight();
104 if (widthInPixels != 0 && heightInPixels != 0) {
105 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
106 glClearColor(0, 0, 0, 1);
107 glDisable(GL_DEPTH_TEST);
108 glDisable(GL_LIGHTING);
109 glDisable(GL_LINE_SMOOTH);
111 glEnable(GL_ALPHA_TEST);
112 glDisable(GL_COLOR_MATERIAL);
114 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
116 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
117 myParent->drawValues(*
this);
147 : FXMainWindow(app.getApp(), "TLS-Tracker",
nullptr,
nullptr, DECOR_ALL,
161 new FXLabel(
myToolBar,
"(s)",
nullptr, LAYOUT_CENTER_Y);
168 FXVerticalFrame* glcanvasFrame =
169 new FXVerticalFrame(
this,
170 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
171 0, 0, 0, 0, 0, 0, 0, 0);
174 setTitle((logic.getID() +
" - " + logic.getProgramID() +
" - tracker").c_str());
185 : FXMainWindow(app.getApp(),
"TLS-Tracker", nullptr, nullptr, DECOR_ALL,
190 setTitle(
"TLS-Tracker");
195 FXVerticalFrame* glcanvasFrame =
196 new FXVerticalFrame(
this,
197 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
198 0, 0, 0, 0, 0, 0, 0, 0);
221 FXMainWindow::create();
240 if (simpleTLLogic ==
nullptr) {
244 MSSimpleTrafficLightLogic::Phases::const_iterator j;
247 for (j = phases.begin(); j != phases.end(); ++j) {
253 WRITE_ERROR(
"Overflow in time computation occurred.");
264 DurationsVector::reverse_iterator i =
myDurations.rbegin();
266 if (durs + (*i) > beginOffset) {
279 leftOffset = beginOffset - durs;
284 glMatrixMode(GL_PROJECTION);
286 glMatrixMode(GL_MODELVIEW);
288 glTranslated(-1, -1, 0);
290 glDisable(GL_TEXTURE_2D);
294 const double height = (double) caller.getHeight();
295 const double width = (double) caller.getWidth();
296 const double barWidth =
MAX2(1.0, width - 31);
297 const double fontHeight = 0.08 * 300. / height;
298 const double fontWidth = 0.08 * 300. / width;
299 const double h9 = ((double) 9 / height);
300 const double h10 = ((double) 10 / height);
301 const double h11 = ((double) 11 / height);
302 const double h16 = ((double) 16 / height);
303 const double h20 = ((double) 20 / height);
305 double h = (double)(1.0 - h10);
311 glVertex2d((
double)(30. / width), h);
315 glTranslated(0, h - h20, 0);
317 glTranslated(0, -h + h20, 0);
323 glVertex2d(0, h + h20);
324 glVertex2d(1.0, h + h20);
328 h += (double) 20 / height;
331 glVertex2d((
double) 30 / width, 1.0);
332 glVertex2d((
double) 30 / width, h);
340 double x = ((double) 31. / width);
341 double ta = (double) leftOffset / width;
356 h = (double)(1.0 - h10);
357 double a = (double) duration / width;
359 const double x2 = x + a;
372 glVertex2d(x, h - h11);
373 glVertex2d(x, h - h9);
374 glVertex2d(x2, h - h9);
375 glVertex2d(x2, h - h11);
381 glVertex2d(x, h - h16);
384 glVertex2d(x2, h - h16);
406 while (t > barWidth / 4.) {
408 t -= (double)(barWidth / 4.);
417 double glpos = (double) pos / width;
418 const double ticSize = 4 / height;
419 while (pos < width + 50) {
423 const double w = 50 / width;
424 glTranslated(glpos - w / 2., glh - h20, 0);
426 glTranslated(-glpos + w / 2., -glh + h20, 0);
429 glVertex2d(glpos, glh);
430 glVertex2d(glpos, glh - ticSize);
436 currTime += tickDist;
467 return FXMainWindow::onConfigure(sender, sel, ptr);
474 return FXMainWindow::onPaint(sender, sel, ptr);
@ MID_SIMSTEP
A Simulation step was performed.
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
#define GUIDesignToolBar
design for default toolbar
FXDEFMAP(GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel) GUITLLogicPhasesTrackerPanelMap[]
std::string time2string(SUMOTime t)
convert SUMOTime to string
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_TL_REDYELLOW
The link has red light (must brake) but indicates upcoming green.
@ LINKSTATE_TL_RED
The link has red light (must brake)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Class passing values from a GUIGlObject to another object.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)
The canvas for the visualisation of phases.
long onConfigure(FXObject *, FXSelector, void *)
called on size change
long onPaint(FXObject *, FXSelector, void *)
called if the widget shall be repainted
~GUITLLogicPhasesTrackerPanel()
Destructor.
This window displays a phase diagram for a chosen tl-logic.
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
FXMutex myLock
A lock to avoid addition of new values while drawing.
SUMOTime myBeginTime
The first time a phase was added at.
std::vector< std::string > myLinkNames
The names of links.
~GUITLLogicPhasesTrackerWindow()
Destructor.
FXRealSpinner * myBeginOffset
The offset changer (tracking mode)
long onSimStep(FXObject *sender, FXSelector sel, void *ptr)
called on a simulation step
GUITLLogicPhasesTrackerPanel * myPanel
The panel to draw on.
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
FXToolBarShell * myToolBarDrag
The tool bar drag (tracking mode)
FXToolBar * myToolBar
The tool bar (tracking mode)
PhasesVector myPhases
The list of phases.
SUMOTime myFirstPhaseOffset
The offset to draw the first phase (left offset)
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.
int myFirstPhase2Show
The index of the first phase that fits into the window.
long onPaint(FXObject *sender, FXSelector sel, void *ptr)
called if the widget shall be repainted
long onConfigure(FXObject *sender, FXSelector sel, void *ptr)
called on size change
SUMOTime myLastTime
The last time a phase was added at.
void create()
Creates the window (FOX-Toolkit)
MSTrafficLightLogic * myTLLogic
The logic to display.
SUMOTime myFirstTime2Show
The time the diagram begins at.
GUIMainWindow * myApplication
The main application.
bool myAmInTrackingMode
Information whether the tracking mode is on.
void drawValues(GUITLLogicPhasesTrackerPanel &caller)
Draws all values.
DurationsVector myDurations
The list of phase durations.
static const RGBColor & getLinkColor(const LinkState &ls)
map from LinkState to color constants
The definition of a single phase of a tls logic.
A fixed traffic light logic.
const Phases & getPhases() const
Returns the phases of this tls program.
The parent class for traffic light logics.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
std::vector< MSPhaseDefinition * > Phases
Definition of a list of phases, being the junction logic.
const std::string & getProgramID() const
Returns this tl-logic's id.
const std::string & getID() const
Returns the id.
A point in 2D or 3D with translation and scaling methods.
static const RGBColor WHITE