From: apo Date: Wed, 30 Nov 2005 07:45:15 +0000 (+0000) Subject: To improve scale factor calculation X-Git-Tag: TG-D5-38-2003_D2005-20-12~95 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=93bb1d8dfd608397bbed7cc03f5f12243c311a01;p=modules%2Fvisu.git To improve scale factor calculation --- diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 1cec84e1..45f6e29f 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -61,6 +61,8 @@ VISU_GaussPointsPL myExtractGeometry->SetExtractInside(0); myPSMapper = VISU_OpenGLPointSpriteMapper::New(); + myPSMapper->SetColorModeToMapScalars(); + myPSMapper->ScalarVisibilityOn(); myGeomFilter = vtkGeometryFilter::New(); @@ -124,15 +126,11 @@ VISU_GaussPointsPL //---------------------------------------------------------------------------- void VISU_GaussPointsPL -::Build() +::Init() { - myPSMapper->SetColorModeToMapScalars(); - myPSMapper->ScalarVisibilityOn(); - myExtractor->SetInput( GetInput2() ); myFieldTransform->SetInput( myExtractor->GetOutput() ); - myFieldTransform->Update(); myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() ); if( myIsDeformed ) @@ -147,7 +145,28 @@ VISU_GaussPointsPL myPSMapper->SetInput( myGeomFilter->GetOutput() ); - SetSourceRange(); + VISU_ScalarMapPL::Init(); + + float aScalarRange[2]; + GetSourceRange(aScalarRange); + vtkDataSet* aDataSet = GetParentMesh(); + SetScale( VISU_DeformedShapePL::GetScaleFactor( aDataSet ) / aScalarRange[1] ); +} + +//---------------------------------------------------------------------------- +void +VISU_GaussPointsPL +::Build() +{ + if( myIsDeformed ) + { + myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() ); + myGeomFilter->SetInput( myWarpVector->GetOutput() ); + } + else + { + myGeomFilter->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() ); + } } //---------------------------------------------------------------------------- @@ -160,6 +179,7 @@ VISU_GaussPointsPL vtkMapper* aMapper = GetMapper(); vtkDataSet* aDataSet = aMapper->GetInput(); + //vtkDataSet* aDataSet = GetParentMesh(); myAverageCellSize = VISU_DeformedShapePL::GetScaleFactor(aDataSet); vtkCellData* aCellData = aDataSet->GetCellData(); @@ -186,10 +206,8 @@ VISU_GaussPointsPL this->myGeomFilter = NULL; } - myWarpVector->UnRegisterAllOutputs(); myWarpVector->Delete(); - myCellDataToPointData->UnRegisterAllOutputs(); myCellDataToPointData->Delete(); } @@ -216,6 +234,7 @@ VISU_GaussPointsPL { myGaussPtsIDMapper = theGaussPtsIDMapper; SetIDMapper(myGaussPtsIDMapper); + Init(); } const VISU::PGaussPtsIDMapper& @@ -225,6 +244,14 @@ VISU_GaussPointsPL return myGaussPtsIDMapper; } +VISU::TVTKOutput* +VISU_GaussPointsPL +::GetParentMesh() const +{ + VISU::TNamedIDMapper* aNamedIDMapper = myGaussPtsIDMapper->GetParent(); + return aNamedIDMapper->GetVTKOutput(); +} + //---------------------------------------------------------------------------- void VISU_GaussPointsPL @@ -458,22 +485,13 @@ VISU_GaussPointsPL void VISU_GaussPointsPL::SetScale( float theScale ) { myWarpVector->SetScaleFactor( theScale ); - myScaleFactor = theScale; + myScaleFactor = GetScale(); Modified(); } float VISU_GaussPointsPL::GetScale() { - if( !myScaleFactor ) - myScaleFactor = VISU_DeformedShapePL::GetScaleFactor( GetMapper()->GetInput() ); - - return myScaleFactor; -} - -vtkPointSet* VISU_GaussPointsPL::doHook() -{ - VISU::CellDataToPoint( myWarpVector, myCellDataToPointData, GetInput2(), myFieldTransform ); - return myWarpVector->GetOutput(); + return myWarpVector->GetScaleFactor(); } void VISU_GaussPointsPL::SetMapScale( float theMapScale ) diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 17ccd6d5..a3747abf 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -77,6 +77,11 @@ public: VISU_OpenGLPointSpriteMapper* GetPSMapper(); + //! Redefined method for initialization of the pipeline. + virtual + void + Init(); + //! Redefined method for building the pipeline. virtual void @@ -101,6 +106,9 @@ public: const VISU::PGaussPtsIDMapper& GetGaussPtsIDMapper() const; + VISU::TVTKOutput* + GetParentMesh() const; + //! Set the Bicolor mode. /*! * When the Bicolor parameter is set to true, scalar bars are