Path: blob/main/src/netedit/elements/additional/GNEAccess.h
193871 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 GNEAccess.h14/// @author Pablo Alvarez Lopez15/// @date Jun 201816///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEAdditional.h"2324// ===========================================================================25// class declarations26// ===========================================================================2728class GNEBusStop;29class GNEMoveElementLaneSingle;3031// ===========================================================================32// class definitions33// ===========================================================================3435class GNEAccess : public GNEAdditional, public Parameterised {3637public:38/// @brief Default constructor39GNEAccess(GNENet* net);4041/**@brief Constructor42* @param[in] id The storage of gl-ids to get the one for this lane representation from43* @param[in] busStop GNEBusStop of this Access belongs44* @param[in] lane GNELane of this Access belongs45* @param[in] pos position of the Access on the lane46* @param[in] length The length of the Access in meters.47* @param[in] friendlyPos enable or disable friendly positions48* @param[in] parameters generic parameters49*/50GNEAccess(GNEAdditional* busStop, GNELane* lane, const double pos, const std::string& specialPos,51const bool friendlyPos, const double length, const Parameterised::Map& parameters);5253/// @brief Destructor54~GNEAccess();5556/// @brief methods to retrieve the elements linked to this access57/// @{5859/// @brief get GNEMoveElement associated with this access60GNEMoveElement* getMoveElement() const override;6162/// @brief get parameters associated with this access63Parameterised* getParameters() override;6465/// @brief get parameters associated with this access (constant)66const Parameterised* getParameters() const override;6768/// @}6970/// @brief check if Position of Access is fixed71bool isAccessPositionFixed() const;7273/// @brief get edge in which this Access is placed74GNEEdge* getEdge() const;7576/// @name members and functions relative to write additionals into XML77/// @{7879/**@brief write additional element into a xml file80* @param[in] device device in which write parameters of additional element81*/82void writeAdditional(OutputDevice& device) const override;8384/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)85bool isAdditionalValid() const override;8687/// @brief return a string with the current additional problem (must be reimplemented in all detector children)88std::string getAdditionalProblem() const override;8990/// @brief fix additional problem (must be reimplemented in all detector children)91void fixAdditionalProblem() override;9293/// @}9495/// @name Function related with contour drawing96/// @{9798/// @brief check if draw move contour (red)99bool checkDrawMoveContour() const override;100101/// @}102103/// @name Functions related with geometry of element104/// @{105106/// @brief update pre-computed geometry information107void updateGeometry() override;108109/// @brief Returns position of additional in view110Position getPositionInView() const override;111112/// @brief update centering boundary (implies change in RTREE)113void updateCenteringBoundary(const bool updateGrid) override;114115/// @brief split geometry116void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) override;117118/// @}119120/// @name inherited from GUIGlObject121/// @{122123/// @brief Returns the name (ID) of the parent object124std::string getParentName() const override;125126/**@brief Draws the object127* @param[in] s The settings for the current view (may influence drawing)128* @see GUIGlObject::drawGL129*/130void drawGL(const GUIVisualizationSettings& s) const override;131132/// @}133134/// @name inherited from GNEAttributeCarrier135/// @{136137/* @brief method for getting the Attribute of an XML key138* @param[in] key The attribute key139* @return string with the value associated to key140*/141std::string getAttribute(SumoXMLAttr key) const override;142143/* @brief method for getting the Attribute of an XML key in double format144* @param[in] key The attribute key145* @return double with the value associated to key146*/147double getAttributeDouble(SumoXMLAttr key) const override;148149/* @brief method for getting the Attribute of an XML key in position format150* @param[in] key The attribute key151* @return position with the value associated to key152*/153Position getAttributePosition(SumoXMLAttr key) const override;154155/* @brief method for getting the Attribute of an XML key in positionVector format156* @param[in] key The attribute key157* @return positionVector with the value associated to key158*/159PositionVector getAttributePositionVector(SumoXMLAttr key) const override;160161/* @brief method for setting the attribute and letting the object perform additional changes162* @param[in] key The attribute key163* @param[in] value The new value164* @param[in] undoList The undoList on which to register changes165*/166void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;167168/* @brief method for checking if the key and their correspond attribute are valid169* @param[in] key The attribute key170* @param[in] value The value associated to key key171* @return true if the value is valid, false in other case172*/173bool isValid(SumoXMLAttr key, const std::string& value) override;174175/// @brief get PopPup ID (Used in AC Hierarchy)176std::string getPopUpID() const override;177178/// @brief get Hierarchy Name (Used in AC Hierarchy)179std::string getHierarchyName() const override;180181/// @}182183protected:184/// @brief position over lane185double myPosOverLane = 0;186187/// @brief friendly position188bool myFriendlyPos = false;189190/// @brief move element lane single191GNEMoveElementLaneSingle* myMoveElementLaneSingle = nullptr;192193/// @brief position over lane194std::string mySpecialPosition;195196/// @brief Access length197double myLength = 0;198199private:200/// @brief set attribute after validation201void setAttribute(SumoXMLAttr key, const std::string& value) override;202203/// @brief Invalidated copy constructor.204GNEAccess(const GNEAccess&) = delete;205206/// @brief Invalidated assignment operator.207GNEAccess& operator=(const GNEAccess&) = delete;208};209210211