Path: blob/main/src/netedit/elements/data/GNEEdgeRelData.h
169684 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 GNEEdgeRelData.h14/// @author Pablo Alvarez Lopez15/// @date Jan 202016///17// class for edge relation data18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEGenericData.h"2324// ===========================================================================25// class definitions26// ===========================================================================27/**28* @class GNEEdgeRelData29* @brief An Element which don't belong to GNENet but has influence in the simulation30*/31class GNEEdgeRelData : public GNEGenericData {3233public:34/// @brief default Constructor35GNEEdgeRelData(GNENet* net);3637/**@brief Constructor38* @param[in] dataIntervalParent pointer to data interval parent39* @param[in] fromEdge pointer to from edge40* @param[in] toEdge pointer to to edge41* @param[in] parameters parameters map42*/43GNEEdgeRelData(GNEDataInterval* dataIntervalParent, GNEEdge* fromEdge, GNEEdge* toEdge,44const Parameterised::Map& parameters);4546/// @brief Destructor47~GNEEdgeRelData();4849/// @brief get edge rel data color50RGBColor setColor(const GUIVisualizationSettings& s) const;51double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;5253/// @brief check if current edge rel data is visible54bool isGenericDataVisible() const;5556/// @brief update pre-computed geometry information57void updateGeometry();5859/// @brief Returns element position in view60Position getPositionInView() const;6162/// @name members and functions relative to write data sets into XML63/// @{64/**@brief write data set element into a xml file65* @param[in] device device in which write parameters of data set element66*/67void writeGenericData(OutputDevice& device) const;6869/// @brief check if current data set is valid to be written into XML (by default true, can be reimplemented in children)70bool isGenericDataValid() const;7172/// @brief return a string with the current data set problem (by default empty, can be reimplemented in children)73std::string getGenericDataProblem() const;7475/// @brief fix data set problem (by default throw an exception, has to be reimplemented in children)76void fixGenericDataProblem();77/// @}7879/// @name inherited from GUIGlObject80/// @{8182/**@brief Draws the object83* @param[in] s The settings for the current view (may influence drawing)84* @see GUIGlObject::drawGL85*/86void drawGL(const GUIVisualizationSettings& s) const;8788//// @brief Returns the boundary to which the view shall be centered in order to show the object89Boundary getCenteringBoundary() const;9091/// @}9293/// @name inherited from GNEPathElement94/// @{9596/// @brief compute pathElement97void computePathElement();9899/**@brief Draws partial object over lane100* @param[in] s The settings for the current view (may influence drawing)101* @param[in] segment lane segment102* @param[in] offsetFront front offset103*/104void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;105106/**@brief Draws partial object over junction107* @param[in] s The settings for the current view (may influence drawing)108* @param[in] segment junction segment109* @param[in] offsetFront front offset110*/111void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;112113/// @brief get first path lane114GNELane* getFirstPathLane() const;115116/// @brief get last path lane117GNELane* getLastPathLane() const;118/// @}119120/// @name inherited from GNEAttributeCarrier121/// @{122/* @brief method for getting the Attribute of an XML key123* @param[in] key The attribute key124* @return string with the value associated to key125*/126std::string getAttribute(SumoXMLAttr key) const;127128/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)129* @param[in] key The attribute key130* @return double with the value associated to key131*/132double getAttributeDouble(SumoXMLAttr key) const;133134/**@brief method for setting the attribute and letting the object perform data set changes135* @param[in] key The attribute key136* @param[in] value The new value137* @param[in] undoList The undoList on which to register changes138*/139void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);140141/**@brief method for checking if the key and their conrrespond attribute are valids142* @param[in] key The attribute key143* @param[in] value The value associated to key key144* @return true if the value is valid, false in other case145*/146bool isValid(SumoXMLAttr key, const std::string& value);147148/* @brief method for check if the value for certain attribute is set149* @param[in] key The attribute key150*/151bool isAttributeEnabled(SumoXMLAttr key) const;152153/// @brief get PopPup ID (Used in AC Hierarchy)154std::string getPopUpID() const;155156/// @brief get Hierarchy Name (Used in AC Hierarchy)157std::string getHierarchyName() const;158/// @}159160private:161/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)162void setAttribute(SumoXMLAttr key, const std::string& value);163164/// @brief Invalidated copy constructor.165GNEEdgeRelData(const GNEEdgeRelData&) = delete;166167/// @brief Invalidated assignment operator.168GNEEdgeRelData& operator=(const GNEEdgeRelData&) = delete;169};170171/****************************************************************************/172173174