SUMO - Simulation of Urban MObility
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.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 "GNEChange_Junction.h"
31 #include "GNENet.h"
32 #include "GNEJunction.h"
33 
34 #ifdef CHECK_MEMORY_LEAKS
35 #include <foreign/nvwa/debug_new.h>
36 #endif
37 
38 
39 // ===========================================================================
40 // FOX-declarations
41 // ===========================================================================
42 FXIMPLEMENT_ABSTRACT(GNEChange_Junction, GNEChange, NULL, 0)
43 
44 // ===========================================================================
45 // member method definitions
46 // ===========================================================================
47 
48 
49 GNEChange_Junction::GNEChange_Junction(GNEJunction* junction, bool forward):
51  GNEChange(junction->getNet(), forward),
52  myJunction(junction) {
53  assert(myNet);
54  junction->incRef("GNEChange_Junction");
55 }
56 
57 
59  assert(myJunction);
60  myJunction->decRef("GNEChange_Junction");
61  if (myJunction->unreferenced()) {
62  delete myJunction;
63  }
64 }
65 
66 
67 void
69  if (myForward) {
71  } else {
73  }
74 }
75 
76 
77 void
79  if (myForward) {
81  } else {
83  }
84 }
85 
86 
87 FXString
89  if (myForward) {
90  return ("Undo create " + toString(SUMO_TAG_JUNCTION)).c_str();
91  } else {
92  return ("Undo delete " + toString(SUMO_TAG_JUNCTION)).c_str();
93  }
94 }
95 
96 
97 FXString
99  if (myForward) {
100  return ("Redo create " + toString(SUMO_TAG_JUNCTION)).c_str();
101  } else {
102  return ("Redo delete " + toString(SUMO_TAG_JUNCTION)).c_str();
103  }
104 }
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:49
void undo()
undo action
begin/end of the description of a junction
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:1315
~GNEChange_Junction()
Destructor.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
GNEJunction * myJunction
full information regarding the junction that is to be created/deleted
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:1368
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