]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To improve scale factor calculation
authorapo <apo@opencascade.com>
Wed, 30 Nov 2005 07:45:15 +0000 (07:45 +0000)
committerapo <apo@opencascade.com>
Wed, 30 Nov 2005 07:45:15 +0000 (07:45 +0000)
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx

index 1cec84e1b8c22b95e36531c887c84fe42d844726..45f6e29fe673833aadada1d16d1f5dd2954dff34 100644 (file)
@@ -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 )
index 17ccd6d5080faf0a9630e72f7136790b88810b63..a3747abfa30c0700711ee269413cbfaa9996b6a2 100644 (file)
@@ -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