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