Version: 6.3.1

src/PIPELINE/VISU_CutPlanesPL.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  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 //  VISU OBJECT : interactive object for VISU entities implementation
00024 // File:    VISU_CutPlanesPL.hxx
00025 // Author:  Alexey PETROV
00026 // Module : VISU
00027 //
00028 #ifndef VISU_CutPlanesPL_HeaderFile
00029 #define VISU_CutPlanesPL_HeaderFile
00030 
00031 #include "VISUPipeline.hxx"
00032 #include "VISU_ScalarMapPL.hxx"
00033 #include "VISU_OptionalDeformationPL.hxx"
00034 #include "VISU_MapperHolder.hxx"
00035 
00036 #include <vector>
00037 
00038 class vtkAppendPolyData;
00039 
00040 
00041 //----------------------------------------------------------------------------
00042 class VISU_PIPELINE_EXPORT VISU_CutPlanesPL : public VISU_ScalarMapPL,
00043                                               public VISU_OptionalDeformationPL
00044 {
00045 public:
00046   vtkTypeMacro(VISU_CutPlanesPL, VISU_ScalarMapPL);
00047 
00048   static 
00049   VISU_CutPlanesPL* 
00050   New();
00051 
00052   virtual
00053   unsigned long int 
00054   GetMTime();
00055 
00056   //----------------------------------------------------------------------------
00057   enum PlaneOrientation {XY, YZ, ZX};
00058 
00059   virtual 
00060   void
00061   SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
00062                  vtkFloatingPointType theXAng, 
00063                  vtkFloatingPointType theYAng, 
00064                  int theNum = 0);
00065   
00066   virtual 
00067   const PlaneOrientation& 
00068   GetPlaneOrientation(int theNum = 0);
00069 
00070   virtual
00071   vtkFloatingPointType 
00072   GetRotateX(int theNum = 0);
00073 
00074   virtual
00075   vtkFloatingPointType
00076   GetRotateY(int theNum = 0);
00077 
00078   virtual
00079   vtkFloatingPointType 
00080   GetDisplacement(int theNum = 0);
00081 
00082   virtual
00083   void
00084   SetDisplacement(vtkFloatingPointType theDisp, 
00085                   int theNum = 0);
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 public:
00114   virtual
00115   void
00116   Init();
00117 
00118   virtual
00119   void
00120   Update();
00121 
00123   virtual
00124   unsigned long int
00125   GetMemorySize();
00126 
00127   virtual
00128   vtkAppendPolyData* 
00129   GetAppendPolyData() 
00130   { 
00131     return myAppendPolyData; 
00132   }
00133 
00134 public:
00135   static
00136   vtkFloatingPointType* 
00137   GetRx(vtkFloatingPointType theRx[3][3], 
00138         vtkFloatingPointType thaAng);
00139 
00140   static
00141   vtkFloatingPointType* 
00142   GetRy(vtkFloatingPointType theRy[3][3], 
00143         vtkFloatingPointType thaAng);
00144 
00145   static
00146   vtkFloatingPointType* 
00147   GetRz(vtkFloatingPointType theRz[3][3], 
00148         vtkFloatingPointType thaAng);
00149 
00150   static
00151   void
00152   CorrectPnt(vtkFloatingPointType thePnt[3], 
00153              const vtkFloatingPointType BoundPrj[6]);
00154 
00155   static
00156   void
00157   GetBoundProject(vtkFloatingPointType BoundPrj[3], 
00158                   const vtkFloatingPointType BoundBox[6], 
00159                   const vtkFloatingPointType Dir[3]);
00160 
00161   static
00162   void
00163   GetDir(vtkFloatingPointType theDir[3],
00164          const vtkFloatingPointType theAng[3],
00165          const PlaneOrientation& theBasePlane);
00166 
00167   static 
00168   void
00169   ClearAppendPolyData(vtkAppendPolyData *theAppendPolyData);
00170 
00171   static 
00172   void
00173   CutWithPlane(vtkAppendPolyData* theAppendPolyData, 
00174                vtkDataSet* theDataSet,
00175                vtkFloatingPointType theDir[3], 
00176                vtkFloatingPointType theOrig[3]);
00177 
00178   static
00179   void
00180   CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
00181                 vtkDataSet* theDataSet,
00182                 int theNbPlanes, 
00183                 vtkFloatingPointType theDir[3], 
00184                 vtkFloatingPointType theBounds[6],
00185                 const std::vector<vtkFloatingPointType>& thePlanePosition,
00186                 const std::vector<int>& thePlaneCondition,
00187                 vtkFloatingPointType theDisplacement);
00188 
00189   virtual void SetVectorialField(VISU::PUnstructuredGridIDMapper);
00190   VISU::PUnstructuredGridIDMapper getVectorialField();
00191 
00192   virtual
00193   void
00194   SetMapScale(vtkFloatingPointType theMapScale = 1.0);
00195 
00196 
00197 protected:
00198   VISU_CutPlanesPL();
00199 
00200   virtual
00201   ~VISU_CutPlanesPL();
00202 
00203   virtual 
00204   vtkDataSet* 
00205   InsertCustomPL();
00206 
00207   virtual
00208   void
00209   DoShallowCopy(VISU_PipeLine *thePipeLine,
00210                 bool theIsCopyInput);
00211 
00212   void
00213   SetPartPosition(int theNum = 0);
00214 
00215   int myNbParts;
00216   PlaneOrientation myBasePlane[2];
00217   vtkFloatingPointType myAng[2][3], myDisplacement[2];
00218   vtkAppendPolyData *myAppendPolyData;
00219   std::vector<vtkFloatingPointType> myPartPosition;
00220   std::vector<int> myPartCondition;
00221 
00222 private:
00223   VISU_CutPlanesPL(const VISU_CutPlanesPL&);  // Not implemented.
00224   void operator=(const VISU_CutPlanesPL&);  // Not implemented.
00225 };
00226 
00227 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS