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 SetReferencePoint(std::vector<double> point);
105 std::vector<double> GetReferencePoint();
107 void SetMeshBase(vtkPolyData* mesh);
108 void SetMeshMemoryMode(vtkPolyData* mesh);
109 void MeshMemoryModeOn();
110 void MeshMemoryModeOff();
111 void CopySetMeshBase(vtkPolyData* mesh);
112 void ResetMeshTemp();
113 //void ResetMeshTemp_();
114 vtkPolyData* GetMeshBase();
115 vtkPolyData* GetMeshTemp();
117 virtual void RefreshOutputs(bool signalBox);
119 std::shared_ptr<MeshModel> GetMeshModel();
120 int GetNumberOfMeshes();
122 void AddMesh_(vtkPolyData* mesh);
123 void AddMesh(vtkPolyData* mesh);
125 void AddEmptyMesh_();
128 void AddMeshes(std::vector<vtkPolyData*> meshList);
129 void AddMeshes_(std::vector<vtkPolyData*> meshList);
131 void InsertMeshesAtCurrent_(std::vector<vtkPolyData*> meshList);
132 void InsertMeshesAtCurrent(std::vector<vtkPolyData*> meshList);
134 void InsertMeshModels_(std::vector<MeshModel*> meshModelList);
135 void InsertMeshModels(std::vector<MeshModel*> meshModelList);
137 void SelectMesh(int i);
138 void SelectMeshByName(std::string meshName);
140 void DeleteMesh_(int position);
141 void DeleteMesh(int position);
142 void DeleteMeshByName(std::string meshName);
143 void DeleteCurrentMesh();
148 void ReplaceMesh(std::vector<vtkPolyData*> meshList);
153 void SaveMemoryMode();
157 std::vector<std::string> GetMeshNames();
158 std::vector<vtkPolyData*> GetAllPolyDatas();
159 int GetCurrentMesh();
161 //--Method template----------------------------
162 // void FunctionName(int& parameterA);
164 //---------------------------------------------
165 //Methods and attributes exposed only to classes
166 //that are derived from this class
167 //---------------------------------------------
170 //---------------------------------------------
171 //Methods and attributes only visible by this class
172 //---------------------------------------------
175 std::vector<std::shared_ptr<MeshModel>> _meshes;
180 std::vector<double> referencePoint;
184 ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId, std::vector<double> refPoint);
186 std::vector<std::shared_ptr<MeshModel>>& GetMeshes();
188 int GetModifiedPos();
189 std::vector<double>& GetReferencePoint();
191 std::vector<std::shared_ptr<MeshModel>> savedMeshes;
192 int savedModifiedPos;
194 std::vector<double> referencePoint;
198 void RestoreState(ManagerState* state);
199 void RestoreStateMemoryMode(ManagerState* state);
201 HistoryHandler<ManagerState> *history;
206 //-end of _MESHMANAGERMODEL_H_------------------------------------------------------