SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GNEChange_Junction.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // A network change in which a single junction is created or deleted
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
10 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "GNEChange_Junction.h"
34 #include "GNENet.h"
35 #include "GNEJunction.h"
36 
37 #ifdef CHECK_MEMORY_LEAKS
38 #include <foreign/nvwa/debug_new.h>
39 #endif
40 
41 
42 // ===========================================================================
43 // FOX-declarations
44 // ===========================================================================
45 FXIMPLEMENT_ABSTRACT(GNEChange_Junction, GNEChange, NULL, 0)
46 
47 // ===========================================================================
48 // member method definitions
49 // ===========================================================================
50 
51 
52 // Constructor for creating a junction
53 GNEChange_Junction::GNEChange_Junction(GNENet* net, GNEJunction* junction, bool forward):
54  GNEChange(net, forward),
55  myJunction(junction) {
56  assert(myNet);
57  junction->incRef("GNEChange_Junction");
58 }
59 
60 
62  assert(myJunction);
63  myJunction->decRef("GNEChange_Junction");
64  if (myJunction->unreferenced()) {
65  delete myJunction;
66  }
67 }
68 
69 
71  if (myForward) {
73  } else {
75  }
76 }
77 
78 
80  if (myForward) {
82  } else {
84  }
85 }
86 
87 
88 FXString GNEChange_Junction::undoName() const {
89  if (myForward) {
90  return ("Undo create junction");
91  } else {
92  return ("Undo delete junction");
93  }
94 }
95 
96 
97 FXString GNEChange_Junction::redoName() const {
98  if (myForward) {
99  return ("Redo create junction");
100  } else {
101  return ("Redo delete junction");
102  }
103 }
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:49
void undo()
undo action
FXString redoName() const
get Redo name
void insertJunction(GNEJunction *junction)
inserts a single junction into the net and into the underlying netbuild-container ...
Definition: GNENet.cpp:1300
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:87
~GNEChange_Junction()
Destructor.
GNEJunction * myJunction
full information regarding the junction that is to be created/deleted we assume shared responsibility...
void decRef(const std::string &debugMsg="")
GNENet * myNet
the net to which operations shall be applied or which shall be informed about gui updates (we are not...
Definition: GNEChange.h:82
void deleteSingleJunction(GNEJunction *junction)
deletes a single junction
Definition: GNENet.cpp:1348
void redo()
redo action
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag ...
Definition: GNEChange.h:87
FXString undoName() const
return undoName