SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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-2016 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(0, forward),
52  myEdge(edge),
53  myNBEdgeConnection(nbCon),
54  myConnection(myEdge->retrieveConnection(nbCon.fromLane, nbCon.toEdge, nbCon.toLane)) {
55  assert(myEdge);
56  //myEdge->incRef("GNEChange_Connection");
57 }
58 
59 
61  assert(myEdge);
62  //myEdge->decRef("GNEChange_Connection");
63 }
64 
65 
67  if (myForward) {
69  } else {
71  }
72 }
73 
74 
76  if (myForward) {
78  } else {
80  }
81 }
82 
83 
85  if (myForward) {
86  return ("Undo create connection");
87  } else {
88  return ("Undo delete connection");
89  }
90 }
91 
92 
94  if (myForward) {
95  return ("Redo create connection");
96  } else {
97  return ("Redo delete connection");
98  }
99 }
void addConnection(NBEdge::Connection nbCon, GNEConnection *con)
adds a connection
Definition: GNEEdge.cpp:872
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:49
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.
FXString undoName() const
return undoName
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:55
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:886
FXString redoName() const
get Redo name