Path: blob/main/src/netedit/elements/additional/GNEDestProbReroute.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 GNEDestProbReroute.h14/// @author Pablo Alvarez Lopez15/// @date Jan 201716///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"2324// ===========================================================================25// class declarations26// ===========================================================================2728class GNEEdge;29class GNERerouterInterval;30class GNERerouterIntervalDialog;3132// ===========================================================================33// class definitions34// ===========================================================================3536class GNEDestProbReroute : public GNEAdditional, public Parameterised {3738public:39/// @brief constructor40GNEDestProbReroute(GNENet* net);4142/// @brief constructor43GNEDestProbReroute(GNEAdditional* rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability);4445/// @brief destructor46~GNEDestProbReroute();4748/**@brief get move operation49* @note returned GNEMoveOperation can be nullptr50*/51GNEMoveOperation* getMoveOperation();5253/// @name members and functions relative to write additionals into XML54/// @{5556/**@brief write additional element into a xml file57* @param[in] device device in which write parameters of additional element58*/59void writeAdditional(OutputDevice& device) const;6061/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)62bool isAdditionalValid() const;6364/// @brief return a string with the current additional problem (must be reimplemented in all detector children)65std::string getAdditionalProblem() const;6667/// @brief fix additional problem (must be reimplemented in all detector children)68void fixAdditionalProblem();6970/// @}7172/// @name Function related with contour drawing73/// @{7475/// @brief check if draw move contour (red)76bool checkDrawMoveContour() const;7778/// @}7980/// @name Functions related with geometry of element81/// @{8283/// @brief update pre-computed geometry information84void updateGeometry();8586/// @brief Returns position of additional in view87Position getPositionInView() const;8889/// @brief update centering boundary (implies change in RTREE)90void updateCenteringBoundary(const bool updateGrid);9192/// @brief split geometry93void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);9495/// @}9697/// @name inherited from GUIGlObject98/// @{99100/**@brief Returns the name of the parent object101* @return This object's parent id102*/103std::string getParentName() const;104105/**@brief Draws the object106* @param[in] s The settings for the current view (may influence drawing)107* @see GUIGlObject::drawGL108*/109void drawGL(const GUIVisualizationSettings& s) const;110111/// @}112113/// @name inherited from GNEAttributeCarrier114/// @{115116/* @brief method for getting the Attribute of an XML key117* @param[in] key The attribute key118* @return string with the value associated to key119*/120std::string getAttribute(SumoXMLAttr key) const;121122/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)123* @param[in] key The attribute key124* @return double with the value associated to key125*/126double getAttributeDouble(SumoXMLAttr key) const;127128/// @brief get parameters map129const Parameterised::Map& getACParametersMap() const;130131/* @brief method for setting the attribute and letting the object perform additional changes132* @param[in] key The attribute key133* @param[in] value The new value134* @param[in] undoList The undoList on which to register changes135*/136void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);137138/* @brief method for checking if the key and their correspond attribute are valids139* @param[in] key The attribute key140* @param[in] value The value associated to key key141* @return true if the value is valid, false in other case142*/143bool isValid(SumoXMLAttr key, const std::string& value);144145/// @brief get PopPup ID (Used in AC Hierarchy)146std::string getPopUpID() const;147148/// @brief get Hierarchy Name (Used in AC Hierarchy)149std::string getHierarchyName() const;150151/// @}152153protected:154/// @brief id of new edge destination155GNEEdge* myNewEdgeDestination;156157/// @brief probability with which a vehicle will use the given edge as destination158double myProbability;159160private:161/// @brief set attribute after validation162void setAttribute(SumoXMLAttr key, const std::string& value);163164/// @brief set move shape165void setMoveShape(const GNEMoveResult& moveResult);166167/// @brief commit move shape168void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);169170/// @brief Invalidated copy constructor.171GNEDestProbReroute(const GNEDestProbReroute&) = delete;172173/// @brief Invalidated assignment operator.174GNEDestProbReroute& operator=(const GNEDestProbReroute&) = delete;175};176177178