]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for Bug IPAL17729
authorapo <apo@opencascade.com>
Fri, 30 May 2008 13:21:51 +0000 (13:21 +0000)
committerapo <apo@opencascade.com>
Fri, 30 May 2008 13:21:51 +0000 (13:21 +0000)
 - Vector presentation is wrong after scaling

src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_VectorsAct.cxx
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_VectorsPL.hxx

index a8f45023e0a6b0ff79fb899493c58862d9c5c54c..5e88cbec62012aa5245845b0c1ff96eb6fe78255 100644 (file)
@@ -179,11 +179,11 @@ VISU_Actor
 ::SetPipeLine(VISU_PipeLine* thePipeLine) 
 {
   myPipeLine = thePipeLine;
-  if(thePipeLine){
-    if(vtkMapper *aMapper = myPipeLine->GetMapper()){
-      if(vtkDataSet *aDataSet = aMapper->GetInput()){
-       SetShrinkable(thePipeLine->IsShrinkable());
-       SetMapperInput(aDataSet);
+  if ( thePipeLine ) {
+    if ( vtkMapper *aMapper = myPipeLine->GetMapper() ) {
+      if ( vtkDataSet *aDataSet = aMapper->GetInput() ) {
+       SetShrinkable( thePipeLine->IsShrinkable() );
+       SetMapperInput( aDataSet );
       }
     }
   }
index 428cbb50e8f3bcd0fb1027c25599bf2fc6435ae7..82742b1d35f42af1faea6f74d196a02ffde4b5aa 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "VISU_VectorsAct.h"
 #include "VISU_VectorsPL.hxx"
+#include "SVTK_Actor.h"
  
 // VTK Includes
 #include <vtkObjectFactory.h>
@@ -58,8 +59,9 @@ void
 VISU_VectorsAct
 ::SetPipeLine(VISU_PipeLine* thePipeLine) 
 {
-  myVectorsPL = dynamic_cast<VISU_VectorsPL*>(thePipeLine);
-  VISU_Actor::SetPipeLine(myVectorsPL.GetPointer());
+  myVectorsPL = dynamic_cast<VISU_VectorsPL*>( thePipeLine );
+
+  Superclass::SetPipeLine( myVectorsPL.GetPointer() );
 }
 
 
@@ -77,8 +79,9 @@ void
 VISU_VectorsAct
 ::SetTransform(VTKViewer_Transform* theTransform)
 {
-  Superclass::SetTransform(theTransform);
-  myVectorsPL->SetTransform(theTransform);
+  // To perform only vector's specific action,
+  // there is nothing to be done for the Superclass
+  myVectorsPL->SetTransform( theTransform );
 }
 
 
@@ -101,6 +104,7 @@ VISU_VectorsAct
     else if(vtkPolyDataMapper* aMapper = dynamic_cast<vtkPolyDataMapper*>(theMapper))
       aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput());
   }
+
   vtkLODActor::SetMapper(theMapper);
 }
 
index 72b29ff8cf42db20c7a4c82bd22269ce05243290..1c3257b929ff9345031121c9c93693a28c4d26de 100644 (file)
@@ -44,18 +44,18 @@ vtkStandardNewMacro(VISU_VectorsPL);
 
 //----------------------------------------------------------------------------
 template<class TOutputFilter>
-void ToCellCenters(TOutputFilter *theOutputFilter, 
-                  vtkCellCenters *theCellCenters,
-                  vtkDataSet* theDataSet,
-                  VISU_UsedPointsFilter* theUsedPointsFilter)
+void ToCellCenters( TOutputFilter *theOutputFilter, 
+                   vtkCellCenters *theCellCenters,
+                   vtkDataSet* theDataSet,
+                   VISU_UsedPointsFilter* theUsedPointsFilter )
 {
-  if(VISU::IsDataOnCells(theDataSet)){
-    theCellCenters->SetInput(theDataSet);
+  if ( VISU::IsDataOnCells( theDataSet ) ) {
+    theCellCenters->SetInput( theDataSet );
     theCellCenters->VertexCellsOn();
-    theOutputFilter->SetInput(theCellCenters->GetOutput());
+    theOutputFilter->SetInput( theCellCenters->GetOutput() );
   }else {
-    theUsedPointsFilter->SetInput(theDataSet);
-    theOutputFilter->SetInput(theUsedPointsFilter->GetOutput());
+    theUsedPointsFilter->SetInput( theDataSet );
+    theOutputFilter->SetInput( theUsedPointsFilter->GetOutput() );
   }
 }
 
@@ -63,10 +63,9 @@ void ToCellCenters(TOutputFilter *theOutputFilter,
 VISU_VectorsPL
 ::VISU_VectorsPL()
 {
-  SetIsShrinkable(false);
+  SetIsShrinkable( false );
 
-  myBaseGlyph = vtkGlyph3D::New();
-  myTransformedGlyph = vtkGlyph3D::New();
+  myGlyph = vtkGlyph3D::New();
 
   myGlyphSource = vtkGlyphSource2D::New();
   myConeSource = vtkConeSource::New();
@@ -83,8 +82,7 @@ VISU_VectorsPL
 VISU_VectorsPL
 ::~VISU_VectorsPL()
 {
-  myBaseGlyph->Delete();
-  myTransformedGlyph->Delete();
+  myGlyph->Delete();
 
   myCenters->Delete();
 
@@ -107,8 +105,7 @@ VISU_VectorsPL
 {
   unsigned long int aTime = Superclass::GetMTime();
 
-  aTime = std::max(aTime, myBaseGlyph->GetMTime());
-  aTime = std::max(aTime, myTransformedGlyph->GetMTime());
+  aTime = std::max(aTime, myGlyph->GetMTime());
   aTime = std::max(aTime, myCenters->GetMTime());
   aTime = std::max(aTime, myGlyphSource->GetMTime());
   aTime = std::max(aTime, myConeSource->GetMTime());
@@ -137,10 +134,9 @@ VISU_VectorsPL
 //----------------------------------------------------------------------------
 void
 VISU_VectorsPL
-::SetTransform(VTKViewer_Transform* theTransform)
+::SetTransform( VTKViewer_Transform* theTransform )
 {
-  GetFieldTransformFilter()->SetSpaceTransform(theTransform);
-  myTransformFilter->SetTransform(theTransform);
+  myTransformFilter->SetTransform( theTransform );
   myTransformFilter->Modified();
 }
 
@@ -150,7 +146,7 @@ VTKViewer_Transform*
 VISU_VectorsPL
 ::GetTransform()
 {
-  return GetFieldTransformFilter()->GetSpaceTransform();
+  return static_cast< VTKViewer_Transform* >( myTransformFilter->GetTransform() );
 }
 
 
@@ -159,13 +155,12 @@ void
 VISU_VectorsPL
 ::SetScale(vtkFloatingPointType theScale) 
 {
-  if(myScaleFactor == theScale) 
+  if ( VISU::CheckIsSameValue( myScaleFactor, theScale ) )
     return;
 
-  myScaleFactor = theScale;
+  myGlyph->SetScaleFactor( theScale );
 
-  myBaseGlyph->SetScaleFactor(myScaleFactor);
-  myTransformedGlyph->SetScaleFactor(myScaleFactor);
+  myScaleFactor = theScale;
 
   Modified();
 }
@@ -176,7 +171,7 @@ vtkFloatingPointType
 VISU_VectorsPL
 ::GetScale() 
 {
-  return myTransformedGlyph->GetScaleFactor();
+  return myGlyph->GetScaleFactor();
 }
 
 
@@ -243,22 +238,15 @@ VISU_VectorsPL
 {
   Superclass::Build();
   
-  ToCellCenters(myBaseGlyph,
-               myCenters,
-               GetMergedInput(),
-               myUsedPointsFilter);
-  myBaseGlyph->SetVectorModeToUseVector();
-  myBaseGlyph->SetScaleModeToScaleByVector();
-  myBaseGlyph->SetColorModeToColorByScalar();
-
-  ToCellCenters(myTransformFilter,
-               myCenters,
-               GetMergedInput(),
-               myUsedPointsFilter);
-  myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
-  myTransformedGlyph->SetVectorModeToUseVector();
-  myTransformedGlyph->SetScaleModeToScaleByVector();
-  myTransformedGlyph->SetColorModeToColorByScalar();
+  ToCellCenters( myTransformFilter,
+                myCenters,
+                GetMergedInput(),
+                myUsedPointsFilter );
+
+  myGlyph->SetInput( myTransformFilter->GetOutput() );
+  myGlyph->SetVectorModeToUseVector();
+  myGlyph->SetScaleModeToScaleByVector();
+  myGlyph->SetColorModeToColorByScalar();
 }
 
 
@@ -267,7 +255,7 @@ vtkDataSet*
 VISU_VectorsPL
 ::InsertCustomPL()
 {
-  return myTransformedGlyph->GetOutput();
+  return myGlyph->GetOutput();
 }
 
 
@@ -290,8 +278,7 @@ VISU_VectorsPL
     case CENTER:
       myGlyphSource->SetCenter(0.0, 0.0, 0.0);
     }
-    myBaseGlyph->SetSource(myGlyphSource->GetOutput());
-    myTransformedGlyph->SetSource(myGlyphSource->GetOutput());
+    myGlyph->SetSource(myGlyphSource->GetOutput());
   }
     break;
   case CONE2:
@@ -313,14 +300,12 @@ VISU_VectorsPL
     case CENTER:
       myConeSource->SetCenter(0.0, 0.0, 0.0);
     }
-    myBaseGlyph->SetSource(myConeSource->GetOutput());
-    myTransformedGlyph->SetSource(myConeSource->GetOutput());
+    myGlyph->SetSource(myConeSource->GetOutput());
   }
     break;
   case NONE:
   default: {
-    myBaseGlyph->SetSource(myLineSource->GetOutput());
-    myTransformedGlyph->SetSource(myLineSource->GetOutput());
+    myGlyph->SetSource(myLineSource->GetOutput());
   }
   }
 
@@ -335,19 +320,12 @@ VISU_VectorsPL
 {
   unsigned long int aSize = Superclass::GetMemorySize();
 
-  if(vtkDataSet* aDataSet = myBaseGlyph->GetOutput())
-    aSize += aDataSet->GetActualMemorySize() * 1024;
-
-  if(vtkDataSet* aDataSet = myTransformedGlyph->GetOutput())
+  if(vtkDataSet* aDataSet = myGlyph->GetOutput())
     aSize += aDataSet->GetActualMemorySize() * 1024;
   
   if(vtkDataSet* aDataSet = myCenters->GetOutput())
     aSize += aDataSet->GetActualMemorySize() * 1024;
 
-  if(myCellDataToPointData->GetInput())
-    if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
-      aSize += aDataSet->GetActualMemorySize() * 1024;
-
   return aSize;
 }
 
@@ -357,8 +335,9 @@ vtkDataSet*
 VISU_VectorsPL
 ::GetOutput()
 {
-  myBaseGlyph->Update();
-  return myBaseGlyph->GetOutput();
+  myGlyph->Update();
+
+  return myGlyph->GetOutput();
 }
 
 
@@ -370,8 +349,7 @@ VISU_VectorsPL
   VISU_ScalarMapPL::SetMapScale(theMapScale);
   myMapScaleFactor = theMapScale;
 
-  myBaseGlyph->SetScaleFactor(myScaleFactor*theMapScale);
-  myTransformedGlyph->SetScaleFactor(myScaleFactor*theMapScale);
+  myGlyph->SetScaleFactor( myScaleFactor*theMapScale );
 
   Modified();
 }
index 09fe54cb5c603f031fe4a4fa2471fde1f2df4b63..0befbd6ecc8a6f5fd721b806766fb897b71a45c1 100644 (file)
@@ -135,8 +135,7 @@ protected:
 
   GlyphType myTypeGlyph;
   GlyphPos myPosGlyph;
-  vtkGlyph3D *myBaseGlyph;
-  vtkGlyph3D *myTransformedGlyph;
+  vtkGlyph3D *myGlyph;
 
   vtkGlyphSource2D *myGlyphSource;
   vtkLineSource *myLineSource;