Path: blob/main/src/netedit/elements/data/GNETAZRelData.h
193871 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 GNETAZRelData.h14/// @author Pablo Alvarez Lopez15/// @date Jan 202016///17// class for TAZ relation data18/****************************************************************************/19#pragma once20#include <config.h>2122#include <netedit/elements/GNEContour.h>23#include <utils/gui/div/GUIGeometry.h>2425#include "GNEGenericData.h"2627// ===========================================================================28// class definitions29// ===========================================================================30/**31* @class GNETAZRelData32* @brief An Element which don't belong to GNENet but has influence in the simulation33*/34class GNETAZRelData : public GNEGenericData {3536public:37/// @brief default Constructor38GNETAZRelData(GNENet* net);3940/**@brief Constructor for two TAZs41* @param[in] dataIntervalParent pointer to data interval parent42* @param[in] fromTAZ pointer to from TAZ43* @param[in] toTAZ pointer to to TAZ44* @param[in] parameters parameters map45*/46GNETAZRelData(GNEDataInterval* dataIntervalParent, GNEAdditional* fromTAZ, GNEAdditional* toTAZ,47const Parameterised::Map& parameters);4849/**@brief Constructor for one TAZ50* @param[in] dataIntervalParent pointer to data interval parent51* @param[in] TAZ pointer to TAZ52* @param[in] parameters parameters map53*/54GNETAZRelData(GNEDataInterval* dataIntervalParent, GNEAdditional* TAZ,55const Parameterised::Map& parameters);5657/// @brief Destructor58~GNETAZRelData();5960/// @brief get TAZ rel data color61RGBColor setColor(const GUIVisualizationSettings& s) const;62double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;63double getScaleValue(const GUIVisualizationSettings& s, int activeScheme) const;6465/// @brief check if current TAZ rel data is visible66bool isGenericDataVisible() const override;6768/// @brief update pre-computed geometry information69void updateGeometry() override;7071/// @brief Returns element position in view72Position getPositionInView() const override;7374/// @name members and functions relative to write data sets into XML75/// @{76/**@brief write data set element into a xml file77* @param[in] device device in which write parameters of data set element78*/79void writeGenericData(OutputDevice& device) const override;8081/// @brief check if current data set is valid to be written into XML (by default true, can be reimplemented in children)82bool isGenericDataValid() const override;8384/// @brief return a string with the current data set problem (by default empty, can be reimplemented in children)85std::string getGenericDataProblem() const override;8687/// @brief fix data set problem (by default throw an exception, has to be reimplemented in children)88void fixGenericDataProblem() override;89/// @}9091/// @name inherited from GUIGlObject92/// @{9394/**@brief Draws the object95* @param[in] s The settings for the current view (may influence drawing)96* @see GUIGlObject::drawGL97*/98void drawGL(const GUIVisualizationSettings& s) const override;99100//// @brief Returns the boundary to which the view shall be centered in order to show the object101Boundary getCenteringBoundary() const override;102103/// @}104105/// @name inherited from GNEPathElement106/// @{107108/// @brief compute pathElement109void computePathElement() override;110111/**@brief Draws partial object over lane112* @param[in] s The settings for the current view (may influence drawing)113* @param[in] segment lane segment114* @param[in] offsetFront front offset115*/116void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;117118/**@brief Draws partial object over junction119* @param[in] s The settings for the current view (may influence drawing)120* @param[in] segment junction segment121* @param[in] offsetFront front offset122*/123void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const override;124125/// @brief get first path lane126GNELane* getFirstPathLane() const override;127128/// @brief get last path lane129GNELane* getLastPathLane() const override;130/// @}131132/// @name inherited from GNEAttributeCarrier133/// @{134/* @brief method for getting the Attribute of an XML key135* @param[in] key The attribute key136* @return string with the value associated to key137*/138std::string getAttribute(SumoXMLAttr key) const override;139140/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)141* @param[in] key The attribute key142* @return double with the value associated to key143*/144double getAttributeDouble(SumoXMLAttr key) const override;145146/**@brief method for setting the attribute and letting the object perform data set changes147* @param[in] key The attribute key148* @param[in] value The new value149* @param[in] undoList The undoList on which to register changes150*/151void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;152153/**@brief method for checking if the key and their conrrespond attribute are valids154* @param[in] key The attribute key155* @param[in] value The value associated to key key156* @return true if the value is valid, false in other case157*/158bool isValid(SumoXMLAttr key, const std::string& value) override;159160/* @brief method for check if the value for certain attribute is set161* @param[in] key The attribute key162*/163bool isAttributeEnabled(SumoXMLAttr key) const override;164165/// @brief get PopPup ID (Used in AC Hierarchy)166std::string getPopUpID() const override;167168/// @brief get Hierarchy Name (Used in AC Hierarchy)169std::string getHierarchyName() const override;170/// @}171172protected:173/// @brief variable used for draw contours174GNEContour myTAZRelDataContour;175176/// @brief Geometry for TAZRel data177GUIGeometry myTAZRelGeometry;178179/// @brief Geometry for TAZRel data (center)180GUIGeometry myTAZRelGeometryCenter;181182/// @brief TAZRel data width183mutable double myLastWidth;184185private:186/// @brief check draw conditions187bool drawTAZRel() const;188189/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)190void setAttribute(SumoXMLAttr key, const std::string& value) override;191192/// @brief sets the color according to the current scheme index and some tazRel function193bool setFunctionalColor(int activeScheme, RGBColor& col) const;194195/// @brief Invalidated copy constructor.196GNETAZRelData(const GNETAZRelData&) = delete;197198/// @brief Invalidated assignment operator.199GNETAZRelData& operator=(const GNETAZRelData&) = delete;200};201202/****************************************************************************/203204205