Path: blob/main/src/utils/gui/tracker/TrackerValueDesc.h
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file TrackerValueDesc.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Sept 200217///18// Representation of a timeline of floats with their names and moments19/****************************************************************************/20#pragma once21#include <config.h>2223#include <utils/foxtools/fxheader.h>24#include <string>25#include <vector>26#include <utils/common/RGBColor.h>27#include <utils/common/SUMOTime.h>28#include <utils/common/ValueRetriever.h>293031// ===========================================================================32// class definitions33// ===========================================================================34/**35* @class TrackerValueDesc36* @brief Representation of a timeline of floats with their names and moments37*38* This class contains the information needed to display a time line of39* float values.40*/41class TrackerValueDesc : public ValueRetriever<double> {42public:43/// Constructor44TrackerValueDesc(const std::string& name, const RGBColor& col,45SUMOTime recordBegin,46double aggregationSeconds);4748/// Destructor49~TrackerValueDesc();5051/// returns the maximum value range52double getRange() const;5354/// Returns the values minimum55double getMin() const;5657/// Returns the values maximum58double getMax() const;5960/// Returns the center of the value61double getYCenter() const;6263/// Returns the color to use to display the value64const RGBColor& getColor() const;6566/** @brief returns the vector of collected values67The values will be locked - no further addition will be perfomed until68the method "unlockValues" will be called */69const std::vector<double>& getValues();7071/** @brief returns the vector of aggregated values72The values will be locked - no further addition will be perfomed until73the method "unlockValues" will be called */74const std::vector<double>& getAggregatedValues();7576/// Returns the name of the value77const std::string& getName() const;7879/// Adds a new value to the list80void addValue(double value);8182/// Releases the locking after the values have been drawn83void unlockValues();8485/// set the aggregation amount86void setAggregationSpan(SUMOTime as);8788/// get the aggregation amount89SUMOTime getAggregationSpan() const;9091/// Returns the timestep the recording started92SUMOTime getRecordingBegin() const;939495private:96/// The name of the value97std::string myName;9899/// The color to use when the value is set as "active"100RGBColor myActiveCol;101102/// The color to use when the value is set as "inactive"103RGBColor myInactiveCol;104105/// Values collected106std::vector<double> myValues;107108/// Collected values in their aggregated form109std::vector<double> myAggregatedValues;110111/// The minimum and the maximum of the value112double myMin, myMax;113114// Mutex to avoid parallel drawing and insertion of new items115FXMutex myLock;116117/// The aggregation interval in simulation steps118int myAggregationInterval;119120/// Values like this shall not be counted on aggregation121double myInvalidValue;122123/// Counter for valid numbers within the current aggregation interval124int myValidNo;125126/// The time step the values are added from127SUMOTime myRecordingBegin;128129/// Temporary storage for the last aggregation interval130double myTmpLastAggValue;131132};133134135