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* Redo(StateType* State);
39 void Save(StateType* State);
40 StateType* GetPrevious();
46 std::deque<StateType*> undoStack;
47 std::deque<StateType*> redoStack;
55 MeshModel(vtkPolyData* mesh, int id);
56 MeshModel(MeshModel* meshModel);
59 void SetMeshBase(vtkPolyData* mesh);
60 void SetMeshMemoryMode(vtkPolyData* mesh);
61 void CopySetMeshBase(vtkPolyData* mesh);
63 void ResetMeshTemp_();
64 vtkPolyData* GetMeshBase();
65 vtkPolyData* GetMeshTemp();
67 std::string GetName();
73 vtkPolyData *_meshBase;
74 vtkPolyData *_meshTemp;
79 #ifndef _MESHMANAGERMODEL_H_
80 #define _MESHMANAGERMODEL_H_
82 //---------------------------------------------
83 // Class Name: MeshManagerModel
85 //---------------------------------------------
87 class MeshManagerModel
90 //---------------------------------------------
91 //Methods and attributes exposed to other classes
92 //---------------------------------------------
95 MeshManagerModel(std::vector<vtkPolyData*> meshList);
101 void SetMeshBase(vtkPolyData* mesh);
102 void SetMeshMemoryMode(vtkPolyData* mesh);
103 void CopySetMeshBase(vtkPolyData* mesh);
104 void ResetMeshTemp();
105 //void ResetMeshTemp_();
106 vtkPolyData* GetMeshBase();
107 vtkPolyData* GetMeshTemp();
109 virtual void RefreshOutputs(bool signalBox);
111 std::shared_ptr<MeshModel> GetMeshModel();
112 int GetNumberOfMeshes();
114 void AddMesh_(vtkPolyData* mesh);
115 void AddMesh(vtkPolyData* mesh);
117 void AddEmptyMesh_();
120 void AddMeshes(std::vector<vtkPolyData*> meshList);
121 void AddMeshes_(std::vector<vtkPolyData*> meshList);
123 void InsertMeshesAtCurrent_(std::vector<vtkPolyData*> meshList);
124 void InsertMeshesAtCurrent(std::vector<vtkPolyData*> meshList);
126 void InsertMeshModels_(std::vector<MeshModel*> meshModelList);
127 void InsertMeshModels(std::vector<MeshModel*> meshModelList);
129 void SelectMesh(int i);
130 void SelectMeshByName(std::string meshName);
132 void DeleteMesh_(int position);
133 void DeleteMesh(int position);
134 void DeleteMeshByName(std::string meshName);
135 void DeleteCurrentMesh();
140 void ReplaceMesh(std::vector<vtkPolyData*> meshList);
148 std::vector<std::string> GetMeshNames();
149 std::vector<vtkPolyData*> GetAllPolyDatas();
150 int GetCurrentMesh();
152 //--Method template----------------------------
153 // void FunctionName(int& parameterA);
155 //---------------------------------------------
156 //Methods and attributes exposed only to classes
157 //that are derived from this class
158 //---------------------------------------------
161 //---------------------------------------------
162 //Methods and attributes only visible by this class
163 //---------------------------------------------
166 std::vector<std::shared_ptr<MeshModel>> _meshes;
173 ManagerState(std::vector<std::shared_ptr<MeshModel>> meshesToSave, int meshId, int modifiedId);
175 std::vector<std::shared_ptr<MeshModel>>& GetMeshes();
177 int GetModifiedPos();
179 std::vector<std::shared_ptr<MeshModel>> savedMeshes;
180 int savedModifiedPos;
185 void RestoreState(ManagerState* state);
187 HistoryHandler<ManagerState> *history;
192 //-end of _MESHMANAGERMODEL_H_------------------------------------------------------