From 77bb14b66399572d88cbf7f05245915b7ca79d62 Mon Sep 17 00:00:00 2001 From: srn Date: Mon, 20 Mar 2006 14:10:42 +0000 Subject: [PATCH] Implented an access to IParameters interface through SALOMEDSClient_ClientFactory --- src/SalomeApp/SalomeApp_Application.cxx | 17 ++++----- src/SalomeApp/SalomeApp_Module.cxx | 2 -- src/SalomeApp/SalomeApp_VisualState.cxx | 46 +++++++++++++------------ 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index fde0af782..0906ec035 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -52,9 +52,8 @@ #include #include -#include "SALOMEDS_StudyManager.hxx" -#include "SALOMEDS_SObject.hxx" -#include "SALOMEDS_IParameters.hxx" +#include "SALOMEDSClient_ClientFactory.hxx" +#include "SALOMEDSClient_IParameters.hxx" #include "SALOME_ListIteratorOfListIO.hxx" #include "SALOME_ListIO.hxx" @@ -382,12 +381,8 @@ void SalomeApp_Application::onSelectionChanged() _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry()); if ( so ) { - SALOMEDS_SObject* aSO = dynamic_cast(so.get()); - - if ( aSO ) { canCopy = studyMgr()->CanCopy(so); canPaste = studyMgr()->CanPaste(so); - } } } } @@ -539,10 +534,10 @@ void SalomeApp_Application::onDumpStudy( ) QFileInfo aFileInfo(aFileName); int savePoint; if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method - SALOMEDS_IParameters::setDumpPython(appStudy->studyDS()); - savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point - //prefix = SALOMEDS_IParameters::getStudyScript(appStudy->studyDS(), appStudy->getVisualComponentName(), savePoint); - + _PTR(AttributeParameter) ap; + _PTR(IParameters) ip = ClientFactory::getIParameters(ap); + ip->setDumpPython(appStudy->studyDS()); + savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point } bool res = aStudy->DumpStudy( aFileInfo.dirPath( true ).latin1(), aFileInfo.baseName().latin1(), toPublish); if ( toSaveGUI ) diff --git a/src/SalomeApp/SalomeApp_Module.cxx b/src/SalomeApp/SalomeApp_Module.cxx index b22992cf4..ac431df27 100644 --- a/src/SalomeApp/SalomeApp_Module.cxx +++ b/src/SalomeApp/SalomeApp_Module.cxx @@ -22,8 +22,6 @@ #include //#include -//#include "SALOMEDS_IParameters.hxx" - #include #include diff --git a/src/SalomeApp/SalomeApp_VisualState.cxx b/src/SalomeApp/SalomeApp_VisualState.cxx index ffb35f74d..6746f010e 100644 --- a/src/SalomeApp/SalomeApp_VisualState.cxx +++ b/src/SalomeApp/SalomeApp_VisualState.cxx @@ -31,7 +31,8 @@ #include #include -#include +#include +#include #include #include @@ -107,7 +108,7 @@ int SalomeApp_VisualState::storeState() savePoint = savePoints[savePoints.size()-1] + 1; _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint ); - SALOMEDS_IParameters ip( ap ); + _PTR(IParameters) ip = ClientFactory::getIParameters( ap ); ViewManagerList lst; myApp->viewManagers( lst ); @@ -120,7 +121,7 @@ int SalomeApp_VisualState::storeState() // store active window's name SUIT_ViewWindow* win = myApp->desktop()->activeWindow(); if ( win ) - ip.setProperty("AP_ACTIVE_VIEW", win->name() ); + ip->setProperty("AP_ACTIVE_VIEW", win->name() ); int viewerID = 0; SUIT_ViewManager* vm = 0; @@ -131,12 +132,12 @@ int SalomeApp_VisualState::storeState() continue; //No views is opened in the viewer std::string viewerEntry = QString( "%1_%2" ).arg( vm->getType() ).arg( ++viewerID ).latin1(); - ip.append("AP_VIEWERS_LIST", viewerEntry); + ip->append("AP_VIEWERS_LIST", viewerEntry); QPtrVector views = vm->getViews(); for(int i = 0; icaption().latin1() ); - ip.append( viewerEntry, views[i]->getVisualParameters().latin1() ); + ip->append( viewerEntry, views[i]->caption().latin1() ); + ip->append( viewerEntry, views[i]->getVisualParameters().latin1() ); } } @@ -145,12 +146,12 @@ int SalomeApp_VisualState::storeState() QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack(); QString workstackInfo; (*workstack) >> workstackInfo; - ip.setProperty( "AP_WORKSTACK_INFO", workstackInfo.latin1() ); + ip->setProperty( "AP_WORKSTACK_INFO", workstackInfo.latin1() ); } //Save a name of the active module if ( CAM_Module* activeModule = myApp->activeModule() ) - ip.setProperty( "AP_ACTIVE_MODULE", activeModule->moduleName().latin1() ); + ip->setProperty( "AP_ACTIVE_MODULE", activeModule->moduleName().latin1() ); //Store visual parameters of the modules QPtrList mlist; @@ -158,7 +159,7 @@ int SalomeApp_VisualState::storeState() CAM_Module* module = 0; for ( module = mlist.first(); module; module = mlist.next() ) { if ( SalomeApp_Module* sModule = dynamic_cast( module ) ) { - ip.append( "AP_MODULES_LIST", sModule->moduleName().latin1() ); + ip->append( "AP_MODULES_LIST", sModule->moduleName().latin1() ); sModule->storeVisualParameters( savePoint ); } } @@ -181,28 +182,29 @@ void SalomeApp_VisualState::restoreState(int savePoint) return; _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint ); - SALOMEDS_IParameters ip(ap); + _PTR(IParameters) ip = ClientFactory::getIParameters(ap); //Remove all already existent veiwers and their views ViewManagerList lst; myApp->viewManagers( lst ); - for ( QPtrListIterator it(lst); it.current(); ++it ) + for ( QPtrListIterator it(lst); it.current(); ++it ) { myApp->removeViewManager( it.current() ); - + qApp->processEvents(); + } //Restore the viewers and view windows - int nbViewers = ip.nbValues( "AP_VIEWERS_LIST" ); + int nbViewers = ip->nbValues( "AP_VIEWERS_LIST" ); SUIT_ViewWindow* viewWin = 0; for ( int i = 0; i < nbViewers; i++ ) { - std::string viewerEntry = ip.getValue( "AP_VIEWERS_LIST", i ); - std::vector veiewerParams = ip.parseValue(viewerEntry,'_'); + std::string viewerEntry = ip->getValue( "AP_VIEWERS_LIST", i ); + std::vector veiewerParams = ip->parseValue(viewerEntry,'_'); std::string type = veiewerParams[0]; std::string viewerID = veiewerParams[1]; SUIT_ViewManager* vm = myApp->newViewManager( type.c_str() ); if ( !vm ) continue; //Unknown viewer - int nbViews = (ip.nbValues(viewerEntry))/2; + int nbViews = (ip->nbValues(viewerEntry))/2; //Create nbViews-1 view (-1 because 1 view is created by createViewManager) for ( int i = 1; i< nbViews; i++ ) { @@ -227,13 +229,13 @@ void SalomeApp_VisualState::restoreState(int savePoint) while ( !viewWin->isVisible() ) qApp->processEvents(); - viewWin->setCaption(ip.getValue(viewerEntry, j).c_str()); - viewWin->setVisualParameters(ip.getValue(viewerEntry, j+1).c_str()); + viewWin->setCaption(ip->getValue(viewerEntry, j).c_str()); + viewWin->setVisualParameters(ip->getValue(viewerEntry, j+1).c_str()); } } // restore modules' visual parameters - std::vector v = ip.getValues("AP_MODULES_LIST"); + std::vector v = ip->getValues("AP_MODULES_LIST"); for ( int i = 0; i < v.size(); i++ ) { myApp->activateModule( v[i].c_str() ); if ( SalomeApp_Module* module = dynamic_cast( myApp->activeModule() ) ) @@ -241,7 +243,7 @@ void SalomeApp_VisualState::restoreState(int savePoint) } // activate module that was active on save - QString activeModuleName( ip.getProperty("AP_ACTIVE_MODULE" ).c_str() ); + QString activeModuleName( ip->getProperty("AP_ACTIVE_MODULE" ).c_str() ); if ( !activeModuleName.isEmpty() ) myApp->activateModule( activeModuleName ); @@ -271,7 +273,7 @@ void SalomeApp_VisualState::restoreState(int savePoint) // some modules can create their own viewers (like VISU creates GaussViewers) if ( myApp->desktop()->inherits( "STD_TabDesktop" ) ) { QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack(); - (*workstack) << ip.getProperty( "AP_WORKSTACK_INFO" ).c_str(); + (*workstack) << ip->getProperty( "AP_WORKSTACK_INFO" ).c_str(); } // restore visual parameters of view windows. it must be done AFTER restoring workstack. @@ -283,7 +285,7 @@ void SalomeApp_VisualState::restoreState(int savePoint) } // set focus to previously saved active view window - std::string activeViewName = ip.getProperty("AP_ACTIVE_VIEW"); + std::string activeViewName = ip->getProperty("AP_ACTIVE_VIEW"); for ( it.toFirst(); it.current(); ++it ) { int view_count = it.current()->getViewsCount(); QPtrVector views = it.current()->getViews(); -- 2.39.2