From: apo Date: Sat, 3 May 2008 07:38:26 +0000 (+0000) Subject: To introduce a transparent way for ELNO data processing X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e4aafbf7ff4550e3f209966285b55aa7254971e2;p=modules%2Fvisu.git To introduce a transparent way for ELNO data processing --- diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index d870f0e1..56a9349d 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -28,6 +28,7 @@ // Salome includes #include "VISU_Convertor.hxx" #include "VISU_ConvertorUtils.hxx" + #include "VISU_MeshPL.hxx" #include "VISU_ScalarMapPL.hxx" #include "VISU_IsoSurfacesPL.hxx" @@ -342,8 +343,10 @@ main(int argc, char** argv) TPresent* aPresent = TPresent::New(); aPresent->SetUnstructuredGridIDMapper( anUnstructuredGridIDMapper ); + //aPresent->SetOrientation( VISU_CutPlanesPL::ZX, 0.0, 0.0, 0 ); aPresent->Update(); + aPresent->GetMapper()->InterpolateScalarsBeforeMappingOn(); anActor->SetMapper( aPresent->GetMapper() ); vtkScalarBarActor* aScalarBar = vtkScalarBarActor::New(); diff --git a/src/PIPELINE/VISU_ColoredPL.cxx b/src/PIPELINE/VISU_ColoredPL.cxx index 49600e84..25e055ad 100644 --- a/src/PIPELINE/VISU_ColoredPL.cxx +++ b/src/PIPELINE/VISU_ColoredPL.cxx @@ -238,6 +238,7 @@ VISU_ColoredPL myFieldTransform->SetInput(myExtractor->GetOutput()); GetMapperHolder()->SetLookupTable(GetMapperTable()); + GetMapper()->InterpolateScalarsBeforeMappingOn(); GetMapper()->SetUseLookupTableScalarRange(true); GetMapper()->SetColorModeToMapScalars(); GetMapper()->ScalarVisibilityOn(); diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index 22493a10..6928b498 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -47,6 +47,8 @@ VISU_CutPlanesPL { SetIsShrinkable(false); + SetElnoDisassembleState( true ); + myAppendPolyData = vtkAppendPolyData::New(); myNbParts = 10; diff --git a/src/PIPELINE/VISU_DataSetMapperHolder.cxx b/src/PIPELINE/VISU_DataSetMapperHolder.cxx index 7766a56a..476a5b76 100644 --- a/src/PIPELINE/VISU_DataSetMapperHolder.cxx +++ b/src/PIPELINE/VISU_DataSetMapperHolder.cxx @@ -100,6 +100,19 @@ VISU_DataSetMapperHolder } +//---------------------------------------------------------------------------- +void +VISU_DataSetMapperHolder +::SetElnoDisassembleState( bool theIsShrunk ) +{ + vtkFloatingPointType aShrinkFactor = std::abs( myElnoDisassembleFilter->GetShrinkFactor() ); + if ( theIsShrunk ) + myElnoDisassembleFilter->SetShrinkFactor( aShrinkFactor ); + else + myElnoDisassembleFilter->SetShrinkFactor( -aShrinkFactor ); +} + + //---------------------------------------------------------------------------- unsigned long int VISU_DataSetMapperHolder diff --git a/src/PIPELINE/VISU_DataSetMapperHolder.hxx b/src/PIPELINE/VISU_DataSetMapperHolder.hxx index 87f91682..6588abd9 100644 --- a/src/PIPELINE/VISU_DataSetMapperHolder.hxx +++ b/src/PIPELINE/VISU_DataSetMapperHolder.hxx @@ -51,6 +51,9 @@ public: ShallowCopy(VISU_MapperHolder *theMapperHolder, bool theIsCopyInput); + void + SetElnoDisassembleState( bool theIsShrunk ); + //! Gets memory size used by the instance (bytes). virtual unsigned long int diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 6631af08..fe459920 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -171,10 +171,10 @@ VISU_DeformedShapePL ::Update() { Superclass::Update(); - //{ - // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myWarpVector.vtk"; - // VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName); - //} + { + std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myWarpVector.vtk"; + VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName); + } } diff --git a/src/PIPELINE/VISU_ElnoAssembleFilter.cxx b/src/PIPELINE/VISU_ElnoAssembleFilter.cxx index 70c41ac9..be843ed3 100644 --- a/src/PIPELINE/VISU_ElnoAssembleFilter.cxx +++ b/src/PIPELINE/VISU_ElnoAssembleFilter.cxx @@ -43,6 +43,8 @@ VISU_ElnoAssembleFilter::VISU_ElnoAssembleFilter() 0, // connection vtkDataObject::FIELD_ASSOCIATION_POINTS, // field association "ELNO_POINT_COORDS" ); // name + + this->myIsRestorePoints = false; } @@ -51,6 +53,16 @@ VISU_ElnoAssembleFilter::~VISU_ElnoAssembleFilter() {} +//---------------------------------------------------------------------------- +void VISU_ElnoAssembleFilter::SetElnoAssembleState( bool theIsRestorePoints ) +{ + if ( myIsRestorePoints == theIsRestorePoints ) + return; + + myIsRestorePoints = theIsRestorePoints; + this->Modified(); +} + //---------------------------------------------------------------------------- namespace { @@ -133,7 +145,7 @@ int VISU_ElnoAssembleFilter::RequestData( vtkInformation *vtkNotUsed(request), vtkDataArray *anElnoPointCoords = this->GetInputArrayToProcess( 0, inputVector ); - if ( !anElnoPointCoords ) { + if ( !myIsRestorePoints || !anElnoPointCoords ) { anOutput->ShallowCopy( anInput ); return 1; } diff --git a/src/PIPELINE/VISU_ElnoAssembleFilter.hxx b/src/PIPELINE/VISU_ElnoAssembleFilter.hxx index 4aca5d5b..8f586c66 100644 --- a/src/PIPELINE/VISU_ElnoAssembleFilter.hxx +++ b/src/PIPELINE/VISU_ElnoAssembleFilter.hxx @@ -29,12 +29,16 @@ public: static VISU_ElnoAssembleFilter *New(); + void SetElnoAssembleState( bool theIsRestorePoints ); + protected: VISU_ElnoAssembleFilter(); ~VISU_ElnoAssembleFilter(); int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + bool myIsRestorePoints; + private: VISU_ElnoAssembleFilter(const VISU_ElnoAssembleFilter&); // Not implemented. void operator=(const VISU_ElnoAssembleFilter&); // Not implemented. diff --git a/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx b/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx index 3be92946..a1d17d6b 100644 --- a/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx +++ b/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx @@ -50,7 +50,7 @@ VISU_ElnoDisassembleFilter::VISU_ElnoDisassembleFilter() vtkDataObject::FIELD_ASSOCIATION_CELLS, // field association "ELNO_COMPONENT_MAPPER" ); // name - this->myShrinkFactor = -1.0; + this->myShrinkFactor = -0.999; } diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index bea9854f..b81dc88a 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -44,6 +44,8 @@ VISU_IsoSurfacesPL { SetIsShrinkable(false); + SetElnoDisassembleState( true ); + myContourFilter = vtkContourFilter::New(); myCellDataToPointData = vtkCellDataToPointData::New(); diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index d679ad2e..ee04a983 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -57,6 +57,8 @@ VISU_ScalarMapPL { SetIsShrinkable(true); + SetElnoDisassembleState( false ); + myElnoAssembleFilter->Delete(); myAppendFilter->SetMergingInputs(true); @@ -155,6 +157,15 @@ VISU_ScalarMapPL } +//---------------------------------------------------------------------------- +void +VISU_ScalarMapPL +::SetElnoDisassembleState( bool theIsShrunk ) +{ + GetDataSetMapperHolder()->SetElnoDisassembleState( theIsShrunk ); + myElnoAssembleFilter->SetElnoAssembleState( theIsShrunk ); +} + //---------------------------------------------------------------------------- void VISU_ScalarMapPL diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index 5962c4a6..fdb4ef94 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -112,6 +112,9 @@ protected: DoShallowCopy(VISU_PipeLine *thePipeLine, bool theIsCopyInput); + void + SetElnoDisassembleState( bool theIsShrunk ); + private: VISU_ScalarMapPL(const VISU_ScalarMapPL&); // Not implemented. void operator=(const VISU_ScalarMapPL&); // Not implemented.