]> SALOME platform Git repositories - modules/hexablock.git/commitdiff
Salome HOME
0023299: [CEA] Finalize multi-study removal
authorimn <imn@opencascade.com>
Fri, 14 Oct 2016 14:07:44 +0000 (17:07 +0300)
committerimn <imn@opencascade.com>
Fri, 14 Oct 2016 14:07:44 +0000 (17:07 +0300)
- delete study id parameter

src/HEXABLOCKGUI/HEXABLOCKGUI.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI.hxx

index cff4a467fde55d51bdb98f74cded0ef99e854d12..89a4f09fe0ddd11fe83202d23ed2c1a5d1fd83f4 100755 (executable)
 using namespace std;
 using namespace HEXABLOCK::GUI;
 
-int  HEXABLOCKGUI::_oldStudyId = -1;
-
 // HEXABLOCK_ORB::HEXABLOCK_Gen_var HEXABLOCKGUI::_hexaEngine  = HEXABLOCK_ORB::HEXABLOCK_Gen::_nil();
 //
 VtkDocumentGraphicView* HEXABLOCKGUI::currentDocGView = NULL;
@@ -252,7 +250,6 @@ void HEXABLOCKGUI::initialize( CAM_Application* app )
     createActions();
     createMenus();
     createTools();
-    studyActivated();
 }
 
 void HEXABLOCKGUI::viewManagers( QStringList& list ) const
@@ -421,13 +418,11 @@ bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy )
     return bOk;
 }
 
-SALOMEDS::Study_var HEXABLOCKGUI::ClientStudyToStudy (_PTR(Study) theStudy)
+SALOMEDS::Study_var HEXABLOCKGUI::ClientStudy()
 {
   SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
-  CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
-  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
-  int aStudyID = theStudy->StudyId();
-  SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(aStudyID);
+  CORBA::Object_var aSMObject = aNamingService->Resolve("/Study");
+  SALOMEDS::Study_var aDSStudy = SALOMEDS::Study::_narrow(aSMObject);
   return aDSStudy._retn();
 }
 
@@ -440,8 +435,7 @@ void HEXABLOCKGUI::addInStudy(QMap<QString, TopoDS_Shape>& topo_shapes,
 
     SalomeApp_Study* appStudy = HEXABLOCKGUI::activeStudy();
     if(!appStudy) return;
-    _PTR(Study) aStudy = appStudy->studyDS();
-    SALOMEDS::Study_var aDSStudy = ClientStudyToStudy( aStudy );
+    SALOMEDS::Study_var aDSStudy = ClientStudy();
     SALOMEDS::StudyBuilder_var     aBuilder (aDSStudy->NewBuilder());
     QString entry = currentDocGView->getDocumentModel()->documentEntry();
     SALOMEDS::SObject_var aFatherSO = aDSStudy->FindObjectID( qPrintable(entry) );
@@ -875,26 +869,6 @@ void HEXABLOCKGUI::preferencesChanged( const QString& sect, const QString& name
 //        _genericGui->getCatalogWidget()->addCatalogFromFile(Resource::userCatalog.toStdString());
 }
 
-void HEXABLOCKGUI::studyActivated() //CS_TODO
-{
-    int newStudyId = getApp()->activeStudy()->id();
-    DEBTRACE("HEXABLOCKGUI::studyActivated " << _oldStudyId << " " << newStudyId);
-//    if (_oldStudyId != -1)
-//    {
-//        _studyContextMap[_oldStudyId] = QtGuiContext::getQtCurrent();
-//        if (_studyContextMap.count(newStudyId))
-//        {
-//            DEBTRACE("switch to valid context " << QtGuiContext::getQtCurrent() << " " << _studyContextMap[newStudyId]);
-//            QtGuiContext::setQtCurrent(_studyContextMap[newStudyId]);
-//        }
-//        else
-//        {
-//            DEBTRACE("no switch to null context");
-//        }
-//    }
-    _oldStudyId = newStudyId;
-}
-
 void HEXABLOCKGUI::treeContextMenu(const QPoint& aPosition)
 {
     QModelIndex currentIndex = _patternDataTreeView->currentIndex();
@@ -3239,8 +3213,7 @@ QString HEXABLOCKGUI::addDocInStudy (HEXA_NS::Document* document)
     if (app_study == NULL)
         return docEntry;
 
-    _PTR(Study)         study    = app_study->studyDS();
-    SALOMEDS::Study_var ds_study = ClientStudyToStudy (study);
+    SALOMEDS::Study_var ds_study = ClientStudy();
     SALOMEDS::StudyBuilder_var aBuilder (ds_study->NewBuilder());
     QString entry = app_study->centry("HEXABLOCK");
     SALOMEDS::SObject_var aFatherSO = ds_study->FindObjectID( qPrintable(entry) );
index 9b88c6aa04829f7988e54a87ea7266df05a3d594..c7efb37e42c5ca107909a2576e1845c1e34ff324 100755 (executable)
@@ -136,7 +136,7 @@ public:
 
   // static HEXABLOCK_ORB::HEXABLOCK_Gen_ptr InitHEXABLOCKGen( SalomeApp_Application* );
   static LightApp_SelectionMgr*   selectionMgr();
-  static SALOMEDS::Study_var  ClientStudyToStudy (_PTR(Study) theStudy);
+  static SALOMEDS::Study_var  ClientStudy();
   static ViewType getActiveViewType();
   static HEXABLOCKGUI*  getInstance();
 
@@ -161,7 +161,6 @@ public:
   virtual void setResource(SUIT_ResourceMgr* r);
   virtual void createPreferences();
   virtual void preferencesChanged( const QString& sect, const QString& name );
-  virtual void studyActivated();
 
   ///Returns a new HEXA_NS::Document and it's entry in the study
   std::pair <QString, HEXA_NS::Document*> newHexaDocument();
@@ -247,7 +246,6 @@ protected:
   HEXABLOCK::GUI::VtkDocumentGraphicView* lastVtkDocGView;
 
   HEXABLOCKGUI_Resource* _myresource;
-  static int _oldStudyId;
   // static HEXABLOCK_ORB::HEXABLOCK_Gen_var _hexaEngine;  // Hexa6 TODo
 private slots: