#include "SALOME_ExtractGeometry.h"
#include "VISU_DeformedShapePL.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
+#include "VTKViewer_PassThroughFilter.h"
#include <vtkPointSource.h>
#include <vtkElevationFilter.h>
myCellDataToPointData->SetPassCellData(true);
myGlyph = vtkGlyph3D::New();
+ myGlyph->SetScaleModeToScaleByScalar();
+ myGlyph->SetColorModeToColorByScalar();
+ myGlyph->ClampingOn();
+
+ myExtractor->SetInput( myExtractGeometry->GetOutput() );
+ myFieldTransform->SetInput( myExtractor->GetOutput() );
+
+ myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
+
mySphereSource = vtkSphereSource::New();
+ myGlyph->SetSource( mySphereSource->GetOutput() );
+
+ for(int i = 0; i < 2; i++)
+ myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
}
+
+//----------------------------------------------------------------------------
+VISU_GaussPointsPL
+::~VISU_GaussPointsPL()
+{
+ if (this->myPSMapper)
+ {
+ this->myPSMapper->Delete();
+ this->myPSMapper = NULL;
+ }
+ if (this->myGeomFilter)
+ {
+ this->myGeomFilter->Delete();
+ this->myGeomFilter = NULL;
+ }
+
+ myWarpVector->Delete();
+
+ myCellDataToPointData->Delete();
+
+ myGlyph->Delete();
+
+ mySphereSource->Delete();
+
+ for(int i = 0; i < 2; i++)
+ myPassFilter[i]->Delete();
+}
+
+
+//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::ShallowCopy(VISU_PipeLine *thePipeLine)
// To restore mapper input from pipeline
myPSMapper->SetInput(aDatsSet);
- SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper());
SetPrimitiveType(aPipeLine->GetPrimitiveType());
SetClamp(aPipeLine->GetClamp());
SetSize(aPipeLine->GetSize());
VISU_GaussPointsPL
::Init()
{
- myExtractor->SetInput( GetInput2() );
- myFieldTransform->SetInput( myExtractor->GetOutput() );
+ Superclass::Init();
- myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
+ float aScalarRange[2];
+ GetSourceRange(aScalarRange);
+ vtkDataSet* aDataSet = GetParentMesh();
+ float aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
+ SetScale( aScaleFactor / aScalarRange[1] );
// Deformed Shape
- if( myIsDeformed )
- {
- myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
- myGeomFilter->SetInput( myWarpVector->GetOutput() );
- }
- else
- myGeomFilter->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
+ myPassFilter[0]->SetInput(myCellDataToPointData->GetUnstructuredGridOutput());
- // Geometrical Sphere
- if( GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
- {
- myGlyph->SetInput( myGeomFilter->GetOutput() );
- myGlyph->SetScaleModeToScaleByScalar();
- myGlyph->SetColorModeToColorByScalar();
- //myGlyph->SetScaleFactor( 5 );
- myGlyph->ClampingOn();
-
- mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. );
- myGlyph->SetSource( mySphereSource->GetOutput() );
-
- myPSMapper->SetInput( myGlyph->GetOutput() );
- }
- else
- myPSMapper->SetInput( myGeomFilter->GetOutput() );
+ myGeomFilter->SetInput( myPassFilter[0]->GetOutput() );
- VISU_ScalarMapPL::Init();
+ // Geometrical Sphere
+ myPassFilter[1]->SetInput(myGeomFilter->GetOutput());
- float aScalarRange[2];
- GetSourceRange(aScalarRange);
- vtkDataSet* aDataSet = GetParentMesh();
- SetScale( VISU_DeformedShapePL::GetScaleFactor( aDataSet ) / aScalarRange[1] );
+ myPSMapper->SetInput( myPassFilter[1]->GetPolyDataOutput() );
}
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::Build()
-{
- if( myIsDeformed )
- {
- myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
- myGeomFilter->SetInput( myWarpVector->GetOutput() );
- }
- else
- {
- myGeomFilter->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
- }
-}
+{}
//----------------------------------------------------------------------------
void
SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( GetParentMesh() ) );
+ mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. );
+
vtkMapper* aMapper = GetMapper();
vtkDataSet* aDataSet = aMapper->GetInput();
vtkCellData* aCellData = aDataSet->GetCellData();
VISU_ScalarMapPL::Update();
}
-//----------------------------------------------------------------------------
-VISU_GaussPointsPL
-::~VISU_GaussPointsPL()
-{
- if (this->myPSMapper)
- {
- this->myPSMapper->Delete();
- this->myPSMapper = NULL;
- }
- if (this->myGeomFilter)
- {
- this->myGeomFilter->Delete();
- this->myGeomFilter = NULL;
- }
-
- myWarpVector->Delete();
-
- myCellDataToPointData->Delete();
-
- myGlyph->UnRegisterAllOutputs();
- myGlyph->Delete();
-
- mySphereSource->Delete();
-}
-
//----------------------------------------------------------------------------
VISU::TGaussPointID
VISU_GaussPointsPL
{
myGaussPtsIDMapper = theGaussPtsIDMapper;
SetIDMapper(myGaussPtsIDMapper);
- Init();
}
const VISU::PGaussPtsIDMapper&
return aNamedIDMapper->GetVTKOutput();
}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetIsDeformed( bool theIsDeformed )
+{
+ if( theIsDeformed )
+ {
+ myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
+ myPassFilter[0]->SetInput(myWarpVector->GetOutput());
+ }
+ else
+ myPassFilter[0]->SetInput(myCellDataToPointData->GetUnstructuredGridOutput());
+
+ myIsDeformed = theIsDeformed;
+
+ Modified();
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU_GaussPointsPL
+::GetIsDeformed() const
+{
+ return myIsDeformed;
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
VISU_GaussPointsPL
::SetPrimitiveType(int thePrimitiveType)
{
+ if( thePrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
+ {
+ myGlyph->SetInput( myGeomFilter->GetOutput() );
+ myPassFilter[1]->SetInput(myGlyph->GetOutput());
+ }
+ else
+ myPassFilter[1]->SetInput(myGeomFilter->GetOutput());
+
myPSMapper->SetPrimitiveType( thePrimitiveType );
+
Modified();
}