/****************************************************************************/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 GNEWalk.h14/// @author Pablo Alvarez Lopez15/// @date Jun 201916///17// A class for visualizing walks 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 GNEWalk : public GNEDemandElement, public GNEDemandElementPlan {3940public:41/// @brief default constructor42GNEWalk(SumoXMLTag tag, GNENet* net);4344/**@brief constructor called in buildWalk45* @param[in] tag walk tag46* @param[in] personParent person parent47* @param[in] planParameters plan parameters48* @param[in] arrivalPosition arrival position49* @param[in] speed speed (not together with duration)50* @param[in] duration duration (not together with speed)51*/52GNEWalk(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,53const double arrivalPosition, const double speed, const SUMOTime duration);5455/// @brief destructor56~GNEWalk();5758/// @brief methods to retrieve the elements linked to this walk59/// @{6061/// @brief get GNEMoveElement associated with this walk62GNEMoveElement* getMoveElement() const override;6364/// @brief get parameters associated with this walk65Parameterised* getParameters() override;6667/// @brief get parameters associated with this walk (constant)68const Parameterised* getParameters() const override;6970/// @}7172/**@brief write demand element element into a xml file73* @param[in] device device in which write parameters of demand element element74*/75void writeDemandElement(OutputDevice& device) const override;7677/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)78Problem isDemandElementValid() const override;7980/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)81std::string getDemandElementProblem() const override;8283/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)84void fixDemandElementProblem() override;8586/// @name members and functions relative to elements common to all demand elements87/// @{88/// @brief obtain VClass related with this demand element89SUMOVehicleClass getVClass() const override;9091/// @brief get color92const RGBColor& getColor() const override;9394/// @}9596/// @name Functions related with geometry of element97/// @{98/// @brief update pre-computed geometry information99void updateGeometry() override;100101/// @brief Returns position of additional in view102Position getPositionInView() const override;103/// @}104105/// @name inherited from GUIGlObject106/// @{107108/**@brief Returns an own popup-menu109*110* @param[in] app The application needed to build the popup-menu111* @param[in] parent The parent window needed to build the popup-menu112* @return The built popup-menu113* @see GUIGlObject::getPopUpMenu114*/115GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;116117/**@brief Returns the name of the parent object118* @return This object's parent id119*/120std::string getParentName() const override;121122/**@brief Returns the boundary to which the view shall be centered in order to show the object123* @return The boundary the object is within124*/125Boundary getCenteringBoundary() const override;126127/// @brief split geometry128void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;129130/**@brief Draws the object131* @param[in] s The settings for the current view (may influence drawing)132* @see GUIGlObject::drawGL133*/134void drawGL(const GUIVisualizationSettings& s) const override;135136/// @}137138/// @name inherited from GNEPathElement139/// @{140141/// @brief compute pathElement142void computePathElement() override;143144/**@brief Draws partial object over lane145* @param[in] s The settings for the current view (may influence drawing)146* @param[in] segment lane segment147* @param[in] offsetFront front offset148*/149void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;150151/**@brief Draws partial object over junction152* @param[in] s The settings for the current view (may influence drawing)153* @param[in] segment junction segment154* @param[in] offsetFront front offset155*/156void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;157158/// @brief get first path lane159GNELane* getFirstPathLane() const override;160161/// @brief get last path lane162GNELane* getLastPathLane() const override;163/// @}164165/// @brief inherited from GNEAttributeCarrier166/// @{167/* @brief method for getting the Attribute of an XML key168* @param[in] key The attribute key169* @return string with the value associated to key170*/171std::string getAttribute(SumoXMLAttr key) const override;172173/* @brief method for getting the Attribute of an XML key in double format174* @param[in] key The attribute key175* @return double with the value associated to key176*/177double getAttributeDouble(SumoXMLAttr key) const override;178179/* @brief method for getting the Attribute of an XML key in position format180* @param[in] key The attribute key181* @return position with the value associated to key182*/183Position getAttributePosition(SumoXMLAttr key) const override;184185/* @brief method for setting the attribute and letting the object perform additional changes186* @param[in] key The attribute key187* @param[in] value The new value188* @param[in] undoList The undoList on which to register changes189* @param[in] net optionally the GNENet to inform about gui updates190*/191void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;192193/* @brief method for setting the attribute and letting the object perform additional changes194* @param[in] key The attribute key195* @param[in] value The new value196* @param[in] undoList The undoList on which to register changes197*/198bool isValid(SumoXMLAttr key, const std::string& value) override;199200/* @brief method for check if the value for certain attribute is set201* @param[in] key The attribute key202*/203bool isAttributeEnabled(SumoXMLAttr key) const override;204205/// @brief get PopPup ID (Used in AC Hierarchy)206std::string getPopUpID() const override;207208/// @brief get Hierarchy Name (Used in AC Hierarchy)209std::string getHierarchyName() const override;210/// @}211212protected:213/// @brief speed214double mySpeed = 0;215216/// @brief duration217SUMOTime myDuration = 0;218219private:220/// @brief method for setting the attribute and nothing else221void setAttribute(SumoXMLAttr key, const std::string& value) override;222223/// @brief Invalidated copy constructor.224GNEWalk(GNEWalk*) = delete;225226/// @brief Invalidated assignment operator.227GNEWalk& operator=(GNEWalk*) = delete;228};229230231