Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEChange_Connection.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// A network change in which a single connection is created or deleted
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22
24
25// ===========================================================================
26// FOX-declarations
27// ===========================================================================
28
29FXIMPLEMENT_ABSTRACT(GNEChange_Connection, GNEChange, nullptr, 0)
30
31// ===========================================================================
32// member method definitions
33// ===========================================================================
34
35
36GNEChange_Connection::GNEChange_Connection(GNEEdge* edge, NBEdge::Connection nbCon, bool selected, bool forward) :
37 GNEChange(Supermode::NETWORK, forward, selected),
38 myEdge(edge),
39 myNBEdgeConnection(nbCon) {
40}
41
42
45
46
47void
49 if (myForward) {
50 // remove connection from edge
52 } else {
53 // add connection into edge
55 }
56 // enable save networkElements
58}
59
60
61void
63 if (myForward) {
64 // add connection into edge
66 } else {
67 // remove connection from edge
69 }
70 // enable save networkElements
72}
73
74
75std::string
77 if (myForward) {
78 return (TL("Undo create ") + toString(SUMO_TAG_CONNECTION) + " '" +
80 } else {
81 return (TL("Undo delete ") + toString(SUMO_TAG_CONNECTION) + " '" +
83 }
84}
85
86
87std::string
89 if (myForward) {
90 return (TL("Redo create connection '") +
92 } else {
93 return (TL("Redo delete connection '") +
95 }
96}
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
#define TL(string)
Definition MsgHandler.h:305
@ SUMO_TAG_CONNECTION
connectioon between two lanes
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
GNENet * getNet() const
get pointer to net
std::string undoName() const
return undoName
NBEdge::Connection myNBEdgeConnection
the data which must be copied because the original reference does not persist
std::string redoName() const
get Redo name
the function-object for an editing operation (abstract base)
Definition GNEChange.h:56
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag
Definition GNEChange.h:180
const bool mySelectedElement
flag for check if element is selected
Definition GNEChange.h:183
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
void removeConnection(NBEdge::Connection nbCon)
removes a connection
Definition GNEEdge.cpp:2292
void addConnection(NBEdge::Connection nbCon, bool selectAfterCreation=false)
adds a connection
Definition GNEEdge.cpp:2268
void requireSaveNetwork()
inform that network has to be saved
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition GNENet.cpp:162
The representation of a single edge during network building.
Definition NBEdge.h:92
int fromLane
The lane the connections starts at.
Definition NBEdge.h:210