SUMO - Simulation of Urban MObility
GNEChange_CalibratorItem.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 Calibrators in netedit
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
25 #include <netedit/GNENet.h>
26 #include <netedit/GNEViewNet.h>
31 
33 
34 // ===========================================================================
35 // FOX-declarations
36 // ===========================================================================
37 FXIMPLEMENT_ABSTRACT(GNEChange_CalibratorItem, GNEChange, nullptr, 0)
38 
39 // ===========================================================================
40 // member method definitions
41 // ===========================================================================
42 
43 
45  GNEChange(calibratorVehicleType->getViewNet()->getNet(), forward),
46  myCalibratorVehicleType(calibratorVehicleType) {
47  myCalibratorVehicleType->incRef("GNEChange_CalibratorItem");
48 }
49 
50 
52 
53 
54 void
56  if (myForward) {
58  // show extra information for tests
59  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
60  WRITE_WARNING("Removing calibrator vehicle type '" + myCalibratorVehicleType->getID() + "'");
61  }
62  // remove calibrator vehicle type
64  } else {
65  throw ProcessError("There isn't a defined Calibrator item");
66  }
67  } else {
69  // show extra information for tests
70  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
71  WRITE_WARNING("Adding calibrator vehicle type '" + myCalibratorVehicleType->getID() + "'");
72  }
73  // add calibrator vehicle type
75  } else {
76  throw ProcessError("There isn't a defined Calibrator item");
77  }
78  }
79  // enable save additionals
81 }
82 
83 
84 void
86  if (myForward) {
88  // show extra information for tests
89  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
90  WRITE_WARNING("Adding calibrator vehicle type '" + myCalibratorVehicleType->getID() + "'");
91  }
92  // add calibrator vehicle type
94  } else {
95  throw ProcessError("There isn't a defined Calibrator item");
96  }
97  } else {
99  // show extra information for tests
100  if (OptionsCont::getOptions().getBool("gui-testing-debug")) {
101  WRITE_WARNING("Removing calibrator vehicle type '" + myCalibratorVehicleType->getID() + "'");
102  }
103  // remove calibrator vehicle type
105  } else {
106  throw ProcessError("There isn't a defined Calibrator item");
107  }
108  }
109  // enable save additionals
111 }
112 
113 
114 FXString
117  return ("Undo change " + toString(myCalibratorVehicleType->getTag()) + " values").c_str();
118  } else {
119  throw ProcessError("There isn't a defined Calibrator item");
120  }
121 }
122 
123 
124 FXString
127  return ("Redo change " + toString(myCalibratorVehicleType->getTag()) + " values").c_str();
128  } else {
129  throw ProcessError("There isn't a defined Calibrator item");
130  }
131 }
void insertCalibratorVehicleType(GNECalibratorVehicleType *vehicleType)
insert Calibrator VehicleType in net
Definition: GNENet.cpp:2235
the function-object for an editing operation (abstract base)
Definition: GNEChange.h:42
void deleteCalibratorVehicleType(GNECalibratorVehicleType *vehicleType)
delete Calibrator VehicleType in net
Definition: GNENet.cpp:2245
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:193
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
FXString redoName() const
get Redo name
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
const std::string getID() const
function to support debugging
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
GNECalibratorVehicleType * myCalibratorVehicleType
modified calibrator vehicle type
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
FXString undoName() const
return undoName