X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_DeviceActor.cxx;h=0b3a424c459e1514510fde43d87fbbce56d6f295;hb=refs%2Ftags%2FT3_2_0b2;hp=962ad1ed8c12f04a210b8ce34e97f659fac19a3a;hpb=83f19818fce494a77ddf10b70493abdd9f73e4e0;p=modules%2Fsmesh.git diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 962ad1ed8..0b3a424c4 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -31,11 +31,12 @@ #include "SMESH_ExtractGeometry.h" #include "SMESH_ControlsDef.hxx" #include "SMESH_ActorUtils.h" +#include "VTKViewer_CellLocationsArray.h" -#include "SALOME_Transform.h" -#include "SALOME_TransformFilter.h" -#include "SALOME_PassThroughFilter.h" -#include "SALOME_ExtractUnstructuredGrid.h" +#include +#include +#include +#include // VTK Includes #include @@ -55,7 +56,6 @@ #include #include -#include #include #include @@ -75,7 +75,8 @@ using namespace std; vtkStandardNewMacro(SMESH_DeviceActor); -SMESH_DeviceActor::SMESH_DeviceActor() +SMESH_DeviceActor +::SMESH_DeviceActor() { if(MYDEBUG) MESSAGE("SMESH_DeviceActor - "<SetReleaseDataFlag(true); myIsImplicitFunctionUsed = false; - myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New(); + myExtractUnstructuredGrid = VTKViewer_ExtractUnstructuredGrid::New(); myMergeFilter = vtkMergeFilter::New(); - myGeomFilter = SALOME_GeometryFilter::New(); + myGeomFilter = VTKViewer_GeometryFilter::New(); - myTransformFilter = SALOME_TransformFilter::New(); + myTransformFilter = VTKViewer_TransformFilter::New(); for(int i = 0; i < 6; i++) - myPassFilter.push_back(SALOME_PassThroughFilter::New()); + myPassFilter.push_back(VTKViewer_PassThroughFilter::New()); } -SMESH_DeviceActor::~SMESH_DeviceActor(){ +SMESH_DeviceActor +::~SMESH_DeviceActor() +{ if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<Delete(); @@ -139,8 +142,8 @@ SMESH_DeviceActor::~SMESH_DeviceActor(){ void -SMESH_DeviceActor:: -SetStoreGemetryMapping(bool theStoreMapping) +SMESH_DeviceActor +::SetStoreGemetryMapping(bool theStoreMapping) { myGeomFilter->SetStoreMapping(theStoreMapping); SetStoreClippingMapping(theStoreMapping); @@ -148,8 +151,8 @@ SetStoreGemetryMapping(bool theStoreMapping) void -SMESH_DeviceActor:: -SetStoreClippingMapping(bool theStoreMapping) +SMESH_DeviceActor +::SetStoreClippingMapping(bool theStoreMapping) { myStoreClippingMapping = theStoreMapping; myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed); @@ -158,15 +161,17 @@ SetStoreClippingMapping(bool theStoreMapping) void -SMESH_DeviceActor:: -SetStoreIDMapping(bool theStoreMapping) +SMESH_DeviceActor +::SetStoreIDMapping(bool theStoreMapping) { myExtractUnstructuredGrid->SetStoreMapping(theStoreMapping); } -void SMESH_DeviceActor::Init(TVisualObjPtr theVisualObj, - vtkImplicitBoolean* theImplicitBoolean) +void +SMESH_DeviceActor +::Init(TVisualObjPtr theVisualObj, + vtkImplicitBoolean* theImplicitBoolean) { myVisualObj = theVisualObj; myExtractGeometry->SetImplicitFunction(theImplicitBoolean); @@ -175,8 +180,8 @@ void SMESH_DeviceActor::Init(TVisualObjPtr theVisualObj, void -SMESH_DeviceActor:: -SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) +SMESH_DeviceActor +::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) { int anId = 0; if(theIsImplicitFunctionUsed) @@ -189,7 +194,10 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) } -void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){ +void +SMESH_DeviceActor +::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid) +{ if(theGrid){ //myIsShrinkable = theGrid->GetNumberOfCells() > 10; myIsShrinkable = true; @@ -231,20 +239,28 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){ } -SALOME_ExtractUnstructuredGrid* SMESH_DeviceActor::GetExtractUnstructuredGrid(){ +VTKViewer_ExtractUnstructuredGrid* +SMESH_DeviceActor +::GetExtractUnstructuredGrid() +{ return myExtractUnstructuredGrid; } -vtkUnstructuredGrid* SMESH_DeviceActor::GetUnstructuredGrid(){ +vtkUnstructuredGrid* +SMESH_DeviceActor +::GetUnstructuredGrid() +{ myExtractUnstructuredGrid->Update(); return myExtractUnstructuredGrid->GetOutput(); } -void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable) +void +SMESH_DeviceActor +::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable) { bool anIsInitialized = theFunctor; if(anIsInitialized){ @@ -284,6 +300,7 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, aScalars->Delete(); theLookupTable->SetRange(aScalars->GetRange()); + theLookupTable->SetNumberOfTableValues(theScalarBarActor->GetMaximumNumberOfColors()); theLookupTable->Build(); myMergeFilter->SetScalars(aDataSet); @@ -293,14 +310,16 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, theScalarBarActor->SetVisibility(anIsInitialized); } -void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, - vtkScalarBarActor* theScalarBarActor, - vtkLookupTable* theLookupTable) +void +SMESH_DeviceActor +::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, + vtkScalarBarActor* theScalarBarActor, + vtkLookupTable* theLookupTable) { bool anIsInitialized = theFunctor; myExtractUnstructuredGrid->ClearRegisteredCells(); myExtractUnstructuredGrid->ClearRegisteredCellsWithType(); - myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll); + myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); myVisualObj->UpdateFunctor(theFunctor); using namespace SMESH::Controls; @@ -347,7 +366,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor } } - vtkIntArray* aCellLocationsArray = vtkIntArray::New(); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents( 1 ); aCellLocationsArray->SetNumberOfTuples( aNbCells ); @@ -407,7 +426,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor } } - vtkIntArray* aCellLocationsArray = vtkIntArray::New(); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents( 1 ); aCellLocationsArray->SetNumberOfTuples( aNbCells ); @@ -432,16 +451,18 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor theScalarBarActor->SetVisibility(anIsInitialized); } -void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor) +void +SMESH_DeviceActor +::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor) { myExtractUnstructuredGrid->ClearRegisteredCells(); myExtractUnstructuredGrid->ClearRegisteredCellsWithType(); - myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::ePassAll); + myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); myVisualObj->UpdateFunctor(theFunctor); using namespace SMESH::Controls; if(FreeBorders* aFreeBorders = dynamic_cast(theFunctor.get())){ - myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding); + myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid(); vtkIdType aNbCells = aGrid->GetNumberOfCells(); for( vtkIdType i = 0; i < aNbCells; i++ ){ @@ -487,7 +508,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor } } - vtkIntArray* aCellLocationsArray = vtkIntArray::New(); + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); aCellLocationsArray->SetNumberOfComponents( 1 ); aCellLocationsArray->SetNumberOfTuples( aNbCells ); @@ -505,7 +526,10 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor -unsigned long int SMESH_DeviceActor::GetMTime(){ +unsigned long int +SMESH_DeviceActor +::GetMTime() +{ unsigned long mTime = this->Superclass::GetMTime(); mTime = max(mTime,myExtractGeometry->GetMTime()); mTime = max(mTime,myExtractUnstructuredGrid->GetMTime()); @@ -516,12 +540,18 @@ unsigned long int SMESH_DeviceActor::GetMTime(){ } -void SMESH_DeviceActor::SetTransform(SALOME_Transform* theTransform){ +void +SMESH_DeviceActor +::SetTransform(VTKViewer_Transform* theTransform) +{ myTransformFilter->SetTransform(theTransform); } -void SMESH_DeviceActor::SetShrink() { +void +SMESH_DeviceActor +::SetShrink() +{ if ( !myIsShrinkable ) return; if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() ) { @@ -531,7 +561,10 @@ void SMESH_DeviceActor::SetShrink() { } } -void SMESH_DeviceActor::UnShrink() { +void +SMESH_DeviceActor +::UnShrink() +{ if ( !myIsShrunk ) return; if ( vtkDataSet* aDataSet = myPassFilter[ 0 ]->GetOutput() ) { @@ -543,18 +576,29 @@ void SMESH_DeviceActor::UnShrink() { } -void SMESH_DeviceActor::SetRepresentation(EReperesent theMode){ +void +SMESH_DeviceActor +::SetRepresentation(EReperesent theMode) +{ switch(theMode){ case ePoint: myGeomFilter->SetInside(true); + myGeomFilter->SetWireframeMode(false); GetProperty()->SetRepresentation(0); break; + case eWireframe: + myGeomFilter->SetInside(false); + myGeomFilter->SetWireframeMode(true); + GetProperty()->SetRepresentation(theMode); + break; case eInsideframe: myGeomFilter->SetInside(true); + myGeomFilter->SetWireframeMode(true); GetProperty()->SetRepresentation(1); break; - default : + case eSurface: myGeomFilter->SetInside(false); + myGeomFilter->SetWireframeMode(false); GetProperty()->SetRepresentation(theMode); } myRepresentation = theMode; @@ -564,7 +608,10 @@ void SMESH_DeviceActor::SetRepresentation(EReperesent theMode){ } -void SMESH_DeviceActor::SetVisibility(int theMode){ +void +SMESH_DeviceActor +::SetVisibility(int theMode) +{ if(!myExtractUnstructuredGrid->GetInput() || GetUnstructuredGrid()->GetNumberOfCells()) { @@ -575,7 +622,10 @@ void SMESH_DeviceActor::SetVisibility(int theMode){ } -int SMESH_DeviceActor::GetVisibility(){ +int +SMESH_DeviceActor +::GetVisibility() +{ if(!GetUnstructuredGrid()->GetNumberOfCells()){ vtkLODActor::SetVisibility(false); } @@ -583,7 +633,10 @@ int SMESH_DeviceActor::GetVisibility(){ } -int SMESH_DeviceActor::GetNodeObjId(int theVtkID){ +int +SMESH_DeviceActor +::GetNodeObjId(int theVtkID) +{ vtkIdType anID = theVtkID; if(IsImplicitFunctionUsed()) @@ -594,16 +647,22 @@ int SMESH_DeviceActor::GetNodeObjId(int theVtkID){ return aRetID; } -float* SMESH_DeviceActor::GetNodeCoord(int theObjID){ +vtkFloatingPointType* +SMESH_DeviceActor +::GetNodeCoord(int theObjID) +{ vtkDataSet* aDataSet = myMergeFilter->GetOutput(); vtkIdType anID = myVisualObj->GetNodeVTKId(theObjID); - float* aCoord = aDataSet->GetPoint(anID); + vtkFloatingPointType* aCoord = aDataSet->GetPoint(anID); if(MYDEBUG) MESSAGE("GetNodeCoord - theObjID = "<