Path: blob/main/src/netedit/elements/demand/GNEDemandElementFlow.h
185790 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 GNEDemandElementFlow.h14/// @author Pablo Alvarez Lopez15/// @date Jul 202316///17// An auxiliar, asbtract class for flow elements (vehicles, person and containers)18/****************************************************************************/19#pragma once20#include <config.h>2122#include <utils/geom/Position.h>23#include <utils/xml/SUMOXMLDefinitions.h>24#include <utils/vehicle/SUMOVehicleParameter.h>2526// ===========================================================================27// class declaration28// ===========================================================================2930class SUMOVehicleParameter;31class GNEDemandElement;3233// ===========================================================================34// class definitions35// ===========================================================================3637class GNEDemandElementFlow : public SUMOVehicleParameter {3839protected:40/// @brief constructor41GNEDemandElementFlow(GNEDemandElement* flowElement);4243/// @brief constructor with parameters44GNEDemandElementFlow(GNEDemandElement* flowElement, const SUMOVehicleParameter& vehicleParameters);4546/// @brief destructor47~GNEDemandElementFlow();4849/// @brief draw flow label50void drawFlowLabel(const Position& position, const double rotation, const double width,51const double length, const double exaggeration) const;5253/// @brief inherited from GNEAttributeCarrier and adapted to GNEDemandElementFlow54/// @{55/* @brief method for getting the Attribute of an XML key56* @param[in] key The attribute key57* @return string with the value associated to key58*/59std::string getFlowAttribute(const GNEDemandElement* flowElement, SumoXMLAttr key) const;6061/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)62* @param[in] key The attribute key63* @return double with the value associated to key64*/65double getFlowAttributeDouble(SumoXMLAttr key) const;6667/* @brief method for setting the attribute and letting the object perform demand element changes68* @param[in] key The attribute key69* @param[in] value The new value70* @param[in] undoList The undoList on which to register changes71* @param[in] net optionally the GNENet to inform about gui updates72*/73void setFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);7475/* @brief method for setting the attribute and letting the object perform demand element changes76* @param[in] key The attribute key77* @param[in] value The new value78* @param[in] undoList The undoList on which to register changes79*/80bool isValidFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value);8182/* @brief method for enable attribute83* @param[in] key The attribute key84* @param[in] undoList The undoList on which to register changes85* @note certain attributes can be only enabled, and can produce the disabling of other attributes86*/87void enableFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, GNEUndoList* undoList);8889/* @brief method for disable attribute90* @param[in] key The attribute key91* @param[in] undoList The undoList on which to register changes92* @note certain attributes can be only enabled, and can produce the disabling of other attributes93*/94void disableFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, GNEUndoList* undoList);9596/* @brief method for check if the value for certain attribute is set97* @param[in] key The attribute key98*/99bool isFlowAttributeEnabled(SumoXMLAttr key) const;100101/// @brief method for setting the attribute and nothing else102void setFlowAttribute(GNEDemandElement* flowElement, SumoXMLAttr key, const std::string& value);103104/// @brief toggle flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers105void toggleFlowAttribute(const SumoXMLAttr attribute, const bool value);106107private:108/// @brief set flow default attributes109void setDefaultFlowAttributes(GNEDemandElement* flowElement);110111/// @brief Invalidated copy constructor.112GNEDemandElementFlow(const GNEDemandElementFlow&) = delete;113114/// @brief Invalidated assignment operator.115GNEDemandElementFlow& operator=(const GNEDemandElementFlow&) = delete;116};117118119