fix update of sub-meshes on group in checkGeomModif()

+ make SMESH_Mesh_i::_mainShapeTick persistent, which is needed for the case:
    - open a saved study with shaper data
    - edit an object in the shaper
    - switch to smesh ==> shape modification not detected
This commit is contained in:
eap 2020-01-20 18:57:12 +03:00
parent 3801576eaf
commit 93ac2e8964
3 changed files with 30 additions and 6 deletions

View File

@ -4369,6 +4369,14 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
aDataset->WriteOnDisk( &meshPersistentId );
aDataset->CloseOnDisk();
// Store SMESH_Mesh_i::_mainShapeTick
int shapeTick = myImpl->MainShapeTick();
aSize[ 0 ] = 1;
aDataset = new HDFdataset( "shapeTick", aTopGroup, HDF_INT32, aSize, 1 );
aDataset->CreateOnDisk();
aDataset->WriteOnDisk( &shapeTick );
aDataset->CloseOnDisk();
// write reference on a shape if exists
SALOMEDS::SObject_wrap myRef;
bool shapeRefFound = false;
@ -5393,7 +5401,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
}
// issue 20918. Restore Persistent Id of SMESHDS_Mesh
if( aTopGroup->ExistInternalObject( "meshPersistentId" ) )
if ( aTopGroup->ExistInternalObject( "meshPersistentId" ) )
{
aDataset = new HDFdataset( "meshPersistentId", aTopGroup );
aDataset->OpenOnDisk();
@ -5405,6 +5413,16 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
delete [] meshPersistentId;
}
// Restore SMESH_Mesh_i::_mainShapeTick
if ( aTopGroup->ExistInternalObject( "shapeTick" ))
{
aDataset = new HDFdataset( "shapeTick", aTopGroup );
aDataset->OpenOnDisk();
int* shapeTick = & myNewMeshImpl->MainShapeTick();
aDataset->ReadFromDisk( shapeTick );
aDataset->CloseOnDisk();
}
// Restore file info
if ( aTopGroup->ExistInternalObject( "file info" ))
{

View File

@ -2046,7 +2046,7 @@ void SMESH_Mesh_i::removeGeomGroupData(CORBA::Object_ptr theSmeshObj)
*/
//================================================================================
TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData, bool onlyIfChanged )
{
TopoDS_Shape newShape;
@ -2066,7 +2066,7 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
for ( CORBA::ULong i = 0; i < ids->length(); ++i )
curIndices.insert( ids[i] );
if ( groupData._indices == curIndices )
if ( onlyIfChanged && groupData._indices == curIndices )
return newShape; // group not changed
// update data
@ -2344,7 +2344,7 @@ void SMESH_Mesh_i::CheckGeomModif()
std::list<TGeomGroupData>::iterator data = _geomGroupData.begin();
for ( ; data != _geomGroupData.end(); ++data )
{
TopoDS_Shape newShape = newGroupShape( *data );
TopoDS_Shape newShape = newGroupShape( *data, /*onlyIfChanged=*/false );
if ( !newShape.IsNull() )
{
if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape
@ -2527,7 +2527,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
bool processedGroup = !it_new.second;
TopoDS_Shape& newShape = it_new.first->second;
if ( !processedGroup )
newShape = newGroupShape( *data );
newShape = newGroupShape( *data, /*onlyIfChanged=*/true );
if ( newShape.IsNull() )
continue; // no changes

View File

@ -623,6 +623,12 @@ public:
std::string FileInfoToString();
void FileInfoFromString(const std::string& info);
/*!
* Persistence of geometry tick
*/
int& MainShapeTick() { return _mainShapeTick; }
/*!
* Sets list of notebook variables used for Mesh operations separated by ":" symbol
*/
@ -769,7 +775,7 @@ private:
/*!
* Return new group contents if it has been changed and update group data
*/
TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
TopoDS_Shape newGroupShape( TGeomGroupData & groupData, bool onlyIfChanged);
};