]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/IO/MementoState.h
undo redo example Done. MementoState updated. Sphere widget still unsync
[cpPlugins.git] / lib / cpExtensions / IO / MementoState.h
1 #ifndef __CPEXTENSIONS__IO__MEMENTOSTATE__H__
2 #define __CPEXTENSIONS__IO__MEMENTOSTATE__H__
3
4 #include <cpExtensions/cpExtensions_Export.h>
5
6
7 #include <vector>
8
9
10 // vtk stuff
11 #include <vtkSmartPointer.h>
12 #include <cpExtensions/Visualization/MPRObjects.h>
13
14 // Plugins interface
15 #include <cpPlugins/Interface/Interface.h>
16 #include <cpPlugins/Interface/ProcessObject.h>
17 #include <cpPlugins/Interface/Image.h>
18 #include <cpPlugins/Interface/ImplicitFunction.h>
19 #include <cpPlugins/Interface/Mesh.h>
20
21 #include <vtkMetaImageReader.h>
22 #include <vtkCommand.h>
23
24 namespace cpExtensions
25 {
26   namespace IO
27   {
28     class cpExtensions_EXPORT MementoState
29     {
30     private:
31       long m_Id;
32       long m_maxId;
33       std::vector<bool> m_stateReady;
34       std::vector<bool>::iterator m_stateIt;
35     public:
36
37       MementoState();
38       bool SetToMemento(cpPlugins::Interface::Image* _img);
39       vtkSmartPointer<vtkImageData> MementoUndo();
40       vtkSmartPointer<vtkImageData> MementoRedo();
41       vtkSmartPointer<vtkImageData> GetFromMemento(long id);
42     private:
43       void Save(const std::string& filename, const std::string& filenameRaw, cpPlugins::Interface::Image* img);
44       vtkSmartPointer<vtkImageData> Load(const std::string& filename);
45
46     };
47   }
48 }
49 //==========================================================================
50
51 // -------------------------------------------------------------------------
52 /**
53  */
54
55
56
57
58
59 #endif // __CPEXTENSIONS__IO__MEMENTOSTATE__H__
60
61 // eof - $RCSfile$