37 myParentDemandElement(demandElementParent),
38 myChildDemandElement(demandElementChild),
39 myOperation(operation),
40 myOriginalChildElements(demandElementParent->getChildDemandElements()),
41 myEditedChildElements(demandElementParent->getChildDemandElements()) {
42 myParentDemandElement->incRef(
"GNEChange_Children");
44 auto it = std::find(myEditedChildElements.begin(), myEditedChildElements.end(), myChildDemandElement);
46 if (it != myEditedChildElements.end()) {
47 if ((operation == Operation::MOVE_FRONT) && (it != (myEditedChildElements.end() - 1))) {
49 it = myEditedChildElements.erase(it);
51 myEditedChildElements.insert(it + 1, myChildDemandElement);
52 }
else if ((operation == Operation::MOVE_BACK) && (it != myEditedChildElements.begin())) {
54 it = myEditedChildElements.erase(it);
56 myEditedChildElements.insert(it - 1, myChildDemandElement);
78 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
83 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
91 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
96 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
112 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
117 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
125 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
130 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
146 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
148 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
151 return (
TL(
"Invalid operation"));
155 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
157 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
160 return (
TL(
"Invalid operation"));
170 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
172 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
175 return (
TL(
"Invalid operation"));
179 if (
myOperation == GNEChange_Children::Operation::MOVE_FRONT) {
181 }
else if (
myOperation == GNEChange_Children::Operation::MOVE_BACK) {
184 return (
TL(
"Invalid operation"));
Supermode
@brie enum for supermodes
const std::string getID() const
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
std::string undoName() const
return undoName
const Operation myOperation
~GNEChange_Children()
Destructor.
std::string redoName() const
get Redo name
GNEDemandElement * myParentDemandElement
full information regarding the parent demand element element that will be modified
GNEDemandElement * myChildDemandElement
demand element which position will be edited edited
the function-object for an editing operation (abstract base)
bool myForward
we group antagonistic commands (create junction/delete junction) and keep them apart by this flag
void requireSaveDemandElements()
inform that demand elements has to be saved
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
void decRef(const std::string &debugMsg="")
Decrease reference.
bool unreferenced()
check if object ins't referenced