Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / PIPELINE / VISU_CutLinesPL.cxx
index 21b5004f6b690caee57f7ef3ea621cf650455019..e2cfe567380ef8390fb7d646fb924d043164f7e1 100644 (file)
@@ -1,22 +1,22 @@
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 // File:    VISU_PipeLine.cxx
@@ -26,7 +26,7 @@
 
 #include "VISU_CutLinesPL.hxx"
 #include "VISU_PipeLineUtils.hxx"
-#include "SALOME_GeometryFilter.h"
+#include "VTKViewer_GeometryFilter.h"
 
 #include <vtkAppendPolyData.h>
 
@@ -34,17 +34,20 @@ using namespace std;
 
 vtkStandardNewMacro(VISU_CutLinesPL);
 
-VISU_CutLinesPL::VISU_CutLinesPL(){}
+VISU_CutLinesPL::VISU_CutLinesPL(){
+  myCondition = 1;
+  myPosition = 0;
+}
 
 void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
   if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(1),
                   aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1);
     SetDisplacement(aPipeLine->GetDisplacement(1),1);
-    SetDefault(); 
+    SetDefault();
     if (!aPipeLine->IsDefault()) SetPosition(aPipeLine->GetPosition());
   }
+  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
 }
 
 void VISU_CutLinesPL::Init(){
@@ -70,7 +73,7 @@ float VISU_CutLinesPL::GetPosition(){
   float aPosition = myPosition;
   if(myCondition){
       float aDir[3], aBounds[6], aBoundPrj[3];
-      myInput->GetBounds(aBounds);
+      GetInput2()->GetBounds(aBounds);
       GetDir(aDir,myAng[0],myBasePlane[0]);
       GetBoundProject(aBoundPrj,aBounds,aDir);
       aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[0];
@@ -93,9 +96,9 @@ void VISU_CutLinesPL::Update(){
   vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New();
   //Build base plane
   float aDir[2][3], aBaseBounds[6];
-  myInput->GetBounds(aBaseBounds);
+  GetInput2()->GetBounds(aBaseBounds);
   GetDir(aDir[0],myAng[0],myBasePlane[0]);
-  vtkUnstructuredGrid* anUnstructuredGrid = 
+  vtkUnstructuredGrid* anUnstructuredGrid =
     myFieldTransform->GetUnstructuredGridOutput();
   CutWithPlanes(anAppendPolyData,anUnstructuredGrid,1,aDir[0],aBaseBounds,
                myPosition,myCondition,myDisplacement[0]);
@@ -112,7 +115,8 @@ void VISU_CutLinesPL::Update(){
   anAppendPolyData->Register(myAppendPolyData);
   anAppendPolyData->Delete();
   //Calculate values for building of table
-  vtkMath::Cross(aDir[0],aDir[1],myDirLn); 
+  vtkMath::Cross(aDir[0],aDir[1],myDirLn);
+  for (int i=0; i<3 ; i++) if(myDirLn[i]<0) myDirLn[i] = (-1)*myDirLn[i];//enk:: correction of bug Bug PAL10401
   GetBoundProject(myBoundPrjLn, aBaseBounds, myDirLn);
   VISU::Mul(myDirLn,myBoundPrjLn[0],myBasePnt);
   CorrectPnt(myBasePnt,aBaseBounds);
@@ -122,7 +126,7 @@ void VISU_CutLinesPL::Update(){
 
 
 void VISU_CutLinesPL::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet,
-                                   int theNbPlanes, float theDir[3], float theBounds[6], 
+                                   int theNbPlanes, float theDir[3], float theBounds[6],
                                    float thePartPosition, int thePartCondition,
                                    float theDisplacement)
 {