Path: blob/main/src/netedit/elements/network/GNEInternalLane.h
185851 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 GNEInternalLane.h14/// @author Jakob Erdmann15/// @date June 201116///17// A class for visualizing Inner Lanes (used when editing traffic lights)18/****************************************************************************/19#pragma once20#include <config.h>21#include "GNENetworkElement.h"2223// ===========================================================================24// class declarations25// ===========================================================================26class GUIGLObjectPopupMenu;27class GNETLSEditorFrame;28class PositionVector;293031// ===========================================================================32// class definitions33// ===========================================================================3435class GNEInternalLane : public GNENetworkElement, public FXDelegator {36/// @brief FOX-declaration37FXDECLARE_OVERRIDE(GNEInternalLane)3839public:40/**@brief Constructor41* @param[in] editor The editor to notify about changes42* @param[in] junctionParent junction parent43* @param[in] id The id of this internal lane44* @param[in] shape The shape of the lane45* @param[in] tlIndex The tl-index of the lane46*/47GNEInternalLane(GNETLSEditorFrame* editor, GNEJunction* junctionParent, const std::string& id,48const PositionVector& shape, int tlIndex, LinkState state = LINKSTATE_DEADEND);4950/// @brief Destructor51~GNEInternalLane();5253/// @brief methods to retrieve the elements linked to this internalLane54/// @{5556/// @brief get GNEMoveElement associated with this internalLane57GNEMoveElement* getMoveElement() const override;5859/// @brief get parameters associated with this internalLane60Parameterised* getParameters() override;6162/// @brief get parameters associated with this internalLane (constant)63const Parameterised* getParameters() const override;6465/// @}6667/// @name Functions related with geometry of element68/// @{6970/// @brief update pre-computed geometry information71void updateGeometry() override;7273/// @brief Returns position of hierarchical element in view74Position getPositionInView() const;7576/// @}7778/// @name Function related with contour drawing79/// @{8081/// @brief check if draw from contour (green)82bool checkDrawFromContour() const override;8384/// @brief check if draw from contour (magenta)85bool checkDrawToContour() const override;8687/// @brief check if draw related contour (cyan)88bool checkDrawRelatedContour() const override;8990/// @brief check if draw over contour (orange)91bool checkDrawOverContour() const override;9293/// @brief check if draw delete contour (pink/white)94bool checkDrawDeleteContour() const override;9596/// @brief check if draw delete contour small (pink/white)97bool checkDrawDeleteContourSmall() const override;9899/// @brief check if draw select contour (blue)100bool checkDrawSelectContour() const override;101102/// @brief check if draw move contour (red)103bool checkDrawMoveContour() const override;104105/// @}106107/// @name inherited from GUIGlObject108/// @{109/**@brief Returns an own popup-menu110*111* @param[in] app The application needed to build the popup-menu112* @param[in] parent The parent window needed to build the popup-menu113* @return The built popup-menu114* @see GUIGlObject::getPopUpMenu115*/116GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;117118/**@brief Returns an own parameter window119*120* @param[in] app The application needed to build the parameter window121* @param[in] parent The parent window needed to build the parameter window122* @return The built parameter window123* @see GUIGlObject::getParameterWindow124*/125GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;126127/// @brief Returns the boundary to which the view shall be centered in order to show the object128Boundary getCenteringBoundary() const override;129130/// @brief update centering boundary (implies change in RTREE)131void updateCenteringBoundary(const bool updateGrid);132133/**@brief Draws the object134* @param[in] s The settings for the current view (may influence drawing)135* @see GUIGlObject::drawGL136*/137void drawGL(const GUIVisualizationSettings& s) const override;138139/// @brief delete element140void deleteGLObject() override;141142/// @brief update GLObject (geometry, ID, etc.)143void updateGLObject() override;144145/// @}146147/// @brief set the linkState (controls drawing color)148void setLinkState(LinkState state);149150/// @brief whether link state has been modified151LinkState getLinkState() const;152153/// @brief multiplexes message to two targets154long onDefault(FXObject*, FXSelector, void*) override;155156/// @brief get Traffic Light index157int getTLIndex() const;158159/// @brief long names for link states160static const StringBijection<FXuint> LinkStateNames;161162/// @brief return the color for each linkstate163static RGBColor colorForLinksState(FXuint state);164165/// @name inherited from GNEAttributeCarrier166/// @{167/* @brief method for getting the Attribute of an XML key168* @param[in] key The attribute key169* @return string with the value associated to key170*/171std::string getAttribute(SumoXMLAttr key) const override;172173/* @brief method for getting the Attribute of an XML key in double format174* @param[in] key The attribute key175* @return double with the value associated to key176*/177double getAttributeDouble(SumoXMLAttr key) const override;178179/* @brief method for getting the Attribute of an XML key in position format180* @param[in] key The attribute key181* @return position with the value associated to key182*/183Position getAttributePosition(SumoXMLAttr key) const override;184185/* @brief method for getting the Attribute of an XML key in Position format186* @param[in] key The attribute key187* @return position with the value associated to key188*/189PositionVector getAttributePositionVector(SumoXMLAttr key) const override;190191/* @brief method for setting the attribute and letting the object perform additional changes192* @param[in] key The attribute key193* @param[in] value The new value194* @param[in] undoList The undoList on which to register changes195*/196void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;197198/* @brief method for checking if the key and their conrrespond attribute are valids199* @param[in] key The attribute key200* @param[in] value The value associated to key key201* @return true if the value is valid, false in other case202*/203bool isValid(SumoXMLAttr key, const std::string& value) override;204205/// @}206207protected:208/// @brief FOX needs this209GNEInternalLane();210211private:212/// @brief pointer to junction parent213GNEJunction* myJunctionParent;214215/// @brief internal lane geometry216GUIGeometry myInternalLaneGeometry;217218/// @brief the state of the link (used for visualization)219FXuint myState;220FXDataTarget myStateTarget;221222/// @brief the original state of the link (used for tracking modification)223LinkState myOrigState;224225/// @brief data target for selection state226FXDataTarget stateTarget;227228/// @brief the editor to inform about changes229GNETLSEditorFrame* myEditor;230231/// @brief the tl-index of this lane232int myTlIndex;233234/// @brief the created popup235GUIGLObjectPopupMenu* myPopup;236237/// @brief linkstates names values238static StringBijection<FXuint>::Entry linkStateNamesValues[];239240private:241/// @brief set attribute after validation242void setAttribute(SumoXMLAttr key, const std::string& value) override;243244/// @brief Invalidated copy constructor.245GNEInternalLane(const GNEInternalLane&) = delete;246247/// @brief Invalidated assignment operator.248GNEInternalLane& operator=(const GNEInternalLane&) = delete;249};250251252