48 #ifdef CHECK_MEMORY_LEAKS 50 #endif // CHECK_MEMORY_LEAKS 76 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*) 0, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y),
85 FXObject*, FXSelector,
void*) {
87 int widthInPixels = getWidth();
88 int heightInPixels = getHeight();
89 if (widthInPixels != 0 && heightInPixels != 0) {
90 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
91 glClearColor(0, 0, 0, 1);
92 glDisable(GL_DEPTH_TEST);
93 glDisable(GL_LIGHTING);
94 glDisable(GL_LINE_SMOOTH);
96 glEnable(GL_ALPHA_TEST);
97 glDisable(GL_COLOR_MATERIAL);
99 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
108 FXObject*, FXSelector,
void*) {
113 int widthInPixels = getWidth();
114 int heightInPixels = getHeight();
115 if (widthInPixels != 0 && heightInPixels != 0) {
116 glViewport(0, 0, widthInPixels - 1, heightInPixels - 1);
117 glClearColor(0, 0, 0, 1);
118 glDisable(GL_DEPTH_TEST);
119 glDisable(GL_LIGHTING);
120 glDisable(GL_LINE_SMOOTH);
122 glEnable(GL_ALPHA_TEST);
123 glDisable(GL_COLOR_MATERIAL);
125 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
127 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
158 : FXMainWindow(app.getApp(), "TLS-Tracker", NULL, NULL, DECOR_ALL,
164 new FXToolBarGrip(
myToolBar,
myToolBar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
171 new FXLabel(
myToolBar,
"(s)", 0, LAYOUT_CENTER_Y);
175 app.addChild(
this,
true);
179 FXVerticalFrame* glcanvasFrame =
180 new FXVerticalFrame(
this,
181 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
182 0, 0, 0, 0, 0, 0, 0, 0);
185 setTitle((logic.getID() +
" - " + logic.getProgramID() +
" - tracker").c_str());
195 : FXMainWindow(app.getApp(),
"TLS-Tracker", NULL, NULL, DECOR_ALL,
201 setTitle(
"TLS-Tracker");
206 FXVerticalFrame* glcanvasFrame =
207 new FXVerticalFrame(
this,
208 FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y,
209 0, 0, 0, 0, 0, 0, 0, 0);
231 FXMainWindow::create();
243 size_t leftOffset = 0;
250 MSSimpleTrafficLightLogic::Phases::const_iterator j;
253 for (j = phases.begin(); j != phases.end(); ++j) {
259 WRITE_ERROR(
"Overflow in time computation occured.");
270 DurationsVector::reverse_iterator i =
myDurations.rbegin();
272 if (durs + (*i) > beginOffset) {
285 leftOffset = beginOffset - durs;
290 glMatrixMode(GL_PROJECTION);
292 glMatrixMode(GL_MODELVIEW);
294 glTranslated(-1, -1, 0);
296 glDisable(GL_TEXTURE_2D);
316 glVertex2d((
SUMOReal)(30. / width), h);
319 if (i < myTLLogic->getLinks().size()) {
320 glRotated(180, 1, 0, 0);
322 glTranslated(0.0, -h + h20 - h4, 0);
324 glTranslated(-0.0, h - h20 + h4, 0);
325 glRotated(-180, 1, 0, 0);
331 glVertex2d(0, h + h20);
332 glVertex2d(1.0, h + h20);
339 glVertex2d((
SUMOReal) 30 / width, 1.0);
340 glVertex2d((
SUMOReal) 30 / width, h);
361 size_t duration = *pd - fpo;
371 LinkState state = (*pi).getSignalState(j);
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);
389 glVertex2d(x, h - h4);
390 glVertex2d(x2, h - h4);
391 glVertex2d(x2, h - h16);
414 while (t > (width - 31.) / 4.) {
416 t -= (
SUMOReal)((width - 31.) / 4.);
427 while (pos < width + 50) {
430 glRotated(180, 1, 0, 0);
432 glTranslated(glpos - w / 2., -glh + h20 - h4, 0);
434 glTranslated(-glpos + w / 2., glh - h20 + h4, 0);
435 glRotated(-180, 1, 0, 0);
438 glVertex2d(glpos, glh);
439 glVertex2d(glpos, glh - h4);
445 currTime += tickDist;
475 FXSelector sel,
void* data) {
477 return FXMainWindow::onConfigure(sender, sel, data);
483 FXSelector sel,
void* data) {
485 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)
const RGBColor & getLinkColor(const LinkState &ls)
std::string time2string(SUMOTime t)
std::vector< std::string > myLinkNames
The names of links.
void pfSetPosition(SUMOReal x, SUMOReal y)
PhasesVector myPhases
The list of phases.
DurationsVector myDurations
The list of phase durations.
long onConfigure(FXObject *sender, FXSelector sel, void *data)
called on size change
FXDEFMAP(GUITLLogicPhasesTrackerWindow::GUITLLogicPhasesTrackerPanel) GUITLLogicPhasesTrackerPanelMap[]
A fixed traffic light logic.
size_t myFirstPhase2Show
The index of the first phase that fits into the window.
void drawValues(GUITLLogicPhasesTrackerPanel &caller)
Draws all values.
const std::string & getID() const
Returns the id.
~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.
long onConfigure(FXObject *, FXSelector, void *)
called on size change
A Simulation step was performed.
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
size_t myFirstPhaseOffset
The offset to draw the first phase (left offset)
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 pfSetScaleXY(SUMOReal sx, SUMOReal sy)
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.
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.
SUMOReal pfdkGetStringWidth(const char *c)
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.
const std::string & getProgramID() const
Returns this tl-logic's id.
FXToolBar * myToolBar
The tool bar (tracking mode)
GUITLLogicPhasesTrackerWindow * myParent
}
void setBeginTime(SUMOTime time)
Sets the time the display shall be shown as beginning at.
GUITLLogicPhasesTrackerWindow()
protected constructor for FOX
long onPaint(FXObject *, FXSelector, void *)
called if the widget shall be repainted
The definition of a single phase of a tls logic.
static FXIcon * getIcon(GUIIcon which)
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.