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).
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"
{
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<string> aParams, aValues;
- if ( GetParameters( anOperation, aParams ) )
- {
- for ( list<string>::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++;
}
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<string>& theParams,
+ list<string>& theValues )
+{
+ ShHealOper_ShapeProcess aHealer;
+ int nbParamValueErrors( 0 );
+ list<string> aParams;
+ if ( GetParameters( theOperation, aParams ) ) {
+ for ( list<string>::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());
}
}
const Handle(TColStd_HArray1OfExtendedString)& theValues );
// Retrieve default Shape Process parameters (from resource file)
- void GetShapeProcessParameters( list<string>& theOperations,
- list<string>& theParams,
+ void GetShapeProcessParameters( list<string>& theOperations,
+ list<string>& theParams,
list<string>& theValues );
+ // Retrieve default Shape Process parameters for given operator
+ bool GetOperatorParameters( const string theOperation,
+ list<string>& theParams,
+ list<string>& theValues );
+
// returns all parameters that are valid for the given operation (Shape Process operator)
static bool GetParameters( const string theOperation, list<string>& theParams );
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<string> operationsList, paramsList, valuesList;
GetOperations()->GetShapeProcessParameters( operationsList, paramsList, valuesList );
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<string>::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<string>::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<string> 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<string>::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();
}
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);