Path: blob/main/src/netedit/changes/GNEChange_RegisterJoin.cpp
193905 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEChange_RegisterJoin.cpp14/// @author Jakob Erdmann15/// @date Mar 201116///17// A network change in which something is changed (for undo/redo)18/****************************************************************************/1920#include <netbuild/NBNodeCont.h>21#include <netedit/GNENet.h>22#include <netedit/GNEUndoList.h>23#include <netedit/elements/data/GNEDataSet.h>2425#include "GNEChange_RegisterJoin.h"2627// ===========================================================================28// FOX-declarations29// ===========================================================================3031FXIMPLEMENT_ABSTRACT(GNEChange_RegisterJoin, GNEChange, nullptr, 0)3233// ===========================================================================34// member method definitions35// ===========================================================================3637void38GNEChange_RegisterJoin::registerJoin(const std::set<NBNode*, ComparatorIdLess>& cluster, NBNodeCont& nc, GNEUndoList* undoList) {39auto change = new GNEChange_RegisterJoin(cluster, nc);40undoList->begin(GUIIcon::UNDO, TLF("Register joined junctions '%'", joinNamedToString(cluster, ",")));41undoList->add(change, true);42undoList->end();43}444546GNEChange_RegisterJoin::~GNEChange_RegisterJoin() {47}484950void51GNEChange_RegisterJoin::undo() {52myNC.unregisterJoinedCluster(myNodeIDs);53}545556void57GNEChange_RegisterJoin::redo() {58myNC.registerJoinedCluster(myNodeIDs);59}606162std::string63GNEChange_RegisterJoin::undoName() const {64return (TL("Undo register joined junctions"));65}666768std::string69GNEChange_RegisterJoin::redoName() const {70return (TL("Redo register joined junctions"));71}727374GNEChange_RegisterJoin::GNEChange_RegisterJoin(const std::set<NBNode*, ComparatorIdLess>& cluster, NBNodeCont& nc) :75GNEChange(Supermode::NETWORK, true, false),76myNC(nc) {77for (NBNode* n : cluster) {78myNodeIDs.insert(n->getID());79}80}818283/****************************************************************************/848586