Path: blob/main/src/netedit/elements/demand/GNEStopPlan.h
185790 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 GNEStopPlan.h14/// @author Pablo Alvarez Lopez15/// @date Oct 202316///17// Representation of Stops in netedit18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDemandElement.h"23#include "GNEDemandElementPlan.h"2425// ===========================================================================26// class definitions27// ===========================================================================2829class GNEStopPlan : public GNEDemandElement, public GNEDemandElementPlan {3031public:32/// @brief default constructor33GNEStopPlan(SumoXMLTag tag, GNENet* net);3435/**@brief constructor called in buildStopPlan36* @param[in] tag stop tag37* @param[in] planParameters plan parameters38* @param[in] additionals from-to additionals39* @param[in] endPos end position40* @param[in] duration stop duration41* @param[in] until stop until42* @param[in] actType act type43* @param[in] friendlyPos friendly pos44* @param[in] parameterSet parameter sets45*/46GNEStopPlan(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,47const double endPos, const SUMOTime duration, const SUMOTime until, const std::string& actType,48const bool friendlyPos, const int parameterSet);4950/// @brief destructor51~GNEStopPlan();5253/// @brief methods to retrieve the elements linked to this stopPlan54/// @{5556/// @brief get GNEMoveElement associated with this stopPlan57GNEMoveElement* getMoveElement() const override;5859/// @brief get parameters associated with this stopPlan60Parameterised* getParameters() override;6162/// @brief get parameters associated with this stopPlan63const Parameterised* getParameters() const override;6465/// @}6667/**@brief write demand element element into a xml file68* @param[in] device device in which write parameters of demand element element69*/70void writeDemandElement(OutputDevice& device) const override;7172/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)73Problem isDemandElementValid() const override;7475/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)76std::string getDemandElementProblem() const override;7778/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)79void fixDemandElementProblem() override;8081/// @name members and functions relative to elements common to all demand elements82/// @{83/// @brief obtain VClass related with this demand element84SUMOVehicleClass getVClass() const override;8586/// @brief get color87const RGBColor& getColor() const override;8889/// @}9091/// @name Functions related with geometry of element92/// @{93/// @brief update pre-computed geometry information94void updateGeometry() override;9596/// @brief Returns position of demand element in view97Position getPositionInView() const override;98/// @}99100/// @name inherited from GUIGlObject101/// @{102/**@brief Returns the name of the parent object103* @return This object's parent id104*/105std::string getParentName() const override;106107/// @brief return exaggeration associated with this GLObject108double getExaggeration(const GUIVisualizationSettings& s) const override;109110/**@brief Returns the boundary to which the view shall be centered in order to show the object111* @return The boundary the object is within112*/113Boundary getCenteringBoundary() const override;114115/// @brief split geometry116void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;117118/**@brief Draws the object119* @param[in] s The settings for the current view (may influence drawing)120* @see GUIGlObject::drawGL121*/122void drawGL(const GUIVisualizationSettings& s) const override;123124/// @}125126/// @name inherited from GNEPathElement127/// @{128129/// @brief compute pathElement130void computePathElement() override;131132/**@brief Draws partial object over lane133* @param[in] s The settings for the current view (may influence drawing)134* @param[in] segment lane segment135* @param[in] offsetFront front offset136*/137void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;138139/**@brief Draws partial object over junction140* @param[in] s The settings for the current view (may influence drawing)141* @param[in] segment junction segment142* @param[in] offsetFront front offset143*/144void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;145146/// @brief get first path lane147GNELane* getFirstPathLane() const override;148149/// @brief get last path lane150GNELane* getLastPathLane() const override;151/// @}152153/// @brief inherited from GNEAttributeCarrier154/// @{155/* @brief method for getting the Attribute of an XML key156* @param[in] key The attribute key157* @return string with the value associated to key158*/159std::string getAttribute(SumoXMLAttr key) const override;160161/* @brief method for getting the Attribute of an XML key in double format162* @param[in] key The attribute key163* @return double with the value associated to key164*/165double getAttributeDouble(SumoXMLAttr key) const override;166167/* @brief method for getting the Attribute of an XML key in position format168* @param[in] key The attribute key169* @return position with the value associated to key170*/171Position getAttributePosition(SumoXMLAttr key) const override;172173/* @brief method for setting the attribute and letting the object perform demand element changes174* @param[in] key The attribute key175* @param[in] value The new value176* @param[in] undoList The undoList on which to register changes177* @param[in] net optionally the GNENet to inform about gui updates178*/179void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;180181/* @brief method for setting the attribute and letting the object perform demand element changes182* @param[in] key The attribute key183* @param[in] value The new value184* @param[in] undoList The undoList on which to register changes185*/186bool isValid(SumoXMLAttr key, const std::string& value) override;187188/* @brief method for enable attribute189* @param[in] key The attribute key190* @param[in] undoList The undoList on which to register changes191* @note certain attributes can be only enabled, and can produce the disabling of other attributes192*/193void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;194195/* @brief method for disable attribute196* @param[in] key The attribute key197* @param[in] undoList The undoList on which to register changes198* @note certain attributes can be only enabled, and can produce the disabling of other attributes199*/200void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList) 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 variable used for draw contours216GNEContour myStopContour;217218/// @brief variable used for draw sign contours219GNEContour myStopSignContour;220221/// @brief sign position222Position mySignPosition;223224/// @brief duration225SUMOTime myDuration;226227/// @brief until228SUMOTime myUntil;229230/// @brief act type231std::string myActType;232233/// @brief friendly pos234bool myFriendlyPos = false;235236/// @brief parameter set237int myParametersSet = 0;238239private:240/// @brief method for setting the attribute and nothing else241void setAttribute(SumoXMLAttr key, const std::string& value) override;242243/// @brief method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)244void toggleAttribute(SumoXMLAttr key, const bool value) override;245246/// @brief Invalidated copy constructor.247GNEStopPlan(const GNEStopPlan&) = delete;248249/// @brief Invalidated assignment operator250GNEStopPlan& operator=(const GNEStopPlan&) = delete;251};252253254