Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / PIPELINE / VISU_CutLinesPL.cxx
index e2cfe567380ef8390fb7d646fb924d043164f7e1..f3849887c2ce7bc568598582582a101eb7ac2ced 100644 (file)
@@ -34,12 +34,17 @@ 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){
+void
+VISU_CutLinesPL
+::ShallowCopy(VISU_PipeLine *thePipeLine)
+{
   if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(1),
                   aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1);
@@ -50,7 +55,10 @@ void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
   VISU_CutPlanesPL::ShallowCopy(thePipeLine);
 }
 
-void VISU_CutLinesPL::Init(){
+void
+VISU_CutLinesPL
+::Init()
+{
   VISU_CutPlanesPL::Init();
 
   myBasePlane[0] = XY;
@@ -64,15 +72,21 @@ void VISU_CutLinesPL::Init(){
 }
 
 
-void VISU_CutLinesPL::SetPosition(float thePosition){
+void
+VISU_CutLinesPL
+::SetPosition(vtkFloatingPointType thePosition)
+{
   myPosition = thePosition;
   myCondition = 0;
   Modified();
 }
-float VISU_CutLinesPL::GetPosition(){
-  float aPosition = myPosition;
+vtkFloatingPointType 
+VISU_CutLinesPL
+::GetPosition()
+{
+  vtkFloatingPointType aPosition = myPosition;
   if(myCondition){
-      float aDir[3], aBounds[6], aBoundPrj[3];
+      vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
       GetInput2()->GetBounds(aBounds);
       GetDir(aDir,myAng[0],myBasePlane[0]);
       GetBoundProject(aBoundPrj,aBounds,aDir);
@@ -81,21 +95,30 @@ float VISU_CutLinesPL::GetPosition(){
   return aPosition;
 }
 
-void VISU_CutLinesPL::SetDefault(){
+void
+VISU_CutLinesPL
+::SetDefault()
+{
   myCondition = 1;
   Modified();
 }
-int VISU_CutLinesPL::IsDefault(){
+int
+VISU_CutLinesPL
+::IsDefault()
+{
   return myCondition;
 }
 
 
-void VISU_CutLinesPL::Update(){
+void
+VISU_CutLinesPL
+::Update()
+{
   ClearAppendPolyData(myAppendPolyData);
   SetPartPosition(1);
   vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New();
   //Build base plane
-  float aDir[2][3], aBaseBounds[6];
+  vtkFloatingPointType aDir[2][3], aBaseBounds[6];
   GetInput2()->GetBounds(aBaseBounds);
   GetDir(aDir[0],myAng[0],myBasePlane[0]);
   vtkUnstructuredGrid* anUnstructuredGrid =
@@ -103,7 +126,7 @@ void VISU_CutLinesPL::Update(){
   CutWithPlanes(anAppendPolyData,anUnstructuredGrid,1,aDir[0],aBaseBounds,
                myPosition,myCondition,myDisplacement[0]);
   //Build lines
-  float aBounds[6];
+  vtkFloatingPointType aBounds[6];
   vtkDataSet *aDataSet = anAppendPolyData->GetOutput();
   aDataSet->Update();
   if(aDataSet->GetNumberOfCells() == 0)
@@ -116,21 +139,31 @@ void VISU_CutLinesPL::Update(){
   anAppendPolyData->Delete();
   //Calculate values for building of table
   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
+  for (int i=0; i<3 ; i++) {
+    myRealDirLn[i] = myDirLn[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);
 
   VISU_ScalarMapPL::Update();
 }
 
 
-void VISU_CutLinesPL::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, vtkDataSet* theDataSet,
-                                   int theNbPlanes, float theDir[3], float theBounds[6],
-                                   float thePartPosition, int thePartCondition,
-                                   float theDisplacement)
+void
+VISU_CutLinesPL
+::CutWithPlanes(vtkAppendPolyData* theAppendPolyData, 
+               vtkDataSet* theDataSet,
+               int theNbPlanes, 
+               vtkFloatingPointType theDir[3], 
+               vtkFloatingPointType theBounds[6],
+               vtkFloatingPointType thePartPosition, 
+               int thePartCondition,
+               vtkFloatingPointType theDisplacement)
 {
-  vector<float> aPartPosition(1,thePartPosition);
+  vector<vtkFloatingPointType> aPartPosition(1,thePartPosition);
   vector<int> aPartCondition(1,thePartCondition);
   VISU_CutPlanesPL::CutWithPlanes(theAppendPolyData,theDataSet,theNbPlanes,theDir,theBounds,
                                  aPartPosition,aPartCondition,theDisplacement);