From: mkr Date: Thu, 20 Dec 2018 08:42:19 +0000 (+0300) Subject: 0054465: TC9.2.0: SMESH: mesh presentation is not fully restored after Controls ... X-Git-Tag: V9_3_0a1~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ead0b153bd628d3b2faa4b983701cf548de6634c;p=modules%2Fsmesh.git 0054465: TC9.2.0: SMESH: mesh presentation is not fully restored after Controls - Reset command --- diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 23dee6860..88616e325 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -1653,95 +1653,7 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) myEntityMode = theMode; // entities to show // Set cell types to extract - - VTKViewer_ExtractUnstructuredGrid* aFilter = myBaseActor->GetExtractUnstructuredGrid(); - VTKViewer_ExtractUnstructuredGrid* aHltFilter = myHighlitableActor->GetExtractUnstructuredGrid(); - aFilter->ClearRegisteredCellsWithType(); - aHltFilter->ClearRegisteredCellsWithType(); - - bool isPassAll = ( myEntityMode == anObjectEntities && myEntityMode ); - if ( isPassAll ) - { - aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); - aHltFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); - } - else - { - aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); - aHltFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); - - if (myEntityMode & e0DElements) { - aFilter->RegisterCellsWithType(VTK_VERTEX); - aHltFilter->RegisterCellsWithType(VTK_VERTEX); - } - - if (myEntityMode & eBallElem) { - aFilter->RegisterCellsWithType(VTK_POLY_VERTEX); - } - - if (myEntityMode & eEdges) { - aFilter->RegisterCellsWithType(VTK_LINE); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); - - aHltFilter->RegisterCellsWithType(VTK_LINE); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); - } - - if (myEntityMode & eFaces) { - aFilter->RegisterCellsWithType(VTK_TRIANGLE); - aFilter->RegisterCellsWithType(VTK_QUAD); - aFilter->RegisterCellsWithType(VTK_POLYGON); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); - aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); - aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); - - aHltFilter->RegisterCellsWithType(VTK_TRIANGLE); - aHltFilter->RegisterCellsWithType(VTK_QUAD); - aHltFilter->RegisterCellsWithType(VTK_POLYGON); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); - aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); - aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); - } - - if (myEntityMode & eVolumes) { - aFilter->RegisterCellsWithType(VTK_TETRA); - aFilter->RegisterCellsWithType(VTK_VOXEL); - aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); - aFilter->RegisterCellsWithType(VTK_WEDGE); - aFilter->RegisterCellsWithType(VTK_PYRAMID); - aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); - aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); - aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUADRATIC_WEDGE); - aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); - aFilter->RegisterCellsWithType(VTK_POLYHEDRON); - - aHltFilter->RegisterCellsWithType(VTK_TETRA); - aHltFilter->RegisterCellsWithType(VTK_VOXEL); - aHltFilter->RegisterCellsWithType(VTK_HEXAHEDRON); - aHltFilter->RegisterCellsWithType(VTK_WEDGE); - aHltFilter->RegisterCellsWithType(VTK_PYRAMID); - aHltFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); - aHltFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); - aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUADRATIC_WEDGE); - aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); - aHltFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); - aHltFilter->RegisterCellsWithType(VTK_POLYHEDRON); - } - } - if ( GetVisibility() ) - aFilter->Update(); - if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells()); + UpdateFilter(); } SetVisibility( GetVisibility(), myRepresentationCache != 0 ); @@ -2629,6 +2541,115 @@ void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMa myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor } +void SMESH_ActorDef::UpdateFilter() +{ + unsigned int anObjectEntities = eAllEntity; // entities present in my object + + if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) { + anObjectEntities &= ~e0DElements; + } + + if(!myVisualObj->GetNbEntities(SMDSAbs_Ball)) { + anObjectEntities &= ~eBallElem; + } + + if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) { + anObjectEntities &= ~eEdges; + } + + if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) { + anObjectEntities &= ~eFaces; + } + + if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) { + anObjectEntities &= ~eVolumes; + } + + VTKViewer_ExtractUnstructuredGrid* aFilter = myBaseActor->GetExtractUnstructuredGrid(); + VTKViewer_ExtractUnstructuredGrid* aHltFilter = myHighlitableActor->GetExtractUnstructuredGrid(); + aFilter->ClearRegisteredCellsWithType(); + aHltFilter->ClearRegisteredCellsWithType(); + + bool isPassAll = ( myEntityMode == anObjectEntities && myEntityMode ); + if ( isPassAll ) + { + aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); + aHltFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); + } + else + { + aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); + aHltFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); + if (myEntityMode & e0DElements) { + aFilter->RegisterCellsWithType(VTK_VERTEX); + aHltFilter->RegisterCellsWithType(VTK_VERTEX); + } + + if (myEntityMode & eBallElem) { + aFilter->RegisterCellsWithType(VTK_POLY_VERTEX); + } + if (myEntityMode & eEdges) { + aFilter->RegisterCellsWithType(VTK_LINE); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); + aHltFilter->RegisterCellsWithType(VTK_LINE); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); + } + + if (myEntityMode & eFaces) { + aFilter->RegisterCellsWithType(VTK_TRIANGLE); + aFilter->RegisterCellsWithType(VTK_QUAD); + aFilter->RegisterCellsWithType(VTK_POLYGON); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); + aHltFilter->RegisterCellsWithType(VTK_TRIANGLE); + aHltFilter->RegisterCellsWithType(VTK_QUAD); + aHltFilter->RegisterCellsWithType(VTK_POLYGON); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); + aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); + aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); + } + + if (myEntityMode & eVolumes) { + aFilter->RegisterCellsWithType(VTK_TETRA); + aFilter->RegisterCellsWithType(VTK_VOXEL); + aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_WEDGE); + aFilter->RegisterCellsWithType(VTK_PYRAMID); + aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUADRATIC_WEDGE); + aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); + aFilter->RegisterCellsWithType(VTK_POLYHEDRON); + aHltFilter->RegisterCellsWithType(VTK_TETRA); + aHltFilter->RegisterCellsWithType(VTK_VOXEL); + aHltFilter->RegisterCellsWithType(VTK_HEXAHEDRON); + aHltFilter->RegisterCellsWithType(VTK_WEDGE); + aHltFilter->RegisterCellsWithType(VTK_PYRAMID); + aHltFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aHltFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); + aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUADRATIC_WEDGE); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); + aHltFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); + aHltFilter->RegisterCellsWithType(VTK_POLYHEDRON); + } + } + if ( GetVisibility() ) + aFilter->Update(); + if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells()); +} + #ifndef DISABLE_PLOT2DVIEWER SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() { diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index c72ca7e16..909c0777c 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -174,6 +174,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor bool bold, bool italic, bool shadow, double r, double g, double b ) = 0; + virtual void UpdateFilter() = 0; + #ifndef DISABLE_PLOT2DVIEWER virtual SPlot2d_Histogram* GetPlot2Histogram() = 0; virtual SPlot2d_Histogram* UpdatePlot2Histogram() = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 3488f4401..9c9639c98 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -239,6 +239,8 @@ class SMESH_ActorDef : public SMESH_Actor virtual void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale ); virtual void SetMarkerTexture( int, VTK::MarkerTexture ); + virtual void UpdateFilter(); + protected: void SetControlMode(eControl theMode, bool theCheckEntityMode); void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index a5dc528c2..1e020c810 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -2540,6 +2540,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) #ifndef DISABLE_PLOT2DVIEWER SMESH::ProcessIn2DViewers(anActor,SMESH::RemoveFrom2dViewer); #endif + anActor->UpdateFilter(); } } }