Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2025 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#include <netedit/GNENet.h>
23#include <netedit/GNEViewNet.h>
27
28#include "GNEChange_MeanData.h"
29
30// ===========================================================================
31// FOX-declarations
32// ===========================================================================
33FXIMPLEMENT_ABSTRACT(GNEChange_MeanData, GNEChange, nullptr, 0)
34
35// ===========================================================================
36// member method definitions
37// ===========================================================================
38
40 GNEChange(Supermode::DATA, forward, meanData->isAttributeCarrierSelected()),
41 myMeanData(meanData) {
42 myMeanData->incRef("GNEChange_MeanData");
43}
44
45
47 // only continue we have undo-redo mode enabled
49 myMeanData->decRef("GNEChange_MeanData");
50 if (myMeanData->unreferenced()) {
51 // make sure that MeanData isn't in net before removing
53 // delete MeanData from net
55 }
56 // delete mean data
57 delete myMeanData;
58 }
59 }
60}
61
62
63void
65 if (myForward) {
66 // unselect if mySelectedElement is enabled
69 }
70 // delete meanData from net
72 } else {
73 // select if mySelectedElement is enabled
76 }
77 // insert meanData into net
79 }
80 // require always save elements
82}
83
84
85void
87 if (myForward) {
88 // select if mySelectedElement is enabled
91 }
92 // insert meanData into net
94 } else {
95 // unselect if mySelectedElement is enabled
98 }
99 // delete meanData from net
101 }
102 // require always save elements
104}
105
106
107std::string
109 if (myForward) {
110 return (TL("Undo create ") + myMeanData->getTagStr());
111 } else {
112 return (TL("Undo delete ") + myMeanData->getTagStr());
113 }
114}
115
116
117std::string
119 if (myForward) {
120 return (TL("Redo create ") + myMeanData->getTagStr());
121 } else {
122 return (TL("Redo delete ") + myMeanData->getTagStr());
123 }
124}
Supermode
@brie enum for supermodes
@ DATA
Data mode (edgeData, LaneData etc..)
#define TL(string)
Definition MsgHandler.h:305
const std::string getID() const
get ID (all Attribute Carriers have one)
void selectAttributeCarrier()
select attribute carrier using GUIGlobalSelection
void unselectAttributeCarrier()
unselect attribute carrier using GUIGlobalSelection
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
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:180
const bool mySelectedElement
flag for check if element is selected
Definition GNEChange.h:183
GNEMeanData * retrieveMeanData(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named meanData.
void insertMeanData(GNEMeanData *meanData)
Insert a meanData element in container.
void deleteMeanData(GNEMeanData *meanData)
delete meanData element of container
void requireSaveMeanDatas()
inform that mean data elements has to be saved
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition GNENet.cpp:164
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:146
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2194
void decRef(const std::string &debugMsg="")
Decrease reference.
bool unreferenced()
check if object ins't referenced
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows