Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEChange_Junction.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 single junction is created or deleted
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22#include <netedit/GNEViewNet.h>
25
26#include "GNEChange_Junction.h"
27
28// ===========================================================================
29// FOX-declarations
30// ===========================================================================
31
32FXIMPLEMENT_ABSTRACT(GNEChange_Junction, GNEChange, nullptr, 0)
33
34// ===========================================================================
35// member method definitions
36// ===========================================================================
37
38
39
41 GNEChange(Supermode::NETWORK, junction, forward, junction->isAttributeCarrierSelected()),
42 myJunction(junction) {
43 junction->incRef("GNEChange_Junction");
44}
45
46
48 // only continue we have undo-redo mode enabled
50 myJunction->decRef("GNEChange_Junction");
51 if (myJunction->unreferenced()) {
52 delete myJunction;
53 }
54 }
55}
56
57
58void
60 if (myForward) {
61 // unselect if mySelectedElement is enabled
64 }
65 // delete junction from net
67 // remove element from parent and children
69 } else {
70 // select if mySelectedElement is enabled
73 }
74 // add element in parent and children
76 // insert junction in net
78 }
79 // enable save networkElements
81}
82
83
84void
86 if (myForward) {
87 // select if mySelectedElement is enabled
90 }
91 // add element in parent and children
93 // add junction into net
95 } else {
96 // unselect if mySelectedElement is enabled
99 }
100 // add element in parent and children
102 // delete junction from net
104 // remove element from parent and children
106 }
107 // enable save networkElements
109}
110
111
112std::string
114 if (myForward) {
115 return (TL("Undo create junction '") + myJunction->getID() + "'");
116 } else {
117 return (TL("Undo delete junction '") + myJunction->getID() + "'");
118 }
119}
120
121
122std::string
124 if (myForward) {
125 return (TL("Redo create junction '") + myJunction->getID() + "'");
126 } else {
127 return (TL("Redo delete junction '") + myJunction->getID() + "'");
128 }
129}
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
#define TL(string)
Definition MsgHandler.h:301
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
GNENet * getNet() const
get pointer to net
std::string undoName() const
return undoName
void redo()
redo action
~GNEChange_Junction()
Destructor.
GNEJunction * myJunction
full information regarding the junction that is to be created/deleted
std::string redoName() const
get Redo name
void undo()
undo 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
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 deleteSingleJunction(GNEJunction *junction)
delete junction from container
void insertJunction(GNEJunction *junction)
insert junction in container
void requireSaveNetwork()
inform that network 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