From fcadb99dda6907b549d342cb8023a4b899fc0b59 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 4 Apr 2005 06:35:09 +0000 Subject: [PATCH] Dump Python: gives for SMESH access to all dump names to avoid same names of different objects. --- idl/GEOM_Gen.idl | 10 ++++++++-- src/GEOM_I/GEOM_DumpPython.cc | 24 ++++++++++++++++++++++++ src/GEOM_I/GEOM_Gen_i.cc | 5 +++-- src/GEOM_I/GEOM_Gen_i.hh | 2 ++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index aa0c9ace9..3cb2e9742 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1985,12 +1985,18 @@ module GEOM */ string GetStringFromIOR (in GEOM_Object theObject); - /*! + /*! * Returns a name with which a GEOM object was dumped into python script * \param theStudyEntry is an entry of the GEOM object in the study */ string GetDumpName (in string theStudyEntry); -}; + + /*! + * Returns all names with which a GEOM objects was dumped + * into python script to avoid the same names in SMESH script + */ + string_array GetAllDumpNames(); + }; }; #endif diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc index 8ed8ce4bc..6b9b92e8e 100644 --- a/src/GEOM_I/GEOM_DumpPython.cc +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -6,6 +6,11 @@ using namespace std; #include #include +//======================================================================= +//function : DumpPython +//purpose : +//======================================================================= + Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished, CORBA::Boolean& isValidScript) @@ -68,3 +73,22 @@ char* GEOM_Gen_i::GetDumpName (const char* theStudyEntry) return NULL; } +//======================================================================= +//function : GetAllDumpNames +//purpose : +//======================================================================= + +GEOM::string_array* GEOM_Gen_i::GetAllDumpNames() +{ + Handle(TColStd_HSequenceOfAsciiString) aHSeq = _impl->GetAllDumpNames(); + int i = 0, aLen = aHSeq->Length(); + + GEOM::string_array_var seq = new GEOM::string_array(); + seq->length(aLen); + + for (; i < aLen; i++) { + seq[i] = CORBA::string_dup(aHSeq->Value(i + 1).ToCString()); + } + + return seq._retn(); +} diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 56ad67851..4948e0079 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -760,7 +760,8 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theS * AddSubShape */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape(GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfLong& theIndices) +GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShape, + const GEOM::ListOfLong& theIndices) { if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil(); Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry()); @@ -769,7 +770,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape(GEOM::GEOM_Object_ptr theMainShape Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length()); for(Standard_Integer i = 0; iSetValue(i+1, theIndices[i]); - Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray); + Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray, true); if(anObject.IsNull()) return GEOM::GEOM_Object::_nil(); TCollection_AsciiString anEntry; diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index 27c4243e3..4c0d95164 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -181,6 +181,8 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, public Engines_Component_i char* GetDumpName (const char* theStudyEntry); + GEOM::string_array* GetAllDumpNames(); + //********************************************************************************************************// // Internal methods //********************************************************************************************************// -- 2.39.2