From: san Date: Mon, 24 Jan 2005 16:00:40 +0000 (+0000) Subject: PAL7768 X-Git-Tag: V2_2_0b2~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc8466f4ed277f900171b2b7c39fd63a8433c63f;p=modules%2Fgeom.git PAL7768 --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 35bcfaa4c..6ed153980 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1599,6 +1599,18 @@ module GEOM void GetShapeProcessParameters (out string_array theOperators, out string_array theParameters, out string_array theValues); + /*! + * Get parameters and parameters' values for the given Shape Process operation. + * In the current implementation the defaults are + * read from the file pointed by CSF_ShHealingDefaults environmental variable. + * \param theOperator Input. The operator's name. + * \param theParameters Output. Default list of names of parameters. + * \param theValues Output. List of default values of parameters, in the same order + * as parameters are listed in \a theParameters list. + */ + void GetOperatorParameters (in string theOperator, + out string_array theParameters, + out string_array theValues); /*! * Remove faces from the given object (shape). diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 9beb4ce2d..27b5ffcf9 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -1672,6 +1672,9 @@ msgstr "Please, select at least one Shape Process operation to proceed." msgid "RepairGUI_ShapeProcessDlg::ERROR_NO_OBJECTS" msgstr "Please, select a geometrical object for Shape Processing." +msgid "RepairGUI_ShapeProcessDlg::TIME_CONSUMING" +msgstr "Enabling this option may result in a very time-consuming operation for some input shapes.\nWould you like to continue?" + msgid "MeasureGUI_PointDlg::POINT" msgstr "Point" diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx index 15852e313..144455fce 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx @@ -141,29 +141,14 @@ void GEOMImpl_IHealingOperations::GetShapeProcessParameters (list& theOp { ShHealOper_ShapeProcess aHealer; TColStd_SequenceOfAsciiString anOperators; - int nbOperatorErrors( 0 ), nbParamValueErrors( 0 ); + int nbOperatorErrors( 0 ); if ( aHealer.GetOperators( anOperators ) ) { for ( Standard_Integer i = 1; i <= anOperators.Length(); i++ ) { string anOperation = anOperators.Value( i ).ToCString(); - theOperations.push_back( anOperation ); - list aParams, aValues; - if ( GetParameters( anOperation, aParams ) ) - { - for ( list::iterator it = aParams.begin(); it != aParams.end(); ++it ) - { - TCollection_AsciiString aParam( (Standard_CString)(*it).c_str() ); - TCollection_AsciiString aValue; - if ( aHealer.GetParameter( aParam, aValue ) ) - { - theParams.push_back( aParam.ToCString() ); - theValues.push_back( aValue.ToCString() ); - } - else - nbParamValueErrors++; - } - } + if ( GetOperatorParameters( anOperation, theParams, theValues ) ) + theOperations.push_back( anOperation ); else nbOperatorErrors++; } @@ -173,11 +158,43 @@ void GEOMImpl_IHealingOperations::GetShapeProcessParameters (list& theOp SetErrorCode("ERROR retrieving operators (GEOMImpl_IHealingOperations)"); } - if (nbOperatorErrors || nbParamValueErrors) { + if ( nbOperatorErrors ) { TCollection_AsciiString aMsg ("ERRORS retrieving ShapeProcess parameters (GEOMImpl_IHealingOperations): nbOperatorErrors = "); - aMsg += TCollection_AsciiString(nbOperatorErrors); - aMsg += " ,nbParamValueErrors = "; - aMsg += TCollection_AsciiString(nbParamValueErrors); + aMsg += TCollection_AsciiString( nbOperatorErrors ); + MESSAGE(aMsg.ToCString()); + } +} + +//============================================================================= +/*! + * GetOperatorParameters + */ +//============================================================================= +bool GEOMImpl_IHealingOperations::GetOperatorParameters( const string theOperation, + list& theParams, + list& theValues ) +{ + ShHealOper_ShapeProcess aHealer; + int nbParamValueErrors( 0 ); + list aParams; + if ( GetParameters( theOperation, aParams ) ) { + for ( list::iterator it = aParams.begin(); it != aParams.end(); ++it ) { + TCollection_AsciiString aParam( (Standard_CString)(*it).c_str() ); + TCollection_AsciiString aValue; + if ( aHealer.GetParameter( aParam, aValue ) ) { + theParams.push_back( aParam.ToCString() ); + theValues.push_back( aValue.ToCString() ); + } + else + nbParamValueErrors++; + } + } + else + return false; + + if ( nbParamValueErrors ) { + TCollection_AsciiString aMsg ("ERRORS retrieving ShapeProcess parameter values (GEOMImpl_IHealingOperations): nbParamValueErrors = "); + aMsg += TCollection_AsciiString( nbParamValueErrors ); MESSAGE(aMsg.ToCString()); } } diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx index b167bcd0d..3203ea99a 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.hxx @@ -23,10 +23,15 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations { const Handle(TColStd_HArray1OfExtendedString)& theValues ); // Retrieve default Shape Process parameters (from resource file) - void GetShapeProcessParameters( list& theOperations, - list& theParams, + void GetShapeProcessParameters( list& theOperations, + list& theParams, list& theValues ); + // Retrieve default Shape Process parameters for given operator + bool GetOperatorParameters( const string theOperation, + list& theParams, + list& theValues ); + // returns all parameters that are valid for the given operation (Shape Process operator) static bool GetParameters( const string theOperation, list& theParams ); diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.cc b/src/GEOM_I/GEOM_IHealingOperations_i.cc index ea8fe487f..2190a7eb2 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.cc +++ b/src/GEOM_I/GEOM_IHealingOperations_i.cc @@ -123,6 +123,10 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out GEOM::string_array_out theParams, GEOM::string_array_out theValues) { + GEOM::string_array_var anOpArray = new GEOM::string_array(); + GEOM::string_array_var aParArray = new GEOM::string_array(); + GEOM::string_array_var aValArray = new GEOM::string_array(); + // retrieve the values as stl-lists list operationsList, paramsList, valuesList; GetOperations()->GetShapeProcessParameters( operationsList, paramsList, valuesList ); @@ -130,33 +134,64 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out parSize = paramsList.size(), valSize = valuesList.size(); - // returns in case of an error - if ( opSize < 0 || parSize < 0 || parSize != valSize ) - return; + if ( opSize >= 0 && parSize >= 0 && parSize == valSize ) { + // allocate the CORBA arrays, sizes == returned lists' sizes + anOpArray->length(opSize); + aParArray->length(parSize); + aValArray->length(valSize); + + // fill the local CORBA arrays with values from lists + list::iterator opIt, parIt, valIt; + int i = 0; + for ( opIt = operationsList.begin(); opIt != operationsList.end(); i++,++opIt ) + anOpArray[i] = CORBA::string_dup( (*opIt).c_str() ); + + for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin(); + parIt != paramsList.end(); i++, ++parIt,++valIt ) { + aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); + aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); + } + } - // allocate the CORBA arrays, sizes == returned lists' sizes - GEOM::string_array_var anOpArray = new GEOM::string_array(); + // initialize out-parameters with local arrays + theOperations = anOpArray._retn(); + theParams = aParArray._retn(); + theValues = aValArray._retn(); +} + +//============================================================================= +/*! + * GetOperatorParameters + */ +//============================================================================= +void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator, + GEOM::string_array_out theParams, + GEOM::string_array_out theValues) +{ GEOM::string_array_var aParArray = new GEOM::string_array(); GEOM::string_array_var aValArray = new GEOM::string_array(); - anOpArray->length(opSize); - aParArray->length(parSize); - aValArray->length(valSize); - - // fill the local CORBA arrays with values from lists - list::iterator opIt, parIt, valIt; - int i = 0; - for ( opIt = operationsList.begin(); opIt != operationsList.end(); i++,++opIt ) - anOpArray[i] = CORBA::string_dup( (*opIt).c_str() ); - - for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin(); - parIt != paramsList.end(); i++, ++parIt,++valIt ) - { - aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); - aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); + + // retrieve the values as stl-lists + list paramsList, valuesList; + if ( GetOperations()->GetOperatorParameters( theOperator, paramsList, valuesList ) ) { + const int parSize = paramsList.size(), valSize = valuesList.size(); + + if ( parSize == valSize ) { + aParArray->length(parSize); + aValArray->length(valSize); + + // fill the local CORBA arrays with values from lists + list::iterator parIt, valIt; + int i; + for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin(); + parIt != paramsList.end(); i++, ++parIt,++valIt ) { + aParArray[i] = CORBA::string_dup( (*parIt).c_str() ); + aValArray[i] = CORBA::string_dup( (*valIt).c_str() ); + } + } } // initialize out-parameters with local arrays - theOperations = anOpArray._retn(); theParams = aParArray._retn(); theValues = aValArray._retn(); } diff --git a/src/GEOM_I/GEOM_IHealingOperations_i.hh b/src/GEOM_I/GEOM_IHealingOperations_i.hh index f26f5dc99..bf5d8eb98 100644 --- a/src/GEOM_I/GEOM_IHealingOperations_i.hh +++ b/src/GEOM_I/GEOM_IHealingOperations_i.hh @@ -26,6 +26,8 @@ class GEOM_IHealingOperations_i : void GetShapeProcessParameters(GEOM::string_array_out theOperations, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + void GetOperatorParameters (const char* theOperator, GEOM::string_array_out theParams, GEOM::string_array_out theValues); + GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theFaces); GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires, CORBA::Boolean isCommonVertex);