43 if (AC->getNet()->getViewNet()->getViewParent()->getGNEAppWindows()->isUndoRedoAllowed()) {
45 auto change = new GNEChange_Attribute(AC, key, value);
47 change->myForceChange = force;
49 if (change->trueChange()) {
50 undoList->begin(AC, TLF(
"change '%' attribute in % '%' to '%'", toString(key), AC->getTagStr(), AC->getID(), value));
51 undoList->add(change, true);
57 AC->setAttribute(key,
value);
68 change->myForceChange = force;
70 if (change->trueChange()) {
72 undoList->
add(change,
true);
85 if (
myAC->getNet()->getViewNet()->getViewParent()->getGNEAppWindows()->isUndoRedoAllowed()) {
89 if (
myAC->unreferenced()) {
104 if (
myAC->getTagProperty()->hasAttribute(
myKey) &&
myAC->getTagProperty()->getAttributeProperties(
myKey)->requireUpdateGeometry()) {
105 myAC->updateGeometry();
108 if (
myAC->getTagProperty()->isGenericData()) {
109 myAC->getNet()->getAttributeCarriers()->retrieveDataSet(
myAC->getAttribute(
GNE_ATTR_DATASET))->updateAttributeColors();
111 myAC->getNet()->getAttributeCarriers()->retrieveDataSet(
myAC->getAttribute(
SUMO_ATTR_ID))->updateAttributeColors();
114 if (
myAC->getTagProperty()->isNetworkElement()) {
115 myAC->getNet()->getSavingStatus()->requireSaveNetwork();
116 }
else if (
myAC->getTagProperty()->isAdditionalElement()) {
117 myAC->getNet()->getSavingStatus()->requireSaveAdditionals();
118 }
else if (
myAC->getTagProperty()->isDemandElement()) {
119 myAC->getNet()->getSavingStatus()->requireSaveDemandElements();
120 }
else if (
myAC->getTagProperty()->isDataElement()) {
121 myAC->getNet()->getSavingStatus()->requireSaveDataElements();
122 }
else if (
myAC->getTagProperty()->isMeanData()) {
123 myAC->getNet()->getSavingStatus()->requireSaveMeanDatas();
136 if (
myAC->getTagProperty()->hasAttribute(
myKey) &&
myAC->getTagProperty()->getAttributeProperties(
myKey)->requireUpdateGeometry()) {
137 myAC->updateGeometry();
140 if (
myAC->getTagProperty()->isGenericData()) {
141 myAC->getNet()->getAttributeCarriers()->retrieveDataSet(
myAC->getAttribute(
GNE_ATTR_DATASET))->updateAttributeColors();
143 myAC->getNet()->getAttributeCarriers()->retrieveDataSet(
myAC->getAttribute(
SUMO_ATTR_ID))->updateAttributeColors();
146 if (
myAC->getTagProperty()->isNetworkElement()) {
147 myAC->getNet()->getSavingStatus()->requireSaveNetwork();
148 }
else if (
myAC->getTagProperty()->isAdditionalElement()) {
149 myAC->getNet()->getSavingStatus()->requireSaveAdditionals();
150 }
else if (
myAC->getTagProperty()->isDemandElement()) {
151 myAC->getNet()->getSavingStatus()->requireSaveDemandElements();
152 }
else if (
myAC->getTagProperty()->isDataElement()) {
153 myAC->getNet()->getSavingStatus()->requireSaveDataElements();
154 }
else if (
myAC->getTagProperty()->isMeanData()) {
155 myAC->getNet()->getSavingStatus()->requireSaveMeanDatas();
163 return (
TL(
"Undo change ") +
myAC->getTagStr() +
" attribute");
169 return (
TL(
"Redo change ") +
myAC->getTagStr() +
" attribute");
const std::string invalid_return< std::string >::value
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_DATASET
data set of a generic data
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isUndoRedoAllowed() const
const std::string getID() const override
get ID (all Attribute Carriers have one)
const std::string & getTagStr() const
get tag assigned to this object in string format
GNENet * getNet() const
get pointer to net
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
the function-object for an editing operation (abstract base)
const SumoXMLAttr myKey
The attribute name (or the original attribute if we're editing a disjoint attribute).
bool myForceChange
flag used to force set attributes
bool trueChange()
wether original and new value differ
std::string undoName() const
get undo Name
const std::string myNewValue
the new value
GNEChange_Attribute(GNEAttributeCarrier *ac, const SumoXMLAttr key, const std::string &value)
constructor
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
GNEAttributeCarrier * myAC
the net to which all operations shall be applied
~GNEChange_Attribute()
Destructor.
const std::string myOrigValue
the original value
std::string redoName() const
get Redo name
the function-object for an editing operation (abstract base)
Supermode getSupermode() const
get supermode
GNEChange(Supermode supermode, bool forward, const bool selectedElement)
Constructor.
GNEViewNet * getViewNet() const
get view net
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
GNEViewParent * getViewParent() const
get the net object
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows