Salome HOME
in PublishGroup(), for the standalone groups, set full ot empty icon
authoreap <eap@opencascade.com>
Mon, 24 Oct 2011 13:12:22 +0000 (13:12 +0000)
committereap <eap@opencascade.com>
Mon, 24 Oct 2011 13:12:22 +0000 (13:12 +0000)
depending on availability of elements of type of the group in the mesh

src/SMESH_I/SMESH_Gen_i_1.cxx

index 1fd5f54150aee1b9d616deaae8175d1d567d6a25..900534d11c705f957bfaa7a9726ccbebdd4d42e2 100644 (file)
@@ -698,10 +698,18 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SALOMEDS::Study_ptr    theStudy
 
       // Add new group to corresponding sub-tree
       SMESH::array_of_ElementType_var elemTypes = theGroup->GetTypes();
-      const int isEmpty = ( elemTypes->length() == 0 );
+      int isEmpty = ( elemTypes->length() == 0 );
       std::string pm[2] = { "ICON_SMESH_TREE_GROUP", "ICON_SMESH_TREE_MESH_WARN" };
       if ( SMESH::DownCast< SMESH_GroupOnFilter_i* > ( theGroup ))
+      {
         pm[0] = "ICON_SMESH_TREE_GROUP_ON_FILTER";
+      }
+      else if ( SMESH::DownCast< SMESH_Group_i* > ( theGroup ))
+      {
+        SMESH::array_of_ElementType_var allElemTypes = theMesh->GetTypes();
+        for ( size_t i =0; i < allElemTypes->length() && isEmpty; ++i )
+          isEmpty = ( allElemTypes[i] != theGroup->GetType() );
+      }
       aGroupSO = publish (theStudy, theGroup, aRootSO, 0, pm[isEmpty].c_str() );
     }
     if ( aGroupSO->_is_nil() )