Path: blob/main/src/netedit/elements/network/GNEWalkingArea.h
185849 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 GNEWalkingArea.h14/// @author Pablo Alvarez Lopez15/// @date Jun 202216///17// A class for visualizing and editing WalkingAreas18/****************************************************************************/19#pragma once20#include <config.h>21#include "GNENetworkElement.h"22#include <utils/gui/globjects/GUIPolygon.h>23#include <netbuild/NBNode.h>2425// ===========================================================================26// class declarations27// ===========================================================================2829class GUIGLObjectPopupMenu;30class PositionVector;31class GNEJunction;32class GNEEdge;3334// ===========================================================================35// class definitions36// ===========================================================================3738class GNEWalkingArea : public GNENetworkElement {3940public:41/**@brief Constructor42* @param[in] junction GNEJunction in which this crossing is placed43* @param[in] ID walkingArea ID44*/45GNEWalkingArea(GNEJunction* junction, const std::string& ID);4647/// @brief Destructor48~GNEWalkingArea();4950/// @brief methods to retrieve the elements linked to this walkingArea51/// @{5253/// @brief get GNEMoveElement associated with this walkingArea54GNEMoveElement* getMoveElement() const override;5556/// @brief get parameters associated with this walkingArea57Parameterised* getParameters() override;5859/// @brief get parameters associated with this walkingArea (constant)60const Parameterised* getParameters() const override;6162/// @}6364/// @name Functions related with geometry of element65/// @{6667/// @brief update pre-computed geometry information68void updateGeometry() override;6970/// @brief Returns position of hierarchical element in view71Position getPositionInView() const;7273/// @}7475/// @name Function related with contour drawing76/// @{7778/// @brief check if draw from contour (green)79bool checkDrawFromContour() const override;8081/// @brief check if draw from contour (magenta)82bool checkDrawToContour() const override;8384/// @brief check if draw related contour (cyan)85bool checkDrawRelatedContour() const override;8687/// @brief check if draw over contour (orange)88bool checkDrawOverContour() const override;8990/// @brief check if draw delete contour (pink/white)91bool checkDrawDeleteContour() const override;9293/// @brief check if draw delete contour small (pink/white)94bool checkDrawDeleteContourSmall() const override;9596/// @brief check if draw select contour (blue)97bool checkDrawSelectContour() const override;9899/// @brief check if draw move contour (red)100bool checkDrawMoveContour() const override;101102/// @}103104/// @brief get referente to NBode::WalkingArea105NBNode::WalkingArea& getNBWalkingArea() const;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 the boundary to which the view shall be centered in order to show the object119Boundary getCenteringBoundary() const override;120121/// @brief update centering boundary (implies change in RTREE)122void updateCenteringBoundary(const bool updateGrid);123124/**@brief Draws the object125* @param[in] s The settings for the current view (may influence drawing)126* @see GUIGlObject::drawGL127*/128void drawGL(const GUIVisualizationSettings& s) const override;129130/// @brief delete element131void deleteGLObject() override;132133/// @brief update GLObject (geometry, ID, etc.)134void updateGLObject() override;135/// @}136137/// @name inherited from GNEAttributeCarrier138/// @{139/* @brief method for getting the Attribute of an XML key140* @param[in] key The attribute key141* @return string with the value associated to key142*/143std::string getAttribute(SumoXMLAttr key) const override;144145/* @brief method for getting the Attribute of an XML key in double format146* @param[in] key The attribute key147* @return double with the value associated to key148*/149double getAttributeDouble(SumoXMLAttr key) const override;150151/* @brief method for getting the Attribute of an XML key in position format152* @param[in] key The attribute key153* @return position with the value associated to key154*/155Position getAttributePosition(SumoXMLAttr key) const override;156157/* @brief method for getting the Attribute of an XML key in Position format158* @param[in] key The attribute key159* @return position with the value associated to key160*/161PositionVector getAttributePositionVector(SumoXMLAttr key) const override;162163/* @brief method for setting the attribute and letting the object perform additional changes164* @param[in] key The attribute key165* @param[in] value The new value166* @param[in] undoList The undoList on which to register changes167*/168void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;169170/* @brief method for checking if the key and their correspond attribute are valids171* @param[in] key The attribute key172* @param[in] value The value associated to key key173* @return true if the value is valid, false in other case174*/175bool isValid(SumoXMLAttr key, const std::string& value) override;176177/* @brief method for check if the value for certain attribute is set178* @param[in] key The attribute key179*/180bool isAttributeEnabled(SumoXMLAttr key) const override;181182/// @}183184protected:185/// @brief An object that stores the shape and its tesselation186mutable TesselatedPolygon myTesselation;187188/// @brief exaggeration used in tesselation189mutable double myExaggeration;190191/// @brief variable used for draw innen contour192GNEContour myInnenContour;193194private:195/// @brief draw walking area196void drawWalkingArea(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,197const PositionVector& shape, const double exaggeration) const;198199/// @brief check if draw walking area in contour mode200bool drawInContourMode() const;201202/// @brief draw tesselated walking area203void drawTesselatedWalkingArea(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d) const;204205/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)206void setAttribute(SumoXMLAttr key, const std::string& value) override;207208/// @brief Invalidated copy constructor.209GNEWalkingArea(const GNEWalkingArea&) = delete;210211/// @brief Invalidated assignment operator.212GNEWalkingArea& operator=(const GNEWalkingArea&) = delete;213};214215216