]> SALOME platform Git repositories - modules/hexablock.git/commitdiff
Salome HOME
Deleted Study parameter mpa/23299
authormpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:19:13 +0000 (16:19 +0300)
committermpa <mpa@opencascade.com>
Fri, 3 Feb 2017 13:19:13 +0000 (16:19 +0300)
doc/tui_component.rst
src/HEXABLOCKGUI/HEXABLOCKGUI.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI.hxx
src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx
src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx
src/HEXABLOCK_SWIG/hexablock.py

index d35241d42510b79e3ac5eccc0e738979968b672c..1a74d04c22785918d6576cd3223445cb51cafe94 100644 (file)
@@ -31,10 +31,6 @@ Get the document number *i*::
 Remove a document in the session::
 
     hexablock.removeDocument(doc_i)
-    
-Set the current study::
-
-       hexablock.SetCurrentStudy(theStudy)
 
 Get a document from the current study::
 
index 89a4f09fe0ddd11fe83202d23ed2c1a5d1fd83f4..5ea5168593f5d45134ab95909a28d7eeb74da442 100755 (executable)
@@ -337,15 +337,6 @@ bool HEXABLOCKGUI::activateModule( SUIT_Study* theStudy )
                 this, SLOT( onWindowClosed(SUIT_ViewWindow *) ), Qt::UniqueConnection );
     }
 
-    /* ************************************   TODO Hexa6
-    _hexaEngine->SetCurrentStudy(SALOMEDS::Study::_nil());
-    if ( SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( theStudy ))
-        if ( _PTR(Study) aStudy = s->studyDS()) {
-            _hexaEngine->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
-            updateObjBrowser(); // objects can be removed
-        }
-     ************************************ */
-
     if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL)
             currentOccGView->getViewWindow()->installEventFilter(this);
 
@@ -418,7 +409,7 @@ bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy )
     return bOk;
 }
 
-SALOMEDS::Study_var HEXABLOCKGUI::ClientStudy()
+SALOMEDS::Study_var HEXABLOCKGUI::getStudyServant()
 {
   SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
   CORBA::Object_var aSMObject = aNamingService->Resolve("/Study");
@@ -435,7 +426,7 @@ void HEXABLOCKGUI::addInStudy(QMap<QString, TopoDS_Shape>& topo_shapes,
 
     SalomeApp_Study* appStudy = HEXABLOCKGUI::activeStudy();
     if(!appStudy) return;
-    SALOMEDS::Study_var aDSStudy = ClientStudy();
+    SALOMEDS::Study_var aDSStudy = getStudyServant();
     SALOMEDS::StudyBuilder_var     aBuilder (aDSStudy->NewBuilder());
     QString entry = currentDocGView->getDocumentModel()->documentEntry();
     SALOMEDS::SObject_var aFatherSO = aDSStudy->FindObjectID( qPrintable(entry) );
@@ -499,29 +490,18 @@ bool HEXABLOCKGUI::renameObject( const QString& entry, const QString& name)
     if (dgview == NULL || dgview->getDocumentModel() == NULL)
         return result;
 
-    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication());
-    SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
-
-    if(!appStudy)
-        return result;
-
-    _PTR(Study) aStudy = appStudy->studyDS();
-
-    if(!aStudy)
-        return result;;
-
-    _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) );
+    _PTR(SObject) obj ( SalomeApp_Application::getStudy()->FindObjectID(qPrintable(entry)) );
     _PTR(GenericAttribute) anAttr;
     if ( obj ){
-        if ( obj->FindAttribute(anAttr, "AttributeName") ){
-            _PTR(AttributeName) aName (anAttr);
-            DocumentModel* docModel = dgview->getDocumentModel();
-            docModel->setName( name );
-            aName->SetValue( name.toLatin1().data() );
-            getApp()->updateObjectBrowser();
-//            _dwPattern->setWindowTitle( name );
-            result = true;
-        }
+      if ( obj->FindAttribute(anAttr, "AttributeName") ) {
+        _PTR(AttributeName) aName (anAttr);
+        DocumentModel* docModel = dgview->getDocumentModel();
+        docModel->setName( name );
+        aName->SetValue( name.toLatin1().data() );
+        getApp()->updateObjectBrowser();
+//        _dwPattern->setWindowTitle( name );
+        result = true;
+      }
     }
     return result;
 }
@@ -824,7 +804,7 @@ bool HEXABLOCKGUI::createSComponent() //addComponent
     DEBTRACE("HEXABLOCKGUI::createSComponent");
     // --- Find or create (if not done yet) "HEXABLOCK" SComponent in the study
 
-    _PTR(Study)            aStudy = (( SalomeApp_Study* )(getApp()->activeStudy()))->studyDS();
+    _PTR(Study)            aStudy = SalomeApp_Application::getStudy();
     _PTR(StudyBuilder)     aBuilder (aStudy->NewBuilder());
     _PTR(GenericAttribute) anAttr;
     _PTR(AttributeName)    aName;
@@ -3213,7 +3193,7 @@ QString HEXABLOCKGUI::addDocInStudy (HEXA_NS::Document* document)
     if (app_study == NULL)
         return docEntry;
 
-    SALOMEDS::Study_var ds_study = ClientStudy();
+    SALOMEDS::Study_var ds_study = getStudyServant();
     SALOMEDS::StudyBuilder_var aBuilder (ds_study->NewBuilder());
     QString entry = app_study->centry("HEXABLOCK");
     SALOMEDS::SObject_var aFatherSO = ds_study->FindObjectID( qPrintable(entry) );
index c7efb37e42c5ca107909a2576e1845c1e34ff324..2b37fa2757f4d1ea9f21f1d99290754b4721a4f2 100755 (executable)
@@ -136,7 +136,7 @@ public:
 
   // static HEXABLOCK_ORB::HEXABLOCK_Gen_ptr InitHEXABLOCKGen( SalomeApp_Application* );
   static LightApp_SelectionMgr*   selectionMgr();
-  static SALOMEDS::Study_var  ClientStudy();
+  static SALOMEDS::Study_var  getStudyServant();
   static ViewType getActiveViewType();
   static HEXABLOCKGUI*  getInstance();
 
index 27a62c43d07076589a73b7ad9dad8a5c7d4bce46..50737eff1afef9dbe1c6b01a96d42f33579f0117 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <SUIT_Session.h>
 
-#include <SalomeApp_Study.h>
 #include <SalomeApp_Application.h>
 
 #include <OCCViewer_ViewWindow.h>
@@ -89,13 +88,12 @@ namespace GUI
        }
 
 
-       _PTR(Study) GetActiveStudyDocument()
+       _PTR(Study) getStudy()
        {
-               SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(GetActiveStudy());
-               if (aStudy)
-                       return aStudy->studyDS();
-               else
-                       return _PTR(Study)();
+      static _PTR(Study) _study;
+        if(!_study)
+          _study = SalomeApp_Application::getStudy();
+      return _study;
        }
 
 
index 2683d4857dc82bae92f554325039dd3ec2e1953b..9515fa0903eb3f0e8b718b3fdbd93cadfef2e596 100644 (file)
@@ -41,7 +41,7 @@ namespace HEXABLOCK
   {
 
 HEXABLOCK_EXPORT  SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry );
-  _PTR(Study)   GetActiveStudyDocument();
+  _PTR(Study)   getStudy();
 
 HEXABLOCK_EXPORT int GetNameOfSelectedElements( SVTK_ViewWindow *theWindow,/* SVTK_Selector* theSelector,*/
                                  const Handle(SALOME_InteractiveObject)& theIO,
index 6698c87884a1b72765d92795c2037b16e96ee759..cd94a9e5cd657264151ca47af81e0382ccc8a82e 100644 (file)
@@ -28,12 +28,12 @@ import salome
 salome.salome_init()
 
 from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
+geompy = geomBuilder.New()
 
 
 import SMESH
 from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
 
 component = hexablock_swig.hex_instance ()
 
@@ -149,7 +149,7 @@ def mesh (doc, name=None, dim=3, container="FactoryServer"):
 
     geompy.addToStudy(shape, name)
     comp_smesh = salome.lcc.FindOrLoadComponent(container, "SMESH")
-    comp_smesh.init_smesh(study, geomBuilder.geom)
+    comp_smesh.init_smesh(geomBuilder.geom)
     meshexa = comp_smesh.Mesh(shape)
 
     so = "libHexaBlockPluginEngine.so"
@@ -188,8 +188,8 @@ def getFromStudy(entry):
 
 # ==================================================== findOrCreateComponent
 # Find or create HexaBlock Study Component
-def findOrCreateComponent( study, builder ):
-    father = study.FindComponent( moduleName() )
+def findOrCreateComponent( builder ):
+    father = salome.myStudy.FindComponent( moduleName() )
     if father is None:
        father = builder.NewComponent( moduleName() )
        attr = builder.FindOrCreateAttribute( father, "AttributeName" )
@@ -208,7 +208,7 @@ def addToStudy(doc):
 
     study   = salome.myStudy
     builder = study.NewBuilder()
-    father  = findOrCreateComponent( study, builder )
+    father  = findOrCreateComponent( builder )
     name    = doc.getName ()
 
     present = study.FindObjectByName(name, moduleName())