Path: blob/main/src/netedit/elements/additional/GNERerouter.h
193874 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 GNERerouter.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"23#include "GNEAdditionalSquared.h"2425// ===========================================================================26// class declarations27// ===========================================================================2829class GNEEdge;3031// ===========================================================================32// class definitions33// ===========================================================================3435class GNERerouter : public GNEAdditional, public GNEAdditionalSquared, public Parameterised {3637public:38/// @brief default Constructor39GNERerouter(GNENet* net);4041/**@brief Constructor42* @param[in] id The storage of gl-ids to get the one for this lane representation from43* @param[in] net pointer to GNENet of this additional element belongs44* @param[in] fileBucket file in which this element is stored45* @param[in] pos position (center) of the rerouter in the map46* @param[in] name Rerouter name47* @param[in] probability The probability for vehicle rerouting48* @param[in] off Whether the router should be inactive initially49* @param[in] parameters generic parameters50*/51GNERerouter(const std::string& id, GNENet* net, FileBucket* fileBucket, const Position& pos, const std::string& name,52double probability, bool off, bool optional, SUMOTime timeThreshold, const std::vector<std::string>& vTypes,53const Parameterised::Map& parameters);5455/// @brief Destructor56~GNERerouter();5758/// @brief methods to retrieve the elements linked to this rerouter59/// @{6061/// @brief get GNEMoveElement associated with this rerouter62GNEMoveElement* getMoveElement() const override;6364/// @brief get parameters associated with this rerouter65Parameterised* getParameters() override;6667/// @brief get parameters associated with this rerouter (constant)68const Parameterised* getParameters() const override;6970/// @}7172/// @brief open GNERerouterDialog73void openAdditionalDialog(FXWindow* restoringFocusWindow) override;7475/// @name members and functions relative to write additionals into XML76/// @{7778/**@brief write additional element into a xml file79* @param[in] device device in which write parameters of additional element80*/81void writeAdditional(OutputDevice& device) const override;8283/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)84bool isAdditionalValid() const override;8586/// @brief return a string with the current additional problem (must be reimplemented in all detector children)87std::string getAdditionalProblem() const override;8889/// @brief fix additional problem (must be reimplemented in all detector children)90void fixAdditionalProblem() override;9192/// @}9394/// @name Function related with contour drawing95/// @{9697/// @brief check if draw move contour (red)98bool checkDrawMoveContour() const override;99100/// @}101102/// @name Functions related with geometry of element103/// @{104105/// @brief update pre-computed geometry information106void updateGeometry() override;107108/// @brief Returns position of additional in view109Position getPositionInView() const override;110111/// @brief update centering boundary (implies change in RTREE)112void updateCenteringBoundary(const bool updateGrid) override;113114/// @brief split geometry115void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;116117/// @}118119/// @name inherited from GUIGlObject120/// @{121122/// @brief Returns the name of the parent object123/// @return This object's parent id124std::string getParentName() const override;125126/**@brief Draws the object127* @param[in] s The settings for the current view (may influence drawing)128* @see GUIGlObject::drawGL129*/130void drawGL(const GUIVisualizationSettings& s) const override;131132/// @}133134/// @name inherited from GNEAttributeCarrier135/// @{136137/* @brief method for getting the Attribute of an XML key138* @param[in] key The attribute key139* @return string with the value associated to key140*/141std::string getAttribute(SumoXMLAttr key) const override;142143/* @brief method for getting the Attribute of an XML key in double format144* @param[in] key The attribute key145* @return double with the value associated to key146*/147double getAttributeDouble(SumoXMLAttr key) const override;148149/* @brief method for getting the Attribute of an XML key in position format150* @param[in] key The attribute key151* @return position with the value associated to key152*/153Position getAttributePosition(SumoXMLAttr key) const override;154155/* @brief method for getting the Attribute of an XML key in positionVector format156* @param[in] key The attribute key157* @return positionVector with the value associated to key158*/159PositionVector getAttributePositionVector(SumoXMLAttr key) const override;160161/* @brief method for setting the attribute and letting the object perform additional changes162* @param[in] key The attribute key163* @param[in] value The new value164* @param[in] undoList The undoList on which to register changes165*/166void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;167168/* @brief method for checking if the key and their correspond attribute are valids169* @param[in] key The attribute key170* @param[in] value The value associated to key key171* @return true if the value is valid, false in other case172*/173bool isValid(SumoXMLAttr key, const std::string& value) override;174175/// @brief get PopPup ID (Used in AC Hierarchy)176std::string getPopUpID() const override;177178/// @brief get Hierarchy Name (Used in AC Hierarchy)179std::string getHierarchyName() const override;180181/// @}182183protected:184/// @brief probability of rerouter185double myProbability = 0;186187/// @brief attribute to enable or disable inactive initially188bool myOff = false;189190/// @brief attribute to enable or disable request trigger191bool myOptional = false;192193/// @brief attribute to configure activation time threshold194SUMOTime myTimeThreshold = 0;195196/// @brief optional vehicle types for restricting the rerouter197std::vector<std::string> myVTypes;198199private:200/// @brief set attribute after validation201void setAttribute(SumoXMLAttr key, const std::string& value) override;202203/// @brief rebuild Rerouter Symbols204void rebuildRerouterSymbols(const std::string& value, GNEUndoList* undoList);205206/// @brief Invalidated copy constructor.207GNERerouter(const GNERerouter&) = delete;208209/// @brief Invalidated assignment operator.210GNERerouter& operator=(const GNERerouter&) = delete;211};212213214