// Comment next line to enable preview in Partition dialog box
#define NO_PREVIEW
+#define DEFAULT_FUZZY_VALUE 1e-5
+
+
//=================================================================================
// class : OperationGUI_PartitionDlg()
// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
mySelfInte->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS"));
GroupPoints->gridLayout1->addWidget(mySelfInte, 5, 0, 1, 3);
+ // Add all "fuzzy parameter" related widgets
+ myFuzzyChk = new QCheckBox(GroupPoints->GroupBox1);
+ myFuzzyChk->setText(tr("GEOM_USE_FUZZY_PARAMETER"));
+ GroupPoints->gridLayout1->addWidget(myFuzzyChk, 6, 0, 1, 3);
+
+ myFuzzyLbl = new QLabel(GroupPoints->GroupBox1);
+ myFuzzyLbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ myFuzzyLbl->setText(tr("GEOM_FUZZY_PARAMETER"));
+ GroupPoints->gridLayout1->addWidget(myFuzzyLbl, 7, 0, 1, 2);
+
+ myFuzzyEdt = new SalomeApp_DoubleSpinBox(GroupPoints->GroupBox1);
+ initSpinBox( myFuzzyEdt, 1.e-7, 10.0, DEFAULT_FUZZY_VALUE, "length_tol_precision" );
+ myFuzzyEdt->setValue(DEFAULT_FUZZY_VALUE);
+ GroupPoints->gridLayout1->addWidget(myFuzzyEdt, 7, 2);
+
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPoints );
GroupPoints->CheckButton1->setChecked( false );
mySelfInte->setChecked(false);
+ // Do not use Fuzzy parameter by default
+ myFuzzyChk->setChecked(false);
+ myFuzzyLbl->setEnabled(false);
+ myFuzzyEdt->setEnabled(false);
+
mainFrame()->GroupBoxPublish->show();
/* signals and slots connections */
connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), mySelfInte, SLOT(setEnabled(bool)) );
connect( mySelfInte, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
+ connect( myFuzzyChk, SIGNAL(stateChanged(int)), this, SLOT(UseFuzzyChanged(int)));
+
mySelfInte->setEnabled(GroupPoints->CheckButton2->isChecked());
initName( tr( "GEOM_PARTITION" ) );
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
globalSelection();
- //myListShapes.length( 0 );
- //myListTools.length( 0 );
- //myListKeepInside.length( 0 ); // obsolete
- //myListRemoveInside.length( 0 ); // obsolete
- //myListMaterials.length( 0 ); // obsolete
-
switch ( constructorId ) {
case 0: /*Full partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
}
+//=================================================================================
+// function : UseFuzzyChanged()
+// purpose : This slot is called whenever the status of CheckButton3 has changed
+//=================================================================================
+void OperationGUI_PartitionDlg::UseFuzzyChanged(int state)
+{
+ QCheckBox* send = (QCheckBox*)sender();
+
+ if (send == myFuzzyChk) {
+ bool isChecked = (state != Qt::Unchecked);
+ myFuzzyLbl->setEnabled(isChecked);
+ myFuzzyEdt->setEnabled(isChecked);
+ }
+}
+
+
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
+ bool useFuzzyParam = myFuzzyChk->isChecked();
+ double aFuzzyParam = (useFuzzyParam ? myFuzzyEdt->value() : -1.0);
+
switch ( getConstructorId() ) {
case 0:
{
bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
anObj = aNoSelfIntersection ?
- anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
- myListKeepInside, myListRemoveInside,
- aLimit, false, myListMaterials, aKeepNonlimitShapes,
- isDetectSelfInte) :
- anOper->MakePartition(myListShapes, myListTools,
- myListKeepInside, myListRemoveInside,
- aLimit, false, myListMaterials, aKeepNonlimitShapes);
+ anOper->MakePartitionNonSelfIntersectedShapeWithFuzzy(myListShapes, myListTools,
+ myListKeepInside, myListRemoveInside,
+ aLimit, false, myListMaterials, aKeepNonlimitShapes,
+ isDetectSelfInte, aFuzzyParam) :
+ anOper->MakePartitionWithFuzzy(myListShapes, myListTools,
+ myListKeepInside, myListRemoveInside,
+ aLimit, false, myListMaterials, aKeepNonlimitShapes, aFuzzyParam);
res = true;
}
break;
case 1:
{
- anObj = anOper->MakeHalfPartition(myListShapes[0].in(), myListTools[0].in());
+ anObj = anOper->MakeHalfPartitionWithFuzzy(myListShapes[0].in(), myListTools[0].in(), aFuzzyParam);
res = true;
}
break;
//=======================================================================
void OperationGUI_PartitionDlg::ComboTextChanged()
{
- //bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3;
- //GroupPoints->LineEdit3->setEnabled(IsEnabled);
- //GroupPoints->LineEdit4->setEnabled(IsEnabled);
- //GroupPoints->TextLabel4->setEnabled(IsEnabled);
- //GroupPoints->TextLabel5->setEnabled(IsEnabled);
- //GroupPoints->PushButton3->setEnabled(IsEnabled);
- //GroupPoints->PushButton4->setEnabled(IsEnabled);
processPreview();
}