From 1763c33f948bc8b2e959aba4946997c7035f3313 Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 29 Jan 2010 14:07:33 +0000 Subject: [PATCH] Mantis issue 0020626: EDF 1200 GEOM: the discretisation of the circles in the OCC viewer is too rough. --- src/GEOMGUI/GeometryGUI.cxx | 5 ++-- src/GEOMToolsGUI/GEOMToolsGUI_1.cxx | 24 +++++++++++++------ .../GEOMToolsGUI_DeflectionDlg.cxx | 11 +++++++-- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 5dd76283c..fd461f03b 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -1601,8 +1601,9 @@ void GeometryGUI::createPreferences() // Set property for deflection value for spinboxes setPreferenceProperty( defl, "min", 1.0e-07 ); - setPreferenceProperty( defl, "max", 10000.0 ); - setPreferenceProperty( defl, "step", 0.0001 ); + setPreferenceProperty( defl, "max", 1.0 ); + setPreferenceProperty( defl, "step", 1.0e-04 ); + setPreferenceProperty( defl, "precision", 10 ); // Set property vertex marker type QList aMarkerTypeIndicesList; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 4e4ce7c9e..34b1f0835 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -557,13 +557,23 @@ void GEOMToolsGUI::OnDeflection() GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg (SUIT_Session::session()->activeApplication()->desktop()); DeflectionDlg->setDC(aDC); - if (DeflectionDlg->exec()) { - SUIT_OverrideCursor(); - double aNewDC = DeflectionDlg->getDC(); - for (; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True); - ic->Redisplay(CurObject); + double aNewDC = 0.0; + bool ok = false; + while (!ok) { + if (DeflectionDlg->exec()) { + SUIT_OverrideCursor(); + aNewDC = DeflectionDlg->getDC(); + ok = (1e-07 <= aNewDC && aNewDC <= 1.0); // spinbox can return zero + if (ok) { + for (; ic->MoreCurrent(); ic->NextCurrent()) { + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True); + ic->Redisplay(CurObject); + } + } + } + else { + ok = true; } } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx index 8f4137a4d..8f240d26b 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_DeflectionDlg.cxx @@ -71,11 +71,18 @@ GEOMToolsGUI_DeflectionDlg::GEOMToolsGUI_DeflectionDlg (QWidget* parent) TextLabel1->setText(tr("GEOM_DEFLECTION")); GroupC1Layout->addWidget(TextLabel1, 0, 0); + //SpinBox = new SalomeApp_DoubleSpinBox (/*min*/1.0e-07, /*max*/1.0, /*step*/1.0e-04, GroupC1); SpinBox = new SalomeApp_DoubleSpinBox (GroupC1); + SpinBox->setPrecision( 10 ); + SpinBox->setDecimals( 10 ); + SpinBox->setRange( 1.0e-07, 1.0 ); + SpinBox->setSingleStep( 1.0e-04 ); + //SpinBox->setMinimum(1.0e-07); + //SpinBox->setMaximum(1.0); + //SpinBox->setStep(1.0e-04); SpinBox->setObjectName("SpinBoxU"); SpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - SpinBox->setMinimum(0); - SpinBox->setValue(1); + SpinBox->setValue(1.0e-04); GroupC1Layout->addWidget(SpinBox, 0, 1); /***************************************************************/ -- 2.39.2