/****************************************************************************/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 GNERide.h14/// @author Pablo Alvarez Lopez15/// @date Jun 201916///17// A class for visualizing rides in Netedit18/****************************************************************************/19#pragma once20#include <config.h>21#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>2223#include "GNEDemandElement.h"24#include "GNEDemandElementPlan.h"2526// ===========================================================================27// class declarations28// ===========================================================================2930class GNEEdge;31class GNEConnection;32class GNEVehicle;3334// ===========================================================================35// class definitions36// ===========================================================================3738class GNERide : public GNEDemandElement, public GNEDemandElementPlan {3940public:41/// @brief default constructor42GNERide(SumoXMLTag tag, GNENet* net);4344/**@brief constructor called in buildRide45* @param[in] tag personTrip tag46* @param[in] personParent person parent47* @param[in] planParameters plan parameters48* @param[in] lines list of lines49* @param[in] group group50*/51GNERide(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,52const double arrivalPosition, const std::vector<std::string>& lines, const std::string& group);5354/// @brief destructor55~GNERide();5657/// @brief methods to retrieve the elements linked to this ride58/// @{5960/// @brief get GNEMoveElement associated with this ride61GNEMoveElement* getMoveElement() const override;6263/// @brief get parameters associated with this ride64Parameterised* getParameters() override;6566/// @brief get parameters associated with this ride (constant)67const Parameterised* getParameters() const override;6869/// @}7071/**@brief write demand element element into a xml file72* @param[in] device device in which write parameters of demand element element73*/74void writeDemandElement(OutputDevice& device) const override;7576/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)77Problem isDemandElementValid() const override;7879/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)80std::string getDemandElementProblem() const override;8182/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)83void fixDemandElementProblem() override;8485/// @name members and functions relative to elements common to all demand elements86/// @{87/// @brief obtain VClass related with this demand element88SUMOVehicleClass getVClass() const override;8990/// @brief get color91const RGBColor& getColor() const override;9293/// @}9495/// @name Functions related with geometry of element96/// @{97/// @brief update pre-computed geometry information98void updateGeometry() override;99100/// @brief Returns position of additional in view101Position getPositionInView() const override;102/// @}103104/// @name inherited from GUIGlObject105/// @{106107/**@brief Returns an own popup-menu108*109* @param[in] app The application needed to build the popup-menu110* @param[in] parent The parent window needed to build the popup-menu111* @return The built popup-menu112* @see GUIGlObject::getPopUpMenu113*/114GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;115116/**@brief Returns the name of the parent object117* @return This object's parent id118*/119std::string getParentName() const override;120121/**@brief Returns the boundary to which the view shall be centered in order to show the object122* @return The boundary the object is within123*/124Boundary getCenteringBoundary() const override;125126/// @brief split geometry127void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;128129/**@brief Draws the object130* @param[in] s The settings for the current view (may influence drawing)131* @see GUIGlObject::drawGL132*/133void drawGL(const GUIVisualizationSettings& s) const override;134135/// @}136137/// @name inherited from GNEPathElement138/// @{139140/// @brief compute pathElement141void computePathElement() override;142143/**@brief Draws partial object over lane144* @param[in] s The settings for the current view (may influence drawing)145* @param[in] segment lane segment146* @param[in] offsetFront front offset147*/148void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;149150/**@brief Draws partial object over junction151* @param[in] s The settings for the current view (may influence drawing)152* @param[in] segment junction segment153* @param[in] offsetFront front offset154*/155void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;156157/// @brief get first path lane158GNELane* getFirstPathLane() const override;159160/// @brief get last path lane161GNELane* getLastPathLane() const override;162/// @}163164/// @brief inherited from GNEAttributeCarrier165/// @{166/* @brief method for getting the Attribute of an XML key167* @param[in] key The attribute key168* @return string with the value associated to key169*/170std::string getAttribute(SumoXMLAttr key) const override;171172/* @brief method for getting the Attribute of an XML key in double format173* @param[in] key The attribute key174* @return double with the value associated to key175*/176double getAttributeDouble(SumoXMLAttr key) const override;177178/* @brief method for getting the Attribute of an XML key in position format179* @param[in] key The attribute key180* @return position with the value associated to key181*/182Position getAttributePosition(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 set200* @param[in] key The attribute key201*/202bool isAttributeEnabled(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;209/// @}210211protected:212/// @brief valid line or vehicle ids or ANY213std::vector<std::string> myLines;214215/// @brief group216std::string myGroup;217218private:219/// @brief method for setting the attribute and nothing else220void setAttribute(SumoXMLAttr key, const std::string& value) override;221222/// @brief Invalidated copy constructor.223GNERide(GNERide*) = delete;224225/// @brief Invalidated assignment operator.226GNERide& operator=(GNERide*) = delete;227};228229230