From: akl Date: Fri, 20 Jun 2014 13:46:52 +0000 (+0400) Subject: Implementation of 'Unpublish' and 'Remove' options functionality. X-Git-Tag: V7_5_0a1~50^2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c199f1b99dfbe105598b5818f443d7f417c6edc2;p=modules%2Fgeom.git Implementation of 'Unpublish' and 'Remove' options functionality. --- diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx index f7cd041d9..277318c36 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx @@ -336,12 +336,58 @@ void GEOMToolsGUI_ReduceStudyDlg::checkVisibleIcon( QTreeWidget* theWidget ) void GEOMToolsGUI_ReduceStudyDlg::unpublishObjects( std::set& theObjects ) { - + SalomeApp_Study* appStudy = dynamic_cast( myApp->activeStudy() ); + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder(); + std::string objectEntry, studyEntry; + std::set::iterator it; + for( it = theObjects.begin(); it != theObjects.end(); ++it ) { + objectEntry = *it; + GEOM::GEOM_BaseObject_var GeomBaseObject = GeometryGUI::GetGeomGen()->GetObject( aStudy->StudyId(), objectEntry.c_str() ); + studyEntry = GeomBaseObject->GetStudyEntry(); + if ( studyEntry == "" ) + continue; + _PTR(SObject) obj ( aStudy->FindObjectID( studyEntry.c_str() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj ) { + _PTR(AttributeDrawable) aDrw = aStudyBuilder->FindOrCreateAttribute( obj, "AttributeDrawable" ); + aDrw->SetDrawable( false ); + myDisplayer.EraseWithChildren( new SALOME_InteractiveObject( studyEntry.c_str(), "GEOM", "TEMP_IO" ) ); + } // if ( obj ) + } // iterator + + myApp->updateObjectBrowser( false ); + myApp->updateActions(); } void GEOMToolsGUI_ReduceStudyDlg::removeObjects( std::set& theObjects ) { - + SalomeApp_Study* appStudy = dynamic_cast( myApp->activeStudy() ); + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder(); + _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder(); + std::string objectEntry, studyEntry; + std::set::iterator it; + for( it = theObjects.begin(); it != theObjects.end(); ++it ) { + objectEntry = *it; + GEOM::GEOM_BaseObject_var GeomBaseObject = GeometryGUI::GetGeomGen()->GetObject( aStudy->StudyId(), objectEntry.c_str() ); + studyEntry = GeomBaseObject->GetStudyEntry(); + if ( studyEntry == "" ) + continue; + _PTR(SObject) obj ( aStudy->FindObjectID( studyEntry.c_str() ) ); + if ( obj ) { + //Remove visual properties of the object + appStudy->removeObjectFromAll(obj->GetID().c_str()); + // remove objects from study + aStudyBuilder->RemoveObjectWithChildren( obj ); + // remove object from use case tree + aUseCaseBuilder->Remove( obj ); + myDisplayer.EraseWithChildren( new SALOME_InteractiveObject( studyEntry.c_str(), "GEOM", "TEMP_IO" ) ); + } // if ( obj ) + } // iterator + + myApp->updateObjectBrowser( false ); + myApp->updateActions(); } //=================================================================================