Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEChange_Edge.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 edge is created or deleted
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22#include <netedit/GNEViewNet.h>
25
26#include "GNEChange_Edge.h"
27
28// ===========================================================================
29// FOX-declarations
30// ===========================================================================
31
32FXIMPLEMENT_ABSTRACT(GNEChange_Edge, GNEChange, nullptr, 0)
33
34// ===========================================================================
35// member method definitions
36// ===========================================================================
37
38
39
41 GNEChange(Supermode::NETWORK, edge, forward, edge->isAttributeCarrierSelected()),
42 myEdge(edge) {
43 edge->incRef("GNEChange_Edge");
44}
45
46
48 // only continue we have undo-redo mode enabled
50 myEdge->decRef("GNEChange_Edge");
51 if (myEdge->unreferenced()) {
52 // delete edge
53 delete myEdge;
54 }
55 }
56}
57
58
59void
61 if (myForward) {
62 // unselect if mySelectedElement is enabled
65 }
66 // delete edge from net
68 // remove element from parent and children
70 } else {
71 // select if mySelectedElement is enabled
74 }
75 // add element in parent and children
77 // insert edge into net
79 }
80 // enable save networkElements
82}
83
84
85void
87 if (myForward) {
88 // select if mySelectedElement is enabled
91 }
92 // add element in parent and children
94 // insert edge into net
96 } else {
97 // unselect if mySelectedElement is enabled
100 }
101 // delete edge from net
103 // remove element from parent and children
105 }
106 // enable save networkElements
108}
109
110
111std::string
113 if (myForward) {
114 return (TL("Undo create edge '") + myEdge->getID() + "'");
115 } else {
116 return (TL("Undo delete edge '") + myEdge->getID() + "'");
117 }
118}
119
120
121std::string
123 if (myForward) {
124 return (TL("Redo create edge '") + myEdge->getID() + "'");
125 } else {
126 return (TL("Redo delete edge '") + myEdge->getID() + "'");
127 }
128}
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
GNENet * getNet() const
get pointer to net
void undo()
undo action
std::string redoName() const
get Redo name
GNEEdge * myEdge
full information regarding the edge that is to be created/deleted
void redo()
redo action
~GNEChange_Edge()
Destructor.
std::string undoName() const
get undo 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
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
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
void deleteSingleEdge(GNEEdge *edge)
delete edge from 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