17 #include "vtkCollection.h"
18 #include "vtkCollectionIterator.h"
19 #include "vtkObjectFactory.h"
41 int num_elements = this->
Collection->GetNumberOfItems();
42 if (elem->GetMergeable() && num_elements > 0)
45 vtkUndoElement::SafeDownCast(this->
Collection->GetItemAsObject(num_elements - 1));
46 if (prev && prev->GetMergeable())
48 if (prev->
Merge(elem))
51 return (num_elements - 1);
69 return vtkUndoElement::SafeDownCast(this->
Collection->GetItemAsObject(index));
87 int max = this->
Collection->GetNumberOfItems();
88 for (
int cc = 0; cc < max; cc++)
96 vtkDebugMacro(
"Redo Action is failing. Start redoing the actions.");
98 for (
int rr = cc - 1; rr >= 0; --rr)
119 int max = this->
Collection->GetNumberOfItems();
120 for (
int cc = max - 1; cc >= 0; --cc)
128 vtkDebugMacro(
"Undo Action is failing. Start redoing the actions.");
130 for (
int rr = 0; rr < cc; ++rr)
151 this->Superclass::PrintSelf(os, indent);
virtual void SetUndoSetWorkingContext(vtkCollection *workCTX)
virtual bool Merge(vtkUndoElement *vtkNotUsed(new_element))
void RemoveElement(int index)
vtkCollection * Collection
vtkCollection * TmpWorkingCollection
void PrintSelf(ostream &os, vtkIndent indent) override
int AddElement(vtkUndoElement *elem)
vtkUndoElement * GetElement(int index)
int GetNumberOfElements()
vtkStandardNewMacro(vtkUndoSet)