Path: blob/main/src/netedit/elements/additional/GNECalibrator.h
194218 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 GNECalibrator.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17// Calibrator over edge or lane18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"2324// ===========================================================================25// class declaration26// ===========================================================================2728class GNERouteProbe;29class GNECalibratorFlow;30class GNERoute;3132// ===========================================================================33// class definitions34// ===========================================================================3536class GNECalibrator : public GNEAdditional, public Parameterised {3738public:39/// @brief Default constructor40GNECalibrator(SumoXMLTag tag, GNENet* net);4142/**@brief Constructor using edge43* @param[in] id The storage of gl-ids to get the one for this lane representation from44* @param[in] net pointer to GNENet of this additional element belongs45* @param[in] fileBucket file in which this element is stored46* @param[in] edge Edge of this calibrator belongs47* @param[in] pos position of the calibrator on the edge (Currently not used)48* @param[in] frequency the aggregation interval in which to calibrate the flows49* @param[in] name Calibrator name50* @param[in] output The output file for writing calibrator information51* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming52* @param[in] vTypes space separated list of vehicle type ids to consider53* @param[in] parameters generic parameters54*/55GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,56const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);5758/**@brief Constructor using edge and routeProbe59* @param[in] id The storage of gl-ids to get the one for this lane representation from60* @param[in] net pointer to GNENet of this additional element belongs61* @param[in] fileBucket file in which this element is stored62* @param[in] edge Edge of this calibrator belongs63* @param[in] pos position of the calibrator on the edge (Currently not used)64* @param[in] frequency the aggregation interval in which to calibrate the flows65* @param[in] name Calibrator name66* @param[in] output The output file for writing calibrator information67* @param[in] routeProbe route probe vinculated with this calibrator68* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming69* @param[in] vTypes space separated list of vehicle type ids to consider70* @param[in] parameters generic parameters71*/72GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,73const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);7475/**@brief Constructor using lane76* @param[in] id The storage of gl-ids to get the one for this lane representation from77* @param[in] net pointer to GNENet of this additional element belongs78* @param[in] fileBucket file in which this element is stored79* @param[in] lane Lane of this calibrator belongs80* @param[in] pos position of the calibrator on the edge (Currently not used)81* @param[in] frequency the aggregation interval in which to calibrate the flows82* @param[in] name Calibrator name83* @param[in] output The output file for writing calibrator information84* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming85* @param[in] vTypes space separated list of vehicle type ids to consider86* @param[in] parameters generic parameters87*/88GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,89const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);9091/**@brief Constructor using lane and routeProbe92* @param[in] id The storage of gl-ids to get the one for this lane representation from93* @param[in] net pointer to GNENet of this additional element belongs94* @param[in] fileBucket file in which this element is stored95* @param[in] lane Lane of this calibrator belongs96* @param[in] pos position of the calibrator on the edge (Currently not used)97* @param[in] frequency the aggregation interval in which to calibrate the flows98* @param[in] name Calibrator name99* @param[in] routeProbe route probe vinculated with this calibrator100* @param[in] output The output file for writing calibrator information101* @param[in] jamThreshold A threshold value to detect and clear unexpected jamming102* @param[in] vTypes space separated list of vehicle type ids to consider103* @param[in] parameters generic parameters104*/105GNECalibrator(const std::string& id, GNENet* net, FileBucket* fileBucket, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,106const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters);107108/// @brief Destructor109~GNECalibrator();110111/// @brief methods to retrieve the elements linked to this calibrator112/// @{113114/// @brief get GNEMoveElement associated with this calibrator115GNEMoveElement* getMoveElement() const override;116117/// @brief get parameters associated with this calibrator118Parameterised* getParameters() override;119120/// @brief get parameters associated with this calibrator121const Parameterised* getParameters() const override;122123/// @}124125/// @name members and functions relative to write additionals into XML126/// @{127128/**@brief write additional element into a xml file129* @param[in] device device in which write parameters of additional element130*/131void writeAdditional(OutputDevice& device) const override;132133/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)134bool isAdditionalValid() const override;135136/// @brief return a string with the current additional problem (must be reimplemented in all detector children)137std::string getAdditionalProblem() const override;138139/// @brief fix additional problem (must be reimplemented in all detector children)140void fixAdditionalProblem() override;141142/// @}143144/// @name Function related with contour drawing145/// @{146147/// @brief check if draw move contour (red)148bool checkDrawMoveContour() const override;149150/// @}151152/// @brief open Calibrator Dialog153void openAdditionalDialog(FXWindow* restoringFocusWindow) override;154155/// @name Functions related with geometry of element156/// @{157158/// @brief update pre-computed geometry information159void updateGeometry() override;160161/// @brief Returns position of additional in view162Position getPositionInView() const override;163164/// @brief update centering boundary (implies change in RTREE)165void updateCenteringBoundary(const bool updateGrid) override;166167/// @brief split geometry168void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;169170/// @}171172/// @name inherited from GUIGlObject173/// @{174175/**@brief Returns the name of the parent object176* @return This object's parent id177*/178std::string getParentName() const override;179180/**@brief Draws the object181* @param[in] s The settings for the current view (may influence drawing)182* @see GUIGlObject::drawGL183*/184void drawGL(const GUIVisualizationSettings& s) const override;185186/// @}187188/// @name inherited from GNEAttributeCarrier189/// @{190191/* @brief method for getting the Attribute of an XML key192* @param[in] key The attribute key193* @return string with the value associated to key194*/195std::string getAttribute(SumoXMLAttr key) const override;196197/* @brief method for getting the Attribute of an XML key in double format198* @param[in] key The attribute key199* @return double with the value associated to key200*/201double getAttributeDouble(SumoXMLAttr key) const override;202203/* @brief method for getting the Attribute of an XML key in position format204* @param[in] key The attribute key205* @return position with the value associated to key206*/207Position getAttributePosition(SumoXMLAttr key) const override;208209/* @brief method for getting the Attribute of an XML key in positionVector format210* @param[in] key The attribute key211* @return positionVector with the value associated to key212*/213PositionVector getAttributePositionVector(SumoXMLAttr key) const override;214215/* @brief method for setting the attribute and letting the object perform additional changes216* @param[in] key The attribute key217* @param[in] value The new value218* @param[in] undoList The undoList on which to register changes219*/220void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;221222/* @brief method for checking if the key and their correspond attribute are valids223* @param[in] key The attribute key224* @param[in] value The value associated to key key225* @return true if the value is valid, false in other case226*/227bool isValid(SumoXMLAttr key, const std::string& value) override;228229/// @brief get PopPup ID (Used in AC Hierarchy)230std::string getPopUpID() const override;231232/// @brief get Hierarchy Name (Used in AC Hierarchy)233std::string getHierarchyName() const override;234235/// @}236237protected:238/// @brief position over Lane239double myPositionOverLane = 0;240241/// @brief Frequency of calibrator242SUMOTime myFrequency = 0;243244/// @brief output of calibrator245std::string myOutput;246247/// @brief jamThreshold248double myJamThreshold = 0;249250/// @brief vTypes251std::vector<std::string> myVTypes;252253/// @brief edge calibrator geometries254std::vector<GUIGeometry> myEdgeCalibratorGeometries;255256/// @brief edge calibrator contours257std::vector<GNEContour*>* myEdgeCalibratorContours;258259private:260/// @brief draw calibrator symbol261void drawCalibratorSymbol(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,262const double exaggeration, const Position& pos, const double rot,263const int symbolIndex) const;264265/// @brief set attribute after validation266void setAttribute(SumoXMLAttr key, const std::string& value) override;267268/// @brief Invalidated copy constructor.269GNECalibrator(const GNECalibrator&) = delete;270271/// @brief Invalidated assignment operator.272GNECalibrator& operator=(const GNECalibrator&) = delete;273};274275276