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);
39 void Save(StateType* State);
44 std::deque<StateType*> undoStack;
45 std::deque<StateType*> redoStack;
53 MeshModel(vtkPolyData* mesh, int id);
54 MeshModel(MeshModel* meshModel);
57 void SetMeshBase(vtkPolyData* mesh);
58 void SetMeshMemoryMode(vtkPolyData* mesh);
59 void CopySetMeshBase(vtkPolyData* mesh);
61 void ResetMeshTemp_();
62 vtkPolyData* GetMeshBase();
63 vtkPolyData* GetMeshTemp();
65 std::string GetName();
71 vtkPolyData *_meshBase;
72 vtkPolyData *_meshTemp;
77 #ifndef _MESHMANAGERMODEL_H_
78 #define _MESHMANAGERMODEL_H_
80 //---------------------------------------------
81 // Class Name: MeshManagerModel
83 //---------------------------------------------
85 class MeshManagerModel
88 //---------------------------------------------
89 //Methods and attributes exposed to other classes
90 //---------------------------------------------
93 MeshManagerModel(std::vector<vtkPolyData*> meshList);
99 void UpdateMeshReference(vtkPolyData* mesh);
100 void SetMeshBase(vtkPolyData* mesh);
101 void SetMeshMemoryMode(vtkPolyData* mesh);
102 void CopySetMeshBase(vtkPolyData* mesh);
103 void ResetMeshTemp();
104 //void ResetMeshTemp_();
105 vtkPolyData* GetMeshBase();
106 vtkPolyData* GetMeshTemp();
108 virtual void RefreshOutputs(bool signalBox);
110 std::shared_ptr<MeshModel> GetMeshModel();
111 int GetNumberOfMeshes();
113 void AddMesh_(vtkPolyData* mesh);
114 void AddMesh(vtkPolyData* mesh);
116 void AddEmptyMesh_();
119 void AddMeshes(std::vector<vtkPolyData*> meshList);
120 void AddMeshes_(std::vector<vtkPolyData*> meshList);
122 void InsertMeshesAtCurrent_(std::vector<vtkPolyData*> meshList);
123 void InsertMeshesAtCurrent(std::vector<vtkPolyData*> meshList);
125 void InsertMeshModels_(std::vector<MeshModel*> meshModelList);
126 void InsertMeshModels(std::vector<MeshModel*> meshModelList);
128 void SelectMesh(int i);
129 void SelectMeshByName(std::string meshName);
131 void DeleteMesh_(int position);
132 void DeleteMesh(int position);
133 void DeleteMeshByName(std::string meshName);
134 void DeleteCurrentMesh();
139 void ReplaceMesh(std::vector<vtkPolyData*> meshList);
147 std::vector<std::string> GetMeshNames();
149 //--Method template----------------------------
150 // void FunctionName(int& parameterA);
152 //---------------------------------------------
153 //Methods and attributes exposed only to classes
154 //that are derived from this class
155 //---------------------------------------------
158 //---------------------------------------------
159 //Methods and attributes only visible by this class
160 //---------------------------------------------
163 std::vector<std::shared_ptr<MeshModel>> _meshes;
169 ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int currentMesh);
171 std::vector<std::shared_ptr<MeshModel>>& GetMeshes();
173 int GetCurrentMesh();
175 std::vector<std::shared_ptr<MeshModel>> savedMeshes;
176 int savedCurrentMesh;
181 void RestoreState(ManagerState* state);
183 HistoryHandler<ManagerState> *history;
188 //-end of _MESHMANAGERMODEL_H_------------------------------------------------------