This commit is contained in:
san 2005-01-24 16:00:40 +00:00
parent 86973cfa9e
commit dc8466f4ed
6 changed files with 119 additions and 45 deletions

View File

@ -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).

View File

@ -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"

View File

@ -141,29 +141,14 @@ void GEOMImpl_IHealingOperations::GetShapeProcessParameters (list<string>& 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();
if ( GetOperatorParameters( anOperation, theParams, theValues ) )
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++;
}
}
else
nbOperatorErrors++;
}
@ -173,11 +158,43 @@ void GEOMImpl_IHealingOperations::GetShapeProcessParameters (list<string>& 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<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());
}
}

View File

@ -27,6 +27,11 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations {
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 );

View File

@ -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<string> operationsList, paramsList, valuesList;
GetOperations()->GetShapeProcessParameters( operationsList, paramsList, valuesList );
@ -130,14 +134,8 @@ 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
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();
anOpArray->length(opSize);
aParArray->length(parSize);
aValArray->length(valSize);
@ -149,11 +147,11 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out
anOpArray[i] = CORBA::string_dup( (*opIt).c_str() );
for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin();
parIt != paramsList.end(); i++, ++parIt,++valIt )
{
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();
@ -161,6 +159,43 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out
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();
// 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
theParams = aParArray._retn();
theValues = aValArray._retn();
}
//=============================================================================
/*!
* SuppressFaces

View File

@ -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);