From a1f6e9582ddccfe6117b2f8803c2618fa18b578f Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 22 Sep 2014 11:41:20 +0400 Subject: [PATCH] 0022616: [CEA 1038] Improve the quality of stl and vtk exports Additional modification to obsolete ImportFile() function, to return list of GEOM::GEOM_BaseObject, instead of list of GEOM::GEOM_Object, to properly handle fields. --- idl/GEOM_Gen.idl | 2 +- src/GEOM_I/GEOM_Gen_i.cc | 2 +- src/GEOM_I/GEOM_IInsertOperations_i.cc | 8 ++++---- src/GEOM_I/GEOM_IInsertOperations_i.hh | 4 ++-- src/GEOM_I_Superv/GEOM_Superv_i.cc | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 149bf9674..076f4fed4 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -3720,7 +3720,7 @@ module GEOM * file length unit will be ignored (set to 'meter') and result model will be scaled. * \return List of GEOM_Object, containing the created shape and groups of materials. */ - ListOfGO ImportFile (in string theFileName, in string theFormatName); + ListOfGBO ImportFile (in string theFileName, in string theFormatName); /*! * \brief Deprecated method. Use ReadValue (from the corresponding plugin) instead. diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 8069f40fe..e939d30f1 100755 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -2967,7 +2967,7 @@ Engines::ListOfIdentifiers* GEOM_Gen_i::importData( aFile.write(aBuffer, aFileStream->length()); aFile.close(); - GEOM::ListOfGO_var aObjects = aInsOp->ImportFile(aFullPath.c_str(), "XAO"); + GEOM::ListOfGBO_var aObjects = aInsOp->ImportFile(aFullPath.c_str(), "XAO"); if ( aObjects->length() > 0 && aInsOp->IsDone() ) { aResult->length(aObjects->length()); diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.cc b/src/GEOM_I/GEOM_IInsertOperations_i.cc index 476e29ad7..5de4d1f23 100644 --- a/src/GEOM_I/GEOM_IInsertOperations_i.cc +++ b/src/GEOM_I/GEOM_IInsertOperations_i.cc @@ -33,7 +33,7 @@ #include "Utils_ExceptHandlers.hxx" #include "GEOM_Engine.hxx" -#include "GEOM_Object.hxx" +#include "GEOM_BaseObject.hxx" #include @@ -121,11 +121,11 @@ void GEOM_IInsertOperations_i::Export * ImportFile */ //============================================================================= -GEOM::ListOfGO* GEOM_IInsertOperations_i::ImportFile +GEOM::ListOfGBO* GEOM_IInsertOperations_i::ImportFile (const char* theFileName, const char* theFormatName) { - GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + GEOM::ListOfGBO_var aSeq = new GEOM::ListOfGBO; //Set a not done flag GetOperations()->SetNotDone(); @@ -142,7 +142,7 @@ GEOM::ListOfGO* GEOM_IInsertOperations_i::ImportFile aSeq->length(aLength); for (Standard_Integer i = 1; i <= aLength; i++) - aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i))); + aSeq[i-1] = GetBaseObject(Handle(GEOM_BaseObject)::DownCast(aHSeq->Value(i))); return aSeq._retn(); } diff --git a/src/GEOM_I/GEOM_IInsertOperations_i.hh b/src/GEOM_I/GEOM_IInsertOperations_i.hh index e06ffa08e..4a2b4f2cc 100644 --- a/src/GEOM_I/GEOM_IInsertOperations_i.hh +++ b/src/GEOM_I/GEOM_IInsertOperations_i.hh @@ -49,8 +49,8 @@ class GEOM_I_EXPORT GEOM_IInsertOperations_i : const char* theFileName, const char* theFormatName); - GEOM::ListOfGO* ImportFile (const char* theFileName, - const char* theFormatName); + GEOM::ListOfGBO* ImportFile (const char* theFileName, + const char* theFormatName); char* ReadValue (const char* theFileName, const char* theFormatName, diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 9070d8e9b..867a5c6f7 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1715,15 +1715,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportFile (const char* theFileName, beginService( " GEOM_Superv_i::ImportFile" ); MESSAGE("GEOM_Superv_i::ImportFile"); getInsOp(); - GEOM::ListOfGO* aSeq = myInsOp->ImportFile(theFileName, theFormatName); - GEOM::GEOM_Object_ptr anObj; + GEOM::ListOfGBO_var aSeq = myInsOp->ImportFile(theFileName, theFormatName); + GEOM::GEOM_Object_var anObj; if (aSeq->length() > 0) { - anObj = aSeq->operator[](0); + anObj = GEOM::GEOM_Object::_narrow(aSeq[0]); } endService( " GEOM_Superv_i::ImportFile" ); - return anObj; + return anObj._retn(); } //============================= TransformOperations =========================== -- 2.30.2