/****************************************************************************/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 GNEStop.h14/// @author Pablo Alvarez Lopez15/// @date March 201916///17// Representation of Stops in netedit18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDemandElement.h"23#include "GNEDemandElementPlan.h"2425// ===========================================================================26// class declaration27// ===========================================================================2829class GNEMoveElementLaneDouble;3031// ===========================================================================32// class definitions33// ===========================================================================3435class GNEStop : public GNEDemandElement, public SUMOVehicleParameter::Stop, public GNEDemandElementPlan {3637public:38/// @brief default constructor39GNEStop(SumoXMLTag tag, GNENet* net);4041/// @brief constructor used for stops over stoppingPlaces42GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter);4344/// @brief constructor used for stops over lane (only for vehicle/route stops)45GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter);4647/// @brief destructor48~GNEStop();4950/// @brief methods to retrieve the elements linked to this stop51/// @{5253/// @brief get GNEMoveElement associated with this stop54GNEMoveElement* getMoveElement() const override;5556/// @brief get parameters associated with this stop57Parameterised* getParameters() override;5859/// @brief get parameters associated with this stop (constant)60const Parameterised* getParameters() const override;6162/// @}6364/**@brief write demand element element into a xml file65* @param[in] device device in which write parameters of demand element element66*/67void writeDemandElement(OutputDevice& device) const override;6869/// @brief check if current demand element is valid to be written into XML (by default true, can be reimplemented in children)70Problem isDemandElementValid() const override;7172/// @brief return a string with the current demand element problem (by default empty, can be reimplemented in children)73std::string getDemandElementProblem() const override;7475/// @brief fix demand element problem (by default throw an exception, has to be reimplemented in children)76void fixDemandElementProblem() override;7778/// @name members and functions relative to elements common to all demand elements79/// @{80/// @brief obtain VClass related with this demand element81SUMOVehicleClass getVClass() const override;8283/// @brief get color84const RGBColor& getColor() const override;8586/// @}8788/// @name Functions related with geometry of element89/// @{90/// @brief update pre-computed geometry information91void updateGeometry() override;9293/// @brief Returns position of demand element in view94Position getPositionInView() const override;95/// @}9697/// @name inherited from GUIGlObject98/// @{99/**@brief Returns the name of the parent object100* @return This object's parent id101*/102std::string getParentName() const override;103104/// @brief return exaggeration associated with this GLObject105double getExaggeration(const GUIVisualizationSettings& s) const override;106107/**@brief Returns the boundary to which the view shall be centered in order to show the object108* @return The boundary the object is within109*/110Boundary getCenteringBoundary() const override;111112/// @brief split geometry113void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;114115/**@brief Draws the object116* @param[in] s The settings for the current view (may influence drawing)117* @see GUIGlObject::drawGL118*/119void drawGL(const GUIVisualizationSettings& s) const override;120121/// @}122123/// @name inherited from GNEPathElement124/// @{125126/// @brief compute pathElement127void computePathElement() override;128129/**@brief Draws partial object over lane130* @param[in] s The settings for the current view (may influence drawing)131* @param[in] segment lane segment132* @param[in] offsetFront front offset133*/134void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;135136/**@brief Draws partial object over junction137* @param[in] s The settings for the current view (may influence drawing)138* @param[in] segment junction segment139* @param[in] offsetFront front offset140*/141void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;142143/// @brief get first path lane144GNELane* getFirstPathLane() const override;145146/// @brief get last path lane147GNELane* getLastPathLane() const override;148/// @}149150/// @brief inherited from GNEAttributeCarrier151/// @{152/* @brief method for getting the Attribute of an XML key153* @param[in] key The attribute key154* @return string with the value associated to key155*/156std::string getAttribute(SumoXMLAttr key) const override;157158/* @brief method for getting the Attribute of an XML key in double format159* @param[in] key The attribute key160* @return double with the value associated to key161*/162double getAttributeDouble(SumoXMLAttr key) const override;163164/* @brief method for getting the Attribute of an XML key in position format165* @param[in] key The attribute key166* @return position with the value associated to key167*/168Position getAttributePosition(SumoXMLAttr key) const override;169170/* @brief method for setting the attribute and letting the object perform demand element changes171* @param[in] key The attribute key172* @param[in] value The new value173* @param[in] undoList The undoList on which to register changes174* @param[in] net optionally the GNENet to inform about gui updates175*/176void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;177178/* @brief method for setting the attribute and letting the object perform demand element changes179* @param[in] key The attribute key180* @param[in] value The new value181* @param[in] undoList The undoList on which to register changes182*/183bool isValid(SumoXMLAttr key, const std::string& value) override;184185/* @brief method for enable attribute186* @param[in] key The attribute key187* @param[in] undoList The undoList on which to register changes188* @note certain attributes can be only enabled, and can produce the disabling of other attributes189*/190void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList) override;191192/* @brief method for disable attribute193* @param[in] key The attribute key194* @param[in] undoList The undoList on which to register changes195* @note certain attributes can be only enabled, and can produce the disabling of other attributes196*/197void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList) 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;209210/// @}211212/// @brief get start position over lane that is applicable to the shape213double getStartGeometryPositionOverLane() const;214215/// @brief get end position over lane that is applicable to the shape216double getEndGeometryPositionOverLane() const;217218protected:219/// @brief move element lane double220GNEMoveElementLaneDouble* myMoveElementLaneDouble = nullptr;221222/// @brief variable used for draw contours223GNEContour myStopContour;224225/// @brief boundary used during moving of elements (to avoid insertion in RTREE)226Boundary myMovingGeometryBoundary;227228/// @brief value for saving first original position over lane before moving229Position myOriginalViewPosition;230231/// @brief value for saving first original position over lane before moving232std::string myFirstOriginalLanePosition;233234/// @brief value for saving second original position over lane before moving235std::string mySecondOriginalPosition;236237/// @brief creation index (using for saving sorted)238const int myCreationIndex;239240/// @brief check if vehicle stop can be draw241bool canDrawVehicleStop() const;242243/// @brief draw index244bool drawIndex() const;245246/// @brief draw stop over lane247void drawStopOverLane(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,248const RGBColor& color, const double width, const double exaggeration) const;249250/// @brief draw stop over stoppingPlace251void drawStopOverStoppingPlace(const GUIVisualizationSettings::Detail d, const RGBColor& color,252const double width, const double exaggeration) const;253254void drawStopLabel(const GUIVisualizationSettings& s) const;255256private:257/// @brief method for setting the attribute and nothing else258void setAttribute(SumoXMLAttr key, const std::string& value) override;259260/// @brief method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)261void toggleAttribute(SumoXMLAttr key, const bool value) override;262263/// @brief draw geometry points264void drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const RGBColor& baseColor) const;265266/// @brief get pathStopIndex267int getPathStopIndex() const;268269/// @brief set stop microsim ID270void setStopMicrosimID();271272/// @brief Invalidated copy constructor.273GNEStop(const GNEStop&) = delete;274275/// @brief Invalidated assignment operator276GNEStop& operator=(const GNEStop&) = delete;277};278279280