]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Implented an access to IParameters interface through SALOMEDSClient_ClientFactory
authorsrn <srn@opencascade.com>
Mon, 20 Mar 2006 14:10:42 +0000 (14:10 +0000)
committersrn <srn@opencascade.com>
Mon, 20 Mar 2006 14:10:42 +0000 (14:10 +0000)
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Module.cxx
src/SalomeApp/SalomeApp_VisualState.cxx

index fde0af7825e12b7e124115b97d23cf382eed7e1a..0906ec0352b9cd3014f1979edb8074dfd5540dca 100644 (file)
@@ -52,9 +52,8 @@
 #include <qpushbutton.h>
 #include <qlabel.h>
 
-#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<SALOMEDS_SObject*>(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 ) 
index b22992cf4daadf35ef64e9f05c12719cf3875d05..ac431df277053c05ecf4e6339a85981fc7c5667f 100644 (file)
@@ -22,8 +22,6 @@
 #include <SALOME_InteractiveObject.hxx>
 //#include <SALOME_Actor.h>
 
-//#include "SALOMEDS_IParameters.hxx"
-
 #include <SUIT_Session.h>
 #include <SUIT_ViewModel.h>
 
index ffb35f74d5a632c1e8fa46ca1ef6e201f64add8f..6746f010e0a98918b5d63892288072363d01c595 100644 (file)
@@ -31,7 +31,8 @@
 #include <qapplication.h>
 #include <qdict.h>
 
-#include <SALOMEDS_IParameters.hxx>
+#include <SALOMEDSClient_ClientFactory.hxx>
+#include <SALOMEDSClient_IParameters.hxx>
 
 #include <vector>
 #include <string>
@@ -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<SUIT_ViewWindow> views = vm->getViews();
     for(int i = 0; i<view_count; i++) {
-      ip.append( viewerEntry, views[i]->caption().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<CAM_Module> 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<SalomeApp_Module*>( 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<SUIT_ViewManager> it(lst); it.current(); ++it )
+  for ( QPtrListIterator<SUIT_ViewManager> 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<std::string> veiewerParams = ip.parseValue(viewerEntry,'_');
+    std::string viewerEntry = ip->getValue( "AP_VIEWERS_LIST", i );
+    std::vector<std::string> 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<std::string> v = ip.getValues("AP_MODULES_LIST");
+  std::vector<std::string> 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<SalomeApp_Module*>( 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<SUIT_ViewWindow> views = it.current()->getViews();