Salome HOME
0020575: EDF 1162 SMESH: Mesh is displayed in "Nodes" mode after compute
authordmv <dmv@opencascade.com>
Thu, 5 Nov 2009 15:06:10 +0000 (15:06 +0000)
committerdmv <dmv@opencascade.com>
Thu, 5 Nov 2009 15:06:10 +0000 (15:06 +0000)
src/OBJECT/SMESH_Object.cxx
src/OBJECT/SMESH_Object.h
src/OBJECT/SMESH_ObjectDef.h
src/SMESHGUI/SMESHGUI_VTKUtils.cxx

index a6908f78ef24f6ceac8a8c47a0969cb9dc33ac6f..e7ef139a4a2d3b88b12c5fe1b78ade97652bfab8 100644 (file)
@@ -520,6 +520,19 @@ bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
   return true;
 }
 
   return true;
 }
 
+//=================================================================================
+// function : IsValid
+// purpose  : Return true if there are some entities
+//=================================================================================
+bool SMESH_VisualObjDef::IsValid() const
+{
+  return GetNbEntities(SMDSAbs_Node) > 0      || 
+         GetNbEntities(SMDSAbs_0DElement) > 0 || 
+         GetNbEntities(SMDSAbs_Edge) > 0      || 
+         GetNbEntities(SMDSAbs_Face) > 0      ||
+         GetNbEntities(SMDSAbs_Volume) > 0 ;
+}
+
 /*
   Class       : SMESH_MeshObj
   Description : Class for visualisation of mesh
 /*
   Class       : SMESH_MeshObj
   Description : Class for visualisation of mesh
index 118c13ad86fb4bb87d2069672c176ae652505aee..3bc178eca4127f47a2da547bfb6dda5083086f3f 100644 (file)
@@ -65,6 +65,7 @@ public:
                              const int theEdgeNum,
                              int&      theNodeId1,
                              int&      theNodeId2 ) const = 0;
                              const int theEdgeNum,
                              int&      theNodeId1,
                              int&      theNodeId2 ) const = 0;
+  virtual bool              IsValid() const = 0;
   
   virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
   
   
   virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
   
index 094504f33adae44e735ae4507141a1e47f2df5fc..82f540913bf98a5d8bba36689338348a2a3675e7 100644 (file)
@@ -69,6 +69,8 @@ public:
   virtual bool              IsNodePrs() const = 0;
   virtual SMDS_Mesh*        GetMesh() const = 0;
 
   virtual bool              IsNodePrs() const = 0;
   virtual SMDS_Mesh*        GetMesh() const = 0;
 
+  virtual bool              IsValid() const;
+
   virtual bool              GetEdgeNodes( const int theElemId,
                                           const int theEdgeNum,
                                           int&      theNodeId1,
   virtual bool              GetEdgeNodes( const int theElemId,
                                           const int theEdgeNum,
                                           int&      theNodeId1,
index 3841a194ec1b94575f6061bff163e0d4759c2a60..7b5db14302a6bd7396bc691fef9f24c77bc8295c 100644 (file)
@@ -712,7 +712,8 @@ namespace SMESH
               _PTR(Study) aDocument = aStudy->studyDS();
               // Pass non-visual objects (hypotheses, etc.), return true in this case
               CORBA::Long anId = aDocument->StudyId();
               _PTR(Study) aDocument = aStudy->studyDS();
               // Pass non-visual objects (hypotheses, etc.), return true in this case
               CORBA::Long anId = aDocument->StudyId();
-              if (TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry))
+              TVisualObjPtr aVisualObj;
+              if ( (aVisualObj = GetVisualObj(anId,theEntry)) && aVisualObj->IsValid())
               {
                 if ((anActor = CreateActor(aDocument,theEntry,true))) {
                   bool needFitAll = noSmeshActors(theWnd); // fit for the first object only
               {
                 if ((anActor = CreateActor(aDocument,theEntry,true))) {
                   bool needFitAll = noSmeshActors(theWnd); // fit for the first object only