Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEChange.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// The reification of a netedit editing operation (see command pattern)
19// inherits from FXCommand and is used to for undo/redo
20/****************************************************************************/
21
22#include "GNEChange.h"
23
24// ===========================================================================
25// FOX-declarations
26// ===========================================================================
27
28FXIMPLEMENT_ABSTRACT(GNEChange, FXObject, nullptr, 0)
29
30// ===========================================================================
31// member method definitions
32// ===========================================================================
33
34GNEChange::GNEChange(Supermode supermode, bool forward, const bool selectedElement) :
35 mySupermode(supermode),
36 myForward(forward),
37 mySelectedElement(selectedElement),
38 next(nullptr) {
39}
40
41
42GNEChange::GNEChange(Supermode supermode, GNEHierarchicalElement* hierarchicalElement, bool forward, const bool selectedElement) :
43 mySupermode(supermode),
44 myParents(hierarchicalElement->getParents()),
45 myForward(forward),
46 mySelectedElement(selectedElement),
47 next(nullptr) {
48 // if we're creating the element, clear hierarchical elements (because parent and children will be added in undo-redo)
49 if (forward) {
50 hierarchicalElement->clearParents();
51 }
52}
53
54
56
57
58int
60 // by default, 1
61 return 1;
62}
63
64
67 return mySupermode;
68}
69
70
71bool
73 return false;
74}
75
76
77bool
79 return false;
80}
81
82
84 mySupermode(Supermode::NETWORK),
85 myForward(false),
86 mySelectedElement(false),
87 next(nullptr) {
88}
89
90/****************************************************************************/
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
the function-object for an editing operation (abstract base)
Definition GNEChange.h:56
virtual int size() const
Return the size of the command group.
Definition GNEChange.cpp:59
Supermode getSupermode() const
get supermode
Definition GNEChange.cpp:66
GNEChange()
FOX need this.
Definition GNEChange.cpp:83
bool mergeWith(GNEChange *command)
Called by the undo system to try and merge the new incoming command with this command; should return ...
Definition GNEChange.cpp:78
~GNEChange()
Destructor.
Definition GNEChange.cpp:55
const Supermode mySupermode
supermode related with this change
Definition GNEChange.h:174
bool canMerge() const
Return TRUE if this command can be merged with previous undo commands. This is useful to combine e....
Definition GNEChange.cpp:72
void clearParents()
clear hierarchical structure parents (used in GNE_Change)