Salome HOME
d2bf38a5a069db9e51c1f5a3b82055ac9088c7f0
[modules/visu.git] / src / PIPELINE / VISU_PipeLine.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  VISU OBJECT : interactive object for VISU entities implementation
24 // File:    VISU_PipeLine.hxx
25 // Author:  Alexey PETROV
26 // Module : VISU
27 //
28 #ifndef VISU_PipeLine_HeaderFile
29 #define VISU_PipeLine_HeaderFile
30
31 #include "VISUPipeline.hxx"
32 #include "VISU_IDMapper.hxx"
33
34 #include <vtkObject.h>
35 #include <vtkSmartPointer.h>
36
37 class vtkCell;
38 class vtkPlane;
39 class vtkMapper;
40 class vtkDataSet;
41 class vtkPointSet;
42 class vtkImplicitFunction;
43
44 class VISU_MapperHolder;
45
46 //----------------------------------------------------------------------------
47 class VISU_PIPELINE_EXPORT VISU_PipeLine : public vtkObject
48 {
49   friend class VISU_MapperHolder;
50
51 public:
52   vtkTypeMacro(VISU_PipeLine, vtkObject);
53
54   //! Gets memory size used by the instance (bytes).
55   virtual
56   unsigned long int
57   GetMemorySize();
58
59   virtual
60   unsigned long int 
61   GetMTime();
62
63   //----------------------------------------------------------------------------
64   virtual
65   void
66   ShallowCopy(VISU_PipeLine *thePipeLine,
67               bool theIsCopyInput);
68
69   virtual
70   void
71   SameAs(VISU_PipeLine *thePipeLine);
72
73   //----------------------------------------------------------------------------
74   void 
75   SetMapperHolder(VISU_MapperHolder* theHolder);
76
77   VISU_MapperHolder* 
78   GetMapperHolder();
79
80   const VISU::PIDMapper&  
81   GetIDMapper();
82
83   virtual
84   vtkDataSet* 
85   GetInput();
86
87   virtual 
88   vtkMapper* 
89   GetMapper();
90
91   virtual
92   vtkDataSet* 
93   GetOutput();
94
95   //----------------------------------------------------------------------------
96   virtual
97   void
98   Init();
99
100   virtual
101   void
102   Update();
103
104   //----------------------------------------------------------------------------
105   virtual
106   vtkIdType
107   GetNodeObjID(vtkIdType theID);
108
109   virtual
110   vtkIdType
111   GetNodeVTKID(vtkIdType theID);
112
113   virtual
114   vtkFloatingPointType* 
115   GetNodeCoord(vtkIdType theObjID);
116
117   virtual
118   vtkIdType
119   GetElemObjID(vtkIdType theID);
120
121   virtual
122   vtkIdType
123   GetElemVTKID(vtkIdType theID);
124
125   virtual
126   vtkCell*
127   GetElemCell(vtkIdType theObjID);
128
129   //----------------------------------------------------------------------------
130   bool
131   IsPlanarInput();
132
133   bool 
134   IsShrinkable();
135
136   bool 
137   IsFeatureEdgesAllowed();
138
139   //----------------------------------------------------------------------------
140   void
141   SetImplicitFunction(vtkImplicitFunction *theFunction);
142
143   vtkImplicitFunction* 
144   GetImplicitFunction();
145
146   void
147   SetExtractInside(bool theMode);
148
149   void
150   SetExtractBoundaryCells(bool theMode);
151
152   //----------------------------------------------------------------------------
153   virtual
154   void 
155   RemoveAllClippingPlanes();
156
157   vtkIdType
158   GetNumberOfClippingPlanes();
159
160   virtual
161   bool
162   AddClippingPlane(vtkPlane* thePlane);
163
164   virtual
165   vtkPlane* 
166   GetClippingPlane(vtkIdType theID);
167
168   virtual void RemoveClippingPlane(vtkIdType theID);
169
170   virtual
171   void
172   SetPlaneParam(vtkFloatingPointType theDir[3], 
173                 vtkFloatingPointType theDist, 
174                 vtkPlane* thePlane);
175
176   virtual
177   void
178   GetPlaneParam(vtkFloatingPointType theDir[3], 
179                 vtkFloatingPointType& theDist, 
180                 vtkPlane* thePlane);
181
182   //----------------------------------------------------------------------------
183   static
184   size_t
185   CheckAvailableMemory(double theSize);
186
187   static
188   size_t
189   GetAvailableMemory(double theSize,
190                      double theMinSize = 1024*1024);
191
192 protected:
193   //----------------------------------------------------------------------------
194   VISU_PipeLine();
195
196   virtual
197   ~VISU_PipeLine();
198
199   //----------------------------------------------------------------------------
200   virtual
201   void
202   Build() = 0;
203
204   virtual
205   void
206   OnCreateMapperHolder() = 0;
207
208   virtual
209   void
210   DoShallowCopy(VISU_PipeLine *thePipeLine,
211                 bool theIsCopyInput);
212
213   //----------------------------------------------------------------------------
214   vtkDataSet* 
215   GetClippedInput();
216
217   void 
218   SetIsShrinkable(bool theIsShrinkable);
219
220   void 
221   SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
222
223 private:
224   //----------------------------------------------------------------------------
225   vtkSmartPointer<VISU_MapperHolder> myMapperHolder;
226   bool myIsShrinkable;
227   bool myIsFeatureEdgesAllowed;
228 };
229
230 #endif