LCOV - code coverage report
Current view: top level - src/utils/gui/tracker - GUIParameterTracker.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 257 0.0 %
Date: 2024-05-03 15:29:52 Functions: 0 25 0.0 %

          Line data    Source code
       1             : /****************************************************************************/
       2             : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3             : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
       4             : // This program and the accompanying materials are made available under the
       5             : // terms of the Eclipse Public License 2.0 which is available at
       6             : // https://www.eclipse.org/legal/epl-2.0/
       7             : // This Source Code may also be made available under the following Secondary
       8             : // Licenses when the conditions for such availability set forth in the Eclipse
       9             : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10             : // or later which is available at
      11             : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12             : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13             : /****************************************************************************/
      14             : /// @file    GUIParameterTracker.cpp
      15             : /// @author  Daniel Krajzewicz
      16             : /// @author  Jakob Erdmann
      17             : /// @author  Michael Behrisch
      18             : /// @date    Sept 2002
      19             : ///
      20             : // A window which displays the time line of one (or more) value(s)
      21             : /****************************************************************************/
      22             : #include <config.h>
      23             : 
      24             : #include <string>
      25             : #include <fstream>
      26             : #include <utils/common/MsgHandler.h>
      27             : #include <utils/common/ToString.h>
      28             : #include <utils/common/StringUtils.h>
      29             : #include <utils/common/SUMOTime.h>
      30             : #include <utils/foxtools/MFXUtils.h>
      31             : #include <utils/iodevices/OutputDevice.h>
      32             : #include <utils/gui/div/GLHelper.h>
      33             : #include <utils/gui/globjects/GUIGlObject.h>
      34             : #include <utils/gui/div/GUIIOGlobals.h>
      35             : #include <utils/gui/div/GUIDesigns.h>
      36             : #include <utils/gui/windows/GUIAppEnum.h>
      37             : #include <utils/gui/windows/GUIMainWindow.h>
      38             : #include <utils/gui/images/GUIIconSubSys.h>
      39             : #include <foreign/fontstash/fontstash.h>
      40             : #include <utils/gui/globjects/GLIncludes.h>
      41             : #include "GUIParameterTracker.h"
      42             : 
      43             : 
      44             : // ===========================================================================
      45             : // FOX callback mapping
      46             : // ===========================================================================
      47             : FXDEFMAP(GUIParameterTracker) GUIParameterTrackerMap[] = {
      48             :     FXMAPFUNC(SEL_CONFIGURE, 0,                                            GUIParameterTracker::onConfigure),
      49             :     FXMAPFUNC(SEL_PAINT,     0,                                            GUIParameterTracker::onPaint),
      50             :     FXMAPFUNC(SEL_COMMAND,   MID_SIMSTEP,                                  GUIParameterTracker::onSimStep),
      51             :     FXMAPFUNC(SEL_COMMAND,   GUIParameterTracker::MID_MULTIPLOT,           GUIParameterTracker::onMultiPlot),
      52             :     FXMAPFUNC(SEL_COMMAND,   GUIParameterTracker::MID_AGGREGATIONINTERVAL, GUIParameterTracker::onCmdChangeAggregation),
      53             :     FXMAPFUNC(SEL_COMMAND,   GUIParameterTracker::MID_SAVE,                GUIParameterTracker::onCmdSave),
      54             : 
      55             : };
      56             : 
      57             : // Macro for the GLTestApp class hierarchy implementation
      58           0 : FXIMPLEMENT(GUIParameterTracker, FXMainWindow, GUIParameterTrackerMap, ARRAYNUMBER(GUIParameterTrackerMap))
      59             : 
      60             : // ===========================================================================
      61             : // static value definitions
      62             : // ===========================================================================
      63             : std::set<GUIParameterTracker*> GUIParameterTracker::myMultiPlots;
      64             : std::vector<RGBColor> GUIParameterTracker::myColors;
      65             : 
      66             : 
      67             : // ===========================================================================
      68             : // method definitions
      69             : // ===========================================================================
      70           0 : GUIParameterTracker::GUIParameterTracker(GUIMainWindow& app,
      71           0 :         const std::string& name)
      72             :     : FXMainWindow(app.getApp(), "Tracker", nullptr, nullptr, DECOR_ALL, 20, 20, 300, 200),
      73           0 :       myApplication(&app) {
      74           0 :     buildToolBar();
      75           0 :     app.addChild(this);
      76           0 :     FXVerticalFrame* glcanvasFrame = new FXVerticalFrame(this, FRAME_SUNKEN | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0, 0, 0, 0, 0);
      77           0 :     myPanel = new GUIParameterTrackerPanel(glcanvasFrame, *myApplication, *this);
      78           0 :     setTitle(name.c_str());
      79           0 :     setIcon(GUIIconSubSys::getIcon(GUIIcon::APP_TRACKER));
      80             : 
      81           0 :     if (myColors.size() == 0) {
      82           0 :         myColors = {RGBColor::BLACK, RGBColor::GREEN, RGBColor::RED, RGBColor::BLUE, RGBColor::ORANGE, RGBColor::CYAN, RGBColor::MAGENTA};
      83             : 
      84             :     }
      85           0 : }
      86             : 
      87             : 
      88           0 : GUIParameterTracker::~GUIParameterTracker() {
      89           0 :     myMultiPlots.erase(this);
      90           0 :     myApplication->removeChild(this);
      91           0 :     for (std::vector<TrackerValueDesc*>::iterator i1 = myTracked.begin(); i1 != myTracked.end(); i1++) {
      92           0 :         delete (*i1);
      93             :     }
      94             :     // deleted by GUINet
      95           0 :     for (std::vector<GLObjectValuePassConnector<double>*>::iterator i2 = myValuePassers.begin(); i2 != myValuePassers.end(); i2++) {
      96           0 :         delete (*i2);
      97             :     }
      98           0 :     delete myToolBarDrag;
      99           0 :     delete myToolBar;
     100           0 : }
     101             : 
     102             : 
     103             : void
     104           0 : GUIParameterTracker::create() {
     105           0 :     FXMainWindow::create();
     106           0 :     myToolBarDrag->create();
     107           0 : }
     108             : 
     109             : 
     110             : void
     111           0 : GUIParameterTracker::buildToolBar() {
     112           0 :     myToolBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
     113           0 :     myToolBar = new FXToolBar(this, myToolBarDrag, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED);
     114           0 :     new FXToolBarGrip(myToolBar, myToolBar, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
     115             :     // save button
     116           0 :     GUIDesigns::buildFXButton(myToolBar, "", "", + TL("Save the data..."),
     117             :                               GUIIconSubSys::getIcon(GUIIcon::SAVE), this, GUIParameterTracker::MID_SAVE, GUIDesignButtonToolbar);
     118             : 
     119             :     // aggregation interval combo
     120           0 :     myAggregationInterval =
     121           0 :         new MFXComboBoxIcon(myToolBar, 8, false, GUIDesignComboBoxVisibleItemsMedium,
     122           0 :                             this, MID_AGGREGATIONINTERVAL, GUIDesignComboBoxStatic);
     123           0 :     myAggregationInterval->appendIconItem("1s");
     124           0 :     myAggregationInterval->appendIconItem("1min");
     125           0 :     myAggregationInterval->appendIconItem("5min");
     126           0 :     myAggregationInterval->appendIconItem("15min");
     127           0 :     myAggregationInterval->appendIconItem("30min");
     128           0 :     myAggregationInterval->appendIconItem("60min");
     129             : 
     130           0 :     myMultiPlot = new FXCheckButton(myToolBar, TL("Multiplot"), this, MID_MULTIPLOT);
     131           0 :     myMultiPlot->setCheck(false);
     132           0 : }
     133             : 
     134             : 
     135             : bool
     136           0 : GUIParameterTracker::addTrackedMultiplot(GUIGlObject& o, ValueSource<double>* src, TrackerValueDesc* newTracked) {
     137             :     bool first = true;
     138           0 :     for (GUIParameterTracker* tr : myMultiPlots) {
     139           0 :         if (first) {
     140             :             first = false;
     141             :         } else {
     142             :             // each Tracker gets its own copy to simplify cleanup
     143           0 :             newTracked = new TrackerValueDesc(newTracked->getName(), RGBColor::BLACK, newTracked->getRecordingBegin(),
     144           0 :                                               STEPS2TIME(newTracked->getAggregationSpan()));
     145           0 :             src = src->copy();
     146             :         }
     147           0 :         tr->addTracked(o, src, newTracked);
     148             :     }
     149           0 :     return myMultiPlots.size() > 0;
     150             : }
     151             : 
     152             : 
     153             : void
     154           0 : GUIParameterTracker::addTracked(GUIGlObject& o, ValueSource<double>* src,
     155             :                                 TrackerValueDesc* newTracked) {
     156           0 :     myTracked.push_back(newTracked);
     157             :     // build connection (is automatically set into an execution map)
     158           0 :     myValuePassers.push_back(new GLObjectValuePassConnector<double>(o, src, newTracked));
     159           0 :     update();
     160           0 : }
     161             : 
     162             : 
     163             : long
     164           0 : GUIParameterTracker::onConfigure(FXObject* sender, FXSelector sel, void* ptr) {
     165           0 :     myPanel->onConfigure(sender, sel, ptr);
     166           0 :     return FXMainWindow::onConfigure(sender, sel, ptr);
     167             : }
     168             : 
     169             : 
     170             : long
     171           0 : GUIParameterTracker::onPaint(FXObject* sender, FXSelector sel, void* ptr) {
     172           0 :     myPanel->onPaint(sender, sel, ptr);
     173           0 :     return FXMainWindow::onPaint(sender, sel, ptr);
     174             : }
     175             : 
     176             : 
     177             : long
     178           0 : GUIParameterTracker::onSimStep(FXObject*, FXSelector, void*) {
     179           0 :     update();
     180           0 :     return 1;
     181             : }
     182             : 
     183             : long
     184           0 : GUIParameterTracker::onCmdChangeAggregation(FXObject*, FXSelector, void*) {
     185           0 :     int index = myAggregationInterval->getCurrentItem();
     186             :     int aggInt = 0;
     187             :     switch (index) {
     188             :         case 0:
     189             :             aggInt = 1;
     190             :             break;
     191             :         case 1:
     192             :             aggInt = 60;
     193             :             break;
     194             :         case 2:
     195             :             aggInt = 60 * 5;
     196             :             break;
     197             :         case 3:
     198             :             aggInt = 60 * 15;
     199             :             break;
     200             :         case 4:
     201             :             aggInt = 60 * 30;
     202             :             break;
     203             :         case 5:
     204             :             aggInt = 60 * 60;
     205             :             break;
     206           0 :         default:
     207           0 :             throw 1;
     208             :     }
     209           0 :     for (TrackerValueDesc* const tvd : myTracked) {
     210           0 :         tvd->setAggregationSpan(TIME2STEPS(aggInt));
     211             :     }
     212           0 :     return 1;
     213             : }
     214             : 
     215             : 
     216             : long
     217           0 : GUIParameterTracker::onCmdSave(FXObject*, FXSelector, void*) {
     218           0 :     FXString file = MFXUtils::getFilename2Write(this, TL("Save Data"), ".csv", GUIIconSubSys::getIcon(GUIIcon::EMPTY), gCurrentFolder);
     219           0 :     if (file == "") {
     220             :         return 1;
     221             :     }
     222             :     try {
     223           0 :         OutputDevice& dev = OutputDevice::getDevice(file.text());
     224             :         // write header
     225             :         std::vector<TrackerValueDesc*>::iterator i;
     226           0 :         dev << "# Time";
     227           0 :         for (i = myTracked.begin(); i != myTracked.end(); ++i) {
     228           0 :             TrackerValueDesc* tvd = *i;
     229           0 :             dev << ';' << tvd->getName();
     230             :         }
     231           0 :         dev << '\n';
     232             :         // count entries
     233             :         int max = 0;
     234           0 :         for (i = myTracked.begin(); i != myTracked.end(); ++i) {
     235           0 :             TrackerValueDesc* tvd = *i;
     236           0 :             int sizei = (int)tvd->getAggregatedValues().size();
     237             :             if (max < sizei) {
     238             :                 max = sizei;
     239             :             }
     240           0 :             tvd->unlockValues();
     241             :         }
     242             :         // write entries
     243           0 :         SUMOTime t = myTracked.empty() ? 0 : myTracked.front()->getRecordingBegin();
     244           0 :         SUMOTime dt = myTracked.empty() ? DELTA_T : myTracked.front()->getAggregationSpan();
     245           0 :         for (int j = 0; j < max; j++) {
     246           0 :             dev << time2string(t);
     247           0 :             for (i = myTracked.begin(); i != myTracked.end(); ++i) {
     248           0 :                 TrackerValueDesc* tvd = *i;
     249           0 :                 dev << ';' << tvd->getAggregatedValues()[j];
     250           0 :                 tvd->unlockValues();
     251             :             }
     252           0 :             dev << '\n';
     253           0 :             t += dt;
     254             :         }
     255           0 :         dev.close();
     256           0 :     } catch (IOError& e) {
     257           0 :         FXMessageBox::error(this, MBOX_OK, TL("Storing failed!"), "%s", e.what());
     258           0 :     }
     259             :     return 1;
     260           0 : }
     261             : 
     262             : 
     263             : long
     264           0 : GUIParameterTracker::onMultiPlot(FXObject*, FXSelector, void*) {
     265           0 :     if (myMultiPlot->getCheck()) {
     266           0 :         myMultiPlots.insert(this);
     267             :     } else {
     268           0 :         myMultiPlots.erase(this);
     269             :     }
     270           0 :     return 1;
     271             : }
     272             : 
     273             : /* -------------------------------------------------------------------------
     274             :  * GUIParameterTracker::GUIParameterTrackerPanel-methods
     275             :  * ----------------------------------------------------------------------- */
     276             : FXDEFMAP(GUIParameterTracker::GUIParameterTrackerPanel) GUIParameterTrackerPanelMap[] = {
     277             :     FXMAPFUNC(SEL_CONFIGURE, 0, GUIParameterTracker::GUIParameterTrackerPanel::onConfigure),
     278             :     FXMAPFUNC(SEL_MOTION,    0, GUIParameterTracker::GUIParameterTrackerPanel::onMouseMove),
     279             :     FXMAPFUNC(SEL_PAINT,     0, GUIParameterTracker::GUIParameterTrackerPanel::onPaint),
     280             : 
     281             : };
     282             : 
     283             : // Macro for the GLTestApp class hierarchy implementation
     284           0 : FXIMPLEMENT(GUIParameterTracker::GUIParameterTrackerPanel, FXGLCanvas, GUIParameterTrackerPanelMap, ARRAYNUMBER(GUIParameterTrackerPanelMap))
     285             : 
     286             : 
     287             : 
     288           0 : GUIParameterTracker::GUIParameterTrackerPanel::GUIParameterTrackerPanel(
     289             :     FXComposite* c, GUIMainWindow& app,
     290           0 :     GUIParameterTracker& parent)
     291           0 :     : FXGLCanvas(c, app.getGLVisual(), app.getBuildGLCanvas(), (FXObject*) nullptr, (FXSelector) 0, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 300, 200),
     292           0 :       myParent(&parent) {}
     293             : 
     294             : 
     295           0 : GUIParameterTracker::GUIParameterTrackerPanel::~GUIParameterTrackerPanel() {}
     296             : 
     297             : 
     298             : void
     299           0 : GUIParameterTracker::GUIParameterTrackerPanel::drawValues() {
     300           0 :     glMatrixMode(GL_PROJECTION);
     301           0 :     glLoadIdentity();
     302           0 :     glMatrixMode(GL_MODELVIEW);
     303           0 :     glLoadIdentity();
     304           0 :     glDisable(GL_TEXTURE_2D);
     305           0 :     for (int i = 0; i < (int)myParent->myTracked.size(); i++) {
     306           0 :         TrackerValueDesc* desc = myParent->myTracked[i];
     307           0 :         glPushMatrix();
     308           0 :         drawValue(*desc, myColors[i % myColors.size()], i);
     309           0 :         glPopMatrix();
     310             :     }
     311           0 : }
     312             : 
     313             : 
     314             : void
     315           0 : GUIParameterTracker::GUIParameterTrackerPanel::drawValue(TrackerValueDesc& desc,
     316             :         const RGBColor& col,
     317             :         int index) {
     318           0 :     const double fontWidth = 0.1 * 300. / myWidthInPixels;
     319           0 :     const double fontHeight = 0.1 * 300. /  myHeightInPixels;
     320           0 :     const bool isMultiPlot = myParent->myTracked.size() > 1;
     321           0 :     const std::vector<double>& values = desc.getAggregatedValues();
     322           0 :     if (values.size() < 2) {
     323             :         // draw name
     324           0 :         glTranslated(-.9, 0.9, 0);
     325           0 :         GLHelper::drawText(desc.getName(), Position((double)index / (double)myParent->myTracked.size(), 0.), 1, fontHeight, col, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     326           0 :         desc.unlockValues();
     327           0 :         return;
     328             :     }
     329             :     //
     330             :     // apply scaling
     331           0 :     GLHelper::pushMatrix();
     332             : 
     333             :     // apply the positiopn offset of the display
     334           0 :     glScaled(0.8, 0.8, 1);
     335             :     // apply value range scaling
     336           0 :     double ys = (double) 2.0 / (double) desc.getRange();
     337           0 :     glScaled(1.0, ys, 1.0);
     338           0 :     glTranslated(-1.0, -desc.getYCenter(), 0);
     339             : 
     340             :     // draw value bounderies
     341             :     // draw minimum boundary
     342           0 :     glBegin(GL_LINES);
     343           0 :     glVertex2d(0, desc.getMin());
     344           0 :     glVertex2d(2.0, desc.getMin());
     345           0 :     glEnd();
     346           0 :     glBegin(GL_LINES);
     347           0 :     glVertex2d(0, desc.getMax());
     348           0 :     glVertex2d(2.0, desc.getMax());
     349           0 :     glEnd();
     350           0 :     GLHelper::setColor(col.changedAlpha(-178));
     351           0 :     for (int a = 1; a < 6; a++) {
     352           0 :         const double yp = desc.getRange() / 6.0 * (double) a + desc.getMin();
     353           0 :         glBegin(GL_LINES);
     354           0 :         glVertex2d(0, yp);
     355           0 :         glVertex2d(2.0, yp);
     356           0 :         glEnd();
     357             :     }
     358             : 
     359           0 :     double latest = 0;
     360           0 :     double mx = (2 * myMouseX / myWidthInPixels - 1) / 0.8 + 1;
     361             :     int mIndex = 0;
     362           0 :     double mouseValue = std::numeric_limits<double>::max();
     363           0 :     latest = values.back();
     364             :     // init values
     365           0 :     const double xStep = 2.0 / (double) values.size();
     366             :     std::vector<double>::const_iterator i = values.begin();
     367           0 :     double yp = (*i);
     368             :     double xp = 0;
     369             :     i++;
     370           0 :     GLHelper::setColor(col);
     371           0 :     for (; i != values.end(); i++) {
     372           0 :         double yn = (*i);
     373           0 :         double xn = xp + xStep;
     374           0 :         if (xp < mx && mx < xn) {
     375           0 :             mouseValue = yp;
     376           0 :             mIndex = (int)(i - values.begin()) - 1;
     377           0 :             glPushMatrix();
     378           0 :             GLHelper::setColor(isMultiPlot ? col.changedBrightness(-40).changedAlpha(-100) : RGBColor::BLUE);
     379           0 :             glTranslated(xn, yn, 0);
     380           0 :             glScaled(20.0 / myWidthInPixels, 10.0 * desc.getRange() / myHeightInPixels, 0);
     381           0 :             GLHelper::drawFilledCircle(1, 8);
     382           0 :             GLHelper::setColor(col);
     383           0 :             glPopMatrix();
     384             :         }
     385           0 :         glBegin(GL_LINES);
     386           0 :         glVertex2d(xp, yp);
     387           0 :         glVertex2d(xn, yn);
     388           0 :         glEnd();
     389             :         yp = yn;
     390             :         xp = xn;
     391             :     }
     392           0 :     desc.unlockValues();
     393           0 :     GLHelper::popMatrix();
     394             : 
     395             :     // draw value bounderies and descriptions
     396           0 :     GLHelper::setColor(col);
     397             : 
     398             :     // draw min time
     399           0 :     SUMOTime beginStep = desc.getRecordingBegin();
     400           0 :     std::string begStr = time2string(beginStep);
     401           0 :     double w = 50 / myWidthInPixels;
     402           0 :     glTranslated(-0.8 - w / 2., -0.88, 0);
     403           0 :     GLHelper::drawText(begStr, Position(0, 0), 1, fontHeight, RGBColor::BLACK, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     404           0 :     glTranslated(0.8 + w / 2., 0.88, 0);
     405             : 
     406             :     // draw max time
     407           0 :     glTranslated(0.75, -0.88, 0);
     408           0 :     GLHelper::drawText(time2string(beginStep + static_cast<SUMOTime>(values.size() * desc.getAggregationSpan())),
     409           0 :                        Position(0, 0), 1, fontHeight, RGBColor::BLACK, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     410           0 :     glTranslated(-0.75, 0.88, 0);
     411             : 
     412             :     // draw min value
     413           0 :     glTranslated(-0.98, -0.82, 0);
     414           0 :     GLHelper::drawText(toString(desc.getMin()), Position(0, index * fontHeight), 1, fontHeight, col, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     415           0 :     glTranslated(0.98, 0.82, 0);
     416             : 
     417             :     // draw max value
     418           0 :     glTranslated(-0.98, 0.78, 0);
     419           0 :     GLHelper::drawText(toString(desc.getMax()), Position(0, -index * fontHeight), 1, fontHeight, col, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     420           0 :     glTranslated(0.98, -0.78, 0);
     421             : 
     422             :     // draw name
     423           0 :     glTranslated(-0.98, .92, 0);
     424           0 :     GLHelper::drawText(desc.getName(), Position((double)index / (double)myParent->myTracked.size(), 0.), 1, fontHeight, col, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     425           0 :     glTranslated(0.98, -.92, 0);
     426             : 
     427             :     // draw current value (with contrasting color)
     428             :     double p = (double) 0.8 -
     429           0 :                ((double) 1.6 / (desc.getMax() - desc.getMin()) * (latest - desc.getMin()));
     430           0 :     glTranslated(-0.98, -(p + .02), 0);
     431           0 :     GLHelper::drawText(toString(latest), Position(isMultiPlot ? 0.1 : 0, 0), 1, fontHeight, isMultiPlot ? col.changedBrightness(50) : RGBColor::RED, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     432           0 :     glTranslated(0.98, p + .02, 0);
     433             : 
     434             :     // draw moused value
     435           0 :     if (mouseValue != std::numeric_limits<double>::max()) {
     436           0 :         p = (double) 0.8 -
     437           0 :             ((double) 1.6 / (desc.getMax() - desc.getMin()) * (mouseValue - desc.getMin()));
     438           0 :         glTranslated(-0.98, -(p + .02), 0);
     439           0 :         GLHelper::drawText(toString(mouseValue), Position(isMultiPlot ? 0.1 : 0, 0), 1, fontHeight, isMultiPlot ? col.changedBrightness(-40) : RGBColor::BLUE, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     440           0 :         glTranslated(0.98, p + .02, 0);
     441             : 
     442           0 :         if (index == 0) {
     443             :             // time is the same for all plots so we only draw it once
     444           0 :             const std::string mouseTime = time2string(beginStep + static_cast<SUMOTime>(mIndex * desc.getAggregationSpan()));
     445           0 :             glTranslated(1.6 * (double)mIndex / (double)values.size() - 0.8, -0.9, 0);
     446           0 :             GLHelper::drawText(mouseTime, Position(0, 0), 1, fontHeight, isMultiPlot ? col.changedBrightness(-40) : RGBColor::BLUE, 0, FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE, fontWidth);
     447             :         }
     448             :     }
     449             : 
     450             : }
     451             : 
     452             : 
     453             : long
     454           0 : GUIParameterTracker::GUIParameterTrackerPanel::onConfigure(FXObject*,
     455             :         FXSelector, void*) {
     456           0 :     if (makeCurrent()) {
     457           0 :         myWidthInPixels = myParent->getWidth();
     458           0 :         myHeightInPixels = myParent->getHeight();
     459           0 :         if (myWidthInPixels != 0 && myHeightInPixels != 0) {
     460           0 :             glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
     461           0 :             glClearColor(1.0, 1.0, 1.0, 1);
     462           0 :             glDisable(GL_DEPTH_TEST);
     463           0 :             glDisable(GL_LIGHTING);
     464           0 :             glDisable(GL_LINE_SMOOTH);
     465           0 :             glEnable(GL_BLEND);
     466           0 :             glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     467           0 :             glEnable(GL_ALPHA_TEST);
     468           0 :             glDisable(GL_COLOR_MATERIAL);
     469           0 :             glLineWidth(1);
     470           0 :             glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
     471             :         }
     472           0 :         makeNonCurrent();
     473             :     }
     474           0 :     return 1;
     475             : }
     476             : 
     477             : 
     478             : long
     479           0 : GUIParameterTracker::GUIParameterTrackerPanel::onPaint(FXObject*,
     480             :         FXSelector, void*) {
     481           0 :     if (!isEnabled()) {
     482             :         return 1;
     483             :     }
     484           0 :     if (makeCurrent()) {
     485           0 :         myWidthInPixels = getWidth();
     486           0 :         myHeightInPixels = getHeight();
     487           0 :         if (myWidthInPixels != 0 && myHeightInPixels != 0) {
     488           0 :             glViewport(0, 0, myWidthInPixels - 1, myHeightInPixels - 1);
     489           0 :             glClearColor(1.0, 1.0, 1.0, 1);
     490           0 :             glDisable(GL_DEPTH_TEST);
     491           0 :             glDisable(GL_LIGHTING);
     492           0 :             glDisable(GL_LINE_SMOOTH);
     493           0 :             glEnable(GL_BLEND);
     494           0 :             glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     495           0 :             glEnable(GL_ALPHA_TEST);
     496           0 :             glDisable(GL_COLOR_MATERIAL);
     497           0 :             glLineWidth(1);
     498           0 :             glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
     499             :             // draw
     500           0 :             glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
     501           0 :             drawValues();
     502           0 :             swapBuffers();
     503             :         }
     504           0 :         makeNonCurrent();
     505             :     }
     506             :     return 1;
     507             : }
     508             : 
     509             : 
     510             : long
     511           0 : GUIParameterTracker::GUIParameterTrackerPanel::onMouseMove(FXObject*, FXSelector, void* ptr) {
     512             :     FXEvent* event = (FXEvent*) ptr;
     513           0 :     myMouseX = event->win_x;
     514           0 :     update();
     515           0 :     return 1;
     516             : }
     517             : 
     518             : 
     519             : 
     520             : /****************************************************************************/

Generated by: LCOV version 1.14