From: ouv Date: Wed, 2 Dec 2009 13:22:18 +0000 (+0000) Subject: Notebook: processed creation of objects dependent on another objects. X-Git-Tag: PHASE_17_Part1_V1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d733e067401aaf7203e41d14274e9f0fa97c296c;hp=f375ccb6ec0bc0c104d61aab40ae1148c83cd73b;p=modules%2Fgeom.git Notebook: processed creation of objects dependent on another objects. --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index a2aac3e4d..1951cbe02 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -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); }; }; diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 184690c13..bff850673 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -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 //===================================================================================== diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index 2bdee062d..967cd9ca5 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -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 // //-----------------------------------------------------------------------// diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 14922b2e0..d90031f5b 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -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); } //============================================================================= diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc index 278d9090d..d0d28dfbd 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.cc +++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc @@ -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); } //============================================================================= diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc index daf9be27b..3db879ed3 100644 --- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc +++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc @@ -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); } //============================================================================= diff --git a/src/GEOM_I/GEOM_IOperations_i.cc b/src/GEOM_I/GEOM_IOperations_i.cc index 4114d6647..5116b98cf 100644 --- a/src/GEOM_I/GEOM_IOperations_i.cc +++ b/src/GEOM_I/GEOM_IOperations_i.cc @@ -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; } //============================================================================= diff --git a/src/GEOM_I/GEOM_IOperations_i.hh b/src/GEOM_I/GEOM_IOperations_i.hh index 54e7b6dad..ef1d6d323 100644 --- a/src/GEOM_I/GEOM_IOperations_i.hh +++ b/src/GEOM_I/GEOM_IOperations_i.hh @@ -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();