Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEChange_DataInterval.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 data interval element 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_DataInterval, GNEChange, nullptr, 0)
34
35// ===========================================================================
36// member method definitions
37// ===========================================================================
38
40 GNEChange(Supermode::DATA, forward, dataInterval->isAttributeCarrierSelected()),
41 myDataInterval(dataInterval),
42 myDataSetParent(dataInterval->getDataSetParent()) {
43 myDataInterval->incRef("GNEChange_DataInterval");
44}
45
46
48 // only continue we have undo-redo mode enabled
50 myDataInterval->decRef("GNEChange_DataInterval");
54 // check that data interval don't exist
56 // delete dataInterval
57 delete myDataInterval;
58 }
59 }
60}
61
62
63void
65 if (myForward) {
66 // remove data interval from data set parent
68 } else {
69 // add data interval into data set parent
71 }
72 // require always save elements
74}
75
76
77void
79 if (myForward) {
80 // add data interval into data set parent
82 } else {
83 // remove data interval from data set parent
85 }
86 // require always save elements
88}
89
90
91std::string
93 if (myForward) {
94 return (TL("Undo create ") + myDataInterval->getTagStr() + " '" + myDataInterval->getID() + "'");
95 } else {
96 return (TL("Undo delete ") + myDataInterval->getTagStr() + " '" + myDataInterval->getID() + "'");
97 }
98}
99
100
101std::string
103 if (myForward) {
104 return (TL("Redo create ") + myDataInterval->getTagStr() + " '" + myDataInterval->getID() + "'");
105 } else {
106 return (TL("Redo delete ") + myDataInterval->getTagStr() + " '" + myDataInterval->getID() + "'");
107 }
108}
109
110
111/****************************************************************************/
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)
const std::string & getTagStr() const
get tag assigned to this object in string format
GNENet * getNet() const
get pointer to net
GNEDataInterval * myDataInterval
full information regarding the data interval element that is to be created/deleted
GNEDataSet * myDataSetParent
pointer to data set parent
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
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag
Definition GNEChange.h:180
GNEDataSet * getDataSetParent() const
Returns a pointer to GNEDataSet parent.
void removeDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
void addDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
GNEDataInterval * retrieveDataInterval(const GNEAttributeCarrier *AC, bool hardFail=true) const
Returns the data interval.
void requireSaveDataElements()
inform that 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
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows