src/PIPELINE/VISU_CutPlanesPL.hxx

Go to the documentation of this file.
00001 //  VISU OBJECT : interactive object for VISU entities implementation
00002 //
00003 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 //  This library is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU Lesser General Public
00008 //  License as published by the Free Software Foundation; either
00009 //  version 2.1 of the License.
00010 //
00011 //  This library is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 //  Lesser General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU Lesser General Public
00017 //  License along with this library; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //
00023 // File:    VISU_CutPlanesPL.hxx
00024 // Author:  Alexey PETROV
00025 // Module : VISU
00026 
00027 #ifndef VISU_CutPlanesPL_HeaderFile
00028 #define VISU_CutPlanesPL_HeaderFile
00029 
00030 #include "VISU_PrsMergerPL.hxx"
00031 
00032 #include <vector>
00033 
00034 class vtkAppendPolyData;
00035 
00036 class VISU_CutPlanesPL : public VISU_PrsMergerPL{
00037 protected:
00038   VISU_CutPlanesPL();
00039   VISU_CutPlanesPL(const VISU_CutPlanesPL&);
00040 public:
00041   vtkTypeMacro(VISU_CutPlanesPL,VISU_PrsMergerPL);
00042   static VISU_CutPlanesPL* New();
00043 
00044   virtual
00045   ~VISU_CutPlanesPL();
00046 
00047   virtual
00048   void
00049   ShallowCopy(VISU_PipeLine *thePipeLine);
00050 
00051   enum PlaneOrientation {XY, YZ, ZX};
00052 
00053   virtual 
00054   void
00055   SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
00056            vtkFloatingPointType theXAng, 
00057            vtkFloatingPointType theYAng, 
00058            int theNum = 0);
00059   
00060   virtual 
00061   const PlaneOrientation& 
00062   GetPlaneOrientation(int theNum = 0);
00063 
00064   virtual
00065   vtkFloatingPointType 
00066   GetRotateX(int theNum = 0);
00067 
00068   virtual
00069   vtkFloatingPointType
00070   GetRotateY(int theNum = 0);
00071 
00072   virtual
00073   vtkFloatingPointType 
00074   GetDisplacement(int theNum = 0)
00075   {
00076     return myDisplacement[theNum];
00077   }
00078 
00079   virtual
00080   void
00081   SetDisplacement(vtkFloatingPointType theDisp, 
00082             int theNum = 0)
00083   { 
00084     myDisplacement[theNum] = theDisp;
00085   }
00086 
00087   virtual
00088   void
00089   SetPartPosition(int thePartNumber, 
00090             vtkFloatingPointType thePartPosition);
00091 
00092   virtual
00093   vtkFloatingPointType 
00094   GetPartPosition(int thePartNumber, 
00095             int theNum = 0);
00096 
00097   virtual 
00098   void
00099   SetPartDefault(int thePartNumber);
00100 
00101   virtual
00102   int
00103   IsPartDefault(int thePartNumber);
00104 
00110   virtual
00111   void
00112   SetNbParts(int theNb);
00113 
00114   virtual
00115   int
00116   GetNbParts()
00117   {
00118     return myNbParts;
00119   }
00120 
00121 public:
00122   virtual
00123   void
00124   Init();
00125 
00126   virtual
00127   void
00128   Update();
00129 
00130   virtual
00131   vtkAppendPolyData* 
00132   GetAppendPolyData() 
00133   { 
00134     return myAppendPolyData; 
00135   }
00136 
00137 public:
00138   static
00139   vtkFloatingPointType* 
00140   GetRx(vtkFloatingPointType theRx[3][3], 
00141      vtkFloatingPointType thaAng);
00142 
00143   static
00144   vtkFloatingPointType* 
00145   GetRy(vtkFloatingPointType theRy[3][3], 
00146      vtkFloatingPointType thaAng);
00147 
00148   static
00149   vtkFloatingPointType* 
00150   GetRz(vtkFloatingPointType theRz[3][3], 
00151      vtkFloatingPointType thaAng);
00152 
00153   static
00154   void
00155   CorrectPnt(vtkFloatingPointType thePnt[3], 
00156           const vtkFloatingPointType BoundPrj[6]);
00157 
00158   static
00159   void
00160   GetBoundProject(vtkFloatingPointType BoundPrj[3], 
00161             const vtkFloatingPointType BoundBox[6], 
00162             const vtkFloatingPointType Dir[3]);
00163 
00164   static
00165   void
00166   GetDir(vtkFloatingPointType theDir[3],
00167       const vtkFloatingPointType theAng[3],
00168       const PlaneOrientation& theBasePlane);
00169 
00170   static 
00171   void
00172   ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData);
00173 
00174   static 
00175   void
00176   CutWithPlane(vtkAppendPolyData* theAppendPolyData, 
00177             vtkDataSet* theDataSet,
00178             vtkFloatingPointType theDir[3], 
00179             vtkFloatingPointType theOrig[3]);
00180 
00181   static
00182   void
00183   CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
00184           vtkDataSet* theDataSet,
00185           int theNbPlanes, 
00186           vtkFloatingPointType theDir[3], 
00187           vtkFloatingPointType theBounds[6],
00188           const std::vector<vtkFloatingPointType>& thePlanePosition,
00189           const std::vector<int>& thePlaneCondition,
00190           vtkFloatingPointType theDisplacement);
00191 protected:
00192   virtual 
00193   THook* 
00194   DoHook();
00195 
00196   void
00197   SetPartPosition(int theNum = 0);
00198 
00199   int myNbParts;
00200   PlaneOrientation myBasePlane[2];
00201   vtkFloatingPointType myAng[2][3], myDisplacement[2];
00202   vtkAppendPolyData *myAppendPolyData;
00203   std::vector<vtkFloatingPointType> myPartPosition;
00204   std::vector<int> myPartCondition;
00205 };
00206 
00207 #endif