58 FXIMPLEMENT(
GUIParameterTracker, FXMainWindow, GUIParameterTrackerMap, ARRAYNUMBER(GUIParameterTrackerMap))
65 const std::
string& name)
66 : FXMainWindow(app.getApp(), "Tracker",
nullptr,
nullptr, DECOR_ALL, 20, 20, 300, 200),
70 FXVerticalFrame* glcanvasFrame =
new FXVerticalFrame(
this, FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
72 setTitle(name.c_str());
79 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
93 FXMainWindow::create();
104 new FXButton(
myToolBar,
"\t\tSave the data...",
132 return FXMainWindow::onConfigure(sender, sel, data);
139 return FXMainWindow::onPaint(sender, sel, data);
177 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
178 (*i1)->setAggregationSpan(
TIME2STEPS(aggInt));
193 std::vector<TrackerValueDesc*>::iterator i;
214 for (
int j = 0; j < max; j++) {
227 FXMessageBox::error(
this, MBOX_OK,
"Storing failed!",
"%s", e.what());
250 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*)
nullptr, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 300, 200),
259 glMatrixMode(GL_PROJECTION);
261 glMatrixMode(GL_MODELVIEW);
263 glDisable(GL_TEXTURE_2D);
265 for (std::vector<TrackerValueDesc*>::iterator i = myParent->myTracked.begin(); i != myParent->myTracked.end(); i++) {
268 (
double) myWidthInPixels / (
double) myParent->myTracked.size() * (double) run);
277 const double fontWidth = 0.1 * 300. / myWidthInPixels;
278 const double fontHeight = 0.1 * 300. / myHeightInPixels;
284 glScaled(0.8, 0.8, 1);
286 double ys = (double) 2.0 / (
double) desc.
getRange();
287 glScaled(1.0, ys, 1.0);
297 glVertex2d(0, desc.
getMin());
298 glVertex2d(2.0, desc.
getMin());
301 glVertex2d(0, desc.
getMax());
302 glVertex2d(2.0, desc.
getMax());
304 glColor4ub(red, green, blue, 77);
305 for (
int a = 1; a < 6; a++) {
306 double ypos = (desc.
getRange()) / (
double) 6.0 * (double) a + desc.
getMin();
309 glVertex2d(2.0, ypos);
314 if (values.size() < 2) {
319 latest = values.back();
321 double xStep = (double) 2.0 / (
double) values.size();
322 std::vector<double>::const_iterator i = values.begin();
326 glColor4ub(red, green, blue, 255);
327 for (; i != values.end(); i++) {
329 double xn = xp + xStep;
342 glColor3b(red, green, blue);
347 double w = 50 / myWidthInPixels;
348 glTranslated(-0.8 - w / 2., -0.88, 0);
350 glTranslated(0.8 + w / 2., 0.88, 0);
353 glTranslated(0.75, -0.88, 0);
356 glTranslated(-0.75, 0.88, 0);
359 glTranslated(-0.98, -0.82, 0);
361 glTranslated(0.98, 0.82, 0);
364 glTranslated(-0.98, 0.78, 0);
366 glTranslated(0.98, -0.78, 0);
369 double p = (double) 0.8 -
371 glTranslated(-0.98, -(p + .02), 0);
373 glTranslated(0.98, p + .02, 0);
376 glTranslated(-0.98, .92, 0);
378 glTranslated(0.98, -.92, 0);
386 myWidthInPixels = myParent->getWidth();
387 myHeightInPixels = myParent->getHeight();
388 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
389 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
390 glClearColor(1.0, 1.0, 1.0, 1);
391 glDisable(GL_DEPTH_TEST);
392 glDisable(GL_LIGHTING);
393 glDisable(GL_LINE_SMOOTH);
395 glEnable(GL_ALPHA_TEST);
396 glDisable(GL_COLOR_MATERIAL);
398 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
413 myWidthInPixels = getWidth();
414 myHeightInPixels = 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);
427 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
double getYCenter() const
Returns the center of the value.
void close()
Closes the device and removes it from the dictionary.
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)
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)
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.
#define GUIDesignToolBar
design for default toolbar
static const RGBColor BLACK
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.
A point in 2D or 3D with translation and scaling methods.
void buildToolBar()
Builds the tool bar.
#define GUIDesignComboBoxStatic
Combo box static (not editable)
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.
Change aggregation interval.
~GUIParameterTracker()
Destructor.
void removeChild(FXMainWindow *child)
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.
A Simulation step was performed.
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.
double getMin() const
Returns the values minimum.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
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.