Path: blob/main/src/netedit/elements/data/GNETAZRelData.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 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>2324#include "GNEGenericData.h"2526// ===========================================================================27// class definitions28// ===========================================================================29/**30* @class GNETAZRelData31* @brief An Element which don't belong to GNENet but has influence in the simulation32*/33class GNETAZRelData : public GNEGenericData {3435public:36/// @brief default Constructor37GNETAZRelData(GNENet* net);3839/**@brief Constructor for two TAZs40* @param[in] dataIntervalParent pointer to data interval parent41* @param[in] fromTAZ pointer to from TAZ42* @param[in] toTAZ pointer to to TAZ43* @param[in] parameters parameters map44*/45GNETAZRelData(GNEDataInterval* dataIntervalParent, GNEAdditional* fromTAZ, GNEAdditional* toTAZ,46const Parameterised::Map& parameters);4748/**@brief Constructor for one TAZ49* @param[in] dataIntervalParent pointer to data interval parent50* @param[in] TAZ pointer to TAZ51* @param[in] parameters parameters map52*/53GNETAZRelData(GNEDataInterval* dataIntervalParent, GNEAdditional* TAZ,54const Parameterised::Map& parameters);5556/// @brief Destructor57~GNETAZRelData();5859/// @brief get TAZ rel data color60RGBColor setColor(const GUIVisualizationSettings& s) const;61double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;6263/// @brief check if current TAZ rel data is visible64bool isGenericDataVisible() const;6566/// @brief update pre-computed geometry information67void updateGeometry();6869/// @brief Returns element position in view70Position getPositionInView() const;7172/// @name members and functions relative to write data sets into XML73/// @{74/**@brief write data set element into a xml file75* @param[in] device device in which write parameters of data set element76*/77void writeGenericData(OutputDevice& device) const;7879/// @brief check if current data set is valid to be written into XML (by default true, can be reimplemented in children)80bool isGenericDataValid() const;8182/// @brief return a string with the current data set problem (by default empty, can be reimplemented in children)83std::string getGenericDataProblem() const;8485/// @brief fix data set problem (by default throw an exception, has to be reimplemented in children)86void fixGenericDataProblem();87/// @}8889/// @name inherited from GUIGlObject90/// @{9192/**@brief Draws the object93* @param[in] s The settings for the current view (may influence drawing)94* @see GUIGlObject::drawGL95*/96void drawGL(const GUIVisualizationSettings& s) const;9798//// @brief Returns the boundary to which the view shall be centered in order to show the object99Boundary getCenteringBoundary() const;100101/// @}102103/// @name inherited from GNEPathElement104/// @{105106/// @brief compute pathElement107void computePathElement();108109/**@brief Draws partial object over lane110* @param[in] s The settings for the current view (may influence drawing)111* @param[in] segment lane segment112* @param[in] offsetFront front offset113*/114void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;115116/**@brief Draws partial object over junction117* @param[in] s The settings for the current view (may influence drawing)118* @param[in] segment junction segment119* @param[in] offsetFront front offset120*/121void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;122123/// @brief get first path lane124GNELane* getFirstPathLane() const;125126/// @brief get last path lane127GNELane* getLastPathLane() const;128/// @}129130/// @name inherited from GNEAttributeCarrier131/// @{132/* @brief method for getting the Attribute of an XML key133* @param[in] key The attribute key134* @return string with the value associated to key135*/136std::string getAttribute(SumoXMLAttr key) const;137138/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)139* @param[in] key The attribute key140* @return double with the value associated to key141*/142double getAttributeDouble(SumoXMLAttr key) const;143144/**@brief method for setting the attribute and letting the object perform data set changes145* @param[in] key The attribute key146* @param[in] value The new value147* @param[in] undoList The undoList on which to register changes148*/149void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);150151/**@brief method for checking if the key and their conrrespond attribute are valids152* @param[in] key The attribute key153* @param[in] value The value associated to key key154* @return true if the value is valid, false in other case155*/156bool isValid(SumoXMLAttr key, const std::string& value);157158/* @brief method for check if the value for certain attribute is set159* @param[in] key The attribute key160*/161bool isAttributeEnabled(SumoXMLAttr key) const;162163/// @brief get PopPup ID (Used in AC Hierarchy)164std::string getPopUpID() const;165166/// @brief get Hierarchy Name (Used in AC Hierarchy)167std::string getHierarchyName() const;168/// @}169170protected:171/// @brief variable used for draw contours172GNEContour myTAZRelDataContour;173174/// @brief Geometry for TAZRel data175GUIGeometry myTAZRelGeometry;176177/// @brief Geometry for TAZRel data (center)178GUIGeometry myTAZRelGeometryCenter;179180/// @brief TAZRel data width181mutable double myLastWidth;182183private:184/// @brief check draw conditions185bool drawTAZRel() const;186187/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)188void setAttribute(SumoXMLAttr key, const std::string& value);189190/// @brief sets the color according to the current scheme index and some tazRel function191bool setFunctionalColor(int activeScheme, RGBColor& col) const;192193/// @brief Invalidated copy constructor.194GNETAZRelData(const GNETAZRelData&) = delete;195196/// @brief Invalidated assignment operator.197GNETAZRelData& operator=(const GNETAZRelData&) = delete;198};199200/****************************************************************************/201202203