49 #ifdef CHECK_MEMORY_LEAKS
51 #endif // CHECK_MEMORY_LEAKS
74 const
std::
string& name)
75 :
FXMainWindow(app.getApp(), "Tracker", NULL, NULL, DECOR_ALL, 20, 20, 300, 200),
78 app.addChild(
this,
true);
79 FXVerticalFrame* glcanvasFrame =
new FXVerticalFrame(
this, FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
81 setTitle(name.c_str());
88 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
102 FXMainWindow::create();
111 new FXToolBarGrip(
myToolBar,
myToolBar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
115 ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
119 FRAME_SUNKEN | LAYOUT_LEFT | LAYOUT_TOP | COMBOBOX_STATIC);
142 return FXMainWindow::onConfigure(sender, sel, data);
149 return FXMainWindow::onPaint(sender, sel, data);
187 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
188 (*i1)->setAggregationSpan(
TIME2STEPS(aggInt));
203 std::vector<TrackerValueDesc*>::iterator i;
224 for (
unsigned int j = 0; j <
max; j++) {
237 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
260 :
FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (
FXObject*) 0, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 300, 200),
261 myParent(&parent), myApplication(&app) {}
272 glMatrixMode(GL_PROJECTION);
274 glMatrixMode(GL_MODELVIEW);
276 glDisable(GL_TEXTURE_2D);
278 for (std::vector<TrackerValueDesc*>::iterator i = myParent->myTracked.begin(); i != myParent->myTracked.end(); i++) {
294 glScaled(0.8, 0.8, 1);
297 glScaled(1.0, ys, 1.0);
307 glVertex2d(0, desc.
getMin());
308 glVertex2d(2.0, desc.
getMin());
311 glVertex2d(0, desc.
getMax());
312 glVertex2d(2.0, desc.
getMax());
314 glColor4ub(red, green, blue, 77);
315 for (
int a = 1; a < 6; a++) {
319 glVertex2d(2.0, ypos);
324 if (values.size() < 2) {
329 latest = values.back();
332 std::vector<SUMOReal>::const_iterator i = values.begin();
336 glColor4ub(red, green, blue, 255);
337 for (; i != values.end(); i++) {
352 glColor3b(red, green, blue);
358 glRotated(180, 1, 0, 0);
360 glTranslated(-0.8 - w / 2., 0.88, 0);
362 glTranslated(0.8 + w / 2., -0.88, 0);
363 glRotated(-180, 1, 0, 0);
366 glRotated(180, 1, 0, 0);
368 glTranslated(0.75, 0.88, 0);
370 glTranslated(-0.75, -0.88, 0);
371 glRotated(-180, 1, 0, 0);
374 glRotated(180, 1, 0, 0);
376 glTranslated(-0.98, 0.82, 0);
378 glTranslated(0.98, -0.82, 0);
379 glRotated(-180, 1, 0, 0);
382 glRotated(180, 1, 0, 0);
384 glTranslated(-0.98, -0.78, 0);
386 glTranslated(0.98, 0.78, 0);
387 glRotated(-180, 1, 0, 0);
390 glRotated(180, 1, 0, 0);
394 glTranslated(-0.98, p + .02, 0);
396 glTranslated(0.98, -(p + .02), 0);
397 glRotated(-180, 1, 0, 0);
400 glRotated(180, 1, 0, 0);
402 glTranslated(-0.98, -.92, 0);
404 glTranslated(0.98, .92, 0);
405 glRotated(-180, 1, 0, 0);
413 myWidthInPixels = myParent->getWidth();
414 myHeightInPixels = myParent->getHeight();
415 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
416 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
417 glClearColor(1.0, 1.0, 1.0, 1);
418 glDisable(GL_DEPTH_TEST);
419 glDisable(GL_LIGHTING);
420 glDisable(GL_LINE_SMOOTH);
422 glEnable(GL_ALPHA_TEST);
423 glDisable(GL_COLOR_MATERIAL);
425 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
440 myWidthInPixels = getWidth();
441 myHeightInPixels = getHeight();
442 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
443 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
444 glClearColor(1.0, 1.0, 1.0, 1);
445 glDisable(GL_DEPTH_TEST);
446 glDisable(GL_LIGHTING);
447 glDisable(GL_LINE_SMOOTH);
449 glEnable(GL_ALPHA_TEST);
450 glDisable(GL_COLOR_MATERIAL);
452 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
454 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
int pfDrawString(const char *c)
SUMOReal getYCenter() const
Returns the center of the value.
void close()
Closes the device and removes it from the dictionary.
std::vector< GLObjectValuePassConnector< SUMOReal > * > myValuePassers
The value sources.
Change aggregation interval.
std::string time2string(SUMOTime t)
void pfSetPosition(SUMOReal x, SUMOReal y)
void unlockValues()
Releases the locking after the values have been drawn.
Representation of a timeline of floats with their names and moments.
FXString gCurrentFolder
The folder used as last.
SUMOReal getMin() const
Returns the values minimum.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the data shall be saved.
GUIMainWindow * myApplication
The main application.
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
FXToolBar * myToolBar
The tracker tool bar.
const std::vector< SUMOReal > & getAggregatedValues()
returns the vector of aggregated values The values will be locked - no further addition will be perfo...
~GUIParameterTrackerPanel()
Destructor.
A Simulation step was performed.
unsigned char blue() const
Returns the blue-amount of the color.
A window which displays the time line of one (or more) value(s)
FXToolBarShell * myToolBarDrag
for some menu detaching fun
void drawValues()
Draws all values.
FXComboBox * myAggregationInterval
A combo box to select an aggregation interval.
SUMOReal getMax() const
Returns the values maximum.
void buildToolBar()
Builds the tool bar.
void drawValue(TrackerValueDesc &desc, SUMOReal namePos)
Draws a single value.
void removeChild(FXMDIChild *child)
removes the given child window from the list
void pfSetScaleXY(SUMOReal sx, SUMOReal sy)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
long onSimStep(FXObject *, FXSelector, void *)
Called on a simulation step.
SUMOReal getRange() const
returns the maximum value range
void create()
Creates the window.
SUMOTime getRecordingBegin() const
Returns the timestep the recording started.
~GUIParameterTracker()
Destructor.
SUMOTime getAggregationSpan() const
get the aggregation amount
void pfSetScale(SUMOReal s)
long onCmdChangeAggregation(FXObject *, FXSelector, void *)
Called when the aggregation interval (combo) has been changed.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
SUMOReal pfdkGetStringWidth(const char *c)
std::vector< TrackerValueDesc * > myTracked
The list of tracked values.
GUIParameterTrackerPanel * myPanel
The panel to display the values in.
void addTracked(GUIGlObject &o, ValueSource< SUMOReal > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
const std::string & getName() const
Returns the name of the value.
Static storage of an output device and its base (abstract) implementation.
unsigned char green() const
Returns the green-amount of the color.
unsigned char red() const
Returns the red-amount of the color.
static FXIcon * getIcon(GUIIcon which)
const RGBColor & getColor() const
Returns the color to use to display the value.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
FXDEFMAP(GUIParameterTracker) GUIParameterTrackerMap[]
Class passing values from a GUIGlObject to another object.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.