Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEChange_Distribution.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A change in which the distribution attribute of some object is modified
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "GNEChange.h"
24
25// ===========================================================================
26// class definitions
27// ===========================================================================
33 FXDECLARE_ABSTRACT(GNEChange_Distribution)
34
35public:
37 static void addKey(GNEDemandElement* distribution, const GNEDemandElement* key, const double value, GNEUndoList* undoList);
38
40 static void removeKey(GNEDemandElement* distribution, const GNEDemandElement* key, GNEUndoList* undoList);
41
43 static void editValue(GNEDemandElement* distribution, const GNEDemandElement* key, const double newValue, GNEUndoList* undoList);
44
47
51 std::string undoName() const;
52
54 std::string redoName() const;
55
57 void undo();
58
60 void redo();
62
63private:
68
71
74
76 const double myNewProbability;
77
79 const bool myAddKey;
80
83
90 GNEChange_Distribution(GNEDemandElement* distribution, const GNEDemandElement* key, const double value, const bool addKey);
91
98 GNEChange_Distribution(GNEDemandElement* distribution, const GNEDemandElement* key, const double originalValue, const double newValue);
99};
the function-object for an editing operation (abstract base)
static void editValue(GNEDemandElement *distribution, const GNEDemandElement *key, const double newValue, GNEUndoList *undoList)
edit value
GNEDemandElement * myDistribution
the distribution to which all operations shall be applied
const double myNewProbability
the new value
const GNEDemandElement * myKey
the key
const bool myAddKey
flag for check if we're adding or removing key
const bool myEditingProbability
flag for check if we're editing value
static void addKey(GNEDemandElement *distribution, const GNEDemandElement *key, const double value, GNEUndoList *undoList)
add new key
const double myOriginalProbability
the original value
static void removeKey(GNEDemandElement *distribution, const GNEDemandElement *key, GNEUndoList *undoList)
remove key
std::string undoName() const
return undoName
std::string redoName() const
get Redo name
the function-object for an editing operation (abstract base)
Definition GNEChange.h:56