mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 08:50:35 +05:00
0020210: EDF SMESH 976: Update of a smesh group after modification of the associated geom group
update groups
This commit is contained in:
parent
42b21b7e94
commit
cd3124ccaa
@ -52,6 +52,7 @@
|
|||||||
#include "Utils_ExceptHandlers.hxx"
|
#include "Utils_ExceptHandlers.hxx"
|
||||||
#include "Utils_SINGLETON.hxx"
|
#include "Utils_SINGLETON.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include "GEOMImpl_Types.hxx"
|
||||||
|
|
||||||
// OCCT Includes
|
// OCCT Includes
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
@ -146,6 +147,8 @@ void SMESH_Mesh_i::SetShape( GEOM::GEOM_Object_ptr theShapeObject )
|
|||||||
catch(SALOME_Exception & S_ex) {
|
catch(SALOME_Exception & S_ex) {
|
||||||
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
|
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
|
||||||
}
|
}
|
||||||
|
// to track changes of GEOM groups
|
||||||
|
addGeomGroupData( theShapeObject, _this() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -620,7 +623,6 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetSubMesh(GEOM::GEOM_Object_ptr aSubShap
|
|||||||
// create a new subMesh object servant if there is none for the shape
|
// create a new subMesh object servant if there is none for the shape
|
||||||
if ( subMesh->_is_nil() )
|
if ( subMesh->_is_nil() )
|
||||||
subMesh = createSubMesh( aSubShapeObject );
|
subMesh = createSubMesh( aSubShapeObject );
|
||||||
|
|
||||||
if ( _gen_i->CanPublishInStudy( subMesh )) {
|
if ( _gen_i->CanPublishInStudy( subMesh )) {
|
||||||
SALOMEDS::SObject_var aSO =
|
SALOMEDS::SObject_var aSO =
|
||||||
_gen_i->PublishSubMesh(_gen_i->GetCurrentStudy(), aMesh,
|
_gen_i->PublishSubMesh(_gen_i->GetCurrentStudy(), aMesh,
|
||||||
@ -733,9 +735,11 @@ SMESH::SMESH_GroupOnGeom_ptr SMESH_Mesh_i::CreateGroupFromGEOM (SMESH::ElementTy
|
|||||||
SMESH::SMESH_GroupOnGeom_var aNewGroup;
|
SMESH::SMESH_GroupOnGeom_var aNewGroup;
|
||||||
|
|
||||||
TopoDS_Shape aShape = _gen_i->GeomObjectToShape( theGeomObj );
|
TopoDS_Shape aShape = _gen_i->GeomObjectToShape( theGeomObj );
|
||||||
if ( !aShape.IsNull() ) {
|
if ( !aShape.IsNull() )
|
||||||
|
{
|
||||||
aNewGroup = SMESH::SMESH_GroupOnGeom::_narrow
|
aNewGroup = SMESH::SMESH_GroupOnGeom::_narrow
|
||||||
( createGroup( theElemType, theName, aShape ));
|
( createGroup( theElemType, theName, aShape ));
|
||||||
|
|
||||||
if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
|
if ( _gen_i->CanPublishInStudy( aNewGroup ) ) {
|
||||||
SALOMEDS::SObject_var aSO =
|
SALOMEDS::SObject_var aSO =
|
||||||
_gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
|
_gen_i->PublishGroup(_gen_i->GetCurrentStudy(), _this(),
|
||||||
@ -1496,61 +1500,115 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::CreateDimGroup(
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return group items of a group present in a study
|
* \brief Remember GEOM group data
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
static GEOM::GEOM_Object_ptr getGroupItemsFromStudy(CORBA::Object_ptr theMesh,
|
void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
|
||||||
SMESH_Gen_i* theGen,
|
CORBA::Object_ptr theSmeshObj)
|
||||||
list<TopoDS_Shape> & theItems)
|
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var groupObj;
|
if ( CORBA::is_nil( theGeomObj ) || theGeomObj->GetType() != GEOM_GROUP )
|
||||||
SALOMEDS::Study_var study = theGen->GetCurrentStudy();
|
return;
|
||||||
GEOM::GEOM_Gen_var geomGen = theGen->GetGeomEngine();
|
// group SO
|
||||||
if ( study->_is_nil() || geomGen->_is_nil() )
|
SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
|
||||||
return groupObj._retn();
|
SALOMEDS::SObject_var groupSO = _gen_i->ObjectToSObject( study, theGeomObj );
|
||||||
|
if ( groupSO->_is_nil() )
|
||||||
|
return;
|
||||||
|
// group indices
|
||||||
|
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
|
||||||
GEOM::GEOM_IGroupOperations_var groupOp =
|
GEOM::GEOM_IGroupOperations_var groupOp =
|
||||||
geomGen->GetIGroupOperations( theGen->GetCurrentStudyID() );
|
geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
|
||||||
GEOM::GEOM_IShapesOperations_var shapeOp =
|
GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
|
||||||
geomGen->GetIShapesOperations( theGen->GetCurrentStudyID() );
|
|
||||||
|
|
||||||
SALOMEDS::SObject_var meshOS = theGen->ObjectToSObject(study, theMesh);
|
// store data
|
||||||
if ( meshOS->_is_nil() || groupOp->_is_nil() || shapeOp->_is_nil() )
|
_geomGroupData.push_back( TGeomGroupData() );
|
||||||
return groupObj._retn();
|
TGeomGroupData & groupData = _geomGroupData.back();
|
||||||
SALOMEDS::SObject_var fatherSO = meshOS->GetFather();
|
// entry
|
||||||
if ( fatherSO->_is_nil() || fatherSO->Tag() != theGen->GetSubMeshOnCompoundTag() )
|
CORBA::String_var entry = groupSO->GetID();
|
||||||
return groupObj._retn(); // keep only submeshes on groups
|
groupData._groupEntry = entry.in();
|
||||||
|
// indices
|
||||||
|
for ( int i = 0; i < ids->length(); ++i )
|
||||||
|
groupData._indices.insert( ids[i] );
|
||||||
|
// SMESH object
|
||||||
|
groupData._smeshObject = theSmeshObj;
|
||||||
|
}
|
||||||
|
|
||||||
SALOMEDS::ChildIterator_var anIter = study->NewChildIterator(meshOS);
|
//================================================================================
|
||||||
if ( anIter->_is_nil() ) return groupObj._retn();
|
/*!
|
||||||
for ( ; anIter->More(); anIter->Next())
|
* Remove GEOM group data relating to removed smesh object
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void SMESH_Mesh_i::removeGeomGroupData(CORBA::Object_ptr theSmeshObj)
|
||||||
|
{
|
||||||
|
list<TGeomGroupData>::iterator
|
||||||
|
data = _geomGroupData.begin(), dataEnd = _geomGroupData.end();
|
||||||
|
for ( ; data != dataEnd; ++data ) {
|
||||||
|
if ( theSmeshObj->_is_equivalent( data->_smeshObject )) {
|
||||||
|
_geomGroupData.erase( data );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Return new group contents if it has been changed and update group data
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
|
||||||
|
{
|
||||||
|
TopoDS_Shape newShape;
|
||||||
|
|
||||||
|
// get geom group
|
||||||
|
SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
|
||||||
|
if ( study->_is_nil() ) return newShape; // means "not changed"
|
||||||
|
SALOMEDS::SObject_var groupSO = study->FindObjectID( groupData._groupEntry.c_str() );
|
||||||
|
if ( !groupSO->_is_nil() )
|
||||||
{
|
{
|
||||||
SALOMEDS::SObject_var aSObject = anIter->Value();
|
CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO );
|
||||||
SALOMEDS::SObject_var aRefSO;
|
if ( CORBA::is_nil( groupObj )) return newShape;
|
||||||
if ( !aSObject->_is_nil() && aSObject->ReferencedObject(aRefSO) )
|
GEOM::GEOM_Object_var geomGroup = GEOM::GEOM_Object::_narrow( groupObj );
|
||||||
{
|
|
||||||
groupObj = GEOM::GEOM_Object::_narrow(aRefSO->GetObject());
|
// get indices of group items
|
||||||
if ( groupObj->_is_nil() ) break;
|
set<int> curIndices;
|
||||||
GEOM::ListOfLong_var ids = groupOp->GetObjects( groupObj );
|
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
|
||||||
GEOM::GEOM_Object_var mainShape = groupObj->GetMainShape();
|
GEOM::GEOM_IGroupOperations_var groupOp =
|
||||||
for ( int i = 0; i < ids->length(); ++i ) {
|
geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
|
||||||
GEOM::GEOM_Object_var subShape = shapeOp->GetSubShape( mainShape, ids[i] );
|
GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
|
||||||
TopoDS_Shape S = theGen->GeomObjectToShape( subShape );
|
for ( int i = 0; i < ids->length(); ++i )
|
||||||
if ( !S.IsNull() )
|
curIndices.insert( ids[i] );
|
||||||
theItems.push_back( S );
|
|
||||||
|
if ( groupData._indices == curIndices )
|
||||||
|
return newShape; // group not changed
|
||||||
|
|
||||||
|
// update data
|
||||||
|
groupData._indices = curIndices;
|
||||||
|
|
||||||
|
GEOM_Client* geomClient = _gen_i->GetShapeReader();
|
||||||
|
if ( !geomClient ) return newShape;
|
||||||
|
TCollection_AsciiString groupIOR = geomGen->GetStringFromIOR( geomGroup );
|
||||||
|
geomClient->RemoveShapeFromBuffer( groupIOR );
|
||||||
|
newShape = _gen_i->GeomObjectToShape( geomGroup );
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
if ( newShape.IsNull() ) {
|
||||||
|
// geom group becomes empty - return empty compound
|
||||||
|
TopoDS_Compound compound;
|
||||||
|
BRep_Builder builder;
|
||||||
|
builder.MakeCompound(compound);
|
||||||
|
newShape = compound;
|
||||||
}
|
}
|
||||||
}
|
return newShape;
|
||||||
return groupObj._retn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Update hypotheses assigned to geom groups if the latter change
|
* \brief Update objects depending on changed geom groups
|
||||||
*
|
*
|
||||||
* NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
|
* NPAL16168: geometrical group edition from a submesh don't modifiy mesh computation
|
||||||
|
* issue 0020210: Update of a smesh group after modification of the associated geom group
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
@ -1561,70 +1619,107 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
|
|||||||
SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
|
SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
|
||||||
if ( study->_is_nil() ) return;
|
if ( study->_is_nil() ) return;
|
||||||
|
|
||||||
// check if items of groups changed
|
CORBA::Long nbEntities = NbNodes() + NbElements();
|
||||||
map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
|
|
||||||
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
|
|
||||||
{
|
|
||||||
const TopoDS_Shape & oldGroupShape = i_sm->second->GetSubShape();
|
|
||||||
SMESHDS_SubMesh * oldDS = i_sm->second->GetSubMeshDS();
|
|
||||||
if ( !oldDS /*|| !oldDS->IsComplexSubmesh()*/ )
|
|
||||||
continue;
|
|
||||||
int oldID = i_sm->first;
|
|
||||||
map<int, SMESH::SMESH_subMesh_ptr>::iterator i_smIor = _mapSubMeshIor.find( oldID );
|
|
||||||
if ( i_smIor == _mapSubMeshIor.end() )
|
|
||||||
continue;
|
|
||||||
list< TopoDS_Shape> newItems;
|
|
||||||
GEOM::GEOM_Object_var groupObj = getGroupItemsFromStudy ( i_smIor->second, _gen_i, newItems );
|
|
||||||
if ( groupObj->_is_nil() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int nbOldItems = oldDS->IsComplexSubmesh() ? oldDS->NbSubMeshes() : 1;
|
// Check if group contents changed
|
||||||
int nbNewItems = newItems.size();
|
|
||||||
bool groupChanged = ( nbOldItems != nbNewItems);
|
typedef map< string, TopoDS_Shape > TEntry2Geom;
|
||||||
if ( !groupChanged ) {
|
TEntry2Geom newGroupContents;
|
||||||
if ( !oldDS->IsComplexSubmesh() ) { // old group has one item
|
|
||||||
groupChanged = ( oldGroupShape != newItems.front() );
|
list<TGeomGroupData>::iterator
|
||||||
}
|
data = _geomGroupData.begin(), dataEnd = _geomGroupData.end();
|
||||||
else {
|
for ( ; data != dataEnd; ++data )
|
||||||
list<TopoDS_Shape>::iterator item = newItems.begin();
|
|
||||||
for ( ; item != newItems.end() && !groupChanged; ++item )
|
|
||||||
{
|
{
|
||||||
SMESHDS_SubMesh * itemDS = _impl->GetMeshDS()->MeshElements( *item );
|
pair< TEntry2Geom::iterator, bool > it_new =
|
||||||
groupChanged = ( !itemDS || !oldDS->ContainsSubMesh( itemDS ));
|
newGroupContents.insert( make_pair( data->_groupEntry, TopoDS_Shape() ));
|
||||||
|
bool processedGroup = !it_new.second;
|
||||||
|
TopoDS_Shape& newShape = it_new.first->second;
|
||||||
|
if ( !processedGroup )
|
||||||
|
newShape = newGroupShape( *data );
|
||||||
|
if ( newShape.IsNull() )
|
||||||
|
continue; // no changes
|
||||||
|
|
||||||
|
if ( processedGroup ) { // update group indices
|
||||||
|
list<TGeomGroupData>::iterator data2 = data;
|
||||||
|
for ( --data2; data2->_groupEntry != data->_groupEntry; --data2)
|
||||||
|
data->_indices = data2->_indices;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
// Update SMESH objects according to new GEOM group contents
|
||||||
// update hypotheses and submeshes if necessary
|
|
||||||
if ( groupChanged )
|
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( data->_smeshObject );
|
||||||
|
if ( !mesh->_is_nil() ) // -------------- MESH ----------------------------
|
||||||
{
|
{
|
||||||
// get a new group shape
|
// TODO
|
||||||
GEOM_Client* geomClient = _gen_i->GetShapeReader();
|
continue;
|
||||||
if ( !geomClient ) continue;
|
}
|
||||||
TCollection_AsciiString groupIOR = _gen_i->GetGeomEngine()->GetStringFromIOR( groupObj );
|
|
||||||
geomClient->RemoveShapeFromBuffer( groupIOR );
|
SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow( data->_smeshObject );
|
||||||
TopoDS_Shape newGroupShape = _gen_i->GeomObjectToShape( groupObj );
|
if ( !submesh->_is_nil() ) // -------------- Sub mesh ---------------------
|
||||||
|
{
|
||||||
|
int oldID = submesh->GetId();
|
||||||
|
if ( _mapSubMeshIor.find( oldID ) == _mapSubMeshIor.end() )
|
||||||
|
continue;
|
||||||
|
TopoDS_Shape oldShape = _mapSubMesh[oldID]->GetSubShape();
|
||||||
|
|
||||||
// update hypotheses
|
// update hypotheses
|
||||||
list <const SMESHDS_Hypothesis * > hyps = _impl->GetHypothesisList(oldGroupShape);
|
list <const SMESHDS_Hypothesis * > hyps = _impl->GetHypothesisList(oldShape);
|
||||||
list <const SMESHDS_Hypothesis * >::iterator hypIt;
|
list <const SMESHDS_Hypothesis * >::iterator hypIt;
|
||||||
for ( hypIt = hyps.begin(); hypIt != hyps.end(); ++hypIt )
|
for ( hypIt = hyps.begin(); hypIt != hyps.end(); ++hypIt )
|
||||||
{
|
{
|
||||||
_impl->RemoveHypothesis( oldGroupShape, (*hypIt)->GetID());
|
_impl->RemoveHypothesis( oldShape, (*hypIt)->GetID());
|
||||||
_impl->AddHypothesis ( newGroupShape, (*hypIt)->GetID());
|
_impl->AddHypothesis ( newShape, (*hypIt)->GetID());
|
||||||
}
|
}
|
||||||
// care of submeshes
|
// care of submeshes
|
||||||
SMESH_subMesh* newSubmesh = _impl->GetSubMesh( newGroupShape );
|
SMESH_subMesh* newSubmesh = _impl->GetSubMesh( newShape );
|
||||||
int newID = newSubmesh->GetId();
|
int newID = newSubmesh->GetId();
|
||||||
if ( newID != oldID ) {
|
if ( newID != oldID ) {
|
||||||
_mapSubMesh [ newID ] = newSubmesh;
|
_mapSubMesh [ newID ] = newSubmesh;
|
||||||
_mapSubMesh_i [ newID ] = _mapSubMesh_i [ oldID ];
|
_mapSubMesh_i [ newID ] = _mapSubMesh_i [ oldID ];
|
||||||
_mapSubMeshIor[ newID ] = _mapSubMeshIor[ oldID ];
|
_mapSubMeshIor[ newID ] = _mapSubMeshIor[ oldID ];
|
||||||
_mapSubMesh.erase (oldID);
|
_mapSubMesh. erase(oldID);
|
||||||
_mapSubMesh_i.erase (oldID);
|
_mapSubMesh_i. erase(oldID);
|
||||||
_mapSubMeshIor.erase(oldID);
|
_mapSubMeshIor.erase(oldID);
|
||||||
_mapSubMesh_i [ newID ]->changeLocalId( newID );
|
_mapSubMesh_i [ newID ]->changeLocalId( newID );
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SMESH::SMESH_GroupOnGeom_var smeshGroup =
|
||||||
|
SMESH::SMESH_GroupOnGeom::_narrow( data->_smeshObject );
|
||||||
|
if ( !smeshGroup->_is_nil() ) // ------------ GROUP -----------------------
|
||||||
|
{
|
||||||
|
SMESH_GroupOnGeom_i* group_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( smeshGroup );
|
||||||
|
if ( group_i ) {
|
||||||
|
::SMESH_Group* group = _impl->GetGroup( group_i->GetLocalID() );
|
||||||
|
SMESHDS_GroupOnGeom* ds = static_cast<SMESHDS_GroupOnGeom*>( group->GetGroupDS() );
|
||||||
|
ds->SetShape( newShape );
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update icons
|
||||||
|
|
||||||
|
CORBA::Long newNbEntities = NbNodes() + NbElements();
|
||||||
|
list< SALOMEDS::SObject_var > soToUpdateIcons;
|
||||||
|
if ( newNbEntities != nbEntities )
|
||||||
|
{
|
||||||
|
// Add all SObjects with icons
|
||||||
|
soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, _this() )); // mesh
|
||||||
|
|
||||||
|
for (map<int, SMESH::SMESH_subMesh_ptr>::iterator i_sm = _mapSubMeshIor.begin();
|
||||||
|
i_sm != _mapSubMeshIor.end(); ++i_sm ) // submeshes
|
||||||
|
soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, i_sm->second ));
|
||||||
|
|
||||||
|
for ( map<int, SMESH::SMESH_GroupBase_ptr>::iterator i_gr = _mapGroups.begin();
|
||||||
|
i_gr != _mapGroups.end(); ++i_gr ) // groups
|
||||||
|
soToUpdateIcons.push_back( _gen_i->ObjectToSObject( study, i_gr->second ));
|
||||||
|
}
|
||||||
|
|
||||||
|
list< SALOMEDS::SObject_var >::iterator so = soToUpdateIcons.begin();
|
||||||
|
for ( ; so != soToUpdateIcons.end(); ++so )
|
||||||
|
_gen_i->SetPixMap( *so, "ICON_SMESH_TREE_MESH_WARN" );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -1650,10 +1745,9 @@ SMESH::SMESH_Group_ptr SMESH_Mesh_i::ConvertToStandalone( SMESH::SMESH_GroupOnGe
|
|||||||
int anId = aGroupToRem->GetLocalID();
|
int anId = aGroupToRem->GetLocalID();
|
||||||
if ( !_impl->ConvertToStandalone( anId ) )
|
if ( !_impl->ConvertToStandalone( anId ) )
|
||||||
return aGroup._retn();
|
return aGroup._retn();
|
||||||
|
removeGeomGroupData( theGroup );
|
||||||
|
|
||||||
SMESH_GroupBase_i* aGroupImpl;
|
SMESH_GroupBase_i* aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
|
||||||
aGroupImpl = new SMESH_Group_i( SMESH_Gen_i::GetPOA(), this, anId );
|
|
||||||
|
|
||||||
|
|
||||||
// remove old instance of group from own map
|
// remove old instance of group from own map
|
||||||
_mapGroups.erase( anId );
|
_mapGroups.erase( anId );
|
||||||
@ -1720,6 +1814,9 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::createSubMesh( GEOM::GEOM_Object_ptr theS
|
|||||||
int nextId = _gen_i->RegisterObject( subMesh );
|
int nextId = _gen_i->RegisterObject( subMesh );
|
||||||
if(MYDEBUG) MESSAGE( "Add submesh to map with id = "<< nextId);
|
if(MYDEBUG) MESSAGE( "Add submesh to map with id = "<< nextId);
|
||||||
|
|
||||||
|
// to track changes of GEOM groups
|
||||||
|
addGeomGroupData( theSubShapeObject, subMesh );
|
||||||
|
|
||||||
return subMesh._retn();
|
return subMesh._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1760,6 +1857,7 @@ void SMESH_Mesh_i::removeSubMesh (SMESH::SMESH_subMesh_ptr theSubMesh,
|
|||||||
catch( const SALOME::SALOME_Exception& ) {
|
catch( const SALOME::SALOME_Exception& ) {
|
||||||
INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
|
INFOS("SMESH_Mesh_i::removeSubMesh(): exception caught!");
|
||||||
}
|
}
|
||||||
|
removeGeomGroupData( theSubShapeObject );
|
||||||
|
|
||||||
int subMeshId = theSubMesh->GetId();
|
int subMeshId = theSubMesh->GetId();
|
||||||
|
|
||||||
@ -1799,6 +1897,12 @@ SMESH::SMESH_GroupBase_ptr SMESH_Mesh_i::createGroup (SMESH::ElementType theElem
|
|||||||
// register CORBA object for persistence
|
// register CORBA object for persistence
|
||||||
int nextId = _gen_i->RegisterObject( aGroup );
|
int nextId = _gen_i->RegisterObject( aGroup );
|
||||||
if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId);
|
if(MYDEBUG) MESSAGE( "Add group to map with id = "<< nextId);
|
||||||
|
|
||||||
|
// to track changes of GEOM groups
|
||||||
|
if ( !theShape.IsNull() ) {
|
||||||
|
GEOM::GEOM_Object_var geom = _gen_i->ShapeToGeomObject( theShape );
|
||||||
|
addGeomGroupData( geom, aGroup );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return aGroup._retn();
|
return aGroup._retn();
|
||||||
}
|
}
|
||||||
@ -1815,6 +1919,7 @@ void SMESH_Mesh_i::removeGroup( const int theId )
|
|||||||
{
|
{
|
||||||
if(MYDEBUG) MESSAGE("SMESH_Mesh_i::removeGroup()" );
|
if(MYDEBUG) MESSAGE("SMESH_Mesh_i::removeGroup()" );
|
||||||
if ( _mapGroups.find( theId ) != _mapGroups.end() ) {
|
if ( _mapGroups.find( theId ) != _mapGroups.end() ) {
|
||||||
|
removeGeomGroupData( _mapGroups[theId] );
|
||||||
_mapGroups.erase( theId );
|
_mapGroups.erase( theId );
|
||||||
_impl->RemoveGroup( theId );
|
_impl->RemoveGroup( theId );
|
||||||
}
|
}
|
||||||
|
@ -503,6 +503,33 @@ private:
|
|||||||
std::map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
|
std::map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
|
||||||
std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
|
std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
|
||||||
SALOME_MED::MedFileInfo_var myFileInfo;
|
SALOME_MED::MedFileInfo_var myFileInfo;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Data used to track changes of GEOM groups
|
||||||
|
struct TGeomGroupData {
|
||||||
|
// keep study entry and not ior because GEOM_Object actually changes if
|
||||||
|
// number of items in a group varies (1) <-> (>1)
|
||||||
|
std::string _groupEntry;
|
||||||
|
std::set<int> _indices; // indices of group items within group's main shape
|
||||||
|
CORBA::Object_ptr _smeshObject; // SMESH object depending on GEOM group
|
||||||
|
};
|
||||||
|
std::list<TGeomGroupData> _geomGroupData;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Remember GEOM group data
|
||||||
|
*/
|
||||||
|
void addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
|
||||||
|
CORBA::Object_ptr theSmeshObj);
|
||||||
|
/*!
|
||||||
|
* Remove GEOM group data relating to removed smesh object
|
||||||
|
*/
|
||||||
|
void removeGeomGroupData(CORBA::Object_ptr theSmeshObj);
|
||||||
|
/*!
|
||||||
|
* \brief Return new group contents if it has been changed and update group data
|
||||||
|
*/
|
||||||
|
TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user