Path: blob/main/src/netedit/changes/GNEChange_Attribute.h
169678 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 GNEChange_Attribute.h14/// @author Jakob Erdmann15/// @date Mar 201116///17// A network change in which the attribute of some object is modified18/****************************************************************************/19#pragma once20#include <config.h>2122#include "GNEChange.h"2324// ===========================================================================25// class definitions26// ===========================================================================27/**28* @class GNEChange_Attribute29* @brief the function-object for an editing operation (abstract base)30*/31class GNEChange_Attribute : public GNEChange {32FXDECLARE_ABSTRACT(GNEChange_Attribute)3334public:35/**@brief change attribute36* @param[in] ac The attribute-carrier to be modified37* @param[in] key The attribute key38* @param[in] value The new value39* @param[in] undoList The undoList40* @param[in] force enable or disable force change attribute41*/42static void changeAttribute(GNEAttributeCarrier* AC, SumoXMLAttr key, const std::string& value,43GNEUndoList* undoList, const bool force = false);4445/**@brief change attribute specifying original value46* @param[in] ac The attribute-carrier to be modified47* @param[in] key The attribute key48* @param[in] value The new value49* @param[in] originalValue The original value50* @param[in] undoList The undoList51* @param[in] force enable or disable force change attribute52*/53static void changeAttribute(GNEAttributeCarrier* AC, SumoXMLAttr key, const std::string& value, const std::string& originalValue,54GNEUndoList* undoList, const bool force = false);5556/// @brief Destructor57~GNEChange_Attribute();5859/// @name inherited from GNEChange60/// @{6162/// @brief get undo Name63std::string undoName() const;6465/// @brief get Redo name66std::string redoName() const;6768/// @brief undo action69void undo();7071/// @brief redo action72void redo();7374/// @}7576private:77/**@brief the net to which all operations shall be applied78* @note we are not responsible for the pointer79*/80GNEAttributeCarrier* myAC;8182/// @brief The attribute name (or the original attribute if we're editing a disjoint attribute)83const SumoXMLAttr myKey;8485/// @brief flag used to force set attributes86bool myForceChange;8788/// @brief the original value89const std::string myOrigValue;9091/// @brief the new value92const std::string myNewValue;9394/**@brief constructor95* @param[in] ac The attribute-carrier to be modified96* @param[in] key The attribute key97* @param[in] value The new value98*/99GNEChange_Attribute(GNEAttributeCarrier* ac, const SumoXMLAttr key, const std::string& value);100101/**@brief Constructor with custom origin value102* @param[in] ac The attribute-carrier to be modified103* @param[in] key The attribute key104* @param[in] value The new value105* @param[in] customOrigValue custom original value106*/107GNEChange_Attribute(GNEAttributeCarrier* ac, const SumoXMLAttr key, const std::string& value,108const std::string& customOrigValue);109110/// @brief wether original and new value differ111bool trueChange();112};113114115