Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/changes/GNEChange_RegisterJoin.cpp
193905 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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_RegisterJoin.cpp
15
/// @author Jakob Erdmann
16
/// @date Mar 2011
17
///
18
// A network change in which something is changed (for undo/redo)
19
/****************************************************************************/
20
21
#include <netbuild/NBNodeCont.h>
22
#include <netedit/GNENet.h>
23
#include <netedit/GNEUndoList.h>
24
#include <netedit/elements/data/GNEDataSet.h>
25
26
#include "GNEChange_RegisterJoin.h"
27
28
// ===========================================================================
29
// FOX-declarations
30
// ===========================================================================
31
32
FXIMPLEMENT_ABSTRACT(GNEChange_RegisterJoin, GNEChange, nullptr, 0)
33
34
// ===========================================================================
35
// member method definitions
36
// ===========================================================================
37
38
void
39
GNEChange_RegisterJoin::registerJoin(const std::set<NBNode*, ComparatorIdLess>& cluster, NBNodeCont& nc, GNEUndoList* undoList) {
40
auto change = new GNEChange_RegisterJoin(cluster, nc);
41
undoList->begin(GUIIcon::UNDO, TLF("Register joined junctions '%'", joinNamedToString(cluster, ",")));
42
undoList->add(change, true);
43
undoList->end();
44
}
45
46
47
GNEChange_RegisterJoin::~GNEChange_RegisterJoin() {
48
}
49
50
51
void
52
GNEChange_RegisterJoin::undo() {
53
myNC.unregisterJoinedCluster(myNodeIDs);
54
}
55
56
57
void
58
GNEChange_RegisterJoin::redo() {
59
myNC.registerJoinedCluster(myNodeIDs);
60
}
61
62
63
std::string
64
GNEChange_RegisterJoin::undoName() const {
65
return (TL("Undo register joined junctions"));
66
}
67
68
69
std::string
70
GNEChange_RegisterJoin::redoName() const {
71
return (TL("Redo register joined junctions"));
72
}
73
74
75
GNEChange_RegisterJoin::GNEChange_RegisterJoin(const std::set<NBNode*, ComparatorIdLess>& cluster, NBNodeCont& nc) :
76
GNEChange(Supermode::NETWORK, true, false),
77
myNC(nc) {
78
for (NBNode* n : cluster) {
79
myNodeIDs.insert(n->getID());
80
}
81
}
82
83
84
/****************************************************************************/
85
86