Eclipse SUMO - Simulation of Urban MObility
GNEChange_MeanData.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 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 network change in which a mean data set is created or deleted
19/****************************************************************************/
20
21// ===========================================================================
22// included modules
23// ===========================================================================
24#include <config.h>
25
26#include <netedit/GNENet.h>
28
29#include "GNEChange_MeanData.h"
30
31// ===========================================================================
32// FOX-declarations
33// ===========================================================================
34FXIMPLEMENT_ABSTRACT(GNEChange_MeanData, GNEChange, nullptr, 0)
35
36// ===========================================================================
37// member method definitions
38// ===========================================================================
39
41 GNEChange(Supermode::DATA, meanData, forward, meanData->isAttributeCarrierSelected()),
42 myMeanData(meanData) {
43 myMeanData->incRef("GNEChange_MeanData");
44}
45
46
48 myMeanData->decRef("GNEChange_MeanData");
49 if (myMeanData->unreferenced()) {
50 // show extra information for tests
51 WRITE_DEBUG("Deleting unreferenced " + myMeanData->getTagStr());
52 // make sure that MeanData isn't in net before removing
54 // delete MeanData from net
56 }
57 // delete mean data
58 delete myMeanData;
59 }
60}
61
62
63void
65 if (myForward) {
66 // show extra information for tests
67 WRITE_DEBUG("Removing " + myMeanData->getTagStr() + " '" + myMeanData->getID() + "' in GNEChange_MeanData");
68 // unselect if mySelectedElement is enabled
71 }
72 // delete meanData from net
74 } else {
75 // show extra information for tests
76 WRITE_DEBUG("Adding " + myMeanData->getTagStr() + " '" + myMeanData->getID() + "' in GNEChange_MeanData");
77 // select if mySelectedElement is enabled
80 }
81 // insert meanData into net
83 }
84 // require always save elements
86}
87
88
89void
91 if (myForward) {
92 // show extra information for tests
93 WRITE_DEBUG("Adding " + myMeanData->getTagStr() + " '" + myMeanData->getID() + "' in GNEChange_MeanData");
94 // select if mySelectedElement is enabled
97 }
98 // insert meanData into net
100 } else {
101 // show extra information for tests
102 WRITE_DEBUG("Removing " + myMeanData->getTagStr() + " '" + myMeanData->getID() + "' in GNEChange_MeanData");
103 // unselect if mySelectedElement is enabled
104 if (mySelectedElement) {
106 }
107 // delete meanData from net
109 }
110 // require always save elements
112}
113
114
115std::string
117 if (myForward) {
118 return (TL("Undo create ") + myMeanData->getTagStr());
119 } else {
120 return (TL("Undo delete ") + myMeanData->getTagStr());
121 }
122}
123
124
125std::string
127 if (myForward) {
128 return (TL("Redo create ") + myMeanData->getTagStr());
129 } else {
130 return (TL("Redo delete ") + myMeanData->getTagStr());
131 }
132}
Supermode
@brie enum for supermodes
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:281
#define TL(string)
Definition: MsgHandler.h:287
const std::string getID() const
get ID (all Attribute Carriers have one)
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
GNEMeanData * myMeanData
full information regarding the mean data set that is to be created/deleted
void undo()
undo action
std::string undoName() const
return undoName
~GNEChange_MeanData()
Destructor.
std::string redoName() const
get Redo name
void redo()
redo action
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:56
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag
Definition: GNEChange.h:212
const bool mySelectedElement
flag for check if element is selected
Definition: GNEChange.h:215
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEMeanData.h:33
void insertMeanData(GNEMeanData *meanData)
Insert a meanData element int GNENet container.
void deleteMeanData(GNEMeanData *meanData)
delete meanData element of GNENet container
bool meanDataExist(const GNEMeanData *meanData) const
return true if given meanData exist
void requireSaveMeanDatas()
inform that mean data elements has to be saved
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition: GNENet.cpp:126
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:120
void decRef(const std::string &debugMsg="")
Decrease reference.
bool unreferenced()
check if object ins't referenced