]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
bos #20253 KERNEL helpers: study editor must be re-initialized when new study is... V9_6_BR fixes_for_960 V9_6_0 V9_6_0rc1
authorvsr <vsr@opencascade.com>
Thu, 22 Oct 2020 18:51:25 +0000 (21:51 +0300)
committervsr <vsr@opencascade.com>
Thu, 22 Oct 2020 18:51:25 +0000 (21:51 +0300)
src/KernelHelpers/SALOME_StudyEditor.cxx
src/KernelHelpers/SALOME_StudyEditor.hxx

index 1d5df1ee49dd612298f286fb3f06f1dd119387a9..ca959454701190fd55d103c4b05182f5f18c2441 100644 (file)
 
 /** Canonic constructor. The object can't be used without a setStudy() */
 SALOME_StudyEditor::SALOME_StudyEditor() {
-  _sbuilder = KERNEL::getStudyServant()->NewBuilder();
+}
+
+SALOMEDS::StudyBuilder_var SALOME_StudyEditor::studyBuilder()
+{
+  return KERNEL::getStudyServant()->NewBuilder();
 }
 
 SALOMEDS::SObject_ptr SALOME_StudyEditor::newObject(SALOMEDS::SObject_ptr parent) {
-  return _sbuilder->NewObject(parent);
+  return studyBuilder()->NewObject(parent);
 }
 
 SALOMEDS::SObject_ptr SALOME_StudyEditor::findObject(const char * entry) {
@@ -39,8 +43,8 @@ SALOMEDS::SObject_ptr SALOME_StudyEditor::findObject(const char * entry) {
 SALOMEDS::SComponent_ptr SALOME_StudyEditor::newRoot(const char * moduleName) {
   SALOMEDS::SComponent_var sroot = findRoot(moduleName);
   if ( sroot->_is_nil() ) {
-    sroot = _sbuilder->NewComponent(moduleName);
-    _sbuilder->SetName(sroot,moduleName);
+    sroot = studyBuilder()->NewComponent(moduleName);
+    studyBuilder()->SetName(sroot,moduleName);
   }
   return sroot._retn();
 }
@@ -54,7 +58,7 @@ bool SALOME_StudyEditor::bindEngine(SALOMEDS::SComponent_var studyRoot,
   // raising (eh, you work on SALOME isn't it?)
   SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(engine);
   if ( driver->_is_nil() || studyRoot->_is_nil() ) return false;
-  _sbuilder->DefineComponentInstance(studyRoot, engine);
+  studyBuilder()->DefineComponentInstance(studyRoot, engine);
   return true;
 }
 
@@ -63,7 +67,7 @@ SALOMEDS::SComponent_ptr SALOME_StudyEditor::findRoot(const char * moduleName) {
 }
 
 void SALOME_StudyEditor::setName(SALOMEDS::SObject_var sobject, const char * value) {
-  _sbuilder->SetName(sobject,value);  
+  studyBuilder()->SetName(sobject,value);  
 }
 const char * SALOME_StudyEditor::getName(SALOMEDS::SObject_var sobject) {
   if (sobject->_is_nil()) return NULL;
@@ -83,7 +87,7 @@ const char * SALOME_StudyEditor::getName(SALOMEDS::SObject_var sobject) {
 void SALOME_StudyEditor::setIcon(SALOMEDS::SObject_var sobject, const char * resourcename) {
   SALOMEDS::GenericAttribute_var anAttr;
   SALOMEDS::AttributePixMap_var aPixmap;
-  anAttr = _sbuilder->FindOrCreateAttribute(sobject, "AttributePixMap");
+  anAttr = studyBuilder()->FindOrCreateAttribute(sobject, "AttributePixMap");
   aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
   aPixmap->SetPixMap(resourcename);
 }
@@ -101,7 +105,7 @@ void SALOME_StudyEditor::setIcon(SALOMEDS::SObject_var sobject, const char * res
 void SALOME_StudyEditor::setParameterInt(SALOMEDS::SObject_var sobject, const char * name, int value) { 
   SALOMEDS::GenericAttribute_var anAttr;
   SALOMEDS::AttributeParameter_var aParam;
-  anAttr = _sbuilder->FindOrCreateAttribute(sobject, "AttributeParameter");
+  anAttr = studyBuilder()->FindOrCreateAttribute(sobject, "AttributeParameter");
   aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
   aParam->SetInt(name,value);
 }
@@ -125,7 +129,7 @@ int SALOME_StudyEditor::getParameterInt(SALOMEDS::SObject_var sobject, const cha
 void SALOME_StudyEditor::setParameterBool(SALOMEDS::SObject_var sobject, const char * name, bool value) {
   SALOMEDS::GenericAttribute_var anAttr;
   SALOMEDS::AttributeParameter_var aParam;
-  anAttr = _sbuilder->FindOrCreateAttribute(sobject, "AttributeParameter");
+  anAttr = studyBuilder()->FindOrCreateAttribute(sobject, "AttributeParameter");
   aParam = SALOMEDS::AttributeParameter::_narrow(anAttr);
   aParam->SetBool(name,value);
 }
index 690d72f2cbf20de30daba58c47bf35331582a73f..440072caaa348d463e2e4b89e7f7f3fa838513f0 100644 (file)
@@ -56,7 +56,7 @@ public:
   static const int UNDEFINED = -1;
 
 private:
-  SALOMEDS::StudyBuilder_var _sbuilder;
+  SALOMEDS::StudyBuilder_var studyBuilder();
 };
 
 #endif // __STUDY_EDITOR_HXX__