SUMO - Simulation of Urban MObility
GNEChange_VariableSpeedSignItem.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A change in the values of Variable Speed Signs in netedit
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
25 #include <netedit/GNENet.h>
26 #include <netedit/GNEViewNet.h>
29 
31 
32 // ===========================================================================
33 // FOX-declarations
34 // ===========================================================================
35 FXIMPLEMENT_ABSTRACT(GNEChange_VariableSpeedSignItem, GNEChange, nullptr, 0)
36 
37 // ===========================================================================
38 // member method definitions
39 // ===========================================================================
40 
42  GNEChange(variableSpeedSignStep->getVariableSpeedSignParent()->getViewNet()->getNet(), forward),
43  myVariableSpeedSignStep(variableSpeedSignStep) {
44  myVariableSpeedSignStep->incRef("GNEChange_VariableSpeedSignItem");
45 }
46 
47 
49  myVariableSpeedSignStep->decRef("GNEChange_VariableSpeedSignItem");
51  // show extra information for tests
52  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
53  WRITE_WARNING("Deleting Variable Speed Sign Step");
54  }
56  }
57 }
58 
59 
60 void
62  if (myForward) {
63  // show extra information for tests
64  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
65  WRITE_WARNING("Removing Step from Variable Speed Sign '" + myVariableSpeedSignStep->getVariableSpeedSignParent()->getID() + "'");
66  }
67  // remove step from Variable Speed Sign
69  } else {
70  // show extra information for tests
71  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
72  WRITE_WARNING("Adding Step to Variable Speed Sign '" + myVariableSpeedSignStep->getVariableSpeedSignParent()->getID() + "'");
73  }
74  // add step to Variable Speed Sign
76  }
77  // enable save additionals
79 }
80 
81 
82 void
84  if (myForward) {
85  // show extra information for tests
86  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
87  WRITE_WARNING("Adding Step to Variable Speed Sign '" + myVariableSpeedSignStep->getVariableSpeedSignParent()->getID() + "'");
88  }
89  // add step to Variable Speed Sign
91  } else {
92  // show extra information for tests
93  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
94  WRITE_WARNING("Removing Step from Variable Speed Sign '" + myVariableSpeedSignStep->getVariableSpeedSignParent()->getID() + "'");
95  }
96  // remove step from Variable Speed Sign
98  }
99  // enable save additionals
101 }
102 
103 
104 FXString
106  return ("Undo change " + toString(myVariableSpeedSignStep->getTag()) + " values").c_str();
107 }
108 
109 
110 FXString
112  return ("Redo change " + toString(myVariableSpeedSignStep->getTag()) + " values").c_str();
113 }
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:42
void removeVariableSpeedSignStep(GNEVariableSpeedSignStep *step)
remove an existent step of variable speed signal
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:193
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
void requiereSaveAdditionals(bool value)
inform that additionals has to be saved
Definition: GNENet.cpp:1833
GNEVariableSpeedSignStep * myVariableSpeedSignStep
modified Variable Speed Sign interval
const std::string getID() const
function to support debugging
FXString undoName() const
return undoName
void decRef(const std::string &debugMsg="")
Decrease reference.
GNENet * myNet
the net to which operations shall be applied or which shall be informed about gui updates (we are not...
Definition: GNEChange.h:75
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag ...
Definition: GNEChange.h:80
SumoXMLTag getTag() const
get XML Tag assigned to this object
GNEVariableSpeedSign * getVariableSpeedSignParent() const
get variable speed sign parent
bool unreferenced()
check if object ins&#39;t referenced
void addVariableSpeedSignStep(GNEVariableSpeedSignStep *step)
insert a new step in variable speed signal