From: jfa Date: Thu, 12 Jul 2007 08:21:56 +0000 (+0000) Subject: Correct precision of double values displaying (bug 16123). X-Git-Tag: T15881~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a46ed42b20faee8edeaf0002ba7af44c39cce93c;p=modules%2Fgeom.git Correct precision of double values displaying (bug 16123). --- diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index c435a3dd1..8461a6f83 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -328,16 +328,16 @@ void EntityGUI_SketcherDlg::Init() double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); /* min, max, step and decimals for spin boxes */ - Group1Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group4Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group4Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group4Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group4Spin->SpinBox_DS->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); + Group1Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group4Spin->SpinBox_DS->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); /* displays Dialog */ GroupConstructors->setEnabled(false); @@ -438,8 +438,8 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId) if ( constructorId == 1 ) { // XY mySketchType = PT_ABS; - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2")); myX = 0.0; @@ -454,8 +454,8 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId) else if ( constructorId == 0 ) { // DXDY mySketchType = PT_RELATIVE; - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2")); myDX = 0.0; @@ -512,8 +512,8 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) myLength = 100.0; if ( myConstructorDirId == 2 ) { // Angle - Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); Group2Spin->SpinBox_DX->SetValue(myAngle); Group2Spin->buttonApply->setFocus(); @@ -588,9 +588,9 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) } else if ( myConstructorDirId == 3 ) { // DXDY - Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); - Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); myDX = 0.0; @@ -626,54 +626,54 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) { // Angle if ( constructorId == 2 ) { // Length - mySketchType = DIR_ANGLE_LENGTH; - Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); - Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); - Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); - Group3Spin->SpinBox_DX->SetValue(myAngle); - myRadius = 100.0; - Group3Spin->SpinBox_DY->SetValue(myRadius); - myLength = 30.0; - Group3Spin->SpinBox_DZ->SetValue(myLength); - Group3Spin->show(); - Group3Spin->buttonApply->setFocus(); + mySketchType = DIR_ANGLE_LENGTH; + Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->SpinBox_DX->SetValue(myAngle); + myRadius = 100.0; + Group3Spin->SpinBox_DY->SetValue(myRadius); + myLength = 30.0; + Group3Spin->SpinBox_DZ->SetValue(myLength); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 0 ) { // Perpendicular if ( constructorId == 2 ) { // Length - mySketchType = DIR_PER_LENGTH; - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); - Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); - myRadius = 100.0; - Group2Spin->SpinBox_DX->SetValue(myRadius); - myLength = 30.0; - Group2Spin->SpinBox_DY->SetValue(myLength); - Group2Spin->show(); - Group2Spin->buttonApply->setFocus(); + mySketchType = DIR_PER_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 1 ) { // Tangent if ( constructorId == 2 ) { // Length - mySketchType = DIR_TAN_LENGTH; - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); - Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); - Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); - myRadius = 100.0; - Group2Spin->SpinBox_DX->SetValue(myRadius); - myLength = 30.0; - Group2Spin->SpinBox_DY->SetValue(myLength); - Group2Spin->show(); - Group2Spin->buttonApply->setFocus(); + mySketchType = DIR_TAN_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); } } else if ( myConstructorDirId == 3 ) diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index ec3acf783..0105cf53a 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -29,6 +29,8 @@ #include "MeasureGUI_CenterMassDlg.h" #include "MeasureGUI_1Sel3LineEdit_QTD.h" +#include "DlgRef_SpinBox.h" + #include "utilities.h" #include "SUIT_Session.h" #include "SalomeApp_Application.h" @@ -245,9 +247,9 @@ void MeasureGUI_CenterMassDlg::processObject() getParameters( x, y, z ); myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); - myGrp->LineEdit2->setText( QString( "%1" ).arg( x ) ); - myGrp->LineEdit3->setText( QString( "%1" ).arg( y ) ); - myGrp->LineEdit4->setText( QString( "%1" ).arg( z ) ); + myGrp->LineEdit2->setText( DlgRef_SpinBox::PrintDoubleValue( x ) ); + myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( y ) ); + myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( z ) ); displayPreview(); } diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index d7ac8ed90..163b19653 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,6 +30,7 @@ #include "MeasureGUI_2Sel1LineEdit_QTD.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" +#include "DlgRef_SpinBox.h" #include "SUIT_Session.h" #include "SUIT_ViewWindow.h" @@ -118,14 +119,13 @@ void MeasureGUI_DistanceDlg::Init() mySelEdit = myGrp->LineEdit1; mySelBtn2 = myGrp->PushButton2; mySelEdit2 = myGrp->LineEdit2; - + myEditCurrentArgument = mySelEdit; connect( mySelEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); MeasureGUI_Skeleton::Init(); - } @@ -163,7 +163,7 @@ void MeasureGUI_DistanceDlg::processObject() double aDist = 0.; if ( getParameters( aDist, aPnt1, aPnt2 ) ) { - myGrp->LineEdit3->setText( QString( "%1" ).arg( aDist ) ); + myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( aDist ) ); redisplayPreview(); } else @@ -171,7 +171,6 @@ void MeasureGUI_DistanceDlg::processObject() myGrp->LineEdit3->setText( "" ); erasePreview(); } - } //================================================================================= @@ -256,12 +255,14 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() { double aDist = 0.; gp_Pnt aPnt1( 0, 0, 0 ), aPnt2( 0, 0, 0 ); - - if ( myObj->_is_nil() || myObj2->_is_nil() || !getParameters( aDist, aPnt1, aPnt2 ) || - SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type() ) + + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + if ( myObj->_is_nil() || myObj2->_is_nil() || + !getParameters( aDist, aPnt1, aPnt2 ) || + vw->getViewManager()->getType() != OCCViewer_Viewer::Type() ) return 0; - + try { if( aDist <= 1.e-9 ) @@ -282,7 +283,6 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() ( aPnt1.Y() + aPnt2.Y() ) / 2, ( aPnt1.Z() + aPnt2.Z() ) / 2 + 100 ); - gp_Vec va( aPnt3, aPnt1 ); gp_Vec vb( aPnt3, aPnt2 ); @@ -291,18 +291,15 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() aPnt3.SetY( ( aPnt1.Y() + aPnt2.Y() ) / 2 + 100 ); aPnt3.SetZ( ( aPnt1.Z() + aPnt2.Z() ) / 2 ); } - + gce_MakePln gce_MP( aPnt1, aPnt2, aPnt3 ); Handle( Geom_Plane ) P = new Geom_Plane( gce_MP.Value() ); - Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension( - aVert1, aVert2, P, aDist, TCollection_ExtendedString( (Standard_CString)aLabel.latin1() ) ); + Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension + (aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.latin1())); - SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - SOCC_Prs* aPrs = dynamic_cast( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) ); - - //QAD_ViewFrame* vf = GEOM_Displayer::GetActiveView(); - //OCCViewer_Prs* aPrs = dynamic_cast( vf->CreatePrs( 0 ) ); + SOCC_Prs* aPrs = + dynamic_cast( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) ); if ( aPrs ) aPrs->AddObject( anIO ); @@ -324,17 +321,3 @@ bool MeasureGUI_DistanceDlg::isValid( QString& msg ) { return MeasureGUI_Skeleton::isValid( msg ) && !myObj2->_is_nil(); } - - - - - - - - - - - - - - diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index cd2a6743e..516f9cd6c 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -203,4 +203,3 @@ bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I, return getOperation()->IsDone(); } } - diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index ed42f2126..a5b1bb77a 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -181,24 +181,3 @@ bool MeasureGUI_MaxToleranceDlg::getParameters( double& theMinFaceToler, return getOperation()->IsDone(); } } - - - - - - - - - - - - - - - - - - - - - diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.cxx b/src/MeasureGUI/MeasureGUI_PointDlg.cxx index 92bf23fd7..ccd2a8f07 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PointDlg.cxx @@ -61,14 +61,13 @@ //================================================================================= // class : MeasureGUI_PointDlg() // purpose : Constructs a MeasureGUI_PointDlg which is a child of 'parent' -// //================================================================================= MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) : MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PointDlg" ) { QPixmap iconPnt( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_POINT" ) ) ); - + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); @@ -78,7 +77,7 @@ MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) RadioButton1->setPixmap( iconPnt ); QGroupBox* aGrp = new QGroupBox( 2, Qt::Horizontal, tr( "COORDINATES" ), this ); - + new QLabel( tr( "POINT" ), aGrp ); QFrame* aFrame = new QFrame( aGrp ); mySelBtn = new QPushButton( aFrame ); @@ -111,7 +110,7 @@ MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) //================================================================================= // function : ~MeasureGUI_PointDlg() // purpose : Destroys the object and frees any allocated resources -//======================myX->setReadOnly( true );=========================================================== +//================================================================================= MeasureGUI_PointDlg::~MeasureGUI_PointDlg() { } @@ -181,7 +180,7 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes( aShape, aShapes ); - + if ( aShape != aShapes( i ) ) aName += QString( ":%1" ).arg( i ); @@ -206,23 +205,3 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() myZ->setText( "" ); } } - - - - - - - - - - - - - - - - - - - - diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index ea3bb594c..71d3d6980 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -31,6 +31,7 @@ #include "GEOM_Displayer.h" #include "GEOMImpl_Types.hxx" #include "GEOMBase.h" +#include "DlgRef_SpinBox.h" #include "SalomeApp_Tools.h" #include "utilities.h" @@ -148,9 +149,9 @@ void MeasureGUI_PropertiesDlg::processObject() } else { - myGrp->LineEdit2->setText( QString( "%1" ).arg( aLength ) ); - myGrp->LineEdit3->setText( QString( "%1" ).arg( anArea ) ); - myGrp->LineEdit4->setText( QString( "%1" ).arg( aVolume ) ); + myGrp->LineEdit2->setText( DlgRef_SpinBox::PrintDoubleValue( aLength ) ); + myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( anArea ) ); + myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( aVolume ) ); } } @@ -200,24 +201,3 @@ SALOME_Prs* MeasureGUI_PropertiesDlg::buildPrs() return getDisplayer()->BuildPrs( aResult ); } - - - - - - - - - - - - - - - - - - - - - diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index 886adba41..52ddfbce4 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -103,9 +103,9 @@ void OperationGUI_ArchimedeDlg::Init() double SpecificStep1 = 0.1; double SpecificStep2 = 0.01; /* min, max, myStep and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, 3); - GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue( 100.0 ); GroupPoints->SpinBox_DY->SetValue( 1.0 ); diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 1a4f75ecd..29ecc1795 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -146,7 +146,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW double SpecificStep = 10.0; QMap< int, DlgRef_SpinBox* >::iterator anIter; for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter ) - anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, 3 ); + anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY ); setHelpFileName("chamfer.htm"); diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.cxx b/src/OperationGUI/OperationGUI_ClippingDlg.cxx index 9e451629f..7f4d49762 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.cxx +++ b/src/OperationGUI/OperationGUI_ClippingDlg.cxx @@ -24,7 +24,7 @@ // File : OperationGUI_ClippingDlg.cxx // Author : Michael Zorin // Module : GEOM -// $Header: +// $Header$ #include "OperationGUI_ClippingDlg.h" #include "DlgRef_SpinBox.h" @@ -41,8 +41,6 @@ #include #include -//#include - // QT Includes #include #include @@ -109,8 +107,8 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg(GeometryGUI* theGeometryGUI, Layout1->addWidget( GroupArguments, 2, 0 ); /* Initialisations */ - SpinBox_Near->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, 3 ); - SpinBox_Far->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, 3 ); + SpinBox_Near->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY ); + SpinBox_Far->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY ); /* signals and slots connections */ connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); @@ -141,13 +139,13 @@ void OperationGUI_ClippingDlg::Init() SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); if (!anActiveWindow) return; - + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); if( !aVTKFrame ) return; - + TextLabelNear->setText( tr( "Near" ) ); TextLabelFar->setText( tr( "Far" ) ); @@ -155,40 +153,40 @@ void OperationGUI_ClippingDlg::Init() vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return; - + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); if( anActiveCamera == NULL ){ MESSAGE("Trying to reset clipping range of non-existant camera"); return; } - + // Find the plane equation for the camera view plane double vn[3]; anActiveCamera->GetViewPlaneNormal(vn); double position[3]; anActiveCamera->GetPosition(position); - + vtkFloatingPointType bounds[6]; aRenderer->ComputeVisiblePropBounds(bounds); - + double center[3]; center[0] = (bounds[0] + bounds[1])/2.0; center[1] = (bounds[2] + bounds[3])/2.0; center[2] = (bounds[4] + bounds[5])/2.0; - + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); - + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + (position[1]-center[1])*(position[1]-center[1]) + (position[2]-center[2])*(position[2]-center[2])); - + vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0}; - + SpinBox_Near->SetValue(range[0]); SpinBox_Far->SetValue(range[1]); - + return; } else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) @@ -200,7 +198,7 @@ void OperationGUI_ClippingDlg::Init() Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); - double depth, thickness; + double depth, thickness; int ztype= view3d->ZClipping(depth, thickness); SpinBox_Near->SetValue(depth); SpinBox_Far->SetValue(thickness); @@ -221,26 +219,26 @@ bool OperationGUI_ClippingDlg::ClickOnApply() SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); if (!anActiveWindow) return false; - + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); if( !aVTKFrame ) return false; - + vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return false; - + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); if( anActiveCamera == NULL ){ MESSAGE("Trying to reset clipping range of non-existant camera"); return false; } - + vtkFloatingPointType range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() }; if (range[0] < 0.0) range[0] = 0.0; anActiveCamera->SetClippingRange( range ); - + return true; } else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) @@ -248,11 +246,11 @@ bool OperationGUI_ClippingDlg::ClickOnApply() OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); - + double depth = SpinBox_Near->GetValue(); double thickness = SpinBox_Far->GetValue(); int aType = TypeCB->currentItem(); - + view3d->SetZClippingType(V3d_TypeOfZclipping(aType)); view3d->SetZClippingDepth(depth); view3d->SetZClippingWidth(thickness); @@ -309,7 +307,7 @@ void OperationGUI_ClippingDlg::onReset() SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); if (!anActiveWindow) return; - + if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { SVTK_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); @@ -318,40 +316,40 @@ void OperationGUI_ClippingDlg::onReset() vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return; - + vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); if( anActiveCamera == NULL ){ MESSAGE("Trying to reset clipping range of non-existant camera"); return; } - + // Find the plane equation for the camera view plane double vn[3]; anActiveCamera->GetViewPlaneNormal(vn); double position[3]; anActiveCamera->GetPosition(position); - + vtkFloatingPointType bounds[6]; aRenderer->ComputeVisiblePropBounds(bounds); - + double center[3]; center[0] = (bounds[0] + bounds[1])/2.0; center[1] = (bounds[2] + bounds[3])/2.0; center[2] = (bounds[4] + bounds[5])/2.0; - + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); - + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + (position[1]-center[1])*(position[1]-center[1]) + (position[2]-center[2])*(position[2]-center[2])); - + vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0}; - + SpinBox_Near->SetValue(range[0]); SpinBox_Far->SetValue(range[1]); - + return; } else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) @@ -360,12 +358,12 @@ void OperationGUI_ClippingDlg::onReset() TextLabelNear->setText( tr( "Depth" ) ); TextLabelFar->setText( tr( "Thickness" ) ); - + Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); - + view3d->SetZClippingType(V3d_TypeOfZclipping(0)); view3d->ZFitAll(); - double depth, thickness; + double depth, thickness; int ztype= view3d->ZClipping(depth, thickness); SpinBox_Near->SetValue(0); SpinBox_Far->SetValue(1000); diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 62633cd0a..e4808de4e 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -105,9 +105,9 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(GeometryGUI* theGeometryGUI, QWid /***************************************************************/ double SpecificStep = 10.0; - Group1->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); - Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); - Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); + Group1->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); setHelpFileName("fillet.htm"); diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 88535e435..1311eb899 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -44,7 +44,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_MultiRotationDlg() -// purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -124,13 +124,13 @@ void TransformationGUI_MultiRotationDlg::Init() double SpecificStep1 = 5; double SpecificStep2 = 1; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10); GroupPoints->SpinBox_DX->SetValue(myNbTimes1); - GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, 3); - GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); - GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10); GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); GroupDimensions->SpinBox_DX2->SetValue(myStep); @@ -164,8 +164,8 @@ void TransformationGUI_MultiRotationDlg::Init() connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); - - connect(myGeomGUI->getApp()->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_MULTIROTATION" ) ); @@ -219,7 +219,7 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); break; - } + } } myEditCurrentArgument->setFocus(); @@ -248,7 +248,7 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply() { if ( !onAccept() ) return false; - + initName(); ConstructorsClicked( getConstructorId() ); return true; @@ -301,7 +301,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_ALLSHAPES ); @@ -331,10 +331,10 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || + if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) { - myEditCurrentArgument = send; + myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } } @@ -347,9 +347,9 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() void TransformationGUI_MultiRotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - + ConstructorsClicked( getConstructorId() ); } @@ -381,7 +381,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) myStep = newValue; else if(send == GroupDimensions->SpinBox_DY2) myNbTimes2 = (int)newValue; - + displayPreview(); } @@ -431,10 +431,10 @@ bool TransformationGUI_MultiRotationDlg::isValid( QString& msg ) bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { case 0 : { @@ -456,10 +456,10 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) break; } } - + if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 75f3e4d35..7f5e33c15 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -45,7 +45,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_MultiTranslationDlg() -// purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -127,18 +127,18 @@ void TransformationGUI_MultiTranslationDlg::Init() /* Get setting of step value from file configuration */ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); - + double SpecificStep = 1; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10); GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DY->SetValue(myNbTimesU); - GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); - GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10); GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); GroupDimensions->SpinBox_DX2->SetValue(myStepV); @@ -178,11 +178,10 @@ void TransformationGUI_MultiTranslationDlg::Init() connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV())); - - connect(myGeomGUI->getApp()->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - initName( tr( "GEOM_MULTITRANSLATION" ) ); ConstructorsClicked( 0 ); } @@ -195,7 +194,7 @@ void TransformationGUI_MultiTranslationDlg::Init() void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) { disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - + myStepU = myStepV = 50.0; myNbTimesU = myNbTimesV = 2; @@ -238,10 +237,10 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorI break; } } - + myEditCurrentArgument->setFocus(); myBase = myVectorU = GEOM::GEOM_Object::_nil(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -265,7 +264,7 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply() { if ( !onAccept() ) return false; - + initName(); ConstructorsClicked( getConstructorId() ); return true; @@ -279,13 +278,15 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply() void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - - if(IObjectCount() != 1) { - if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + + if (IObjectCount() != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1) myBase = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + else if (myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2) myVectorU = GEOM::GEOM_Object::_nil(); - else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + else if (myEditCurrentArgument == GroupDimensions->LineEdit3) myVectorV = GEOM::GEOM_Object::_nil(); return; } @@ -297,15 +298,17 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) - myBase = aSelectedObject; - else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + if (myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupDimensions->LineEdit1) + myBase = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints->LineEdit2 || + myEditCurrentArgument == GroupDimensions->LineEdit2) myVectorU = aSelectedObject; - else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + else if (myEditCurrentArgument == GroupDimensions->LineEdit3) myVectorV = aSelectedObject; myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); - + displayPreview(); } @@ -317,7 +320,6 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; @@ -339,7 +341,7 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupDimensions->LineEdit3; globalSelection( GEOM_LINE ); } - + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -356,7 +358,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || send == GroupDimensions->LineEdit3) { - myEditCurrentArgument = send; + myEditCurrentArgument = send; GEOMBase_Skeleton::LineEditReturnPressed(); } } @@ -369,7 +371,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); @@ -418,7 +420,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu break; } } - + displayPreview(); } @@ -430,14 +432,14 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu void TransformationGUI_MultiTranslationDlg::ReverseStepU() { myStepU = -myStepU; - + int aConstructorId = getConstructorId(); if(aConstructorId == 0) GroupPoints->SpinBox_DX->SetValue(myStepU); else if(aConstructorId == 1) GroupDimensions->SpinBox_DX1->SetValue(myStepU); - + displayPreview(); } @@ -449,9 +451,9 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU() void TransformationGUI_MultiTranslationDlg::ReverseStepV() { myStepV = -myStepV; - + GroupDimensions->SpinBox_DX2->SetValue(myStepV); - + displayPreview(); } @@ -473,12 +475,12 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) { int aConstructorId = getConstructorId(); - + if(aConstructorId == 0) return !(myBase->_is_nil() || myVectorU->_is_nil()); else if(aConstructorId == 1) return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()); - return 0; + return 0; } //================================================================================= @@ -488,10 +490,10 @@ bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { case 0 : { @@ -512,10 +514,10 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) break; } } - + if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx index 6a33e47e8..42ee42499 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -42,7 +42,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_OffsetDlg() -// purpose : Constructs a TransformationGUI_OffsetDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_OffsetDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -62,7 +62,7 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr RadioButton1->setPixmap(image0); RadioButton2->close(TRUE); RadioButton3->close(TRUE); - + GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); @@ -73,13 +73,13 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr GroupPoints->CheckButton1->hide(); GroupPoints->PushButton1->setPixmap(image1); - + Layout1->addWidget(GroupPoints, 2, 0); - + /***************************************************************/ - setHelpFileName("offset_surface.htm"); - + setHelpFileName("offset_surface.htm"); + Init(); } @@ -89,7 +89,7 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr // purpose : Destroys the object and frees any allocated resources //================================================================================= TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg() -{ +{ /* no need to delete child widgets, Qt does it all for us */ } @@ -99,20 +99,18 @@ TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg() // purpose : //================================================================================= void TransformationGUI_OffsetDlg::Init() -{ +{ /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setReadOnly( true ); - + /* Get setting of step value from file configuration */ double step = 1; - + /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox_DX->setPrecision(5); - //@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(1e-05); - + // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); CreateCopyModeChanged(true); @@ -120,18 +118,17 @@ void TransformationGUI_OffsetDlg::Init() /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - + initName( tr( "GEOM_OFFSET" ) ); globalSelection( GEOM_ALLSHAPES ); - } @@ -154,7 +151,7 @@ bool TransformationGUI_OffsetDlg::ClickOnApply() { if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) ) return false; - + initName(); return true; } @@ -180,9 +177,9 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument() GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) return; - + myEditCurrentArgument->setText( aName ); - + displayPreview(); } @@ -209,7 +206,7 @@ void TransformationGUI_OffsetDlg::LineEditReturnPressed() void TransformationGUI_OffsetDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; @@ -237,7 +234,7 @@ void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) void TransformationGUI_OffsetDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection( GEOM_ALLSHAPES ); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -292,28 +289,28 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg ) bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - - + if (GroupPoints->CheckButton1->isChecked() || IsPreview()) for (int i = 0; i < myObjects.length(); i++) - { - - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + OffsetShapeCopy( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } else for (int i = 0; i < myObjects.length(); i++) - { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); - } - + { + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + OffsetShape( myObjects[i], GetOffset() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); + } + res = true; - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 39f71533b..51b85c60b 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -44,7 +44,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_RotationDlg() -// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -88,16 +88,17 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ + double anAngle = 0; double SpecificStep = 5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(anAngle); // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); CreateCopyModeChanged(true); - + /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -107,14 +108,14 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; @@ -143,9 +144,9 @@ void TransformationGUI_RotationDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit2->clear(); - + myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - + initName( tr( "GEOM_ROTATION" ) ); ConstructorsClicked( 0 ); } @@ -157,14 +158,14 @@ void TransformationGUI_RotationDlg::Init() void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId) { disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - + myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); switch (constructorId) { case 0: /* rotation an object angle and axis */ - { + { GroupPoints->ShowRows(2,3,false); resize(0,0); GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); @@ -186,11 +187,11 @@ void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit5->clear(); myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); break; - } + } } - + myEditCurrentArgument->setFocus(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -213,7 +214,7 @@ bool TransformationGUI_RotationDlg::ClickOnApply() { if ( !onAccept( GroupPoints->CheckButton1->isChecked()) ) return false; - + initName(); ConstructorsClicked( getConstructorId() ); return true; @@ -228,7 +229,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); QString aName; - + if(myEditCurrentArgument == GroupPoints->LineEdit1) { int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); @@ -241,7 +242,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() if (!myObjects.length()) return; } - else + else { if(IObjectCount() != 1) { @@ -273,7 +274,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() aName = GEOMBase::GetName( aSelectedObject ); } myEditCurrentArgument->setText( aName ); - + displayPreview(); } @@ -285,7 +286,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() void TransformationGUI_RotationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); @@ -316,7 +317,7 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() // purpose : //================================================================================= void TransformationGUI_RotationDlg::LineEditReturnPressed() -{ +{ QLineEdit* send = (QLineEdit*)sender(); if(send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) @@ -334,7 +335,7 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed() void TransformationGUI_RotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); @@ -380,12 +381,12 @@ bool TransformationGUI_RotationDlg::isValid( QString& msg ) { switch (getConstructorId()) { - case 0: + case 0: { return !(myObjects.length() == 0 || myAxis->_is_nil()); break; } - case 1: + case 1: { return !(myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() ); break; @@ -405,22 +406,24 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); GEOM::GEOM_Object_var anObj; - - switch ( getConstructorId() ) + + switch ( getConstructorId() ) { case 0 : { if (toCreateCopy) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + RotateCopy( myObjects[i], myAxis, GetAngle() * PI180 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + Rotate( myObjects[i], myAxis, GetAngle() * PI180 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } @@ -432,14 +435,16 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) if (toCreateCopy) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + RotateThreePointsCopy( myObjects[i], myCentPoint, myPoint1, myPoint2 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + RotateThreePoints( myObjects[i], myCentPoint, myPoint1, myPoint2 ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } @@ -447,7 +452,7 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects ) break; } } - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 40e6cc20a..44ec3615a 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -44,7 +44,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_ScaleDlg() -// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -85,9 +85,9 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG double aFactor = 2.0; double SpecificStep = 0.5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox_DX->SetValue(aFactor); - + // Activate Create a Copy mode GroupPoints->CheckButton1->setChecked(true); CreateCopyModeChanged(true); @@ -95,18 +95,18 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - - connect(myGeomGUI->getApp()->selectionMgr(), + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; setHelpFileName("scale_transform.htm"); @@ -120,7 +120,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG // purpose : Destroys the object and frees any allocated resources //================================================================================= TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg() -{ +{ /* no need to delete child widgets, Qt does it all for us */ } @@ -133,9 +133,9 @@ void TransformationGUI_ScaleDlg::Init() { myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit2->clear(); - + myPoint = GEOM::GEOM_Object::_nil(); - + initName( tr( "GEOM_SCALE" ) ); } @@ -200,7 +200,7 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument() aName = GEOMBase::GetName( myPoint ); } myEditCurrentArgument->setText( aName ); - + displayPreview(); } @@ -228,7 +228,7 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed() void TransformationGUI_ScaleDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - + if(send == GroupPoints->PushButton1) { myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); @@ -237,7 +237,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit2; globalSelection( GEOM_POINT ); } - + myEditCurrentArgument->setFocus(); SelectionIntoArgument(); } @@ -250,7 +250,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() void TransformationGUI_ScaleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection(); GroupPoints->LineEdit1->setFocus(); @@ -305,25 +305,27 @@ bool TransformationGUI_ScaleDlg::isValid( QString& msg ) bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; if (GroupPoints->CheckButton1->isChecked() || IsPreview()) for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + ScaleShapeCopy( myObjects[i], myPoint, GetFactor() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } else for (int i = 0; i < myObjects.length(); i++) { - anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->ScaleShape( myObjects[i], myPoint, GetFactor() ); + anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )-> + ScaleShape( myObjects[i], myPoint, GetFactor() ); if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); } res = true; - + return res; } diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 22a8a0e2b..aa29811d3 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -44,7 +44,7 @@ using namespace std; //================================================================================= // class : TransformationGUI_TranslationDlg() -// purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the +// purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. @@ -84,9 +84,9 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg Layout1->addWidget(GroupPoints, 2, 0); /***************************************************************/ - + setHelpFileName("translation.htm"); - + Init(); } @@ -124,9 +124,9 @@ void TransformationGUI_TranslationDlg::Init() double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); - GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); + GroupPoints->SpinBox1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); + GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); GroupPoints->SpinBox1->SetValue(0.0); GroupPoints->SpinBox2->SetValue(0.0); @@ -153,8 +153,8 @@ void TransformationGUI_TranslationDlg::Init() connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - connect(myGeomGUI->getApp()->selectionMgr(), - SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(myGeomGUI->getApp()->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_TRANSLATION" ) ); ConstructorsClicked( 0 ); @@ -176,7 +176,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) switch (constructorId) { case 0: /* translation an object by dx, dy, dz */ - { + { GroupPoints->ShowRows(1,2,false); resize(0,0); GroupPoints->ShowRows(3,5,true); @@ -192,7 +192,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit3->clear(); myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); break; - } + } case 2: /* translation an object by vector */ { GroupPoints->ShowRows(2,5,false); @@ -206,7 +206,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) } myEditCurrentArgument->setFocus(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -269,7 +269,7 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() myPoint2 = GEOM::GEOM_Object::_nil(); return; } - + Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult); @@ -281,7 +281,7 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) myVector = aSelectedObject; else if (myEditCurrentArgument == GroupPoints->LineEdit3) - myPoint2 = aSelectedObject; + myPoint2 = aSelectedObject; aName = GEOMBase::GetName( aSelectedObject ); } @@ -311,7 +311,7 @@ void TransformationGUI_TranslationDlg::LineEditReturnPressed() // purpose : //================================================================================= void TransformationGUI_TranslationDlg::SetEditCurrentArgument() -{ +{ QPushButton* send = (QPushButton*)sender(); if (send == GroupPoints->PushButton1) { @@ -341,7 +341,7 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(myGeomGUI->getApp()->selectionMgr(), + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); @@ -419,7 +419,7 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj; - switch ( getConstructorId() ) + switch ( getConstructorId() ) { case 0: {