]> Creatis software - creaVtk.git/blob - lib/creaVtk/MeshManagerModel.h
#3504 Mesh Manager handle multiple meshes
[creaVtk.git] / lib / creaVtk / MeshManagerModel.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 #                        pour la Sante)
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
9 #
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.
16 #
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
21 #  liability.
22 #
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 # ------------------------------------------------------------------------
26 */
27 #include <vtkPolyData.h>
28
29 class MeshModel{
30
31 public:
32         MeshModel(int id);
33         MeshModel(vtkPolyData* mesh, int id);
34         ~MeshModel();
35         
36         void                    SetMeshBase(vtkPolyData* mesh);
37     void                        SetMeshMemoryMode(vtkPolyData* mesh);
38     void                        CopySetMeshBase(vtkPolyData* mesh);
39     void                        ResetMeshTemp();
40     void                        ResetMeshTemp_();
41     vtkPolyData*        GetMeshBase();
42     vtkPolyData*        GetMeshTemp();
43     int                         GetId();
44     std::string         GetName();
45     
46 protected:
47
48 private:
49         vtkPolyData                             *_meshBase;
50     vtkPolyData                                 *_meshTemp;
51     int                                                 _meshId;
52     std::string                                 _name;
53 };
54
55 #ifndef _MESHMANAGERMODEL_H_
56 #define _MESHMANAGERMODEL_H_
57
58 //---------------------------------------------
59 // Class Name: MeshManagerModel
60 // [classdescription]
61 //---------------------------------------------
62
63 class MeshManagerModel
64 {
65
66 //---------------------------------------------
67 //Methods and attributes exposed to other classes
68 //---------------------------------------------
69 public :
70   MeshManagerModel();
71   ~MeshManagerModel();
72
73     void SetMeshBase(vtkPolyData* mesh);
74     void SetMeshMemoryMode(vtkPolyData* mesh);
75     void CopySetMeshBase(vtkPolyData* mesh);
76     void ResetMeshTemp();
77     //void ResetMeshTemp_();
78     vtkPolyData* GetMeshBase();
79     vtkPolyData* GetMeshTemp();
80     
81     virtual void RefreshOutputs(bool signalBox);
82     
83     MeshModel* GetMeshModel();
84     int GetNumberOfMeshes();
85     
86     void AddMesh_(vtkPolyData* mesh);
87     void AddMesh(vtkPolyData* mesh);
88     
89     void AddEmptyMesh_();
90     void AddEmptyMesh();
91     
92     void AddMeshes(std::vector<vtkPolyData*> meshList);
93     void AddMeshes_(std::vector<vtkPolyData*> meshList);
94     
95     void InsertMeshesAtCurrent_(std::vector<vtkPolyData*> meshList);
96     void InsertMeshesAtCurrent(std::vector<vtkPolyData*> meshList);
97     
98     void SelectMesh(int i);
99     void SelectMeshByName(std::string meshName);
100     void DeleteMesh(int position);
101     void DeleteMeshByName(std::string meshName);
102     void DeleteCurrentMesh();
103     void DeleteAll();
104     void NextMesh();
105     void PreviousMesh();
106     std::vector<std::string> GetMeshNames();
107
108 //--Method template----------------------------
109 //  void FunctionName(int& parameterA);
110
111 //---------------------------------------------
112 //Methods and attributes exposed only to classes
113 //that are derived from this class
114 //---------------------------------------------
115 protected:
116
117 //---------------------------------------------
118 //Methods and attributes only visible by this class
119 //---------------------------------------------
120 private:
121     
122     std::vector<MeshModel*>     _meshes;
123     int                                                 currentMesh;
124     int                                                 meshId;
125 };
126
127 //-end of _MESHMANAGERMODEL_H_------------------------------------------------------
128 #endif