Path: blob/main/src/netedit/elements/demand/GNERouteRef.h
185790 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2016-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 GNERouteRef.h14/// @author Pablo Alvarez Lopez15/// @date April 202516///17// A class for route references18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDemandElement.h"2324// ===========================================================================25// class declarations26// ===========================================================================2728class GNERouteDistribution;2930// ===========================================================================31// class definitions32// ===========================================================================3334class GNERouteRef : public GNEDemandElement {3536public:37/// @brief default constructor38GNERouteRef(GNENet* net);3940/// @brief parameter constructor41GNERouteRef(GNEDemandElement* distributionParent, GNEDemandElement* routeParent);4243/// @brief parameter constructor44GNERouteRef(GNEDemandElement* distributionParent, GNEDemandElement* routeParent, const double probability);4546/// @brief destructor47~GNERouteRef();4849/// @brief methods to retrieve the elements linked to this routeRef50/// @{5152/// @brief get GNEMoveElement associated with this routeRef53GNEMoveElement* getMoveElement() const override;5455/// @brief get parameters associated with this routeRef56Parameterised* getParameters() override;5758/// @brief get parameters associated with this routeRef (constant)59const Parameterised* getParameters() const override;6061/// @}6263/**@brief write demand element element into a xml file64* @param[in] device device in which write parameters of demand element element65*/66void writeDemandElement(OutputDevice& device) const override;6768/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)69Problem isDemandElementValid() const override;7071/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)72std::string getDemandElementProblem() const override;7374/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)75void fixDemandElementProblem() override;7677/// @name members and functions relative to elements common to all demand elements78/// @{79/// @brief obtain VClass related with this demand element80SUMOVehicleClass getVClass() const override;8182/// @brief get color83const RGBColor& getColor() const override;8485/// @}8687/// @name Functions related with geometry of element88/// @{89/// @brief update pre-computed geometry information90void updateGeometry() override;9192/// @brief Returns position of additional in view93Position getPositionInView() const override;94/// @}9596/// @name inherited from GUIGlObject97/// @{9899/**@brief Returns an own popup-menu100*101* @param[in] app The application needed to build the popup-menu102* @param[in] parent The parent window needed to build the popup-menu103* @return The built popup-menu104* @see GUIGlObject::getPopUpMenu105*/106GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;107108/**@brief Returns the name of the parent object109* @return This object's parent id110*/111std::string getParentName() const override;112113/// @brief return exaggeration associated with this GLObject114double getExaggeration(const GUIVisualizationSettings& s) const override;115116/**@brief Returns the boundary to which the view shall be centered in order to show the object117* @return The boundary the object is within118*/119Boundary getCenteringBoundary() const override;120121/// @brief split geometry122void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;123124/**@brief Draws the object125* @param[in] s The settings for the current view (may influence drawing)126* @see GUIGlObject::drawGL127*/128void drawGL(const GUIVisualizationSettings& s) const override;129130/// @}131132/// @name inherited from GNEPathElement133/// @{134135/// @brief compute pathElement136void computePathElement() override;137138/**@brief Draws partial object over lane139* @param[in] s The settings for the current view (may influence drawing)140* @param[in] segment lane segment141* @param[in] offsetFront front offset142*/143void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;144145/**@brief Draws partial object over junction146* @param[in] s The settings for the current view (may influence drawing)147* @param[in] segment junction segment148* @param[in] offsetFront front offset149*/150void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;151152/// @brief get first path lane153GNELane* getFirstPathLane() const override;154155/// @brief get last path lane156GNELane* getLastPathLane() const override;157/// @}158159/// @brief inherited from GNEAttributeCarrier160/// @{161/* @brief method for getting the Attribute of an XML key162* @param[in] key The attribute key163* @return string with the value associated to key164*/165std::string getAttribute(SumoXMLAttr key) const override;166167/* @brief method for getting the Attribute of an XML key in double format168* @param[in] key The attribute key169* @return double with the value associated to key170*/171double getAttributeDouble(SumoXMLAttr key) const override;172173/* @brief method for getting the Attribute of an XML key in position format174* @param[in] key The attribute key175* @return position with the value associated to key176*/177Position getAttributePosition(SumoXMLAttr key) const override;178179/* @brief method for check if the value for certain attribute is set180* @param[in] key The attribute key181*/182bool isAttributeEnabled(SumoXMLAttr key) const override;183184/* @brief method for setting the attribute and letting the object perform additional changes185* @param[in] key The attribute key186* @param[in] value The new value187* @param[in] undoList The undoList on which to register changes188* @param[in] net optionally the GNENet to inform about gui updates189*/190void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;191192/* @brief method for setting the attribute and letting the object perform additional changes193* @param[in] key The attribute key194* @param[in] value The new value195* @param[in] undoList The undoList on which to register changes196*/197bool isValid(SumoXMLAttr key, const std::string& value) override;198199/* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)200* @param[in] key The attribute key201*/202bool isAttributeComputed(SumoXMLAttr key) const override;203204/// @brief get PopPup ID (Used in AC Hierarchy)205std::string getPopUpID() const override;206207/// @brief get Hierarchy Name (Used in AC Hierarchy)208std::string getHierarchyName() const override;209210/// @}211212protected:213/// @brief probability214double myProbability = INVALID_DOUBLE;215216private:217/// @brief method for setting the attribute and nothing else218void setAttribute(SumoXMLAttr key, const std::string& value) override;219220/// @brief Invalidated copy constructor.221GNERouteRef(GNERouteRef*) = delete;222223/// @brief Invalidated assignment operator.224GNERouteRef& operator=(GNERouteRef*) = delete;225};226227228