SUMO - Simulation of Urban MObility
GNEChange_Connection.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A network change in which a single connection is created or deleted
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <cassert>
31 #include "GNEChange_Connection.h"
32 #include "GNEConnection.h"
33 #include "GNEEdge.h"
34 
35 #ifdef CHECK_MEMORY_LEAKS
36 #include <foreign/nvwa/debug_new.h>
37 #endif
38 
39 
40 // ===========================================================================
41 // FOX-declarations
42 // ===========================================================================
43 FXIMPLEMENT_ABSTRACT(GNEChange_Connection, GNEChange, NULL, 0)
44 
45 // ===========================================================================
46 // member method definitions
47 // ===========================================================================
48 
49 
50 GNEChange_Connection::GNEChange_Connection(GNEEdge* edge, NBEdge::Connection nbCon, bool forward) :
51  GNEChange(edge->getNet(), forward),
52  myEdge(edge),
53  myNBEdgeConnection(nbCon),
54  myConnection(myEdge->retrieveConnection(nbCon.fromLane, nbCon.toEdge, nbCon.toLane)) {
55  assert(myEdge);
56 }
57 
58 
60  assert(myEdge);
61 }
62 
63 
64 void
66  if (myForward) {
68  } else {
70  }
71 }
72 
73 
74 void
76  if (myForward) {
78  } else {
80  }
81 }
82 
83 
84 FXString
86  if (myForward) {
87  return ("Undo create " + toString(SUMO_TAG_CONNECTION)).c_str();
88  } else {
89  return ("Undo delete " + toString(SUMO_TAG_CONNECTION)).c_str();
90  }
91 }
92 
93 
94 FXString
96  if (myForward) {
97  return ("Redo create " + toString(SUMO_TAG_CONNECTION)).c_str();
98  } else {
99  return ("Redo delete " + toString(SUMO_TAG_CONNECTION)).c_str();
100  }
101 }
void addConnection(NBEdge::Connection nbCon, GNEConnection *con)
adds a connection
Definition: GNEEdge.cpp:891
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:49
connectio between two lanes
The representation of a single edge during network building.
Definition: NBEdge.h:71
~GNEChange_Connection()
Destructor.
NBEdge::Connection myNBEdgeConnection
the data which must be copied because the original reference does not persist
GNEConnection * myConnection
We only keep this to retain the GUIGlID.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
FXString undoName() const
return undoName
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag ...
Definition: GNEChange.h:87
void removeConnection(NBEdge::Connection nbCon)
removes a connection
Definition: GNEEdge.cpp:905
FXString redoName() const
get Redo name