Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEChange_GenericData.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 generic data set is created or deleted
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22#include <netedit/GNEViewNet.h>
26
28
29// ===========================================================================
30// FOX-declarations
31// ===========================================================================
32
33FXIMPLEMENT_ABSTRACT(GNEChange_GenericData, GNEChange, nullptr, 0)
34
35// ===========================================================================
36// member method definitions
37// ===========================================================================
38
40 GNEChange(Supermode::DATA, genericData, forward, genericData->isAttributeCarrierSelected()),
41 myGenericData(genericData),
42 myDataIntervalParent(genericData->getDataIntervalParent()) {
43 myGenericData->incRef("GNEChange_GenericData");
44}
45
46
48 // only continue we have undo-redo mode enabled
50 myGenericData->decRef("GNEChange_GenericData");
54 // delete generic data from interval parent
56 // delete generic data
57 delete myGenericData;
58 }
59 }
60}
61
62
63void
65 if (myForward) {
66 // unselect if mySelectedElement is enabled
69 }
70 // delete generic data from interval parent
72 // remove element from parent and children
74 } else {
75 // select if mySelectedElement is enabled
78 }
79 // add element in parent and children
81 // insert generic data into interval parent
83 }
84 // require always save elements
86}
87
88
89void
91 if (myForward) {
92 // select if mySelectedElement is enabled
95 }
96 // add element in parent and children
98 // insert generic data into interval parent
100 } else {
101 // unselect if mySelectedElement is enabled
102 if (mySelectedElement) {
104 }
105 // delete generic data from interval parent
107 // remove element from parent and children
109 }
110 // require always save elements
112}
113
114
115std::string
117 if (myForward) {
118 return (TL("Undo create ") + myGenericData->getTagStr());
119 } else {
120 return (TL("Undo delete ") + myGenericData->getTagStr());
121 }
122}
123
124
125std::string
127 if (myForward) {
128 return (TL("Redo create ") + myGenericData->getTagStr());
129 } else {
130 return (TL("Redo delete ") + myGenericData->getTagStr());
131 }
132}
Supermode
@brie enum for supermodes
@ DATA
Data mode (edgeData, LaneData etc..)
#define TL(string)
Definition MsgHandler.h:304
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
GNENet * getNet() const
get pointer to net
std::string undoName() const
return undoName
GNEGenericData * myGenericData
full information regarding the generic data set that is to be created/deleted
std::string redoName() const
get Redo name
GNEDataInterval * myDataIntervalParent
data interval parent
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
void addElementInParentsAndChildren(T *element)
add given element in parents and children
Definition GNEChange.h:121
void removeElementFromParentsAndChildren(T *element)
remove given element from parents and children
Definition GNEChange.h:148
void removeGenericDataChild(GNEGenericData *genericData)
add generic data child
void addGenericDataChild(GNEGenericData *genericData)
add generic data child
GNEDataInterval * retrieveDataInterval(const GNEAttributeCarrier *AC, bool hardFail=true) const
Returns the data interval.
GNEGenericData * retrieveGenericData(const GUIGlObject *glObject, bool hardFail=true) const
Returns the generic data.
void requireSaveDataElements()
inform that data elements has to be saved
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition GNENet.cpp:162
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
void decRef(const std::string &debugMsg="")
Decrease reference.
bool unreferenced()
check if object ins't referenced
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows