64 FXIMPLEMENT(
GUIParameterTracker, FXMainWindow, GUIParameterTrackerMap, ARRAYNUMBER(GUIParameterTrackerMap))
71 const std::
string& name)
72 : FXMainWindow(app.getApp(), "Tracker", NULL, NULL, DECOR_ALL, 20, 20, 300, 200),
75 app.addChild(
this,
true);
76 FXVerticalFrame* glcanvasFrame =
new FXVerticalFrame(
this, FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
78 setTitle(name.c_str());
85 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
99 FXMainWindow::create();
110 new FXButton(
myToolBar,
"\t\tSave the data...",
138 return FXMainWindow::onConfigure(sender, sel, data);
145 return FXMainWindow::onPaint(sender, sel, data);
183 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
184 (*i1)->setAggregationSpan(
TIME2STEPS(aggInt));
199 std::vector<TrackerValueDesc*>::iterator i;
220 for (
int j = 0; j <
max; j++) {
233 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
256 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*) 0, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 300, 200),
266 pfSetScaleXY((
double)(.1 * 300. / myWidthInPixels), (
double)(.1 * 300. / (
double) myHeightInPixels));
268 glMatrixMode(GL_PROJECTION);
270 glMatrixMode(GL_MODELVIEW);
272 glDisable(GL_TEXTURE_2D);
274 for (std::vector<TrackerValueDesc*>::iterator i = myParent->myTracked.begin(); i != myParent->myTracked.end(); i++) {
277 (
double) myWidthInPixels / (
double) myParent->myTracked.size() * (double) run);
290 glScaled(0.8, 0.8, 1);
292 double ys = (double) 2.0 / (
double) desc.
getRange();
293 glScaled(1.0, ys, 1.0);
303 glVertex2d(0, desc.
getMin());
304 glVertex2d(2.0, desc.
getMin());
307 glVertex2d(0, desc.
getMax());
308 glVertex2d(2.0, desc.
getMax());
310 glColor4ub(red, green, blue, 77);
311 for (
int a = 1; a < 6; a++) {
312 double ypos = (desc.
getRange()) / (
double) 6.0 * (double) a + desc.
getMin();
315 glVertex2d(2.0, ypos);
320 if (values.size() < 2) {
325 latest = values.back();
327 double xStep = (double) 2.0 / (
double) values.size();
328 std::vector<double>::const_iterator i = values.begin();
332 glColor4ub(red, green, blue, 255);
333 for (; i != values.end(); i++) {
335 double xn = xp + xStep;
348 glColor3b(red, green, blue);
354 glRotated(180, 1, 0, 0);
356 glTranslated(-0.8 - w / 2., 0.88, 0);
358 glTranslated(0.8 + w / 2., -0.88, 0);
359 glRotated(-180, 1, 0, 0);
362 glRotated(180, 1, 0, 0);
364 glTranslated(0.75, 0.88, 0);
366 glTranslated(-0.75, -0.88, 0);
367 glRotated(-180, 1, 0, 0);
370 glRotated(180, 1, 0, 0);
372 glTranslated(-0.98, 0.82, 0);
374 glTranslated(0.98, -0.82, 0);
375 glRotated(-180, 1, 0, 0);
378 glRotated(180, 1, 0, 0);
380 glTranslated(-0.98, -0.78, 0);
382 glTranslated(0.98, 0.78, 0);
383 glRotated(-180, 1, 0, 0);
386 glRotated(180, 1, 0, 0);
388 double p = (double) 0.8 -
390 glTranslated(-0.98, p + .02, 0);
392 glTranslated(0.98, -(p + .02), 0);
393 glRotated(-180, 1, 0, 0);
396 glRotated(180, 1, 0, 0);
398 glTranslated(-0.98, -.92, 0);
400 glTranslated(0.98, .92, 0);
401 glRotated(-180, 1, 0, 0);
409 myWidthInPixels = myParent->getWidth();
410 myHeightInPixels = myParent->getHeight();
411 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
412 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
413 glClearColor(1.0, 1.0, 1.0, 1);
414 glDisable(GL_DEPTH_TEST);
415 glDisable(GL_LIGHTING);
416 glDisable(GL_LINE_SMOOTH);
418 glEnable(GL_ALPHA_TEST);
419 glDisable(GL_COLOR_MATERIAL);
421 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
436 myWidthInPixels = getWidth();
437 myHeightInPixels = getHeight();
438 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
439 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
440 glClearColor(1.0, 1.0, 1.0, 1);
441 glDisable(GL_DEPTH_TEST);
442 glDisable(GL_LIGHTING);
443 glDisable(GL_LINE_SMOOTH);
445 glEnable(GL_ALPHA_TEST);
446 glDisable(GL_COLOR_MATERIAL);
448 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
450 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
double getYCenter() const
Returns the center of the value.
int pfDrawString(const char *c)
void close()
Closes the device and removes it from the dictionary.
void pfSetScale(double s)
void drawValue(TrackerValueDesc &desc, double namePos)
Draws a single value.
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
std::string time2string(SUMOTime t)
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
void unlockValues()
Releases the locking after the values have been drawn.
SUMOTime getRecordingBegin() const
Returns the timestep the recording started.
Representation of a timeline of floats with their names and moments.
FXString gCurrentFolder
The folder used as last.
unsigned char blue() const
Returns the blue-amount of the color.
void pfSetPosition(double x, double y)
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.
SUMOTime getAggregationSpan() const
get the aggregation amount
~GUIParameterTrackerPanel()
Destructor.
A window which displays the time line of one (or more) value(s)
FXToolBarShell * myToolBarDrag
for some menu detaching fun
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void drawValues()
Draws all values.
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
FXComboBox * myAggregationInterval
A combo box to select an aggregation interval.
void buildToolBar()
Builds the tool bar.
#define GUIDesignComboBoxStatic
Combo box static (not editable)
void removeChild(FXMDIChild *child)
removes the given child window from the list
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
const std::vector< double > & getAggregatedValues()
returns the vector of aggregated values The values will be locked - no further addition will be perfo...
long onSimStep(FXObject *, FXSelector, void *)
Called on a simulation step.
void create()
Creates the window.
~GUIParameterTracker()
Destructor.
double pfdkGetStringWidth(const char *c)
const std::string & getName() const
Returns the name of the value.
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.
unsigned char green() const
Returns the green-amount of the color.
double getMax() const
Returns the values maximum.
std::vector< TrackerValueDesc * > myTracked
The list of tracked values.
GUIParameterTrackerPanel * myPanel
The panel to display the values in.
unsigned char red() const
Returns the red-amount of the color.
Static storage of an output device and its base (abstract) implementation.
const RGBColor & getColor() const
Returns the color to use to display the value.
Change aggregation interval.
double getMin() const
Returns the values minimum.
#define GUIDesignToolBarShell3
A Simulation step was performed.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void pfSetScaleXY(double sx, double sy)
std::vector< GLObjectValuePassConnector< double > * > myValuePassers
The value sources.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
double getRange() const
returns the maximum value range
FXDEFMAP(GUIParameterTracker) GUIParameterTrackerMap[]
Class passing values from a GUIGlObject to another object.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.