0022762: [EDF] Fast detection of face/face face/solid solid/solid interference

Minor additional improvements:
- display sub-shapes from 1st and 2nd source shapes with different colors
- limit minimal value of deflection to avoid long computation of tesselation (well, this is "fast" intersection algorithm)
This commit is contained in:
vsr 2014-12-19 15:21:13 +03:00
parent 84828621fc
commit d55c107e74

View File

@ -56,17 +56,7 @@
// true to construct a modal dialog. // true to construct a modal dialog.
//================================================================================= //=================================================================================
MeasureGUI_FastCheckIntersectionsDlg::MeasureGUI_FastCheckIntersectionsDlg (GeometryGUI* GUI, QWidget* parent) MeasureGUI_FastCheckIntersectionsDlg::MeasureGUI_FastCheckIntersectionsDlg (GeometryGUI* GUI, QWidget* parent)
: GEOMBase_Skeleton (GUI, parent, false), : GEOMBase_Skeleton (GUI, parent, false)
mySelButton1 (0),
mySelButton2 (0),
myEditObjName1 (0),
myEditObjName2 (0),
myDetGaps (0),
myTolerance (0),
myDeflection (0),
myComputeButton (0),
myShapeList1 (0),
myShapeList2 (0)
{ {
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FAST_CHECK_INTERSECTIONS"))); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FAST_CHECK_INTERSECTIONS")));
@ -82,33 +72,30 @@ MeasureGUI_FastCheckIntersectionsDlg::MeasureGUI_FastCheckIntersectionsDlg (Geom
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
QGroupBox *aGrp = new QGroupBox(tr("GEOM_FAST_CHECK_OBJ")); QGroupBox* aGrp = new QGroupBox(tr("GEOM_FAST_CHECK_OBJ"), centralWidget());
QLabel *anObjLbl1 = new QLabel(tr("GEOM_OBJECT_I").arg("1")); QLabel* anObjLbl1 = new QLabel(tr("GEOM_OBJECT_I").arg("1"), aGrp);
QLabel *anObjLbl2 = new QLabel(tr("GEOM_OBJECT_I").arg("2")); QLabel* anObjLbl2 = new QLabel(tr("GEOM_OBJECT_I").arg("2"), aGrp);
QLabel *aShapeLbl1 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("1")); QLabel* aShapeLbl1 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("1"), aGrp);
QLabel *aShapeLbl2 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("2")); QLabel* aShapeLbl2 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("2"), aGrp);
QLabel *aDeflectLbl = new QLabel(tr("GEOM_FAST_CHECK_INT_DEFLECT")); QLabel* aDeflectLbl = new QLabel(tr("GEOM_FAST_CHECK_INT_DEFLECT"), aGrp);
QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias); mySelButton1 = new QPushButton(aGrp);
mySelButton1 = new QPushButton;
mySelButton1->setIcon(image1); mySelButton1->setIcon(image1);
mySelButton1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mySelButton1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
mySelButton2 = new QPushButton; mySelButton2 = new QPushButton(aGrp);
mySelButton2->setIcon(image1); mySelButton2->setIcon(image1);
mySelButton2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mySelButton2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
myEditObjName1 = new QLineEdit; myEditObjName1 = new QLineEdit(aGrp);
myEditObjName1->setReadOnly(true); myEditObjName1->setReadOnly(true);
myEditObjName2 = new QLineEdit; myEditObjName2 = new QLineEdit(aGrp);
myEditObjName2->setReadOnly(true); myEditObjName2->setReadOnly(true);
myDetGaps = new QCheckBox(tr( "GEOM_FAST_CHECK_INT_DETECT_GAPS" )); myDetGaps = new QCheckBox(tr( "GEOM_FAST_CHECK_INT_DETECT_GAPS" ));
myTolerance = new SalomeApp_DoubleSpinBox; myTolerance = new SalomeApp_DoubleSpinBox(aGrp);
myDeflection = new SalomeApp_DoubleSpinBox; myDeflection = new SalomeApp_DoubleSpinBox(aGrp);
myShapeList1 = new QListWidget; myShapeList1 = new QListWidget(aGrp);
myShapeList2 = new QListWidget; myShapeList2 = new QListWidget(aGrp);
myShapeList1->setSelectionMode(QAbstractItemView::ExtendedSelection); myShapeList1->setSelectionMode(QAbstractItemView::ExtendedSelection);
myShapeList2->setSelectionMode(QAbstractItemView::ExtendedSelection); myShapeList2->setSelectionMode(QAbstractItemView::ExtendedSelection);
@ -170,18 +157,14 @@ void MeasureGUI_FastCheckIntersectionsDlg::Init()
myEditObjName2->setEnabled(false); myEditObjName2->setEnabled(false);
myDetGaps->setChecked(false); myDetGaps->setChecked(false);
double SpecificStep = 0.001; initSpinBox(myTolerance, 0, MAX_NUMBER, 1);
double prec = Precision::Confusion(); myTolerance->setValue(0);
initSpinBox(myTolerance, prec, MAX_NUMBER, SpecificStep);
myTolerance->setValue(SpecificStep);
myTolerance->setEnabled(false); myTolerance->setEnabled(false);
// Obtain deflection from preferences // Obtain deflection from preferences
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
const char* quantity = "deflection_coeff"; initSpinBox(myDeflection, 1e-3, 1.0, 1e-3);
double aDeflection = resMgr->doubleValue("Geometry", quantity, 0.00001); myDeflection->setValue(qMax(1e-3, resMgr->doubleValue("Geometry", "deflection_coeff", 1e-3)));
initSpinBox(myDeflection, prec, 1.0, aDeflection);
myDeflection->setValue(aDeflection);
myEditCurrentArgument = myEditObjName1; myEditCurrentArgument = myEditObjName1;
@ -560,12 +543,12 @@ void MeasureGUI_FastCheckIntersectionsDlg::previewSubShapesListSelection(QListWi
SALOME_Prs* aPrs = 0; SALOME_Prs* aPrs = 0;
TopExp::MapShapes(aSelShape, anIndices); TopExp::MapShapes(aSelShape, anIndices);
QList<int>::iterator it; QList<int>::iterator it;
getDisplayer()->SetColor(theWidget == myShapeList1 ? Quantity_NOC_RED : Quantity_NOC_GREEN);
getDisplayer()->SetWidth(3);
getDisplayer()->SetToActivate(false);
for (it = aIds.begin(); it != aIds.end(); ++it) { for (it = aIds.begin(); it != aIds.end(); ++it) {
aSubShape = anIndices.FindKey(anInters[(*it)]); aSubShape = anIndices.FindKey(anInters[(*it)]);
try { try {
getDisplayer()->SetColor(Quantity_NOC_RED);
getDisplayer()->SetWidth(3);
getDisplayer()->SetToActivate(false);
aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0; aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0;
if (aPrs) if (aPrs)
displayPreview(aPrs, true); displayPreview(aPrs, true);