Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEChange_Additional.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 busStop is created or deleted
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22#include <netedit/GNEViewNet.h>
25
27
28// ===========================================================================
29// FOX-declarations
30// ===========================================================================
31
32FXIMPLEMENT_ABSTRACT(GNEChange_Additional, GNEChange, nullptr, 0)
33
34// ===========================================================================
35// member method definitions
36// ===========================================================================
37
39 GNEChange(Supermode::NETWORK, additional, forward, additional->isAttributeCarrierSelected()),
40 myAdditional(additional) {
41 myAdditional->incRef("GNEChange_Additional");
42}
43
44
46 // only continue we have undo-redo mode enabled
48 myAdditional->decRef("GNEChange_Additional");
50 // make sure that additional isn't in net before removing
52 // delete additional from net
54 }
55 delete myAdditional;
56 }
57 }
58}
59
60
61void
63 if (myForward) {
64 // unselect if mySelectedElement is enabled
67 }
68 // delete additional from net
70 // remove element from parent and children
72 } else {
73 // select if mySelectedElement is enabled
76 }
77 // add element in parent and children
79 // insert additional into net
81 }
82 // require always save additionals
84}
85
86
87void
89 if (myForward) {
90 // select if mySelectedElement is enabled
93 }
94 // add element in parent and children
96 // insert additional into net
98 } else {
99 // unselect if mySelectedElement is enabled
100 if (mySelectedElement) {
102 }
103 // delete additional from net
105 // remove element from parent and children
107 }
108 // require always save additionals
110}
111
112
113std::string
115 if (myForward) {
116 return (TL("Undo create ") + myAdditional->getTagStr() + " '" + myAdditional->getID() + "'");
117 } else {
118 return (TL("Undo delete ") + myAdditional->getTagStr() + " '" + myAdditional->getID() + "'");
119 }
120}
121
122
123std::string
125 if (myForward) {
126 return (TL("Redo create ") + myAdditional->getTagStr() + " '" + myAdditional->getID() + "'");
127 } else {
128 return (TL("Redo delete ") + myAdditional->getTagStr() + " '" + myAdditional->getID() + "'");
129 }
130}
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, 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
GNENet * getNet() const
get pointer to net
std::string redoName() const
get Redo name
GNEAdditional * myAdditional
full information regarding the additional element that is to be created/deleted
std::string undoName() const
return undoName
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
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
void deleteAdditional(GNEAdditional *additional)
delete additional element of container
void insertAdditional(GNEAdditional *additional)
Insert a additional element in container.
void requireSaveAdditionals()
inform that additionals 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