]> SALOME platform Git repositories - modules/visu.git/blob - src/PIPELINE/VISU_CutPlanesPL.hxx
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / PIPELINE / VISU_CutPlanesPL.hxx
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  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 // File:    VISU_CutPlanesPL.hxx
24 // Author:  Alexey PETROV
25 // Module : VISU
26
27 #ifndef VISU_CutPlanesPL_HeaderFile
28 #define VISU_CutPlanesPL_HeaderFile
29
30 #include "VISUPipeline.hxx"
31 #include "VISU_ScalarMapPL.hxx"
32
33 #include <vector>
34
35 class vtkAppendPolyData;
36
37
38 //----------------------------------------------------------------------------
39 class VISU_PIPELINE_EXPORT VISU_CutPlanesPL : public VISU_ScalarMapPL
40 {
41 public:
42   vtkTypeMacro(VISU_CutPlanesPL, VISU_ScalarMapPL);
43
44   static 
45   VISU_CutPlanesPL* 
46   New();
47
48   virtual
49   unsigned long int 
50   GetMTime();
51
52   //----------------------------------------------------------------------------
53   enum PlaneOrientation {XY, YZ, ZX};
54
55   virtual 
56   void
57   SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
58                  vtkFloatingPointType theXAng, 
59                  vtkFloatingPointType theYAng, 
60                  int theNum = 0);
61   
62   virtual 
63   const PlaneOrientation& 
64   GetPlaneOrientation(int theNum = 0);
65
66   virtual
67   vtkFloatingPointType 
68   GetRotateX(int theNum = 0);
69
70   virtual
71   vtkFloatingPointType
72   GetRotateY(int theNum = 0);
73
74   virtual
75   vtkFloatingPointType 
76   GetDisplacement(int theNum = 0);
77
78   virtual
79   void
80   SetDisplacement(vtkFloatingPointType theDisp, 
81                   int theNum = 0);
82
83   virtual
84   void
85   SetPartPosition(int thePartNumber, 
86                   vtkFloatingPointType thePartPosition);
87
88   virtual
89   vtkFloatingPointType 
90   GetPartPosition(int thePartNumber, 
91                   int theNum = 0);
92
93   virtual 
94   void
95   SetPartDefault(int thePartNumber);
96
97   virtual
98   int
99   IsPartDefault(int thePartNumber);
100
101   virtual
102   void
103   SetNbParts(int theNb);
104
105   virtual
106   int
107   GetNbParts();
108
109 public:
110   virtual
111   void
112   Init();
113
114   virtual
115   void
116   Update();
117
118   //! Gets memory size used by the instance (bytes).
119   virtual
120   unsigned long int
121   GetMemorySize();
122
123   virtual
124   vtkAppendPolyData* 
125   GetAppendPolyData() 
126   { 
127     return myAppendPolyData; 
128   }
129
130 public:
131   static
132   vtkFloatingPointType* 
133   GetRx(vtkFloatingPointType theRx[3][3], 
134         vtkFloatingPointType thaAng);
135
136   static
137   vtkFloatingPointType* 
138   GetRy(vtkFloatingPointType theRy[3][3], 
139         vtkFloatingPointType thaAng);
140
141   static
142   vtkFloatingPointType* 
143   GetRz(vtkFloatingPointType theRz[3][3], 
144         vtkFloatingPointType thaAng);
145
146   static
147   void
148   CorrectPnt(vtkFloatingPointType thePnt[3], 
149              const vtkFloatingPointType BoundPrj[6]);
150
151   static
152   void
153   GetBoundProject(vtkFloatingPointType BoundPrj[3], 
154                   const vtkFloatingPointType BoundBox[6], 
155                   const vtkFloatingPointType Dir[3]);
156
157   static
158   void
159   GetDir(vtkFloatingPointType theDir[3],
160          const vtkFloatingPointType theAng[3],
161          const PlaneOrientation& theBasePlane);
162
163   static 
164   void
165   ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData);
166
167   static 
168   void
169   CutWithPlane(vtkAppendPolyData* theAppendPolyData, 
170                vtkDataSet* theDataSet,
171                vtkFloatingPointType theDir[3], 
172                vtkFloatingPointType theOrig[3]);
173
174   static
175   void
176   CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
177                 vtkDataSet* theDataSet,
178                 int theNbPlanes, 
179                 vtkFloatingPointType theDir[3], 
180                 vtkFloatingPointType theBounds[6],
181                 const std::vector<vtkFloatingPointType>& thePlanePosition,
182                 const std::vector<int>& thePlaneCondition,
183                 vtkFloatingPointType theDisplacement);
184
185 protected:
186   VISU_CutPlanesPL();
187
188   virtual
189   ~VISU_CutPlanesPL();
190
191   virtual 
192   vtkDataSet* 
193   InsertCustomPL();
194
195   virtual
196   void
197   DoShallowCopy(VISU_PipeLine *thePipeLine,
198                 bool theIsCopyInput);
199
200   void
201   SetPartPosition(int theNum = 0);
202
203   int myNbParts;
204   PlaneOrientation myBasePlane[2];
205   vtkFloatingPointType myAng[2][3], myDisplacement[2];
206   vtkAppendPolyData *myAppendPolyData;
207   std::vector<vtkFloatingPointType> myPartPosition;
208   std::vector<int> myPartCondition;
209
210 private:
211   VISU_CutPlanesPL(const VISU_CutPlanesPL&);  // Not implemented.
212   void operator=(const VISU_CutPlanesPL&);  // Not implemented.
213 };
214
215 #endif