]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0054465: TC9.2.0: SMESH: mesh presentation is not fully restored after Controls ...
authormkr <margarita.karpunina@opencascade.com>
Thu, 20 Dec 2018 08:42:19 +0000 (11:42 +0300)
committereap <eap@opencascade.com>
Thu, 17 Jan 2019 15:06:22 +0000 (18:06 +0300)
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/SMESHGUI/SMESHGUI.cxx

index 23dee68601b29a83e4662531fdd0554d0d6258fa..88616e325f0ad2f34bbdb24ca2919162b40d3652 100644 (file)
@@ -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()
 {
index c72ca7e1688a0bf8209a34818eb438ad27482cc4..909c0777cf2685f055c92c08485a06ba63f28ec2 100644 (file)
@@ -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;
index 3488f4401ed620c8b3dcf0724bfe31cd3cd6675b..9c9639c9892c35f76ac58c9c942e9446e6b988f3 100644 (file)
@@ -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);
index a5dc528c275cefb88e646ee7dc0ddaec6ae1975b..1e020c81066282000f6d4a5e371e927e3da3db37 100644 (file)
@@ -2540,6 +2540,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 #ifndef DISABLE_PLOT2DVIEWER
             SMESH::ProcessIn2DViewers(anActor,SMESH::RemoveFrom2dViewer);
 #endif
+            anActor->UpdateFilter();
           }
         }
       }