LCOV - code coverage report
Current view: top level - src/utils/gui/tracker - GUIParameterTracker.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 4 0
Test Date: 2024-11-22 15:46:21 Functions: 0.0 % 2 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.h
      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              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <vector>
      26              : #include <utils/foxtools/MFXComboBoxIcon.h>
      27              : // fx3d includes windows.h so we need to guard against macro pollution
      28              : #ifdef WIN32
      29              : #define NOMINMAX
      30              : #endif
      31              : #include <fx3d.h>
      32              : #ifdef WIN32
      33              : #undef NOMINMAX
      34              : #endif
      35              : #include <utils/gui/globjects/GUIGlObject.h>
      36              : #include <utils/gui/div/GLObjectValuePassConnector.h>
      37              : #include "TrackerValueDesc.h"
      38              : 
      39              : 
      40              : // ===========================================================================
      41              : // class definitions
      42              : // ===========================================================================
      43              : /** @class GUIParameterTracker
      44              :  * @brief A window which displays the time line of one (or more) value(s)
      45              :  */
      46              : class GUIParameterTracker : public FXMainWindow {
      47            0 :     FXDECLARE(GUIParameterTracker)
      48              : public:
      49              :     /// @brief callback-enumerations
      50              :     enum {
      51              :         /// @brief Change aggregation interval
      52              :         MID_AGGREGATIONINTERVAL = FXMainWindow::ID_LAST,
      53              :         /// @brief Save the current values
      54              :         MID_SAVE,
      55              :         /// @brief toggle multiplot
      56              :         MID_MULTIPLOT,
      57              :         /// @brief end-of-enum
      58              :         ID_LAST
      59              :     };
      60              : 
      61              : 
      62              :     /** @brief Constructor (the tracker is empty)
      63              :      * @param[in] app The main application window
      64              :      * @param[in] name The title of the tracker
      65              :      */
      66              :     GUIParameterTracker(GUIMainWindow& app, const std::string& name);
      67              : 
      68              : 
      69              :     /// @brief Destructor
      70              :     ~GUIParameterTracker();
      71              : 
      72              : 
      73              :     /// @brief Creates the window
      74              :     void create();
      75              : 
      76              : 
      77              :     /** @brief Adds a further time line to display
      78              :      * @param[in] o The object to get values from
      79              :      * @param[in] src The value source of the object
      80              :      * @param[in] newTracked The description of the tracked value
      81              :      */
      82              :     void addTracked(GUIGlObject& o, ValueSource<double>* src,
      83              :                     TrackerValueDesc* newTracked);
      84              : 
      85              : 
      86              :     /// @name FOX-callbacks
      87              :     /// @{
      88              : 
      89              :     /// @brief Called on window resizing
      90              :     long onConfigure(FXObject*, FXSelector, void*);
      91              : 
      92              :     /// @brief Called if the window shall be repainted
      93              :     long onPaint(FXObject*, FXSelector, void*);
      94              : 
      95              :     /// @brief Called on a simulation step
      96              :     long onSimStep(FXObject*, FXSelector, void*);
      97              : 
      98              :     /// @brief Called on a simulation step
      99              :     long onMultiPlot(FXObject*, FXSelector, void*);
     100              : 
     101              :     /// @brief Called when the aggregation interval (combo) has been changed
     102              :     long onCmdChangeAggregation(FXObject*, FXSelector, void*);
     103              : 
     104              :     /// @brief Called when the data shall be saved
     105              :     long onCmdSave(FXObject*, FXSelector, void*);
     106              :     /// @}
     107              : 
     108              : 
     109              :     /// @brief all value source to multiplot trackers
     110              :     static bool addTrackedMultiplot(GUIGlObject& o, ValueSource<double>* src, TrackerValueDesc* newTracked);
     111              : 
     112              : public:
     113              :     /**
     114              :      * @class GUIParameterTrackerPanel
     115              :      * This panel lies within the GUIParameterTracker being the main widget.
     116              :      * It is the widget responsible for displaying the information while
     117              :      * GUIParameterTracker only provides window-facilities.
     118              :      */
     119              :     class GUIParameterTrackerPanel : public FXGLCanvas {
     120            0 :         FXDECLARE(GUIParameterTrackerPanel)
     121              :     public:
     122              :         /** @brief Constructor
     123              :          * @param[in] c The parent composite
     124              :          * @param[in] app The main window
     125              :          * @param[in] parent The parent tracker window this view belongs to
     126              :          */
     127              :         GUIParameterTrackerPanel(FXComposite* c, GUIMainWindow& app,
     128              :                                  GUIParameterTracker& parent);
     129              : 
     130              :         /// @brief Destructor
     131              :         ~GUIParameterTrackerPanel();
     132              : 
     133              :         /// @brief needed to update
     134              :         friend class GUIParameterTracker;
     135              : 
     136              : 
     137              :         /// @name FOX-callbacks
     138              :         /// @{
     139              : 
     140              :         /// Called on window resizing
     141              :         long onConfigure(FXObject*, FXSelector, void*);
     142              : 
     143              :         /// Called if the window shall be repainted
     144              :         long onPaint(FXObject*, FXSelector, void*);
     145              : 
     146              :         /// @brief called on mouse movement (for updating moused value)
     147              :         long onMouseMove(FXObject*, FXSelector, void*);
     148              : 
     149              :         /// @}
     150              : 
     151              : 
     152              :     private:
     153              :         /** @brief Draws all values
     154              :          */
     155              :         void drawValues();
     156              : 
     157              :         /** @brief Draws a single value
     158              :          * @param[in] desc The tracked values to draw
     159              :          * @param[in] index Mulitplot index
     160              :          */
     161              :         void drawValue(TrackerValueDesc& desc, const RGBColor& col, int index);
     162              : 
     163              :     private:
     164              :         /// @brief The parent window
     165              :         GUIParameterTracker* myParent;
     166              : 
     167              :         /// @brief the sizes of the window
     168              :         int myWidthInPixels, myHeightInPixels;
     169              : 
     170              :         /// @brief latest mouse position
     171              :         double myMouseX;
     172              : 
     173              :     protected:
     174            0 :         FOX_CONSTRUCTOR(GUIParameterTrackerPanel)
     175              :     };
     176              : 
     177              : public:
     178              :     /// @brief the panel may change some things
     179              :     friend class GUIParameterTrackerPanel;
     180              : 
     181              : private:
     182              :     /// @brief Builds the tool bar
     183              :     void buildToolBar();
     184              : 
     185              : protected:
     186              :     /// @brief The main application
     187              :     GUIMainWindow* myApplication;
     188              : 
     189              :     /// @brief The list of tracked values
     190              :     std::vector<TrackerValueDesc*> myTracked;
     191              : 
     192              :     /// @brief The panel to display the values in
     193              :     GUIParameterTrackerPanel* myPanel;
     194              : 
     195              :     /// @brief The value sources
     196              :     std::vector<GLObjectValuePassConnector<double>*> myValuePassers;
     197              : 
     198              :     /// @brief for some menu detaching fun
     199              :     FXToolBarShell* myToolBarDrag;
     200              : 
     201              :     /// @brief A combo box to select an aggregation interval
     202              :     MFXComboBoxIcon* myAggregationInterval;
     203              : 
     204              :     /// @brief The simulation delay
     205              :     FXdouble myAggregationDelay;
     206              : 
     207              :     /// @brief The tracker tool bar
     208              :     FXToolBar* myToolBar;
     209              : 
     210              :     /// @brief Whether phase names shall be printed instead of indices
     211              :     FXCheckButton* myMultiPlot;
     212              : 
     213              :     /// @brief all trackers that are opened for plotting multiple values
     214              :     static std::set<GUIParameterTracker*> myMultiPlots;
     215              :     static std::vector<RGBColor> myColors;
     216              : 
     217              : protected:
     218            0 :     FOX_CONSTRUCTOR(GUIParameterTracker)
     219              : 
     220              : };
        

Generated by: LCOV version 2.0-1