]> Creatis software - creaVtk.git/blobdiff - lib/creaVtk/MeshManagerModel.h
#3517 Adjustments Undo - Redo for deformation
[creaVtk.git] / lib / creaVtk / MeshManagerModel.h
index d8e6a780a52814ed6cd5a22087b093262f364f7c..98f55063366cf46a758c13597fe790279a904ddc 100644 (file)
@@ -34,9 +34,13 @@ public:
        HistoryHandler(int maxElements);
        ~HistoryHandler();
        void            CleanHistory();
-       StateType*      Undo();
-       StateType*      Redo();
+       StateType*      Undo(StateType* State);
+       StateType*      UndoKeepCurrent();
+       StateType*      Redo(StateType* State);
+       StateType*      RedoKeepCurrent();
        void            Save(StateType* State);
+       StateType*      GetPrevious();
+       StateType*      GetNext();
        int             UndoSize();
        int             RedoSize();
        
@@ -93,12 +97,19 @@ public :
   MeshManagerModel(std::vector<vtkPolyData*> meshList);
   ~MeshManagerModel();
 
+       void SetHistory(int maxCapacity);
        void ResetHistory();
        void ResetAll();
        
-       void UpdateMeshReference(vtkPolyData* mesh);
+       void SetReferencePoint(std::vector<double> point);
+       std::vector<double> GetReferencePoint();
+       void SetReferenceNormal(std::vector<double> normal);
+       std::vector<double> GetReferenceNormal();
+       
     void SetMeshBase(vtkPolyData* mesh);
     void SetMeshMemoryMode(vtkPolyData* mesh);
+       void MeshMemoryModeOn();
+    void MeshMemoryModeOff();
     void CopySetMeshBase(vtkPolyData* mesh);
     void ResetMeshTemp();
     //void ResetMeshTemp_();
@@ -141,10 +152,13 @@ public :
     void NextMesh();
     void PreviousMesh();
     
+    void SaveMemoryMode();
     void Undo();
     void Redo();
     
     std::vector<std::string> GetMeshNames();
+    std::vector<vtkPolyData*> GetAllPolyDatas();
+    int  GetCurrentMesh();
 
 //--Method template----------------------------
 //  void FunctionName(int& parameterA);
@@ -163,22 +177,31 @@ private:
     std::vector<std::shared_ptr<MeshModel>> _meshes;
     int                                                                        currentMesh;
     int                                                                                meshId;
+    int                                                                                lastModified;
+    bool                                                                       memoryMode;
+    std::vector<double>                                                referencePoint;
+    std::vector<double>                                                referenceNormal;
     
     class ManagerState{
        public:
-               ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int currentMesh);
+               ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId);
+               ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId, std::vector<double> refPoint, std::vector<double> refNormal);
                ~ManagerState();
                std::vector<std::shared_ptr<MeshModel>>& GetMeshes();
                int GetMeshId();
-               int GetCurrentMesh();
-       private:
+               int GetModifiedPos();
+               std::vector<double>& GetReferencePoint();
+
                std::vector<std::shared_ptr<MeshModel>> savedMeshes;
-               int savedCurrentMesh;
+               int savedModifiedPos;
                int savedId;
+               std::vector<double> referencePoint;
+               std::vector<double> referenceNormal;
     };
     
     void                                                       Save();
     void                                                       RestoreState(ManagerState* state);
+    void                                                       RestoreStateMemoryMode(ManagerState* state);
     
     HistoryHandler<ManagerState>       *history;