Salome HOME
Porting to VTK 6.
[modules/visu.git] / src / PIPELINE / VISU_CutPlanesPL.cxx
index 38eb875290665952461e0aa002ac4c8d600cdd09..06ab525d24040255c5358799a88575e4c6b98404 100644 (file)
@@ -38,7 +38,7 @@
 
 //#include <vtkUnstructuredGrid.h>
 
-static vtkFloatingPointType EPS = 1.0E-3;
+static double EPS = 1.0E-3;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
@@ -147,11 +147,11 @@ VISU_CutPlanesPL
 
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+vtkAlgorithmOutput* 
 VISU_CutPlanesPL
 ::InsertCustomPL()
 {
-  return GetWarpVectorOutput();
+  return GetWarpVectorOutputPort();
 }
 
 
@@ -179,12 +179,12 @@ VISU_CutPlanesPL
 
   SetPartPosition();
   
-  vtkFloatingPointType aDir[3];
+  double aDir[3];
   GetDir(aDir, 
          myAng[0], 
          myBasePlane[0]);
   
-  vtkFloatingPointType aBounds[6];
+  double aBounds[6];
 
   vtkDataSet* aFilterOutput = GetMergeFilterOutput();
   
@@ -243,10 +243,10 @@ VISU_CutPlanesPL
 
 
 //----------------------------------------------------------------------------
-vtkFloatingPointType* 
+double* 
 VISU_CutPlanesPL::
