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);
227 std::vector<TrackerValueDesc*>::iterator i;
247 for (
int j = 0; j < max; j++) {
259 FXMessageBox::error(
this, MBOX_OK,
TL(
"Storing failed!"),
"%s", e.what());
293 : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*)
nullptr, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 300, 200),
302 glMatrixMode(GL_PROJECTION);
304 glMatrixMode(GL_MODELVIEW);
306 glDisable(GL_TEXTURE_2D);
307 for (
int i = 0; i < (int)myParent->myTracked.size(); i++) {
320 const double fontWidth = 0.1 * 300. / myWidthInPixels;
321 const double fontHeight = 0.1 * 300. / myHeightInPixels;
322 const bool isMultiPlot = myParent->myTracked.size() > 1;
324 if (values.size() < 2) {
326 glTranslated(-.9, 0.9, 0);
336 glScaled(0.8, 0.8, 1);
338 double ys = (double) 2.0 / (
double) desc.
getRange();
339 glScaled(1.0, ys, 1.0);
345 glVertex2d(0, desc.
getMin());
346 glVertex2d(2.0, desc.
getMin());
349 glVertex2d(0, desc.
getMax());
350 glVertex2d(2.0, desc.
getMax());
353 for (
int a = 1; a < 6; a++) {
354 const double yp = desc.
getRange() / 6.0 * (double) a + desc.
getMin();
362 double mx = (2 * myMouseX / myWidthInPixels - 1) / 0.8 + 1;
364 double mouseValue = std::numeric_limits<double>::max();
365 latest = values.back();
367 const double xStep = 2.0 / (double) values.size();
368 std::vector<double>::const_iterator i = values.begin();
373 for (; i != values.end(); i++) {
375 double xn = xp + xStep;
376 if (xp < mx && mx < xn) {
378 mIndex = (int)(i - values.begin()) - 1;
381 glTranslated(xn, yn, 0);
382 glScaled(20.0 / myWidthInPixels, 10.0 * desc.
getRange() / myHeightInPixels, 0);
403 double w = 50 / myWidthInPixels;
404 glTranslated(-0.8 - w / 2., -0.88, 0);
406 glTranslated(0.8 + w / 2., 0.88, 0);
409 glTranslated(0.75, -0.88, 0);
412 glTranslated(-0.75, 0.88, 0);
415 glTranslated(-0.98, -0.82, 0);
417 glTranslated(0.98, 0.82, 0);
420 glTranslated(-0.98, 0.78, 0);
422 glTranslated(0.98, -0.78, 0);
425 glTranslated(-0.98, .92, 0);
427 glTranslated(0.98, -.92, 0);
430 double p = (double) 0.8 -
432 glTranslated(-0.98, -(p + .02), 0);
434 glTranslated(0.98, p + .02, 0);
437 if (mouseValue != std::numeric_limits<double>::max()) {
440 glTranslated(-0.98, -(p + .02), 0);
442 glTranslated(0.98, p + .02, 0);
447 glTranslated(1.6 * (
double)mIndex / (
double)values.size() - 0.8, -0.9, 0);
459 myWidthInPixels = myParent->getWidth();
460 myHeightInPixels = myParent->getHeight();
461 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
462 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
463 glClearColor(1.0, 1.0, 1.0, 1);
464 glDisable(GL_DEPTH_TEST);
465 glDisable(GL_LIGHTING);
466 glDisable(GL_LINE_SMOOTH);
468 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
469 glEnable(GL_ALPHA_TEST);
470 glDisable(GL_COLOR_MATERIAL);
472 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
487 myWidthInPixels = getWidth();
488 myHeightInPixels = getHeight();
489 if (myWidthInPixels != 0 && myHeightInPixels != 0) {
490 glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
491 glClearColor(1.0, 1.0, 1.0, 1);
492 glDisable(GL_DEPTH_TEST);
493 glDisable(GL_LIGHTING);
494 glDisable(GL_LINE_SMOOTH);
496 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
497 glEnable(GL_ALPHA_TEST);
498 glDisable(GL_COLOR_MATERIAL);
500 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
502 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
514 FXEvent*
event = (FXEvent*) ptr;
515 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 &extensions, 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
static StringBijection< CSVFileExtension > CSVFileExtensions
CSV file Extensions.
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