Salome HOME
Merge from BR_WIN_INDUS_514 branch 21/03/2011 (Windows industrialization)
[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 class vtkTimeStamp;
44
45 class VISU_MapperHolder;
46
47 //----------------------------------------------------------------------------
48 class VISU_PIPELINE_EXPORT VISU_PipeLine : public vtkObject
49 {
50   friend class VISU_MapperHolder;
51
52 public:
53   vtkTypeMacro(VISU_PipeLine, vtkObject);
54
55   //! Gets memory size used by the instance (bytes).
56   virtual
57   unsigned long int
58   GetMemorySize();
59
60   virtual
61   unsigned long int 
62   GetMTime();
63
64   //----------------------------------------------------------------------------
65   virtual
66   void
67   ShallowCopy(VISU_PipeLine *thePipeLine,
68               bool theIsCopyInput);
69
70   virtual
71   void
72   SameAs(VISU_PipeLine *thePipeLine);
73
74   //----------------------------------------------------------------------------
75   void 
76   SetMapperHolder(VISU_MapperHolder* theHolder);
77
78   VISU_MapperHolder* 
79   GetMapperHolder();
80
81   const VISU::PIDMapper&  
82   GetIDMapper();
83
84   virtual
85   vtkDataSet* 
86   GetInput();
87
88   virtual 
89   vtkMapper* 
90   GetMapper();
91
92   virtual
93   vtkDataSet* 
94   GetOutput();
95
96   //----------------------------------------------------------------------------
97   virtual
98   void
99   Init();
100
101   virtual
102   void
103   Update();
104
105   //----------------------------------------------------------------------------
106   virtual
107   vtkIdType
108   GetNodeObjID(vtkIdType theID);
109
110   virtual
111   vtkIdType
112   GetNodeVTKID(vtkIdType theID);
113
114   virtual
115   vtkFloatingPointType* 
116   GetNodeCoord(vtkIdType theObjID);
117
118   virtual
119   vtkIdType
120   GetElemObjID(vtkIdType theID);
121
122   virtual
123   vtkIdType
124   GetElemVTKID(vtkIdType theID);
125
126   virtual
127   vtkCell*
128   GetElemCell(vtkIdType theObjID);
129
130   //----------------------------------------------------------------------------
131   bool
132   IsPlanarInput();
133
134   bool 
135   IsShrinkable();
136
137   bool 
138   IsFeatureEdgesAllowed();
139
140   //----------------------------------------------------------------------------
141   void
142   SetImplicitFunction(vtkImplicitFunction *theFunction);
143
144   vtkImplicitFunction* 
145   GetImplicitFunction();
146
147   void
148   SetExtractInside(bool theMode);
149
150   void
151   SetExtractBoundaryCells(bool theMode);
152
153   //----------------------------------------------------------------------------
154   virtual
155   void 
156   RemoveAllClippingPlanes();
157
158   vtkIdType
159   GetNumberOfClippingPlanes();
160
161   virtual
162   bool
163   AddClippingPlane(vtkPlane* thePlane);
164
165   virtual
166   vtkPlane* 
167   GetClippingPlane(vtkIdType theID);
168
169   virtual void RemoveClippingPlane(vtkIdType theID);
170
171   virtual
172   void
173   SetPlaneParam(vtkFloatingPointType theDir[3], 
174                 vtkFloatingPointType theDist, 
175                 vtkPlane* thePlane);
176
177   virtual
178   void
179   GetPlaneParam(vtkFloatingPointType theDir[3], 
180                 vtkFloatingPointType& theDist, 
181                 vtkPlane* thePlane);
182
183   void                
184   GetVisibleBounds(vtkFloatingPointType theBounds[6]);
185
186   //----------------------------------------------------------------------------
187   static
188   size_t
189   CheckAvailableMemory(double theSize);
190
191   static
192   size_t
193   GetAvailableMemory(double theSize,
194                      double theMinSize = 1024*1024);
195
196 protected:
197   //----------------------------------------------------------------------------
198   VISU_PipeLine();
199
200   virtual
201   ~VISU_PipeLine();
202
203   //----------------------------------------------------------------------------
204   virtual
205   void
206   Build() = 0;
207
208   virtual
209   void
210   OnCreateMapperHolder() = 0;
211
212   virtual
213   void
214   DoShallowCopy(VISU_PipeLine *thePipeLine,
215                 bool theIsCopyInput);
216                 
217   virtual
218   void
219   ComputeVisibleBounds();
220
221   //----------------------------------------------------------------------------
222   vtkDataSet* 
223   GetClippedInput();
224
225   void 
226   SetIsShrinkable(bool theIsShrinkable);
227
228   void 
229   SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed);
230   
231   //Visible bounds xmin, xmax, ymin, ymax, zmin, zmax
232   vtkFloatingPointType myVisibleBounds[6];
233   vtkTimeStamp myVisibleComputeTime;       // Time at which visible bounds computed
234
235 private:
236   //----------------------------------------------------------------------------
237   vtkSmartPointer<VISU_MapperHolder> myMapperHolder;
238   bool myIsShrinkable;
239   bool myIsFeatureEdgesAllowed;
240 };
241
242 #endif