Path: blob/main/src/netedit/elements/demand/GNEPersonTrip.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 GNEPersonTrip.h14/// @author Pablo Alvarez Lopez15/// @date Jun 201916///17// A class for visualizing person trips 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 GNEPersonTrip : public GNEDemandElement, public GNEDemandElementPlan {3940public:41/// @brief default constructor42GNEPersonTrip(SumoXMLTag tag, GNENet* net);4344/**@brief constructor called in buildPersonTrip45* @param[in] tag personTrip tag46* @param[in] planParameters plan parameters47* @param[in] types list of possible vehicle types to take48* @param[in] modes list of possible traffic modes49* @param[in] lines list of lines50* @param[in] walkFactor walk factor51* @param[in] group group52*/53GNEPersonTrip(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,54const double arrivalPosition, const std::vector<std::string>& types, const std::vector<std::string>& modes,55const std::vector<std::string>& lines, const double walkFactor, const std::string& group);5657/// @brief destructor58~GNEPersonTrip();5960/// @brief methods to retrieve the elements linked to this personTrip61/// @{6263/// @brief get GNEMoveElement associated with this personTrip64GNEMoveElement* getMoveElement() const override;6566/// @brief get parameters associated with this personTrip67Parameterised* getParameters() override;6869/// @brief get parameters associated with this personTrip70const Parameterised* getParameters() const override;7172/// @}7374/**@brief write demand element element into a xml file75* @param[in] device device in which write parameters of demand element element76*/77void writeDemandElement(OutputDevice& device) const override;7879/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)80Problem isDemandElementValid() const override;8182/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)83std::string getDemandElementProblem() const override;8485/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)86void fixDemandElementProblem() override;8788/// @name members and functions relative to elements common to all demand elements89/// @{90/// @brief obtain VClass related with this demand element91SUMOVehicleClass getVClass() const override;9293/// @brief get color94const RGBColor& getColor() const override;9596/// @}9798/// @name Functions related with geometry of element99/// @{100/// @brief update pre-computed geometry information101void updateGeometry() override;102103/// @brief Returns position of additional in view104Position getPositionInView() const override;105/// @}106107/// @name inherited from GUIGlObject108/// @{109110/**@brief Returns an own popup-menu111*112* @param[in] app The application needed to build the popup-menu113* @param[in] parent The parent window needed to build the popup-menu114* @return The built popup-menu115* @see GUIGlObject::getPopUpMenu116*/117GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;118119/**@brief Returns the name of the parent object120* @return This object's parent id121*/122std::string getParentName() const override;123124/**@brief Returns the boundary to which the view shall be centered in order to show the object125* @return The boundary the object is within126*/127Boundary getCenteringBoundary() const override;128129/// @brief split geometry130void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;131132/**@brief Draws the object133* @param[in] s The settings for the current view (may influence drawing)134* @see GUIGlObject::drawGL135*/136void drawGL(const GUIVisualizationSettings& s) const override;137138/// @}139140/// @name inherited from GNEPathElement141/// @{142143/// @brief compute pathElement144void computePathElement() override;145146/**@brief Draws partial object over lane147* @param[in] s The settings for the current view (may influence drawing)148* @param[in] segment lane segment149* @param[in] offsetFront front offset150*/151void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;152153/**@brief Draws partial object over junction154* @param[in] s The settings for the current view (may influence drawing)155* @param[in] segment junction segment156* @param[in] offsetFront front offset157*/158void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;159160/// @brief get first path lane161GNELane* getFirstPathLane() const override;162163/// @brief get last path lane164GNELane* getLastPathLane() const override;165/// @}166167/// @brief inherited from GNEAttributeCarrier168/// @{169/* @brief method for getting the Attribute of an XML key170* @param[in] key The attribute key171* @return string with the value associated to key172*/173std::string getAttribute(SumoXMLAttr key) const override;174175/* @brief method for getting the Attribute of an XML key in double format176* @param[in] key The attribute key177* @return double with the value associated to key178*/179double getAttributeDouble(SumoXMLAttr key) const override;180181/* @brief method for getting the Attribute of an XML key in position format182* @param[in] key The attribute key183* @return position with the value associated to key184*/185Position getAttributePosition(SumoXMLAttr key) const override;186187/* @brief method for setting the attribute and letting the object perform additional changes188* @param[in] key The attribute key189* @param[in] value The new value190* @param[in] undoList The undoList on which to register changes191* @param[in] net optionally the GNENet to inform about gui updates192*/193void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;194195/* @brief method for setting the attribute and letting the object perform additional changes196* @param[in] key The attribute key197* @param[in] value The new value198* @param[in] undoList The undoList on which to register changes199*/200bool isValid(SumoXMLAttr key, const std::string& value) override;201202/* @brief method for check if the value for certain attribute is set203* @param[in] key The attribute key204*/205bool isAttributeEnabled(SumoXMLAttr key) const override;206207/// @brief get PopPup ID (Used in AC Hierarchy)208std::string getPopUpID() const override;209210/// @brief get Hierarchy Name (Used in AC Hierarchy)211std::string getHierarchyName() const override;212/// @}213214protected:215/// @brief valid line or vehicle types216std::vector<std::string> myVTypes;217218/// @brief valid line or modes219std::vector<std::string> myModes;220221/// @brief valid line or vehicle ids or ANY222std::vector<std::string> myLines;223224/// @brief walk factor225double myWalkFactor = 0;226227/// @brief group228std::string myGroup;229230private:231/// @brief method for setting the attribute and nothing else232void setAttribute(SumoXMLAttr key, const std::string& value) override;233234/// @brief Invalidated copy constructor.235GNEPersonTrip(GNEPersonTrip*) = delete;236237/// @brief Invalidated assignment operator.238GNEPersonTrip& operator=(GNEPersonTrip*) = delete;239};240241242