2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
27 #include <vtkPolyData.h>
31 template<class StateType>
34 HistoryHandler(int maxElements);
37 StateType* Undo(StateType* State);
38 StateType* UndoKeepCurrent();
39 StateType* Redo(StateType* State);
40 StateType* RedoKeepCurrent();
41 void Save(StateType* State);
42 StateType* GetPrevious();
48 std::deque<StateType*> undoStack;
49 std::deque<StateType*> redoStack;
57 MeshModel(vtkPolyData* mesh, int id);
58 MeshModel(MeshModel* meshModel);
61 void SetMeshBase(vtkPolyData* mesh);
62 void SetMeshMemoryMode(vtkPolyData* mesh);
63 void CopySetMeshBase(vtkPolyData* mesh);
65 void ResetMeshTemp_();
66 vtkPolyData* GetMeshBase();
67 vtkPolyData* GetMeshTemp();
69 std::string GetName();
75 vtkPolyData *_meshBase;
76 vtkPolyData *_meshTemp;
81 #ifndef _MESHMANAGERMODEL_H_
82 #define _MESHMANAGERMODEL_H_
84 //---------------------------------------------
85 // Class Name: MeshManagerModel
87 //---------------------------------------------
89 class MeshManagerModel
92 //---------------------------------------------
93 //Methods and attributes exposed to other classes
94 //---------------------------------------------
97 MeshManagerModel(std::vector<vtkPolyData*> meshList);
100 void SetHistory(int maxCapacity);
104 void SetMeshBase(vtkPolyData* mesh);
105 void SetMeshMemoryMode(vtkPolyData* mesh);
106 void MeshMemoryModeOn();
107 void MeshMemoryModeOff();
108 void CopySetMeshBase(vtkPolyData* mesh);
109 void ResetMeshTemp();
110 //void ResetMeshTemp_();
111 vtkPolyData* GetMeshBase();
112 vtkPolyData* GetMeshTemp();
114 virtual void RefreshOutputs(bool signalBox);
116 std::shared_ptr<MeshModel> GetMeshModel();
117 int GetNumberOfMeshes();
119 void AddMesh_(vtkPolyData* mesh);
120 void AddMesh(vtkPolyData* mesh);
122 void AddEmptyMesh_();
125 void AddMeshes(std::vector<vtkPolyData*> meshList);
126 void AddMeshes_(std::vector<vtkPolyData*> meshList);
128 void InsertMeshesAtCurrent_(std::vector<vtkPolyData*> meshList);
129 void InsertMeshesAtCurrent(std::vector<vtkPolyData*> meshList);
131 void InsertMeshModels_(std::vector<MeshModel*> meshModelList);
132 void InsertMeshModels(std::vector<MeshModel*> meshModelList);
134 void SelectMesh(int i);
135 void SelectMeshByName(std::string meshName);
137 void DeleteMesh_(int position);
138 void DeleteMesh(int position);
139 void DeleteMeshByName(std::string meshName);
140 void DeleteCurrentMesh();
145 void ReplaceMesh(std::vector<vtkPolyData*> meshList);
150 void SaveMemoryMode();
154 std::vector<std::string> GetMeshNames();
155 std::vector<vtkPolyData*> GetAllPolyDatas();
156 int GetCurrentMesh();
158 //--Method template----------------------------
159 // void FunctionName(int& parameterA);
161 //---------------------------------------------
162 //Methods and attributes exposed only to classes
163 //that are derived from this class
164 //---------------------------------------------
167 //---------------------------------------------
168 //Methods and attributes only visible by this class
169 //---------------------------------------------
172 std::vector<std::shared_ptr<MeshModel>> _meshes;
180 ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId);
182 std::vector<std::shared_ptr<MeshModel>>& GetMeshes();
184 int GetModifiedPos();
186 std::vector<std::shared_ptr<MeshModel>> savedMeshes;
187 int savedModifiedPos;
192 void RestoreState(ManagerState* state);
193 void RestoreStateMemoryMode(ManagerState* state);
195 HistoryHandler<ManagerState> *history;
200 //-end of _MESHMANAGERMODEL_H_------------------------------------------------------