-GetRx(vtkFloatingPointType theRx[3][3], 
-      vtkFloatingPointType thaAng)
+GetRx(double theRx[3][3], 
+      double thaAng)
 {
   theRx[0][0] = 1.0;            theRx[0][1] = 0.0;            theRx[0][2] = 0.0;
   theRx[1][0] = 0.0;            theRx[1][1] = cos(thaAng);    theRx[1][2] = -sin(thaAng);
@@ -257,10 +257,10 @@ GetRx(vtkFloatingPointType theRx[3][3],
 
 
 //----------------------------------------------------------------------------
-vtkFloatingPointType* 
+double* 
 VISU_CutPlanesPL
-::GetRy(vtkFloatingPointType theRy[3][3], 
-        vtkFloatingPointType thaAng)
+::GetRy(double theRy[3][3], 
+        double thaAng)
 {
   theRy[0][0] = cos(thaAng);    theRy[0][1] = 0.0;            theRy[0][2] = sin(thaAng);
   theRy[1][0] = 0.0;            theRy[1][1] = 1.0;            theRy[1][2] = 0.0;
@@ -270,10 +270,10 @@ VISU_CutPlanesPL
 
 
 //----------------------------------------------------------------------------
-vtkFloatingPointType* 
+double* 
 VISU_CutPlanesPL
-::GetRz(vtkFloatingPointType theRz[3][3], 
-        vtkFloatingPointType thaAng)
+::GetRz(double theRz[3][3], 
+        double thaAng)
 {
   theRz[0][0] = cos(thaAng);    theRz[0][1] = -sin(thaAng);   theRz[0][2] = 0.0;
   theRz[1][0] = sin(thaAng);    theRz[1][1] = cos(thaAng);    theRz[1][2] = 0.0;
@@ -285,8 +285,8 @@ VISU_CutPlanesPL
 //----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
-::CorrectPnt(vtkFloatingPointType thePnt[3], 
-             const vtkFloatingPointType BoundPrj[6])
+::CorrectPnt(double thePnt[3], 
+             const double BoundPrj[6])
 {
   for(int i = 0, j = 0; i < 3; ++i, j=2*i){
     if(thePnt[i] < BoundPrj[j]) thePnt[i] = BoundPrj[j];
@@ -298,11 +298,11 @@ VISU_CutPlanesPL
 //----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
-::GetBoundProject(vtkFloatingPointType BoundPrj[3], 
-                  const vtkFloatingPointType BoundBox[6], 
-                  const vtkFloatingPointType Dir[3])
+::GetBoundProject(double BoundPrj[3], 
+                  const double BoundBox[6], 
+                  const double Dir[3])
 {
-  vtkFloatingPointType BoundPoints[8][3] = { {BoundBox[0],BoundBox[2],BoundBox[4]},
+  double BoundPoints[8][3] = { {BoundBox[0],BoundBox[2],BoundBox[4]},
                                              {BoundBox[1],BoundBox[2],BoundBox[4]},
                                              {BoundBox[0],BoundBox[3],BoundBox[4]},
                                              {BoundBox[1],BoundBox[3],BoundBox[4]},
@@ -312,7 +312,7 @@ VISU_CutPlanesPL
                                              {BoundBox[1],BoundBox[3],BoundBox[5]}};
   BoundPrj[0] = vtkMath::Dot(Dir,BoundPoints[0]), BoundPrj[1] = BoundPrj[0];
   for(int i = 1; i < 8; i++){
-    vtkFloatingPointType tmp = vtkMath::Dot(Dir,BoundPoints[i]);
+    double tmp = vtkMath::Dot(Dir,BoundPoints[i]);
     if(BoundPrj[1] < tmp) BoundPrj[1] = tmp;
     if(BoundPrj[0] > tmp) BoundPrj[0] = tmp;
   }
@@ -327,8 +327,8 @@ VISU_CutPlanesPL
 void
 VISU_CutPlanesPL
 ::SetOrientation(const VISU_CutPlanesPL::PlaneOrientation& theOrient,
-                 vtkFloatingPointType theXAng, 
-                 vtkFloatingPointType theYAng, 
+                 double theXAng, 
+                 double theYAng, 
                  int theNum)
 {
   myBasePlane[theNum] = theOrient;
@@ -353,7 +353,7 @@ VISU_CutPlanesPL
   return myBasePlane[theNum];
 }
 
-vtkFloatingPointTyp
+doubl
 VISU_CutPlanesPL
 ::GetRotateX(int theNum)
 {
@@ -367,7 +367,7 @@ VISU_CutPlanesPL
 
 
 //----------------------------------------------------------------------------
-vtkFloatingPointTyp
+doubl
 VISU_CutPlanesPL
 ::GetRotateY(int theNum)
 {
@@ -381,7 +381,7 @@ VISU_CutPlanesPL
 
 
 //----------------------------------------------------------------------------
-vtkFloatingPointTyp
+doubl
 VISU_CutPlanesPL
 ::GetDisplacement(int theNum)
 {
@@ -392,7 +392,7 @@ VISU_CutPlanesPL
 //----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
-::SetDisplacement(vtkFloatingPointType theDisp, 
+::SetDisplacement(double theDisp, 
                   int theNum) 
 {
   if(VISU::CheckIsSameValue(myDisplacement[theNum], theDisp))
@@ -430,7 +430,7 @@ VISU_CutPlanesPL
 void
 VISU_CutPlanesPL
 ::SetPartPosition(int thePartNumber, 
-                  vtkFloatingPointType thePartPosition)
+                  double thePartPosition)
 {
   if(thePartNumber >= myNbParts) 
     return;
@@ -447,7 +447,7 @@ VISU_CutPlanesPL
 
 
 //----------------------------------------------------------------------------
-vtkFloatingPointTyp
+doubl
 VISU_CutPlanesPL
 ::GetPartPosition(int thePartNumber, 
                   int theNum)
@@ -455,9 +455,9 @@ VISU_CutPlanesPL
   if(thePartNumber >= myNbParts) 
     return 0;
 
-  vtkFloatingPointType aPosition = myPartPosition[thePartNumber];
+  double aPosition = myPartPosition[thePartNumber];
   if(myPartCondition[thePartNumber]){
-      vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
+      double aDir[3], aBounds[6], aBoundPrj[3];
       if(!IsDeformed()) 
         GetMergedInput()->GetBounds(aBounds);
       else
@@ -473,9 +473,9 @@ VISU_CutPlanesPL
                       aDir);
 
       if(myNbParts > 1){
-        vtkFloatingPointType aDBoundPrj = aBoundPrj[2]/(myNbParts - 1);
-        vtkFloatingPointType aDisplacement = aDBoundPrj * myDisplacement[theNum];
-        vtkFloatingPointType aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
+        double aDBoundPrj = aBoundPrj[2]/(myNbParts - 1);
+        double aDisplacement = aDBoundPrj * myDisplacement[theNum];
+        double aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
         aPosition = aStartPosition + thePartNumber*aDBoundPrj;
       }else
         aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[theNum];
@@ -519,12 +519,12 @@ VISU_CutPlanesPL
 //----------------------------------------------------------------------------
 void
 VISU_CutPlanesPL
-::GetDir(vtkFloatingPointType theDir[3],
-         const vtkFloatingPointType theAng[3],
+::GetDir(double theDir[3],
+         const double theAng[3],
          const PlaneOrientation& theBasePlane)
 {
   int iPlane = 0;
-  vtkFloatingPointType aRx[3][3], aRy[3][3], aRz[3][3], aRotation[3][3];
+  double aRx[3][3], aRy[3][3], aRz[3][3], aRotation[3][3];
   switch(theBasePlane){
   case XY:
     if(fabs(theAng[0]) > EPS) GetRx(aRx,theAng[0]); else vtkMath::Identity3x3(aRx);
@@ -556,18 +556,18 @@ void
 VISU_CutPlanesPL
 ::CutWithPlane(vtkAppendPolyData* theAppendPolyData,
                vtkDataSet* theDataSet,
-               vtkFloatingPointType theDir[3], 
-               vtkFloatingPointType theOrig[3])
+               double theDir[3], 
+               double theOrig[3])
 {
   vtkEDFCutter *aCutPlane = vtkEDFCutter::New();
-  aCutPlane->SetInput(theDataSet);
+  aCutPlane->SetInputData(theDataSet);
   vtkPlane *aPlane = vtkPlane::New();
   aPlane->SetOrigin(theOrig);
 
   aPlane->SetNormal(theDir);
   aCutPlane->SetCutFunction(aPlane);
   aPlane->Delete();
-  theAppendPolyData->AddInput(aCutPlane->GetOutput());
+  theAppendPolyData->AddInputConnection(aCutPlane->GetOutputPort());
   aCutPlane->Delete();
 }
 
@@ -578,18 +578,18 @@ VISU_CutPlanesPL
 ::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
                 vtkDataSet* theDataSet,
                 int theNbPlanes, 
-                vtkFloatingPointType theDir[3], 
-                vtkFloatingPointType theBounds[6],
-                const std::vector<vtkFloatingPointType>& thePlanePosition,
+                double theDir[3], 
+                double theBounds[6],
+                const std::vector<double>& thePlanePosition,
                 const std::vector<int>& thePlaneCondition,
-                vtkFloatingPointType theDisplacement)
+                double theDisplacement)
 {
-  vtkFloatingPointType aBoundPrj[3], aOrig[3], aPosition;
+  double aBoundPrj[3], aOrig[3], aPosition;
   GetBoundProject(aBoundPrj, theBounds, theDir);
   if(theNbPlanes > 1){
-    vtkFloatingPointType aDBoundPrj = aBoundPrj[2]/(theNbPlanes - 1);
-    vtkFloatingPointType aDisplacement = aDBoundPrj*theDisplacement;
-    vtkFloatingPointType aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
+    double aDBoundPrj = aBoundPrj[2]/(theNbPlanes - 1);
+    double aDisplacement = aDBoundPrj*theDisplacement;
+    double aStartPosition = aBoundPrj[0] - 0.5*aDBoundPrj + aDisplacement;
     for (int i = 0; i < theNbPlanes; i++){
       aPosition = aStartPosition + i*aDBoundPrj;
       if(thePlaneCondition[i]){
@@ -608,7 +608,6 @@ VISU_CutPlanesPL
     CutWithPlane(theAppendPolyData,theDataSet,theDir,aOrig);
   }
   vtkPolyData *aPolyData = theAppendPolyData->GetOutput();
-  aPolyData->Update();
   theAppendPolyData->Update();
 }
 
@@ -639,7 +638,7 @@ getVectorialField()
 }
 
 //----------------------------------------------------------------------------
-void VISU_CutPlanesPL::SetMapScale(vtkFloatingPointType theMapScale){
+void VISU_CutPlanesPL::SetMapScale(double theMapScale){
   Superclass::SetMapScale(theMapScale);
   if(IsDeformed())
     VISU_OptionalDeformationPL::SetMapScale(theMapScale);