Salome HOME
Notebook: processed creation of objects dependent on another objects.
authorouv <ouv@opencascade.com>
Wed, 2 Dec 2009 13:22:18 +0000 (13:22 +0000)
committerouv <ouv@opencascade.com>
Wed, 2 Dec 2009 13:22:18 +0000 (13:22 +0000)
idl/GEOM_Gen.idl
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_I/GEOM_Gen_i.hh
src/GEOM_I/GEOM_I3DPrimOperations_i.cc
src/GEOM_I/GEOM_IBasicOperations_i.cc
src/GEOM_I/GEOM_ICurvesOperations_i.cc
src/GEOM_I/GEOM_IOperations_i.cc
src/GEOM_I/GEOM_IOperations_i.hh

index a2aac3e4d9a71e2be4b0312f60f08f6e3e33f462..1951cbe02ecf8ece703d895a18d40395d9b7a9f2 100644 (file)
@@ -3201,6 +3201,12 @@ module GEOM
     ListOfGO PublishNamedShapesInStudy(in SALOMEDS::Study theStudy,
                                             //in SObject theSObject,
                                             in Object theObject);
+
+    /*!
+     *  Returns a pointer to SALOME Notebook interface.
+     *  \param theStudyID is a SALOMEDS Study ID
+     */
+    SALOME::Notebook GetNotebook(in long theStudyID);
   };
 };
 
index 184690c13a390d754830a6e4b33f7973fd4b5b51..bff850673e108cb302670ac5f1e388db9678d837 100644 (file)
@@ -1815,6 +1815,19 @@ char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry)
   return ret;
 }
 
+//=================================================================================
+// function : GetNotebook()
+// purpose  : Returns a pointer to SALOME Notebook object by an id of the study
+//=================================================================================
+SALOME::Notebook_ptr GEOM_Gen_i::GetNotebook( CORBA::Long theStudyID )
+{
+  CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
+  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
+  SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( theStudyID );
+  SALOME::Notebook_var aNotebook = aStudy->GetNotebook();
+  return aNotebook._retn();
+}
+
 //=====================================================================================
 // EXPORTED METHODS
 //=====================================================================================
index 2bdee062d71d25f6c61bb9cf6199e26db72aba5b..967cd9ca5b6e71cc05cd94cd880d39b3d29c2a70 100644 (file)
@@ -242,6 +242,8 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
   virtual bool hasObjectInfo();
   virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
   
+  SALOME::Notebook_ptr GetNotebook(CORBA::Long theStudyID);
+  
   //-----------------------------------------------------------------------//
   // Internal methods                                                      //
   //-----------------------------------------------------------------------//
index 14922b2e0240a7fbf2e183d6eb3ff2bc0255a809..d90031f5bde6fc90611a31b5b2afc6ffe59127cc 100644 (file)
@@ -71,7 +71,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double the
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -122,7 +122,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -234,7 +234,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -255,7 +255,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -305,7 +305,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double the
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -354,7 +354,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -403,7 +403,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
index 278d9090df9c92c7c85d3de0f18882419b677937..d0d28dfbda463a629fb1d136871ef1470d00b049 100644 (file)
@@ -72,7 +72,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointXYZ
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -288,7 +288,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeVectorDXDYDZ
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -558,7 +558,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
index daf9be27b6a0edb96fbbcf63c9a6fc076889caed..3db879ed35abf21810b7eb452c8ecb49bd4a9a48 100644 (file)
@@ -447,7 +447,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
@@ -473,7 +473,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();
 
-  return GetObject(anObject);
+  return GetObject(anObject, false);
 }
 
 //=============================================================================
index 4114d6647a0cfdcc579a6e6f276b1e139d9ec214..5116b98cf65056e6c190de05c44684f18bbaaa7e 100644 (file)
@@ -129,14 +129,21 @@ void GEOM_IOperations_i::AbortOperation()
  *  GetObject
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObject)
+GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObject,
+                                                    bool theIsDependent)
 {
   GEOM::GEOM_Object_var GO;
   if (theObject.IsNull()) return GO._retn();
   TCollection_AsciiString anEntry;
   TDF_Tool::Entry(theObject->GetEntry(), anEntry);
   GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString());
-  return GO._retn();
+  GEOM::GEOM_Object_ptr aResult = GO._retn();
+  if (theIsDependent && !CORBA::is_nil(aResult)) {
+    SALOME::Notebook_ptr aNotebook = _engine->GetNotebook(aResult->GetStudyID());
+    if (!CORBA::is_nil(aNotebook))
+      aResult->StoreDependencies(aNotebook);
+  }
+  return aResult;
 }
 
 //=============================================================================
index 54e7b6dad87db2b1e424177629729995e789a5fd..ef1d6d323b97f2835783dfd26c850a32bad8b304 100644 (file)
@@ -46,7 +46,7 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
 
   virtual CORBA::Long GetStudyID();    
 
-  virtual GEOM::GEOM_Object_ptr GetObject(Handle(GEOM_Object) theObject);
+  virtual GEOM::GEOM_Object_ptr GetObject(Handle(GEOM_Object) theObject, bool theIsDependent = true);
   virtual Handle(GEOM_Object) GetObjectImpl(GEOM::GEOM_Object_ptr theObject);
 
   virtual void StartOperation();