Path: blob/main/src/netedit/elements/additional/GNEEntryExitDetector.h
193874 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 GNEEntryExitDetector.h14/// @author Pablo Alvarez Lopez15/// @date Nov 201516///17//18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEDetector.h"2324// ===========================================================================25// class declarations26// ===========================================================================2728class GNEMoveElementLaneSingle;29class GNEMultiEntryExitDetector;3031// ===========================================================================32// class definitions33// ===========================================================================3435class GNEEntryExitDetector : public GNEDetector {3637public:38/// @brief default Constructor39GNEEntryExitDetector(SumoXMLTag entryExitTag, GNENet* net);4041/**@brief Constructor42* @param[in] entryExitTag Child Tag (Either SUMO_TAG_DET_ENTRY or SUMO_TAG_DET_EXIT)43* @param[in] parent pointer to GNEMultiEntryExitDetector of this GNEEntryExitDetector belongs44* @param[in] lane Lane of this detector is placed45* @param[in] pos position of the detector on the lane46* @param[in] friendlyPos enable or disable friendly positions47* @param[in] parameters generic parameters48*/49GNEEntryExitDetector(SumoXMLTag entryExitTag, GNEAdditional* parent, GNELane* lane, const double pos,50const bool friendlyPos, const Parameterised::Map& parameters);5152/// @brief destructor53~GNEEntryExitDetector();5455/// @brief methods to retrieve the elements linked to this GNEAdditional56/// @{5758/// @brief get GNEMoveElement associated with this GNEAdditional59GNEMoveElement* getMoveElement() const override;6061/// @}6263/// @name members and functions relative to write additionals into XML64/// @{6566/**@brief write additional element into a xml file67* @param[in] device device in which write parameters of additional element68*/69void writeAdditional(OutputDevice& device) const override;7071/// @brief check if current additional is valid to be written into XML72bool isAdditionalValid() const override;7374/// @brief return a string with the current additional problem75std::string getAdditionalProblem() const override;7677/// @brief fix additional problem78void fixAdditionalProblem() override;7980/// @}8182/// @brief update pre-computed geometry information83void updateGeometry() override;8485/// @name inherited from GUIGlObject86/// @{8788/**@brief Draws the object89* @param[in] s The settings for the current view (may influence drawing)90* @see GUIGlObject::drawGL91*/92void drawGL(const GUIVisualizationSettings& s) const override;9394/// @}9596/// @name inherited from GNEAttributeCarrier97/// @{9899/* @brief method for getting the Attribute of an XML key100* @param[in] key The attribute key101* @return string with the value associated to key102*/103std::string getAttribute(SumoXMLAttr key) const override;104105/* @brief method for getting the Attribute of an XML key in double format106* @param[in] key The attribute key107* @return double with the value associated to key108*/109double getAttributeDouble(SumoXMLAttr key) const override;110111/* @brief method for getting the Attribute of an XML key in position format112* @param[in] key The attribute key113* @return position with the value associated to key114*/115Position getAttributePosition(SumoXMLAttr key) const override;116117/* @brief method for setting the attribute and letting the object perform additional changes118* @param[in] key The attribute key119* @param[in] value The new value120* @param[in] undoList The undoList on which to register changes121*/122void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;123124/* @brief method for checking if the key and their correspond attribute are valids125* @param[in] key The attribute key126* @param[in] value The value associated to key key127* @return true if the value is valid, false in other case128*/129bool isValid(SumoXMLAttr key, const std::string& value) override;130131/// @}132133protected:134/// @brief position over lane135double myPosOverLane = 0;136137/// @brief friendly position138bool myFriendlyPos = false;139140/// @brief move element lane single141GNEMoveElementLaneSingle* myMoveElementLaneSingle = nullptr;142143private:144/// @brief draw body145void drawBody(const GUIVisualizationSettings::Detail d, const RGBColor& color, const double exaggeration) const;146147/// @brief draw entry logo148void drawEntryLogo(const GUIVisualizationSettings::Detail d, const RGBColor& color, const double exaggeration) const;149150/// @brief draw E3 logo151void drawE3Logo(const GUIVisualizationSettings::Detail d, const RGBColor& color, const double exaggeration) const;152153/// @brief set attribute after validation154void setAttribute(SumoXMLAttr key, const std::string& value) override;155156/// @brief Invalidated copy constructor.157GNEEntryExitDetector(const GNEEntryExitDetector&) = delete;158159/// @brief Invalidated assignment operator.160GNEEntryExitDetector& operator=(const GNEEntryExitDetector&) = delete;161};162163164