Path: blob/main/src/netedit/elements/data/GNEGenericData.h
193873 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 GNEGenericData.h14/// @author Pablo Alvarez Lopez15/// @date Jan 202016///17// A abstract class for generic datas18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/elements/GNEAttributeCarrier.h>23#include <netedit/elements/GNEHierarchicalElement.h>24#include <netedit/elements/GNEPathElement.h>25#include <utils/gui/globjects/GUIGlObject.h>26#include <utils/common/Parameterised.h>2728// ===========================================================================29// class declarations30// ===========================================================================3132class GNEDataInterval;33class GNENet;3435// ===========================================================================36// class definitions37// ===========================================================================3839class GNEGenericData : public GNEAttributeCarrier, public GNEHierarchicalElement, public GUIGlObject, public GNEPathElement, public Parameterised {4041public:42/// @brief default Constructor43GNEGenericData(SumoXMLTag tag, GNENet* net);4445/**@brief Constructor46* @param[in] tag generic data Tag (edgeData, laneData, etc.)47* @param[in] dataIntervalParent pointer to data interval parent48* @param[in] parameters parameters map49*/50GNEGenericData(const SumoXMLTag tag, GNEDataInterval* dataIntervalParent,51const Parameterised::Map& parameters);5253/// @brief Destructor54virtual ~GNEGenericData();5556/// @brief methods to retrieve the elements linked to this dataSet57/// @{5859/// @brief get GNEHierarchicalElement associated with this genericData60GNEHierarchicalElement* getHierarchicalElement() override;6162/// @brief get GNEMoveElement associated with this genericData63GNEMoveElement* getMoveElement() const override;6465/// @brief get parameters associated with this genericData66Parameterised* getParameters() override;6768/// @brief get parameters associated with this genericData (constant)69const Parameterised* getParameters() const override;7071/// @brief get GUIGlObject associated with this genericData72GUIGlObject* getGUIGlObject() override;7374/// @brief get GUIGlObject associated with this genericData (constant)75const GUIGlObject* getGUIGlObject() const override;7677/// @}7879/// @brief check if current generic data is visible80virtual bool isGenericDataVisible() const = 0;8182/// @brief get reference to fileBucket in which save this AC83FileBucket* getFileBucket() const override;8485/// @brief get data interval parent86GNEDataInterval* getDataIntervalParent() const;8788// @brief draw attribute89void drawAttribute(const PositionVector& shape) const;9091/// @brief Returns element position in view92virtual Position getPositionInView() const = 0;9394/// @name Function related with contour drawing95/// @{9697/// @brief check if draw from contour (green)98bool checkDrawFromContour() const override;99100/// @brief check if draw from contour (magenta)101bool checkDrawToContour() const override;102103/// @brief check if draw related contour (cyan)104bool checkDrawRelatedContour() const override;105106/// @brief check if draw over contour (orange)107bool checkDrawOverContour() const override;108109/// @brief check if draw delete contour (pink/white)110bool checkDrawDeleteContour() const override;111112/// @brief check if draw delete contour small (pink/white)113bool checkDrawDeleteContourSmall() const override;114115/// @brief check if draw select contour (blue)116bool checkDrawSelectContour() const override;117118/// @brief check if draw move contour (red)119bool checkDrawMoveContour() const override;120121/// @}122123/// @name members and functions relative to write data sets into XML124/// @{125/**@brief write data set element into a xml file126* @param[in] device device in which write parameters of data set element127*/128virtual void writeGenericData(OutputDevice& device) const = 0;129130/// @brief check if current data set is valid to be written into XML (by default true, can be reimplemented in children)131virtual bool isGenericDataValid() const;132133/// @brief return a string with the current data set problem (by default empty, can be reimplemented in children)134virtual std::string getGenericDataProblem() const;135136/// @brief fix data set problem (by default throw an exception, has to be reimplemented in children)137virtual void fixGenericDataProblem();138/// @}139140/// @name inherited from GUIGlObject141/// @{142/**@brief Returns an own popup-menu143*144* @param[in] app The application needed to build the popup-menu145* @param[in] parent The parent window needed to build the popup-menu146* @return The built popup-menu147* @see GUIGlObject::getPopUpMenu148*/149GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;150151/**@brief Returns an own parameter window152*153* @param[in] app The application needed to build the parameter window154* @param[in] parent The parent window needed to build the parameter window155* @return The built parameter window156* @see GUIGlObject::getParameterWindow157*/158GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;159160/// @brief delete element161void deleteGLObject() override;162163/// @brief select element164void selectGLObject() override;165166/// @brief update GLObject (geometry, ID, etc.)167void updateGLObject() override;168169/// @}170171/// @name inherited from GNEAttributeCarrier172/// @{173174/* @brief method for getting the Attribute of an XML key in position format175* @param[in] key The attribute key176* @return position with the value associated to key177*/178Position getAttributePosition(SumoXMLAttr key) const override;179180/* @brief method for getting the Attribute of an XML key in positionVector format181* @param[in] key The attribute key182* @return positionVector with the value associated to key183*/184PositionVector getAttributePositionVector(SumoXMLAttr key) const override;185186/// @}187188/// @name inherited from GNEPathElement189/// @{190191/// @brief check if path element is selected192bool isPathElementSelected() const override;193194/// @}195196protected:197/// @brief dataInterval Parent198GNEDataInterval* myDataIntervalParent;199200/// @brief draw filtered attribute201void drawFilteredAttribute(const GUIVisualizationSettings& s, const PositionVector& laneShape, const std::string& attribute, const GNEDataInterval* dataIntervalParent) const;202203/// @brief check if attribute is visible in inspect, delete or select mode204bool isVisibleInspectDeleteSelect() const;205206/// @brief replace the first parent edge207void replaceFirstParentEdge(const std::string& value);208209/// @brief replace the last parent edge210void replaceLastParentEdge(const std::string& value);211212/// @brief replace the first parent TAZElement213void replaceParentTAZElement(const int index, const std::string& value);214215/// @brief get partial ID216std::string getPartialID() const;217218private:219/// @brief Invalidated copy constructor.220GNEGenericData(const GNEGenericData&) = delete;221222/// @brief Invalidated assignment operator.223GNEGenericData& operator=(const GNEGenericData&) = delete;224};225226/****************************************************************************/227228229