58FXIMPLEMENT(
GUIParameterTracker, FXMainWindow, GUIParameterTrackerMap, ARRAYNUMBER(GUIParameterTrackerMap))
71 const std::string& name)
72 : FXMainWindow(app.getApp(),
"Tracker", nullptr, nullptr, DECOR_ALL, 20, 20, 300, 200),
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());
91 for (std::vector<TrackerValueDesc*>::iterator i1 =
myTracked.begin(); i1 !=
myTracked.end(); i1++) {
105 FXMainWindow::create();
147 tr->addTracked(o, src, newTracked);
166 return FXMainWindow::onConfigure(sender, sel, ptr);
173 return FXMainWindow::onPaint(sender, sel, ptr);
225 std::vector<TrackerValueDesc*>::iterator i;
245 for (
int j = 0; j < max; j++) {
257 FXMessageBox::error(
this, MBOX_OK,
TL(
"Storing failed!"),
"%s", e.what());
291 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*)
nullptr, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 300, 200),
300 glMatrixMode(GL_PROJECTION);
302 glMatrixMode(GL_MODELVIEW);
304 glDisable(GL_TEXTURE_2D);
305 for (
int i = 0; i < (int)myParent->myTracked.size(); i++) {
318 const double fontWidth = 0.1 * 300. / myWidthInPixels;
319 const double fontHeight = 0.1 * 300. / myHeightInPixels;
320 const bool isMultiPlot = myParent->myTracked.size() > 1;
322 if (values.size() < 2) {
324 glTranslated(-.9, 0.9, 0);
334 glScaled(0.8, 0.8, 1);
336 double ys = (double) 2.0 / (
double) desc.
getRange();
337 glScaled(1.0, ys, 1.0);
343 glVertex2d(0, desc.
getMin());
344 glVertex2d(2.0, desc.
getMin());
347 glVertex2d(0, desc.
getMax());
348 glVertex2d(2.0, desc.
getMax());
351 for (
int a = 1; a < 6; a++) {
352 const double yp = desc.
getRange() / 6.0 * (double) a + desc.
getMin();
360 double mx = (2 * myMouseX / myWidthInPixels - 1) / 0.8 + 1;
362 double mouseValue = std::numeric_limits<double>::max();
363 latest = values.back();
365 const double xStep = 2.0 / (double) values.size();
366 std::vector<double>::const_iterator i = values.begin();
371 for (; i != values.end(); i++) {
373 double xn = xp + xStep;
374 if (xp < mx && mx < xn) {
376 mIndex = (int)(i - values.begin()) - 1;
379 glTranslated(xn, yn, 0);
380 glScaled(20.0 / myWidthInPixels, 10.0 * desc.
getRange() / myHeightInPixels, 0);
401 double w = 50 / myWidthInPixels;
402 glTranslated(-0.8 - w / 2., -0.88, 0);
404 glTranslated(0.8 + w / 2., 0.88, 0);
407 glTranslated(0.75, -0.88, 0);
410 glTranslated(-0.75, 0.88, 0);
413 glTranslated(-0.98, -0.82, 0);
415 glTranslated(0.98, 0.82, 0);
418 glTranslated(-0.98, 0.78, 0);
420 glTranslated(0.98, -0.78, 0);
423 glTranslated(-0.98, .92, 0);
425 glTranslated(0.98, -.92, 0);
428 double p = (double) 0.8 -
430 glTranslated(-0.98, -(p + .02), 0);
432 glTranslated(0.98, p + .02, 0);
435 if (mouseValue != std::numeric_limits<double>::max()) {
438 glTranslated(-0.98, -(p + .02), 0);
440 glTranslated(0.98, p + .02, 0);
445 glTranslated(1.6 * (
double)mIndex / (
double)values.size() - 0.8, -0.9, 0);
457 myWidthInPixels = myParent->getWidth();
458 myHeightInPixels = myParent->getHeight();
459 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
460 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
461 glClearColor(1.0, 1.0, 1.0, 1);
462 glDisable(GL_DEPTH_TEST);
463 glDisable(GL_LIGHTING);
464 glDisable(GL_LINE_SMOOTH);
466 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
467 glEnable(GL_ALPHA_TEST);
468 glDisable(GL_COLOR_MATERIAL);
470 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
485 myWidthInPixels = getWidth();
486 myHeightInPixels = getHeight();
487 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
488 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
489 glClearColor(1.0, 1.0, 1.0, 1);
490 glDisable(GL_DEPTH_TEST);
491 glDisable(GL_LIGHTING);
492 glDisable(GL_LINE_SMOOTH);
494 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
495 glEnable(GL_ALPHA_TEST);
496 glDisable(GL_COLOR_MATERIAL);
498 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
500 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
512 FXEvent*
event = (FXEvent*) ptr;
513 myMouseX =
event->win_x;
@ MID_SIMSTEP
A Simulation step was performed.
#define GUIDesignComboBoxStatic
Combo box static (not editable)
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
#define GUIDesignToolBar
design for default toolbar
#define GUIDesignComboBoxVisibleItems
FXString gCurrentFolder
The folder used as last.
FXDEFMAP(GUIParameterTracker) GUIParameterTrackerMap[]
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawFilledCircle(const double widradiusth, const int steps=8)
Draws a filled circle around (0,0)
static void popMatrix()
pop matrix
static void pushMatrix()
push matrix
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, const int align=0, double width=-1)
Class passing values from a GUIGlObject to another object.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)
~GUIParameterTrackerPanel()
Destructor.
long onMouseMove(FXObject *, FXSelector, void *)
called on mouse movement (for updating moused value)
void drawValue(TrackerValueDesc &desc, const RGBColor &col, int index)
Draws a single value.
void drawValues()
Draws all values.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
A window which displays the time line of one (or more) value(s)
static std::vector< RGBColor > myColors
long onCmdChangeAggregation(FXObject *, FXSelector, void *)
Called when the aggregation interval (combo) has been changed.
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
GUIParameterTrackerPanel * myPanel
The panel to display the values in.
void create()
Creates the window.
GUIParameterTracker(GUIMainWindow &app, const std::string &name)
Constructor (the tracker is empty)
GUIMainWindow * myApplication
The main application.
long onConfigure(FXObject *, FXSelector, void *)
Called on window resizing.
FXCheckButton * myMultiPlot
Whether phase names shall be printed instead of indices.
std::vector< TrackerValueDesc * > myTracked
The list of tracked values.
long onSimStep(FXObject *, FXSelector, void *)
Called on a simulation step.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the data shall be saved.
long onPaint(FXObject *, FXSelector, void *)
Called if the window shall be repainted.
FXToolBar * myToolBar
The tracker tool bar.
static std::set< GUIParameterTracker * > myMultiPlots
all trackers that are opened for plotting multiple values
std::vector< GLObjectValuePassConnector< double > * > myValuePassers
The value sources.
@ MID_SAVE
Save the current values.
@ MID_MULTIPLOT
toggle multiplot
@ MID_AGGREGATIONINTERVAL
Change aggregation interval.
MFXComboBoxIcon * myAggregationInterval
A combo box to select an aggregation interval.
static bool addTrackedMultiplot(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
all value source to multiplot trackers
long onMultiPlot(FXObject *, FXSelector, void *)
Called on a simulation step.
void buildToolBar()
Builds the tool bar.
~GUIParameterTracker()
Destructor.
FXToolBarShell * myToolBarDrag
for some menu detaching fun
FXint getCurrentItem() const
Get the current item's index.
FXint appendIconItem(const FXString &text, FXIcon *icon=nullptr, FXColor bgColor=FXRGB(255, 255, 255), void *ptr=nullptr)
append icon item in the last position
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString ¤tFolder)
Returns the file name to write.
Static storage of an output device and its base (abstract) implementation.
void close()
Closes the device and removes it from the dictionary.
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
A point in 2D or 3D with translation and scaling methods.
static const RGBColor BLUE
static const RGBColor ORANGE
static const RGBColor CYAN
static const RGBColor GREEN
static const RGBColor BLACK
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
RGBColor changedAlpha(int change) const
Returns a new color with altered opacity.
static const RGBColor MAGENTA
static const RGBColor RED
named colors
Representation of a timeline of floats with their names and moments.
const std::string & getName() const
Returns the name of the value.
double getMax() const
Returns the values maximum.
void unlockValues()
Releases the locking after the values have been drawn.
double getYCenter() const
Returns the center of the value.
double getRange() const
returns the maximum value range
SUMOTime getAggregationSpan() const
get the aggregation amount
const std::vector< double > & getAggregatedValues()
returns the vector of aggregated values The values will be locked - no further addition will be perfo...
SUMOTime getRecordingBegin() const
Returns the timestep the recording started.
double getMin() const
Returns the values minimum.
virtual ValueSource * copy() const =0