From: apo Date: Fri, 30 May 2008 13:21:51 +0000 (+0000) Subject: Fix for Bug IPAL17729 X-Git-Tag: V4_1_3rc1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=61273c59f1e2fed08cceb7406084fe0f2876e73c;p=modules%2Fvisu.git Fix for Bug IPAL17729 - Vector presentation is wrong after scaling --- diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index a8f45023..5e88cbec 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -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 ); } } } diff --git a/src/OBJECT/VISU_VectorsAct.cxx b/src/OBJECT/VISU_VectorsAct.cxx index 428cbb50..82742b1d 100644 --- a/src/OBJECT/VISU_VectorsAct.cxx +++ b/src/OBJECT/VISU_VectorsAct.cxx @@ -28,6 +28,7 @@ #include "VISU_VectorsAct.h" #include "VISU_VectorsPL.hxx" +#include "SVTK_Actor.h" // VTK Includes #include @@ -58,8 +59,9 @@ void VISU_VectorsAct ::SetPipeLine(VISU_PipeLine* thePipeLine) { - myVectorsPL = dynamic_cast(thePipeLine); - VISU_Actor::SetPipeLine(myVectorsPL.GetPointer()); + myVectorsPL = dynamic_cast( 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(theMapper)) aMapper->SetInput(myPassFilter[3]->GetPolyDataOutput()); } + vtkLODActor::SetMapper(theMapper); } diff --git a/src/PIPELINE/VISU_VectorsPL.cxx b/src/PIPELINE/VISU_VectorsPL.cxx index 72b29ff8..1c3257b9 100644 --- a/src/PIPELINE/VISU_VectorsPL.cxx +++ b/src/PIPELINE/VISU_VectorsPL.cxx @@ -44,18 +44,18 @@ vtkStandardNewMacro(VISU_VectorsPL); //---------------------------------------------------------------------------- template -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(); } diff --git a/src/PIPELINE/VISU_VectorsPL.hxx b/src/PIPELINE/VISU_VectorsPL.hxx index 09fe54cb..0befbd6e 100644 --- a/src/PIPELINE/VISU_VectorsPL.hxx +++ b/src/PIPELINE/VISU_VectorsPL.hxx @@ -135,8 +135,7 @@ protected: GlyphType myTypeGlyph; GlyphPos myPosGlyph; - vtkGlyph3D *myBaseGlyph; - vtkGlyph3D *myTransformedGlyph; + vtkGlyph3D *myGlyph; vtkGlyphSource2D *myGlyphSource; vtkLineSource *myLineSource;