Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/changes/GNEChange.cpp
169678 views
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
/****************************************************************************/
14
/// @file GNEChange.cpp
15
/// @author Jakob Erdmann
16
/// @date Mar 2011
17
///
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
28
FXIMPLEMENT_ABSTRACT(GNEChange, FXObject, nullptr, 0)
29
30
// ===========================================================================
31
// member method definitions
32
// ===========================================================================
33
34
GNEChange::GNEChange(Supermode supermode, bool forward, const bool selectedElement) :
35
mySupermode(supermode),
36
myForward(forward),
37
mySelectedElement(selectedElement),
38
next(nullptr) {
39
}
40
41
42
GNEChange::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
55
GNEChange::~GNEChange() {}
56
57
58
int
59
GNEChange::size() const {
60
// by default, 1
61
return 1;
62
}
63
64
65
Supermode
66
GNEChange::getSupermode() const {
67
return mySupermode;
68
}
69
70
71
bool
72
GNEChange::canMerge() const {
73
return false;
74
}
75
76
77
bool
78
GNEChange::mergeWith(GNEChange*) {
79
return false;
80
}
81
82
83
GNEChange::GNEChange() :
84
mySupermode(Supermode::NETWORK),
85
myForward(false),
86
mySelectedElement(false),
87
next(nullptr) {
88
}
89
90
/****************************************************************************/
91
92