73 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*) 0, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y),
82 FXObject*, FXSelector,
void*) {
84 int widthInPixels = getWidth();
85 int heightInPixels = getHeight();
86 if (widthInPixels != 0 && heightInPixels != 0) {
87 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
88 glClearColor(0, 0, 0, 1);
89 glDisable(GL_DEPTH_TEST);
90 glDisable(GL_LIGHTING);
91 glDisable(GL_LINE_SMOOTH);
93 glEnable(GL_ALPHA_TEST);
94 glDisable(GL_COLOR_MATERIAL);
96 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
105 FXObject*, FXSelector,
void*) {
110 int widthInPixels = getWidth();
111 int heightInPixels = getHeight();
112 if (widthInPixels != 0 && heightInPixels != 0) {
113 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
114 glClearColor(0, 0, 0, 1);
115 glDisable(GL_DEPTH_TEST);
116 glDisable(GL_LIGHTING);
117 glDisable(GL_LINE_SMOOTH);
119 glEnable(GL_ALPHA_TEST);
120 glDisable(GL_COLOR_MATERIAL);
122 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
124 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
155 : FXMainWindow(app.getApp(), "TLS-Tracker", NULL, NULL, DECOR_ALL,
168 new FXLabel(
myToolBar,
"(s)", 0, LAYOUT_CENTER_Y);
172 app.addChild(
this,
true);
176 FXVerticalFrame* glcanvasFrame =
177 new FXVerticalFrame(
this,
178 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
179 0, 0, 0, 0, 0, 0, 0, 0);
182 setTitle((logic.getID() +
" - " + logic.getProgramID() +
" - tracker").c_str());
192 : FXMainWindow(app.getApp(),
"TLS-Tracker", NULL, NULL, DECOR_ALL,
198 setTitle(
"TLS-Tracker");
203 FXVerticalFrame* glcanvasFrame =
204 new FXVerticalFrame(
this,
205 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
206 0, 0, 0, 0, 0, 0, 0, 0);
228 FXMainWindow::create();
247 if (simpleTLLogic == 0) {
251 MSSimpleTrafficLightLogic::Phases::const_iterator j;
254 for (j = phases.begin(); j != phases.end(); ++j) {
260 WRITE_ERROR(
"Overflow in time computation occured.");
271 DurationsVector::reverse_iterator i =
myDurations.rbegin();
273 if (durs + (*i) > beginOffset) {
286 leftOffset = beginOffset - durs;
291 glMatrixMode(GL_PROJECTION);
293 glMatrixMode(GL_MODELVIEW);
295 glTranslated(-1, -1, 0);
297 glDisable(GL_TEXTURE_2D);
301 const double height = (double) caller.getHeight();
302 const double width = (double) caller.getWidth();
303 const double barWidth =
MAX2(1.0, width - 31);
304 const double fontHeight = 0.08 * 300. / height;
305 const double fontWidth = 0.08 * 300. / width;
306 const double h9 = ((double) 9 / height);
307 const double h10 = ((double) 10 / height);
308 const double h11 = ((double) 11 / height);
309 const double h16 = ((double) 16 / height);
310 const double h20 = ((double) 20 / height);
312 double h = (double)(1.0 - h10);
318 glVertex2d((
double)(30. / width), h);
322 glTranslated(0, h - h20, 0);
324 glTranslated(0, -h + h20, 0);
330 glVertex2d(0, h + h20);
331 glVertex2d(1.0, h + h20);
335 h += (double) 20 / height;
338 glVertex2d((
double) 30 / width, 1.0);
339 glVertex2d((
double) 30 / width, h);
347 double x = ((double) 31. / width);
348 double ta = (double) leftOffset / width;
363 h = (double)(1.0 - h10);
364 double a = (double) duration / width;
366 const double x2 = x + a;
379 glVertex2d(x, h - h11);
380 glVertex2d(x, h - h9);
381 glVertex2d(x2, h - h9);
382 glVertex2d(x2, h - h11);
388 glVertex2d(x, h - h16);
391 glVertex2d(x2, h - h16);
413 while (t > barWidth / 4.) {
415 t -= (double)(barWidth / 4.);
424 double glpos = (double) pos / width;
425 const double ticSize = 4 / height;
426 while (pos < width + 50) {
428 const double w = 50 / width;
429 glTranslated(glpos - w / 2., glh - h20, 0);
431 glTranslated(-glpos + w / 2., -glh + h20, 0);
434 glVertex2d(glpos, glh);
435 glVertex2d(glpos, glh - ticSize);
441 currTime += tickDist;
471 FXSelector sel,
void* data) {
473 return FXMainWindow::onConfigure(sender, sel, data);
479 FXSelector sel,
void* data) {
481 return FXMainWindow::onPaint(sender, sel, data);
bool myAmInTrackingMode
Information whether the tracking mode is on.
GUIMainWindow * myApplication
The main application.
static const RGBColor WHITE
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)
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, int align=0, double width=-1)
int myFirstPhase2Show
The index of the first phase that fits into the window.
PhasesVector myPhases
The list of phases.
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
A point in 2D or 3D with translation and scaling methods.
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
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)
A Simulation step was performed.
GUITLLogicPhasesTrackerWindow * myParent
}
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
#define GUIDesignToolBarShell3
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
const Phases & getPhases() const
Returns the phases of this tls program.
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.
~GUITLLogicPhasesTrackerWindow()
Destructor.
Class passing values from a GUIGlObject to another object.