From: apo Date: Wed, 30 Mar 2005 14:06:25 +0000 (+0000) Subject: Bug PAL7444 - display mesh takes a lot of more memory in 2.1.0 than in 2.0.0. X-Git-Tag: T_3_0_0_a1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=83f19818fce494a77ddf10b70493abdd9f73e4e0 Bug PAL7444 - display mesh takes a lot of more memory in 2.1.0 than in 2.0.0. --- diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index f3794ec5e..004399a7f 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -101,8 +101,9 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj, } -SMESH_ActorDef::SMESH_ActorDef(){ - if(MYDEBUG) MESSAGE("SMESH_ActorDef"); +SMESH_ActorDef::SMESH_ActorDef() +{ + if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<SetUserMatrix(aMatrix); - my2DActor->SetStoreMapping(true); my2DActor->PickableOff(); my2DActor->SetProperty(mySurfaceProp); my2DActor->SetBackfaceProperty(myBackSurfaceProp); @@ -149,7 +149,6 @@ SMESH_ActorDef::SMESH_ActorDef(){ my3DActor = SMESH_DeviceActor::New(); my3DActor->SetUserMatrix(aMatrix); - my3DActor->SetStoreMapping(true); my3DActor->PickableOff(); my3DActor->SetProperty(mySurfaceProp); my3DActor->SetBackfaceProperty(myBackSurfaceProp); @@ -177,7 +176,6 @@ SMESH_ActorDef::SMESH_ActorDef(){ my1DActor = SMESH_DeviceActor::New(); my1DActor->SetUserMatrix(aMatrix); - my1DActor->SetStoreMapping(true); my1DActor->PickableOff(); my1DActor->SetHighlited(true); my1DActor->SetProperty(myEdgeProp); @@ -202,7 +200,6 @@ SMESH_ActorDef::SMESH_ActorDef(){ my1DExtActor = SMESH_DeviceActor::New(); my1DExtActor->SetUserMatrix(aMatrix); - my1DExtActor->SetStoreMapping(true); my1DExtActor->PickableOff(); my1DExtActor->SetHighlited(true); my1DExtActor->SetVisibility(false); @@ -224,7 +221,7 @@ SMESH_ActorDef::SMESH_ActorDef(){ myNodeActor = SMESH_DeviceActor::New(); myNodeActor->SetUserMatrix(aMatrix); - myNodeActor->SetStoreMapping(true); + myNodeActor->SetStoreClippingMapping(true); myNodeActor->PickableOff(); myNodeActor->SetVisibility(false); myNodeActor->SetProperty(myNodeProp); @@ -238,9 +235,8 @@ SMESH_ActorDef::SMESH_ActorDef(){ myBaseActor = SMESH_DeviceActor::New(); myBaseActor->SetUserMatrix(aMatrix); - myBaseActor->SetStoreMapping(true); + myBaseActor->SetStoreGemetryMapping(true); myBaseActor->GetProperty()->SetOpacity(0.0); - myBaseActor->myGeomFilter->SetInside(true); myPickableActor = myBaseActor; @@ -268,19 +264,9 @@ SMESH_ActorDef::SMESH_ActorDef(){ myHighlitableActor = SMESH_DeviceActor::New(); myHighlitableActor->SetUserMatrix(aMatrix); - myHighlitableActor->SetStoreMapping(false); myHighlitableActor->PickableOff(); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); - myNodeHighlitableActor = SMESH_DeviceActor::New(); - myNodeHighlitableActor->SetUserMatrix(aMatrix); - myNodeHighlitableActor->SetStoreMapping(false); - myNodeHighlitableActor->PickableOff(); - myNodeHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint); - aFilter = myNodeHighlitableActor->GetExtractUnstructuredGrid(); - aFilter->SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints); - - SetShrinkFactor(SMESH::GetFloat("SMESH:SettingsShrinkCoeff", 75)/100.); myName = ""; @@ -494,8 +480,9 @@ SMESH_ActorDef::SMESH_ActorDef(){ } -SMESH_ActorDef::~SMESH_ActorDef(){ - if(MYDEBUG) MESSAGE("~SMESH_ActorDef"); +SMESH_ActorDef::~SMESH_ActorDef() +{ + if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<Delete(); myLookupTable->Delete(); @@ -522,8 +509,6 @@ SMESH_ActorDef::~SMESH_ActorDef(){ myBaseActor->Delete(); myHighlitableActor->Delete(); - myNodeHighlitableActor->Delete(); - //Deleting of pints numbering pipeline //--------------------------------------- @@ -624,8 +609,21 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled) } -void SMESH_ActorDef::SetControlMode(eControl theMode){ +void +SMESH_ActorDef:: +SetControlMode(eControl theMode) +{ + SetControlMode(theMode,true); +} + + +void +SMESH_ActorDef:: +SetControlMode(eControl theMode, + bool theCheckEntityMode) +{ myControlMode = eNone; + theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"; my1DActor->GetMapper()->SetScalarVisibility(false); my2DActor->GetMapper()->SetScalarVisibility(false); @@ -734,27 +732,36 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){ switch(myControlMode){ case eFreeEdges: case eFreeBorders: - my1DExtActor->SetExtControlMode(aFunctor,myControlActor); + my1DExtActor->SetExtControlMode(aFunctor); break; case eLength2D: case eMultiConnection2D: - my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable); + my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable); break; default: myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable); } } - if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){ + if(theCheckEntityMode){ if(myControlActor == my1DActor) - myEntityMode = eEdges; - else if(myControlActor == my2DActor) - myEntityMode = eFaces; - else if(myControlActor == my3DActor) - myEntityMode = eVolumes; + SetEntityMode(eEdges); + else if(myControlActor == my2DActor){ + switch(myControlMode){ + case eLength2D: + case eFreeEdges: + case eMultiConnection2D: + //SetEntityMode(eEdges); + SetEntityMode(eFaces); + break; + default: + SetEntityMode(eFaces); + } + }else if(myControlActor == my3DActor) + SetEntityMode(eVolumes); } - }else if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){ + }else if(theCheckEntityMode){ myEntityMode = eAllEntity; } @@ -778,7 +785,6 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){ theRenderer->AddActor(my1DExtActor); theRenderer->AddActor(myHighlitableActor); - theRenderer->AddActor(myNodeHighlitableActor); theRenderer->AddActor2D(myScalarBarActor); @@ -796,7 +802,6 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){ theRenderer->RemoveActor(myBaseActor); theRenderer->RemoveActor(myHighlitableActor); - theRenderer->RemoveActor(myNodeHighlitableActor); theRenderer->RemoveActor(my1DActor); theRenderer->RemoveActor(my1DExtActor); @@ -826,7 +831,6 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, myBaseActor->Init(myVisualObj,myImplicitBoolean); myHighlitableActor->Init(myVisualObj,myImplicitBoolean); - myNodeHighlitableActor->Init(myVisualObj,myImplicitBoolean); my1DActor->Init(myVisualObj,myImplicitBoolean); my1DExtActor->Init(myVisualObj,myImplicitBoolean); @@ -883,7 +887,6 @@ void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){ myBaseActor->SetTransform(theTransform); myHighlitableActor->SetTransform(theTransform); - myNodeHighlitableActor->SetTransform(theTransform); my1DActor->SetTransform(theTransform); my1DExtActor->SetTransform(theTransform); @@ -1067,14 +1070,22 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){ - if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) + myEntityState = eAllEntity; + + if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)){ + myEntityState &= ~eEdges; theMode &= ~eEdges; + } - if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) + if(!myVisualObj->GetNbEntities(SMDSAbs_Face)){ + myEntityState &= ~eFaces; theMode &= ~eFaces; + } - if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) + if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)){ + myEntityState &= ~eVolumes; theMode &= ~eVolumes; + } if(!theMode){ if(myVisualObj->GetNbEntities(SMDSAbs_Edge)) @@ -1087,6 +1098,8 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){ theMode |= eVolumes; } + myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState); + myEntityMode = theMode; SALOME_ExtractUnstructuredGrid* aFilter = NULL; aFilter = myBaseActor->GetExtractUnstructuredGrid(); @@ -1229,27 +1242,27 @@ void SMESH_ActorDef::UpdateHighlight(){ myHighlitableActor->SetVisibility(false); myHighlitableActor->SetHighlited(false); - myNodeHighlitableActor->SetVisibility(false); - myNodeHighlitableActor->SetHighlited(false); - if(myIsHighlighted){ myHighlitableActor->SetProperty(myHighlightProp); }else if(myIsPreselected){ myHighlitableActor->SetProperty(myPreselectProp); } - bool isVisible = GetVisibility(); + bool anIsVisible = GetVisibility(); if(myIsHighlighted || myIsPreselected){ if(GetUnstructuredGrid()->GetNumberOfCells()){ + myHighlitableActor->SetHighlited(anIsVisible); + myHighlitableActor->SetVisibility(anIsVisible); + myHighlitableActor->GetExtractUnstructuredGrid()-> + SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::eCells); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); - myHighlitableActor->SetVisibility(isVisible); - myHighlitableActor->SetHighlited(isVisible); - } - if(myRepresentation == ePoint || GetPointRepresentation()){ - myNodeHighlitableActor->SetProperty(myHighlitableActor->GetProperty()); - myNodeHighlitableActor->SetVisibility(isVisible); - myNodeHighlitableActor->SetHighlited(isVisible); + }else if(myRepresentation == ePoint || GetPointRepresentation()){ + myHighlitableActor->SetHighlited(anIsVisible); + myHighlitableActor->SetVisibility(anIsVisible); + myHighlitableActor->GetExtractUnstructuredGrid()-> + SetModeOfExtraction(SALOME_ExtractUnstructuredGrid::ePoints); + myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint); } } } @@ -1308,7 +1321,7 @@ void SMESH_ActorDef::Update(){ unsigned long aTime = myTimeStamp->GetMTime(); unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime(); if (anObjTime > aTime) - SetControlMode(GetControlMode()); + SetControlMode(GetControlMode(),false); } if(myIsPointsLabeled){ SetPointsLabeled(myIsPointsLabeled); @@ -1461,7 +1474,6 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); - myNodeHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index ea3f8d029..e6925d30e 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -186,6 +186,7 @@ class SMESH_ActorDef : public SMESH_Actor{ virtual long GetControlsPrecision() const { return myControlsPrecision; } protected: + void SetControlMode(eControl theMode, bool theCheckEntityMode); void SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed); bool IsImplicitFunctionUsed() const; @@ -207,7 +208,6 @@ class SMESH_ActorDef : public SMESH_Actor{ vtkProperty* myHighlightProp; vtkProperty* myPreselectProp; SMESH_DeviceActor* myHighlitableActor; - SMESH_DeviceActor* myNodeHighlitableActor; eControl myControlMode; SMESH_DeviceActor* my2DActor; @@ -220,6 +220,7 @@ class SMESH_ActorDef : public SMESH_Actor{ SMESH_DeviceActor* my1DExtActor; unsigned int myEntityMode; + unsigned int myEntityState; bool myIsPointsVisible; bool myIsShrinkable; diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 337aba648..962ad1ed8 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -75,7 +75,10 @@ using namespace std; vtkStandardNewMacro(SMESH_DeviceActor); -SMESH_DeviceActor::SMESH_DeviceActor(){ +SMESH_DeviceActor::SMESH_DeviceActor() +{ + if(MYDEBUG) MESSAGE("SMESH_DeviceActor - "<SetReleaseDataFlag(true); - myExtractGeometry->SetStoreMapping(true); myIsImplicitFunctionUsed = false; myExtractUnstructuredGrid = SALOME_ExtractUnstructuredGrid::New(); - myExtractUnstructuredGrid->SetStoreMapping(true); - + myMergeFilter = vtkMergeFilter::New(); - myStoreMapping = false; myGeomFilter = SALOME_GeometryFilter::New(); myTransformFilter = SALOME_TransformFilter::New(); @@ -112,43 +114,54 @@ SMESH_DeviceActor::SMESH_DeviceActor(){ SMESH_DeviceActor::~SMESH_DeviceActor(){ - if(MYDEBUG) MESSAGE("~SMESH_DeviceActor"); + if(MYDEBUG) MESSAGE("~SMESH_DeviceActor - "<Delete(); - myMapper->RemoveAllInputs(); myMapper->Delete(); - myShrinkFilter->UnRegisterAllOutputs(); myShrinkFilter->Delete(); - myExtractUnstructuredGrid->UnRegisterAllOutputs(); myExtractUnstructuredGrid->Delete(); - myMergeFilter->UnRegisterAllOutputs(); myMergeFilter->Delete(); - myGeomFilter->UnRegisterAllOutputs(); myGeomFilter->Delete(); - myExtractGeometry->UnRegisterAllOutputs(); myExtractGeometry->Delete(); - myTransformFilter->UnRegisterAllOutputs(); myTransformFilter->Delete(); for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++){ - myPassFilter[i]->UnRegisterAllOutputs(); myPassFilter[i]->Delete(); } } -void SMESH_DeviceActor::SetStoreMapping(int theStoreMapping){ - if (myStoreMapping == theStoreMapping) - return; - myStoreMapping = theStoreMapping; - myGeomFilter->SetStoreMapping( myStoreMapping ); - Modified(); +void +SMESH_DeviceActor:: +SetStoreGemetryMapping(bool theStoreMapping) +{ + myGeomFilter->SetStoreMapping(theStoreMapping); + SetStoreClippingMapping(theStoreMapping); +} + + +void +SMESH_DeviceActor:: +SetStoreClippingMapping(bool theStoreMapping) +{ + myStoreClippingMapping = theStoreMapping; + myExtractGeometry->SetStoreMapping(theStoreMapping && myIsImplicitFunctionUsed); + SetStoreIDMapping(theStoreMapping); +} + + +void +SMESH_DeviceActor:: +SetStoreIDMapping(bool theStoreMapping) +{ + myExtractUnstructuredGrid->SetStoreMapping(theStoreMapping); } @@ -165,9 +178,6 @@ void SMESH_DeviceActor:: SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) { - if(myIsImplicitFunctionUsed == theIsImplicitFunctionUsed) - return; - int anId = 0; if(theIsImplicitFunctionUsed) myPassFilter[ anId ]->SetInput( myExtractGeometry->GetOutput() ); @@ -175,6 +185,7 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() ); myIsImplicitFunctionUsed = theIsImplicitFunctionUsed; + SetStoreClippingMapping(myStoreClippingMapping); } @@ -190,11 +201,10 @@ void SMESH_DeviceActor::SetUnstructuredGrid(vtkUnstructuredGrid* theGrid){ myExtractGeometry->SetInput(myMergeFilter->GetOutput()); int anId = 0; - myPassFilter[ anId ]->SetInput( myMergeFilter->GetOutput() ); + SetImplicitFunctionUsed(myIsImplicitFunctionUsed); myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() ); anId++; // 1 - myGeomFilter->SetStoreMapping( myStoreMapping ); myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); anId++; // 2 @@ -239,7 +249,11 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, bool anIsInitialized = theFunctor; if(anIsInitialized){ vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New(); + + SetStoreIDMapping(true); + myExtractUnstructuredGrid->Update(); vtkUnstructuredGrid* aGrid = myExtractUnstructuredGrid->GetOutput(); + aDataSet->ShallowCopy(aGrid); vtkDoubleArray *aScalars = vtkDoubleArray::New(); @@ -280,7 +294,6 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor, } void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, - SMESH_DeviceActor* theDeviceActor, vtkScalarBarActor* theScalarBarActor, vtkLookupTable* theLookupTable) { @@ -419,8 +432,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor theScalarBarActor->SetVisibility(anIsInitialized); } -void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, - SMESH_DeviceActor* theDeviceActor) +void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor) { myExtractUnstructuredGrid->ClearRegisteredCells(); myExtractUnstructuredGrid->ClearRegisteredCellsWithType(); @@ -553,7 +565,9 @@ void SMESH_DeviceActor::SetRepresentation(EReperesent theMode){ void SMESH_DeviceActor::SetVisibility(int theMode){ - if(!myExtractUnstructuredGrid->GetInput() || GetUnstructuredGrid()->GetNumberOfCells()){ + if(!myExtractUnstructuredGrid->GetInput() || + GetUnstructuredGrid()->GetNumberOfCells()) + { vtkLODActor::SetVisibility(theMode); }else{ vtkLODActor::SetVisibility(false); @@ -576,7 +590,7 @@ int SMESH_DeviceActor::GetNodeObjId(int theVtkID){ anID = myExtractGeometry->GetNodeObjId(theVtkID); vtkIdType aRetID = myVisualObj->GetNodeObjId(anID); - if(MYDEBUG) MESSAGE("GetNodeObjId - theVtkID = "<GetReferenceCount() = " << myGrid->GetReferenceCount() ); + if(MYDEBUG) { + MESSAGE("~SMESH_MeshObj - "<DebugOn(); + } myGrid->Delete(); } diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index bf4ae7f76..34c82ee21 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -730,6 +730,8 @@ namespace{ SALOME_Selection *Sel = SALOME_Selection::Selection(anActiveStudy->getSelection()); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + + aStudyBuilder->NewCommand(); // There is a transaction for(; It.More(); It.Next()){ Handle(SALOME_InteractiveObject) IObject = It.Value(); if(IObject->hasEntry()){ @@ -737,7 +739,7 @@ namespace{ /* Erase child graphical objects */ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO); - for(; it->More(); it->Next()){ + for(it->InitEx(true); it->More(); it->Next()){ SALOMEDS::SObject_var CSO = it->Value(); if(CSO->FindAttribute(anAttr, "AttributeIOR")){ anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); @@ -785,6 +787,7 @@ namespace{ } /* IObject->hasEntry() */ } /* more/next */ + aStudyBuilder->CommitCommand(); /* Clear any previous selection */ Sel->ClearIObjects(); @@ -1274,6 +1277,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent) } CORBA::Long anId = aStudy->StudyId(); TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry()); + cout<<"myAutomaticUpdate - "<Update(); SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry()); diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index 8bd6cdce9..89cebc3c4 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -244,6 +244,17 @@ namespace SMESH{ void RemoveActor(QAD_StudyFrame *theStudyFrame, SMESH_Actor* theActor){ if(VTKViewer_ViewFrame* aViewFrame = GetVtkViewFrame(theStudyFrame)){ aViewFrame->RemoveActor(theActor); + if(theActor->hasIO()){ + Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); + if(anIO->hasEntry()){ + std::string anEntry = anIO->getEntry(); + QAD_Study* aStudy = theStudyFrame->getStudy(); + int aStudyId = aStudy->getStudyId(); + TVisualObjCont::key_type aKey(aStudyId,anEntry); + VISUAL_OBJ_CONT.erase(aKey); + } + } + theActor->Delete(); aViewFrame->Repaint(); } } diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index db273b203..9eb0f79ff 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -498,8 +498,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMesh( GEOM::GEOM_Object_ptr theShapeObj ASSERT( meshServant ); meshServant->SetShape( theShapeObject ); // publish mesh in the study - if ( CanPublishInStudy( mesh ) ) + if( CanPublishInStudy( mesh ) ){ + SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); + aStudyBuilder->NewCommand(); // There is a transaction PublishMesh( myCurrentStudy, mesh.in() ); + aStudyBuilder->CommitCommand(); + } return mesh._retn(); } @@ -520,8 +524,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromUNV( const char* theFileName SMESH::SMESH_Mesh_var aMesh = createMesh(); string aFileName; // = boost::filesystem::path(theFileName).leaf(); // publish mesh in the study - if ( CanPublishInStudy( aMesh ) ) + if ( CanPublishInStudy( aMesh ) ){ + SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); + aStudyBuilder->NewCommand(); // There is a transaction PublishMesh( myCurrentStudy, aMesh.in(), aFileName.c_str() ); + aStudyBuilder->CommitCommand(); + } SMESH_Mesh_i* aServant = dynamic_cast( GetServant( aMesh ).in() ); ASSERT( aServant ); @@ -553,9 +561,12 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName, SMESH::mesh_array_var aResult = new SMESH::mesh_array(); theStatus = (SMESH::DriverMED_ReadStatus)aStatus; if(theStatus == SMESH::DRS_OK){ + SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); + aStudyBuilder->NewCommand(); // There is a transaction + aResult->length( aNames.size() ); int i = 0; - + // Iterate through all meshes and create mesh objects for ( list::iterator it = aNames.begin(); it != aNames.end(); it++ ) { // create mesh @@ -575,6 +586,7 @@ SMESH::mesh_array* SMESH_Gen_i::CreateMeshesFromMED( const char* theFileName, aResult[i++] = SMESH::SMESH_Mesh::_duplicate( mesh ); } + aStudyBuilder->CommitCommand(); } return aResult._retn(); } @@ -596,8 +608,12 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateMeshesFromSTL( const char* theFileName SMESH::SMESH_Mesh_var aMesh = createMesh(); string aFileName; // = boost::filesystem::path(theFileName).leaf(); // publish mesh in the study - if ( CanPublishInStudy( aMesh ) ) + if( CanPublishInStudy( aMesh ) ){ + SALOMEDS::StudyBuilder_var aStudyBuilder = myCurrentStudy->NewBuilder(); + aStudyBuilder->NewCommand(); // There is a transaction PublishInStudy( myCurrentStudy, SALOMEDS::SObject::_nil(), aMesh.in(), aFileName.c_str() ); + aStudyBuilder->CommitCommand(); + } SMESH_Mesh_i* aServant = dynamic_cast( GetServant( aMesh ).in() ); ASSERT( aServant ); diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index d0da172ba..0fa06e040 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -76,7 +76,8 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA, CORBA::Long studyId ) : SALOME::GenericObj_i( thePOA ) { - INFOS("SMESH_Mesh_i"); + INFOS("SMESH_Mesh_i; this = "<