Move string list conversion method to the base class

This commit is contained in:
skv 2014-09-12 10:32:29 +04:00
parent 4745388c8f
commit e1490f893e
4 changed files with 35 additions and 27 deletions

View File

@ -78,25 +78,6 @@ Handle(TColStd_HArray1OfInteger) GEOM_IHealingOperations_i::Convert
return anOutArray;
}
//=============================================================================
/*!
* Convert
*/
//=============================================================================
Handle(TColStd_HArray1OfExtendedString) GEOM_IHealingOperations_i::Convert
(const GEOM::string_array& theInArray)
{
Handle(TColStd_HArray1OfExtendedString) anOutArray;
int n = theInArray.length();
if ( n <= 0 )
return anOutArray;
anOutArray = new TColStd_HArray1OfExtendedString( 1, n );
for ( int i = 0; i < n; i++ )
anOutArray->SetValue( i+1, TCollection_ExtendedString( theInArray[i].in() ) );
return anOutArray;
}
//=============================================================================
/*!
* ProcessShape
@ -125,7 +106,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ProcessShape (GEOM::GEOM_Object
// Perform
Handle(GEOM_Object) aNewObject = GetOperations()->ShapeProcess( anObject,
Convert( theOperations ), Convert( theParams ), Convert( theValues ) );
ConvertStringArray( theOperations ), ConvertStringArray( theParams ),
ConvertStringArray( theValues ) );
if ( !GetOperations()->IsDone() || aNewObject.IsNull() )
return aGEOMObject._retn();

View File

@ -33,9 +33,6 @@
#include "GEOMImpl_IHealingOperations.hxx"
#include <TColStd_HArray1OfExtendedString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
class GEOM_I_EXPORT GEOM_IHealingOperations_i :
public virtual POA_GEOM::GEOM_IHealingOperations,
public virtual GEOM_IOperations_i
@ -101,7 +98,6 @@ class GEOM_I_EXPORT GEOM_IHealingOperations_i :
::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); }
private:
Handle(TColStd_HArray1OfExtendedString) Convert( const GEOM::string_array& );
Handle(TColStd_HArray1OfInteger) Convert( const GEOM::short_array& );
};

View File

@ -237,3 +237,28 @@ void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj)
}
}
}
//=============================================================================
/*!
* ConvertStringArray
*/
//=============================================================================
Handle(TColStd_HArray1OfExtendedString) GEOM_IOperations_i::ConvertStringArray
(const GEOM::string_array &theInArray)
{
Handle(TColStd_HArray1OfExtendedString) anOutArray;
const int n = theInArray.length();
int i;
if (n <= 0) {
return anOutArray;
}
anOutArray = new TColStd_HArray1OfExtendedString( 1, n );
for (i = 0; i < n; i++) {
anOutArray->SetValue(i + 1, TCollection_ExtendedString(theInArray[i].in()));
}
return anOutArray;
}

View File

@ -52,9 +52,6 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
virtual GEOM::GEOM_Object_ptr GetObject(Handle(GEOM_Object) theObject);
virtual Handle(GEOM_Object) GetObjectImpl(GEOM::GEOM_Object_ptr theObject);
virtual Handle(TColStd_HSequenceOfTransient)
GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects);
virtual void StartOperation();
virtual void FinishOperation();
@ -66,6 +63,14 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
virtual void UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj);
protected:
Handle(TColStd_HSequenceOfTransient)
GetListOfObjectsImpl(const GEOM::ListOfGO& theObjects);
Handle(TColStd_HArray1OfExtendedString)
ConvertStringArray(const GEOM::string_array &theInArray);
private:
::GEOM_IOperations* _impl;