Path: blob/main/src/netedit/elements/additional/GNEAccess.h
169684 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 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;2930// ===========================================================================31// class definitions32// ===========================================================================3334class GNEAccess : public GNEAdditional, public Parameterised {3536public:37/// @brief Default constructor38GNEAccess(GNENet* net);3940/**@brief Constructor41* @param[in] id The storage of gl-ids to get the one for this lane representation from42* @param[in] busStop GNEBusStop of this Access belongs43* @param[in] lane GNELane of this Access belongs44* @param[in] pos position of the Access on the lane45* @param[in] length The length of the Access in meters.46* @param[in] friendlyPos enable or disable friendly positions47* @param[in] parameters generic parameters48*/49GNEAccess(GNEAdditional* busStop, GNELane* lane, const double pos, const std::string& specialPos,50const bool friendlyPos, const double length, const Parameterised::Map& parameters);5152/// @brief Destructor53~GNEAccess();5455/**@brief get move operation56* @note returned GNEMoveOperation can be nullptr57*/58GNEMoveOperation* getMoveOperation();5960/// @brief check if Position of Access is fixed61bool isAccessPositionFixed() const;6263/// @brief get edge in which this Access is placed64GNEEdge* getEdge() const;6566/// @name members and functions relative to write additionals into XML67/// @{6869/**@brief write additional element into a xml file70* @param[in] device device in which write parameters of additional element71*/72void writeAdditional(OutputDevice& device) const;7374/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)75bool isAdditionalValid() const;7677/// @brief return a string with the current additional problem (must be reimplemented in all detector children)78std::string getAdditionalProblem() const;7980/// @brief fix additional problem (must be reimplemented in all detector children)81void fixAdditionalProblem();8283/// @}8485/// @name Function related with contour drawing86/// @{8788/// @brief check if draw move contour (red)89bool checkDrawMoveContour() const;9091/// @}9293/// @name Functions related with geometry of element94/// @{9596/// @brief update pre-computed geometry information97void updateGeometry();9899/// @brief Returns position of additional in view100Position getPositionInView() const;101102/// @brief update centering boundary (implies change in RTREE)103void updateCenteringBoundary(const bool updateGrid);104105/// @brief split geometry106void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);107108/// @}109110/// @name inherited from GUIGlObject111/// @{112113/// @brief Returns the name (ID) of the parent object114std::string getParentName() const;115116/**@brief Draws the object117* @param[in] s The settings for the current view (may influence drawing)118* @see GUIGlObject::drawGL119*/120void drawGL(const GUIVisualizationSettings& s) const;121122/// @}123124/// @name inherited from GNEAttributeCarrier125/// @{126127/* @brief method for getting the Attribute of an XML key128* @param[in] key The attribute key129* @return string with the value associated to key130*/131std::string getAttribute(SumoXMLAttr key) const;132133/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)134* @param[in] key The attribute key135* @return double with the value associated to key136*/137double getAttributeDouble(SumoXMLAttr key) const;138139/// @brief get parameters map140const Parameterised::Map& getACParametersMap() const;141142/* @brief method for setting the attribute and letting the object perform additional changes143* @param[in] key The attribute key144* @param[in] value The new value145* @param[in] undoList The undoList on which to register changes146*/147void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);148149/* @brief method for checking if the key and their correspond attribute are valid150* @param[in] key The attribute key151* @param[in] value The value associated to key key152* @return true if the value is valid, false in other case153*/154bool isValid(SumoXMLAttr key, const std::string& value);155156/// @brief get PopPup ID (Used in AC Hierarchy)157std::string getPopUpID() const;158159/// @brief get Hierarchy Name (Used in AC Hierarchy)160std::string getHierarchyName() const;161162/// @}163164protected:165/// @brief position over lane166double myPositionOverLane = 0;167168/// @brief position over lane169std::string mySpecialPosition;170171/// @brief Access length172double myLength = 0;173174/// @brief flag to check if friendly position is enabled175bool myFriendlyPosition = false;176177private:178/// @brief set attribute after validation179void setAttribute(SumoXMLAttr key, const std::string& value);180181/// @brief set move shape182void setMoveShape(const GNEMoveResult& moveResult);183184/// @brief commit move shape185void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);186187/// @brief Invalidated copy constructor.188GNEAccess(const GNEAccess&) = delete;189190/// @brief Invalidated assignment operator.191GNEAccess& operator=(const GNEAccess&) = delete;192};193194195