X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FBooleanGUI%2FBooleanGUI_Dialog.cxx;h=4a007557df4c1fcbbaa94380a66e8bb3596ff643;hb=e3ce834889860adba76bbcf27743ab15a96c4765;hp=02ebd41d5c4b0f748dec4a9fe26b3f50fc3a30a9;hpb=29dfaa447450872cc5f5fbb57419e83aa9fd2cff;p=modules%2Fgeom.git diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 02ebd41d5..4a007557d 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -41,6 +41,9 @@ // Comment next line to enable preview in BOP dialog box #define NO_PREVIEW +#define DEFAULT_FUZZY_VALUE 1e-5 + + //================================================================================= // class : BooleanGUI_Dialog() // purpose : Constructs a BooleanGUI_Dialog which is a child of 'parent', with the @@ -78,7 +81,7 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SECTION"))); aTitle = tr("GEOM_SECTION"); aCaption = tr("GEOM_SECTION_TITLE"); - setHelpFileName("section_opeartion_page.html"); + setHelpFileName("section_operation_page.html"); break; } QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); @@ -130,9 +133,21 @@ BooleanGUI_Dialog::BooleanGUI_Dialog (const int theOperation, GeometryGUI* theGe myGroup->TextLabel4->hide(); myGroup->SpinBox_DX->hide(); myGroup->SpinBox_DY->hide(); - myGroup->CheckBox3->hide(); myGroup->CheckBox1->setText(tr("GEOM_CHECK_SELF_INTERSECTIONS")); + // Add all "fuzzy parameter" related widgets + myGroup->CheckBox3->setText(tr("GEOM_USE_FUZZY_PARAMETER")); + + myFuzzyLbl = new QLabel(myGroup->GroupBox1); + myFuzzyLbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + myFuzzyLbl->setText(tr("GEOM_FUZZY_PARAMETER")); + myGroup->gridLayout1->addWidget(myFuzzyLbl, 7, 0, 1, 2); + + myFuzzyEdt = new SalomeApp_DoubleSpinBox(myGroup->GroupBox1); + initSpinBox( myFuzzyEdt, 1.e-7, 10.0, DEFAULT_FUZZY_VALUE, "length_tol_precision" ); + myFuzzyEdt->setValue(DEFAULT_FUZZY_VALUE); + myGroup->gridLayout1->addWidget(myFuzzyEdt, 7, 2); + QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); layout->addWidget(myGroup); @@ -173,6 +188,11 @@ void BooleanGUI_Dialog::Init() myGroup->CheckBox2->setChecked(true); } + // Do not use Fuzzy parameter by default + myGroup->CheckBox3->setChecked(false); + myFuzzyLbl->setEnabled(false); + myFuzzyEdt->setEnabled(false); + myObject1.nullify(); reset(); @@ -186,6 +206,10 @@ void BooleanGUI_Dialog::Init() connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); } + if (!myGroup->CheckBox3->isHidden()) { + connect(myGroup->CheckBox3, SIGNAL(stateChanged(int)), this, SLOT(UseFuzzyChanged(int))); + } + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()), Qt::UniqueConnection); @@ -198,7 +222,7 @@ void BooleanGUI_Dialog::Init() mainFrame()->RadioButton1->setFocus(); globalSelection(GEOM_ALLSHAPES); - //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision) + //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: deactivate local selection in BOP (CoTech decision) myGroup->PushButton1->click(); resize(100,100); @@ -314,6 +338,21 @@ void BooleanGUI_Dialog::SelectionIntoArgument() processPreview(); } +//================================================================================= +// function : UseFuzzyChanged() +// purpose : This slot is called whenever the status of CheckButton3 has changed +//================================================================================= +void BooleanGUI_Dialog::UseFuzzyChanged(int state) +{ + QCheckBox* send = (QCheckBox*)sender(); + + if (send == myGroup->CheckBox3) { + bool isChecked = (state != Qt::Unchecked); + myFuzzyLbl->setEnabled(isChecked); + myFuzzyEdt->setEnabled(isChecked); + } +} + //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -338,7 +377,7 @@ void BooleanGUI_Dialog::SetEditCurrentArgument() } globalSelection(GEOM_ALLSHAPES); - //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision) + //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: deactivate local selection in BOP (CoTech decision) // enable line edit myEditCurrentArgument->setEnabled(true); @@ -378,7 +417,7 @@ void BooleanGUI_Dialog::enterEvent (QEvent*) //================================================================================= GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation() { - return getGeomEngine()->GetIBooleanOperations(getStudyId()); + return getGeomEngine()->GetIBooleanOperations(); } //================================================================================= @@ -417,6 +456,8 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects) GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation()); const bool isCheckSelfInte = myGroup->CheckBox1->isChecked(); + const bool useFuzzyParam = myGroup->CheckBox3->isChecked(); + const double fuzzyValue = (useFuzzyParam ? myFuzzyEdt->value() : -1); GEOM::ListOfGO_var anObjects = new GEOM::ListOfGO(); anObjects->length( myObjects.count() ); @@ -427,24 +468,20 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects) case BooleanGUI::FUSE: { const bool isRmExtraEdges = myGroup->CheckBox2->isChecked(); - - anObj = anOper->MakeFuseList - (anObjects, isCheckSelfInte, isRmExtraEdges); + anObj = anOper->MakeFuseListWithFuzzy(anObjects, isCheckSelfInte, isRmExtraEdges, fuzzyValue); } - break; + break; case BooleanGUI::COMMON: - anObj = anOper->MakeCommonList(anObjects, isCheckSelfInte); - break; - case BooleanGUI::CUT: - anObj = - anOper->MakeCutList(myObject1.get(), anObjects, isCheckSelfInte); - break; - case BooleanGUI::SECTION: - anObj = anOper->MakeBoolean - (myObject1.get(), anObjects[0], myOperation, isCheckSelfInte); - break; - default: - break; + anObj = anOper->MakeCommonListWithFuzzy(anObjects, isCheckSelfInte, fuzzyValue); + break; + case BooleanGUI::CUT: + anObj = anOper->MakeCutListWithFuzzy(myObject1.get(), anObjects, isCheckSelfInte, fuzzyValue); + break; + case BooleanGUI::SECTION: + anObj = anOper->MakeBooleanWithFuzzy(myObject1.get(), anObjects[0], myOperation, isCheckSelfInte, fuzzyValue); + break; + default: + break; } if (!anObj->_is_nil()) @@ -457,12 +494,11 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects) // function : restoreSubShapes // purpose : //================================================================================= -void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject) +void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::SObject_ptr theSObject) { if (mainFrame()->CheckBoxRestoreSS->isChecked()) { // empty list of arguments means that all arguments should be restored - getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), + getGeomEngine()->RestoreSubShapesSO( theSObject, GEOM::ListOfGO(), /*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame /*theInheritFirstArg=*/myOperation == BooleanGUI::CUT, mainFrame()->CheckBoxAddPrefix->isChecked()); // ? false