Eclipse SUMO - Simulation of Urban MObility
GNEChange_RegisterJoin.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-2024 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 something is changed (for undo/redo)
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <netbuild/NBNodeCont.h>
23 #include <netedit/GNENet.h>
24 #include <netedit/GNEUndoList.h>
26 
27 #include "GNEChange_RegisterJoin.h"
28 
29 // ===========================================================================
30 // FOX-declarations
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 
48 }
49 
50 
51 void
53  // show extra information for tests
54  WRITE_DEBUG("Reverting join registration");
56 }
57 
58 
59 void
61  // show extra information for tests
62  WRITE_DEBUG("Redo join registration");
64 }
65 
66 
67 std::string
69  return (TL("Undo register joined junctions"));
70 }
71 
72 
73 std::string
75  return (TL("Redo register joined junctions"));
76 }
77 
78 
79 GNEChange_RegisterJoin::GNEChange_RegisterJoin(const std::set<NBNode*, ComparatorIdLess>& cluster, NBNodeCont& nc) :
80  GNEChange(Supermode::NETWORK, true, false),
81  myNC(nc)
82 {
83  for (NBNode* n : cluster) {
84  myNodeIDs.insert(n->getID());
85  }
86 }
87 
88 
89 /****************************************************************************/
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:306
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
std::string joinNamedToString(const std::set< T *, C > &ns, const T_BETWEEN &between)
Definition: ToString.h:317
the function-object for an editing operation (abstract base)
std::string redoName() const
get Redo name
std::string undoName() const
get undo Name
GNEChange_RegisterJoin(const std::set< NBNode *, ComparatorIdLess > &cluster, NBNodeCont &nc)
constructor
std::set< std::string > myNodeIDs
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:56
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:57
void registerJoinedCluster(const NodeSet &cluster)
gets all joined clusters (see doc for myClusters2Join)
void unregisterJoinedCluster(const std::set< std::string > &cluster)
remove cluster from list (on netedit-undo)
Represents a single node (junction) during network building.
Definition: NBNode.h:66
Definition: json.hpp:4471
Function-object for stable sorting of objects acting like Named without being derived (SUMOVehicle)
Definition: Named.h:30