Salome HOME
Merge from OCC_development_generic_2006
[modules/visu.git] / src / PIPELINE / VISU_CutLinesPL.cxx
index 106b1b71be3a202c7738a5af5b972988afebc649..b518dfad7996c974b88c36c7abaadfb077cf746a 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
@@ -37,14 +37,14 @@ vtkStandardNewMacro(VISU_CutLinesPL);
 VISU_CutLinesPL::VISU_CutLinesPL(){}
 
 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 +70,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 +93,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 +112,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 +123,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)
 {