Path: blob/main/src/netedit/elements/additional/GNEPOI.h
193964 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 GNEPOI.h14/// @author Pablo Alvarez Lopez15/// @date Jun 201716///17// A class for visualizing and editing POIS in netedit (adapted from18// GUIPointOfInterest and NLHandler)19/****************************************************************************/20#pragma once21#include <config.h>2223#include <utils/shapes/Shape.h>24#include <utils/xml/CommonXMLStructure.h>2526#include "GNEAdditional.h"2728// ===========================================================================29// class declaration30// ===========================================================================3132class GNEMoveElementLaneSingle;33class GNEMoveElementViewResizable;3435// ===========================================================================36// class definitions37// ===========================================================================3839class GNEPOI : public Shape, public GNEAdditional, public Parameterised {4041public:42// avoid diamond problem43using GNEAttributeCarrier::getID;4445/// @brief Constructor46GNEPOI(SumoXMLTag tag, GNENet* net);4748/**@brief Constructor49* @param[in] id The name of the POI50* @param[in] net net in which this polygon is placed51* @param[in] fileBucket file in which this element is stored52* @param[in] type The (abstract) type of the POI53* @param[in] color The color of the POI54* @param[in] pos The position X or Lon of the POI55* @param[in[ geo use GEO coordinates (lon/lat)56* @param[in] icon the POI icon57* @param[in] layer The layer of the POI58* @param[in] angle The rotation of the POI59* @param[in] imgFile The raster image of the shape60* @param[in] width The width of the POI image61* @param[in] height The height of the POI image62* @param[in] name POI's name63* @param[in] parameters generic parameters64*/65GNEPOI(const std::string& id, GNENet* net, FileBucket* fileBucket, const std::string& type, const RGBColor& color,66const Position& pos, const bool geo, POIIcon icon, const double layer, const double angle, const std::string& imgFile,67const double width, const double height, const std::string& name, const Parameterised::Map& parameters);6869/**@brief Constructor70* @param[in] id The name of the POI71* @param[in] net net in which this polygon is placed72* @param[in] fileBucket file in which this element is stored73* @param[in] type The (abstract) type of the POI74* @param[in] color The color of the POI75* @param[in] icon the POI icon76* @param[in] layer The layer of the POI77* @param[in] angle The rotation of the POI78* @param[in] imgFile The raster image of the shape79* @param[in] lane lane in which this POILane is placed80* @param[in] posOverLane Position over lane in which this POILane is placed81* @param[in] posLat Lateral position over lane82* @param[in] width The width of the POI image83* @param[in] height The height of the POI image84* @param[in] name POI's name85* @param[in] parameters generic parameters86*/87GNEPOI(const std::string& id, GNENet* net, FileBucket* fileBucket, const std::string& type, const RGBColor& color, GNELane* lane,88const double posOverLane, const bool friendlyPos, const double posLat, POIIcon icon, const double layer, const double angle,89const std::string& imgFile, const double width, const double height, const std::string& name, const Parameterised::Map& parameters);9091/// @brief Destructor92~GNEPOI();9394/// @brief methods to retrieve the elements linked to this POI95/// @{9697/// @brief get GNEMoveElement associated with this POI98GNEMoveElement* getMoveElement() const override;99100/// @brief get parameters associated with this POI101Parameterised* getParameters() override;102103/// @brief get parameters associated with this POI (constant)104const Parameterised* getParameters() const override;105106/// @}107108/// @brief gererate a new ID for an element child109std::string generateChildID(SumoXMLTag childTag);110111/// @brief get SUMOBaseObject with all POIattributes112CommonXMLStructure::SumoBaseObject* getSumoBaseObject() const;113114/// @name inherited from GNEAdditional115/// @{116117/// @brief update pre-computed geometry information118void updateGeometry() override;119120/// @brief Returns position of shape in view121Position getPositionInView() const override;122123/// @brief return exaggeration associated with this GLObject124double getExaggeration(const GUIVisualizationSettings& s) const override;125126/// @brief update centering boundary (implies change in RTREE)127void updateCenteringBoundary(const bool updateGrid) override;128129/// @brief split geometry130void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement,131const GNENetworkElement* newElement, GNEUndoList* undoList) override;132133/**@brief write additional element into a xml file134* @param[in] device device in which write parameters of additional element135*/136void writeAdditional(OutputDevice& device) const override;137138/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)139bool isAdditionalValid() const override;140141/// @brief return a string with the current additional problem (must be reimplemented in all detector children)142std::string getAdditionalProblem() const override;143144/// @brief fix additional problem (must be reimplemented in all detector children)145void fixAdditionalProblem() override;146147/// @brief Returns the numerical id of the object148GUIGlID getGlID() const;149150/// @}151152/// @name Function related with contour drawing153/// @{154155/// @brief check if draw move contour (red)156bool checkDrawMoveContour() const override;157158/// @}159160/// @name inherited from GUIGlObject161/// @{162/**@brief Returns the name of the parent object163* @return This object's parent id164*/165std::string getParentName() const override;166167/**@brief Returns an own popup-menu168*169* @param[in] app The application needed to build the popup-menu170* @param[in] parent The parent window needed to build the popup-menu171* @return The built popup-menu172* @see GUIGlObject::getPopUpMenu173*/174GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;175176/**@brief Draws the object177* @param[in] s The settings for the current view (may influence drawing)178* @see GUIGlObject::drawGL179*/180void drawGL(const GUIVisualizationSettings& s) const override;181182/// @}183184/// @name inherited from GNEAttributeCarrier185/// @{186187/**@brief method for getting the Attribute of an XML key188* @param[in] key The attribute key189* @return string with the value associated to key190*/191std::string getAttribute(SumoXMLAttr key) const override;192193/* @brief method for getting the Attribute of an XML key in double format194* @param[in] key The attribute key195* @return double with the value associated to key196*/197double getAttributeDouble(SumoXMLAttr key) const override;198199/* @brief method for getting the Attribute of an XML key in position format200* @param[in] key The attribute key201* @return position with the value associated to key202*/203Position getAttributePosition(SumoXMLAttr key) const override;204205/* @brief method for getting the Attribute of an XML key in positionVector format206* @param[in] key The attribute key207* @return positionVector with the value associated to key208*/209PositionVector getAttributePositionVector(SumoXMLAttr key) const override;210211/**@brief method for setting the attribute and letting the object perform additional changes212* @param[in] key The attribute key213* @param[in] value The new value214* @param[in] undoList The undoList on which to register changes215*/216void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;217218/**@brief method for checking if the key and their correspond attribute are valids219* @param[in] key The attribute key220* @param[in] value The value associated to key key221* @return true if the value is valid, false in other case222*/223bool isValid(SumoXMLAttr key, const std::string& value) override;224225/* @brief method for check if the value for certain attribute is set226* @param[in] key The attribute key227*/228bool isAttributeEnabled(SumoXMLAttr key) const override;229230/// @}231232/// @brief get PopPup ID (Used in AC Hierarchy)233std::string getPopUpID() const override;234235/// @brief get Hierarchy Name (Used in AC Hierarchy)236std::string getHierarchyName() const override;237238protected:239/// @brief position over view240Position myPosOverView;241242/// @brief position over lane243double myPosOverLane = 0;244245/// @brief friendly position246bool myFriendlyPos = false;247248/// @brief width249double myWidth = 0;250251/// @brief height252double myHeight = 0;253254/// @brief lateral position;255double myPosLat = 0;256257/// @brief POI icon258POIIcon myPOIIcon = POIIcon::NONE;259260/// @brief move element over single lane261GNEMoveElementLaneSingle* myMoveElementLaneSingle = nullptr;262263/// @brief move element view resizable264GNEMoveElementViewResizable* myMoveElementViewResizable = nullptr;265266private:267/// @brief draw POI268void drawPOI(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,269const bool movingGeometryPoints) const;270271/// @brief calculate contour272void calculatePOIContour(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,273const double exaggeration, const bool movingGeometryPoints) const;274275/// @brief set attribute after validation276void setAttribute(SumoXMLAttr key, const std::string& value) override;277278/// @brief Invalidated copy constructor.279GNEPOI(const GNEPOI&) = delete;280281/// @brief Invalidated assignment operator.282GNEPOI& operator=(const GNEPOI&) = delete;283};284285286