mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-24 16:30:35 +05:00
22763: [EDF] Shape processing
For DropSmallSolids operator, fix some bugs: - Add missing default values of parameters in a resource file - Add workaround to ShapeProcess functionality to process properly optional parameters (the case for DropSmallSolids operator) - Small redesign of RepairGUI::ShowStatistics() function
This commit is contained in:
parent
cceb7b5b9e
commit
57bf55dc1f
@ -18,6 +18,10 @@ ShapeProcess.FixFaceSize.Tolerance : 0.05
|
||||
|
||||
ShapeProcess.DropSmallEdges.Tolerance3d : 0.05
|
||||
|
||||
ShapeProcess.DropSmallSolids.WidthFactorThreshold : 1
|
||||
ShapeProcess.DropSmallSolids.VolumeThreshold : 1000
|
||||
ShapeProcess.DropSmallSolids.MergeSolids : 1
|
||||
|
||||
ShapeProcess.BSplineRestriction.SurfaceMode : 1
|
||||
ShapeProcess.BSplineRestriction.Curve3dMode : 1
|
||||
ShapeProcess.BSplineRestriction.Curve2dMode : 1
|
||||
@ -210,6 +214,11 @@ ShapeProcess.SameParameter.Tolerance3d : 1.e-7
|
||||
! DropSmallEdges : Eliminate small edges by removing or merging with neighbour
|
||||
! DropSmallEdges.Tolerance3d : Tolerance (3d)
|
||||
|
||||
! DropSmallSolids : Eliminate small solids by a) removing them or b) absorbing them by adjacent larger solids.
|
||||
! DropSmallSolids.WidthFactorThreshold : Maximum value of 2V/S of a solid where V is volume and S is surface area of the solid.
|
||||
! DropSmallSolids.VolumeThreshold : Maximum volume of a solid.
|
||||
! DropSmallSolids.MergeSolids : If false, solids are removed; otherwise, solids are merged to adjacent larger solids.
|
||||
|
||||
! FixShape.Tolerance3d : Tolerance (3d) for fixing of shape.
|
||||
! FixShape.MaxTolerance3d : Maximal possible value of increasing of tolerance during fixing.
|
||||
! FixShape.MinTolerance3d : Minimal value of tolerance.
|
||||
|
@ -275,6 +275,11 @@ bool GEOMImpl_IHealingOperations::GetParameters (const std::string theOperation,
|
||||
} else if( theOperation == "DropSmallEdges" ) {
|
||||
theParams.push_back( "DropSmallEdges.Tolerance3d" );
|
||||
|
||||
} else if( theOperation == "DropSmallSolids" ) {
|
||||
theParams.push_back( "DropSmallSolids.WidthFactorThreshold" );
|
||||
theParams.push_back( "DropSmallSolids.VolumeThreshold" );
|
||||
theParams.push_back( "DropSmallSolids.MergeSolids" );
|
||||
|
||||
} else if( theOperation == "BSplineRestriction" ) {
|
||||
theParams.push_back( "BSplineRestriction.SurfaceMode" );
|
||||
theParams.push_back( "BSplineRestriction.Curve3dMode" );
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_OverrideCursor.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
|
||||
#include "RepairGUI_SewingDlg.h" // Method SEWING
|
||||
@ -147,8 +148,7 @@ namespace
|
||||
|
||||
StatsDlg::StatsDlg( GEOM::ModifStatistics_var stats, QWidget* parent ): QDialog( parent )
|
||||
{
|
||||
setModal( false );
|
||||
setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
setModal( true );
|
||||
setWindowTitle( tr( "GEOM_HEALING_STATS_TITLE" ) );
|
||||
setMinimumWidth( 500 );
|
||||
|
||||
@ -174,11 +174,12 @@ namespace
|
||||
// helpBtn->setAutoDefault( true );
|
||||
|
||||
QHBoxLayout* btnLayout = new QHBoxLayout;
|
||||
btnLayout->setMargin( 9 );
|
||||
btnLayout->setMargin( 0 );
|
||||
btnLayout->setSpacing( 6 );
|
||||
|
||||
btnLayout->addStretch();
|
||||
btnLayout->addWidget( okBtn );
|
||||
btnLayout->addStretch( 10 );
|
||||
btnLayout->addStretch();
|
||||
// btnLayout->addWidget( helpBtn );
|
||||
|
||||
QVBoxLayout* aLay = new QVBoxLayout( this );
|
||||
@ -196,7 +197,6 @@ namespace
|
||||
|
||||
connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ));
|
||||
//connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,6 +213,9 @@ void RepairGUI::ShowStatistics( GEOM::GEOM_IHealingOperations_var anOper, QWidge
|
||||
if ( ! &stats.in() || stats->length() == 0 )
|
||||
return;
|
||||
|
||||
StatsDlg* dlg = new StatsDlg( stats, parent );
|
||||
dlg->exec();
|
||||
SUIT_OverrideCursor wc;
|
||||
wc.suspend();
|
||||
|
||||
StatsDlg dlg( stats, parent );
|
||||
dlg.exec();
|
||||
}
|
||||
|
@ -162,10 +162,10 @@ void RepairGUI_ShapeProcessDlg::init()
|
||||
myDropSmallSolidsVolChk = new QCheckBox( tr("VOLUME_TOL"), w );
|
||||
myDropSmallSolidsWidTol = new SalomeApp_DoubleSpinBox( w );
|
||||
myDropSmallSolidsVolTol = new SalomeApp_DoubleSpinBox( w );
|
||||
initSpinBox( myDropSmallSolidsWidTol, 0., 100., 1e-7, "len_tol_precision" );
|
||||
initSpinBox( myDropSmallSolidsVolTol, 0., 100., 1e-7, "len_tol_precision" );
|
||||
myDropSmallSolidsWidTol->setValue( 1e-7 );
|
||||
myDropSmallSolidsVolTol->setValue( 1e-7 );
|
||||
initSpinBox( myDropSmallSolidsWidTol, 0., 1e3, 1., "len_tol_precision" );
|
||||
initSpinBox( myDropSmallSolidsVolTol, 0., 1e9, 1., "len_tol_precision" );
|
||||
myDropSmallSolidsWidTol->setValue( 1 );
|
||||
myDropSmallSolidsVolTol->setValue( 1e3 );
|
||||
myDropSmallSolidsVolChk->setChecked( true );
|
||||
myDropSmallSolidsWidTol->setEnabled( false );
|
||||
myDropSmallSolidsMergeChk = new QCheckBox( tr("TO_MERGE_SOLIDS"), w );
|
||||
@ -563,14 +563,23 @@ void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& th
|
||||
QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const
|
||||
{
|
||||
if ( theControl ) {
|
||||
if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl ))
|
||||
if ( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )) {
|
||||
if ( ( theControl == myDropSmallSolidsWidTol || theControl == myDropSmallSolidsVolTol ) && !theControl->isEnabled() ) {
|
||||
// VSR: stupid workaround about ShapeProcessAPI:
|
||||
// specific processing for optional parameters of DropSmallSolids operator
|
||||
return QString::number( Precision::Infinite() );
|
||||
}
|
||||
return QString::number( qobject_cast<SalomeApp_DoubleSpinBox*>( theControl )->value() );
|
||||
else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl ))
|
||||
}
|
||||
else if ( qobject_cast<SalomeApp_IntSpinBox*>( theControl )) {
|
||||
return QString::number( qobject_cast<SalomeApp_IntSpinBox*>( theControl )->value() );
|
||||
else if ( qobject_cast<QComboBox*>( theControl ))
|
||||
}
|
||||
else if ( qobject_cast<QComboBox*>( theControl )) {
|
||||
return qobject_cast<QComboBox*>( theControl )->currentText();
|
||||
else if ( qobject_cast<QCheckBox*>( theControl ))
|
||||
}
|
||||
else if ( qobject_cast<QCheckBox*>( theControl )) {
|
||||
return qobject_cast<QCheckBox*>( theControl )->isChecked() ? "1" : "0";
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -705,17 +714,14 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
|
||||
GEOM::string_array* RepairGUI_ShapeProcessDlg::getActiveOperators()
|
||||
{
|
||||
GEOM::string_array_var anOperators = new GEOM::string_array();
|
||||
QStringList aCheckedList;
|
||||
|
||||
for ( int i = 0; i < myOpList->count(); i++ ) {
|
||||
int j = 0, n = myOpList->count();
|
||||
anOperators->length( n );
|
||||
for ( int i = 0; i < n; i++ ) {
|
||||
if ( myOpList->item( i )->checkState() == Qt::Checked )
|
||||
aCheckedList << myOpList->item( i )->text();
|
||||
anOperators[j++] = myOpList->item( i )->text().toLatin1().constData();
|
||||
}
|
||||
|
||||
anOperators->length( aCheckedList.count() );
|
||||
|
||||
for ( int i = 0; i < aCheckedList.count(); i++ )
|
||||
anOperators[i] = aCheckedList[i].toLatin1().constData();
|
||||
anOperators->length( j );
|
||||
|
||||
return anOperators._retn();
|
||||
}
|
||||
@ -732,7 +738,7 @@ QWidget* RepairGUI_ShapeProcessDlg::getControl( const QString& theParam )
|
||||
else if ( theParam == "FixFaceSize.Tolerance" ) return myFixFaceSizeTol;
|
||||
else if ( theParam == "DropSmallEdges.Tolerance3d" ) return myDropSmallEdgesTol3D;
|
||||
else if ( theParam == "DropSmallSolids.WidthFactorThreshold" ) return myDropSmallSolidsWidTol;
|
||||
else if ( theParam == "DropSmallSolids.VolumeThreshold" ) return myDropSmallSolidsWidTol;
|
||||
else if ( theParam == "DropSmallSolids.VolumeThreshold" ) return myDropSmallSolidsVolTol;
|
||||
else if ( theParam == "DropSmallSolids.MergeSolids" ) return myDropSmallSolidsMergeChk;
|
||||
else if ( theParam == "BSplineRestriction.SurfaceMode" ) return myBSplineSurfModeChk;
|
||||
else if ( theParam == "BSplineRestriction.Curve3dMode" ) return myBSpline3DCurveChk;
|
||||
@ -824,18 +830,21 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getParameters( const GEOM::string
|
||||
|
||||
// calculate the length of parameters
|
||||
for ( i = 0, j = 0; i < theOperators.length(); i++ )
|
||||
j += myValMap[ QString( theOperators[i] ) ].size();
|
||||
j += myValMap[ QString( theOperators[i].in() ) ].size();
|
||||
|
||||
// set the new length of paremeters
|
||||
aParams->length( j );
|
||||
|
||||
// fill the parameters
|
||||
for ( i = 0, j = 0; i < theOperators.length(); i++ ) {
|
||||
QStringList aValLst = myValMap[ QString( theOperators[i] ) ];
|
||||
for ( QStringList::Iterator it = aValLst.begin(); it != aValLst.end(); ++it )
|
||||
aParams[j++] = CORBA::string_dup( (*it).toLatin1().constData() );
|
||||
QStringList aParamLst = myValMap[ QString( theOperators[i].in() ) ];
|
||||
foreach ( QString aParam, aParamLst ) {
|
||||
aParams[j++] = CORBA::string_dup( aParam.toLatin1().constData() );
|
||||
}
|
||||
}
|
||||
|
||||
aParams->length( j );
|
||||
|
||||
return aParams._retn();
|
||||
}
|
||||
|
||||
@ -851,7 +860,7 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getValues( const GEOM::string_arr
|
||||
|
||||
for ( int i = 0; i < theParams.length(); i++ ) {
|
||||
QWidget* aCtrl = getControl( (const char*)theParams[i] );
|
||||
if ( aCtrl && aCtrl->isEnabled() )
|
||||
if ( aCtrl )
|
||||
aValues[i] = get_convert( (const char*)theParams[i], getValue( aCtrl ));
|
||||
}
|
||||
|
||||
|
@ -163,12 +163,12 @@ void ShHealOper_ShapeProcess::SetParameter(const TCollection_AsciiString& theNam
|
||||
TCollection_AsciiString anameParam(myPrefix);
|
||||
anameParam += ".";
|
||||
anameParam+= theNameParam;
|
||||
if(theVal.IsIntegerValue())
|
||||
myOperations.Context()->ResourceManager()->
|
||||
SetResource(anameParam.ToCString(),theVal.IntegerValue());
|
||||
else if(theVal.IsRealValue())
|
||||
if(theVal.IsRealValue())
|
||||
myOperations.Context()->ResourceManager()->
|
||||
SetResource(anameParam.ToCString(),theVal.RealValue());
|
||||
else if(theVal.IsIntegerValue())
|
||||
myOperations.Context()->ResourceManager()->
|
||||
SetResource(anameParam.ToCString(),theVal.IntegerValue());
|
||||
else
|
||||
myOperations.Context()->ResourceManager()->
|
||||
SetResource(anameParam.ToCString(),theVal.ToCString());
|
||||
|
Loading…
Reference in New Issue
Block a user