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_ScalarMapPL.hxx"
00031 
00032 #include <vector>
00033 
00034 class vtkAppendPolyData;
00035 
00036 class VISU_CutPlanesPL : public VISU_ScalarMapPL{
00037 protected:
00038   VISU_CutPlanesPL();
00039   VISU_CutPlanesPL(const VISU_CutPlanesPL&);
00040 public:
00041   vtkTypeMacro(VISU_CutPlanesPL,VISU_ScalarMapPL);
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 
00105   virtual
00106   void
00107   SetNbParts(int theNb);
00108 
00109   virtual
00110   int
00111   GetNbParts()
00112   {
00113     return myNbParts;
00114   }
00115 
00116 public:
00117   virtual
00118   void
00119   Init();
00120 
00121   virtual
00122   void
00123   Update();
00124 
00125   virtual
00126   vtkAppendPolyData* 
00127   GetAppendPolyData() 
00128   { 
00129     return myAppendPolyData; 
00130   }
00131 
00132 public:
00133   static
00134   vtkFloatingPointType* 
00135   GetRx(vtkFloatingPointType theRx[3][3], 
00136      vtkFloatingPointType thaAng);
00137 
00138   static
00139   vtkFloatingPointType* 
00140   GetRy(vtkFloatingPointType theRy[3][3], 
00141      vtkFloatingPointType thaAng);
00142 
00143   static
00144   vtkFloatingPointType* 
00145   GetRz(vtkFloatingPointType theRz[3][3], 
00146      vtkFloatingPointType thaAng);
00147 
00148   static
00149   void
00150   CorrectPnt(vtkFloatingPointType thePnt[3], 
00151           const vtkFloatingPointType BoundPrj[6]);
00152 
00153   static
00154   void
00155   GetBoundProject(vtkFloatingPointType BoundPrj[3], 
00156             const vtkFloatingPointType BoundBox[6], 
00157             const vtkFloatingPointType Dir[3]);
00158 
00159   static
00160   void
00161   GetDir(vtkFloatingPointType theDir[3],
00162       const vtkFloatingPointType theAng[3],
00163       const PlaneOrientation& theBasePlane);
00164 
00165   static 
00166   void
00167   ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData);
00168 
00169   static 
00170   void
00171   CutWithPlane(vtkAppendPolyData* theAppendPolyData, 
00172             vtkDataSet* theDataSet,
00173             vtkFloatingPointType theDir[3], 
00174             vtkFloatingPointType theOrig[3]);
00175 
00176   static
00177   void
00178   CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
00179           vtkDataSet* theDataSet,
00180           int theNbPlanes, 
00181           vtkFloatingPointType theDir[3], 
00182           vtkFloatingPointType theBounds[6],
00183           const std::vector<vtkFloatingPointType>& thePlanePosition,
00184           const std::vector<int>& thePlaneCondition,
00185           vtkFloatingPointType theDisplacement);
00186 protected:
00187   virtual 
00188   THook* 
00189   DoHook();
00190 
00191   void
00192   SetPartPosition(int theNum = 0);
00193 
00194   int myNbParts;
00195   PlaneOrientation myBasePlane[2];
00196   vtkFloatingPointType myAng[2][3], myDisplacement[2];
00197   vtkAppendPolyData *myAppendPolyData;
00198   std::vector<vtkFloatingPointType> myPartPosition;
00199   std::vector<int> myPartCondition;
00200 };
00201 
00202 #endif