+//================================================================================
+/*!
+ * \brief Remove a group, whose name is stored by hypothesis, upon group name modification
+ * \param [in] oldName - old group name
+ * \param [in] newName - new group name
+ * \param [in] type - group type
+ */
+//================================================================================
+
+void StdMeshersGUI_StdHypothesisCreator::
+removeOldGroup(const char* oldName, const char* newName, SMESH::ElementType type) const
+{
+ if ( !oldName || !oldName[0] )
+ return; // old name undefined
+ if ( newName && strcmp( oldName, newName ) == 0 )
+ return; // same name
+
+ SMESH::SMESH_Hypothesis_var h = hypothesis();
+ SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( h );
+ for ( size_t i = 0; i < listSOmesh.size(); i++ )
+ {
+ _PTR(SObject) submSO = listSOmesh[i];
+ SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
+ SMESH::SMESH_subMesh_var subMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
+ if( !subMesh->_is_nil() )
+ mesh = subMesh->GetFather();
+ if ( mesh->_is_nil() )
+ continue;
+ SMESH::ListOfGroups_var groups = mesh->GetGroups();
+ for ( CORBA::ULong iG = 0; iG < groups->length(); iG++ )
+ {
+ if ( groups[iG]->GetType() != type )
+ continue;
+ CORBA::String_var name = groups[iG]->GetName();
+ if ( strcmp( name.in(), oldName ))
+ continue;
+ mesh->RemoveGroup( groups[iG] );
+ }
+ }
+}
+