Correct precision of double values displaying (bug 16123).

This commit is contained in:
jfa 2007-07-12 08:21:56 +00:00
parent eac09dcfb0
commit a46ed42b20
17 changed files with 296 additions and 370 deletions

View File

@ -328,16 +328,16 @@ void EntityGUI_SketcherDlg::Init()
double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
/* min, max, step and decimals for spin boxes */ /* min, max, step and decimals for spin boxes */
Group1Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group1Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group2Spin->SpinBox_DX->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, 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group4Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); Group4Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY);
Group4Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); Group4Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY);
Group4Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group4Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group4Spin->SpinBox_DS->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); Group4Spin->SpinBox_DS->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY);
/* displays Dialog */ /* displays Dialog */
GroupConstructors->setEnabled(false); GroupConstructors->setEnabled(false);
@ -438,8 +438,8 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId)
if ( constructorId == 1 ) if ( constructorId == 1 )
{ // XY { // XY
mySketchType = PT_ABS; mySketchType = PT_ABS;
Group2Spin->SpinBox_DX->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, 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2")); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2"));
Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2"));
myX = 0.0; myX = 0.0;
@ -454,8 +454,8 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId)
else if ( constructorId == 0 ) else if ( constructorId == 0 )
{ // DXDY { // DXDY
mySketchType = PT_RELATIVE; mySketchType = PT_RELATIVE;
Group2Spin->SpinBox_DX->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, 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2")); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2"));
Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2"));
myDX = 0.0; myDX = 0.0;
@ -512,8 +512,8 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId)
myLength = 100.0; myLength = 100.0;
if ( myConstructorDirId == 2 ) if ( myConstructorDirId == 2 )
{ // Angle { // Angle
Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); Group2Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY);
Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2"));
Group2Spin->SpinBox_DX->SetValue(myAngle); Group2Spin->SpinBox_DX->SetValue(myAngle);
Group2Spin->buttonApply->setFocus(); Group2Spin->buttonApply->setFocus();
@ -588,9 +588,9 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId)
} }
else if ( myConstructorDirId == 3 ) else if ( myConstructorDirId == 3 )
{ // DXDY { // DXDY
Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY);
Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, 3); Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 0.1, DBL_DIGITS_DISPLAY);
Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2"));
Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2"));
myDX = 0.0; myDX = 0.0;
@ -626,54 +626,54 @@ void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId)
{ // Angle { // Angle
if ( constructorId == 2 ) if ( constructorId == 2 )
{ // Length { // Length
mySketchType = DIR_ANGLE_LENGTH; mySketchType = DIR_ANGLE_LENGTH;
Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); Group3Spin->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY);
Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group3Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); Group3Spin->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY);
Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2"));
Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2"));
Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2"));
Group3Spin->SpinBox_DX->SetValue(myAngle); Group3Spin->SpinBox_DX->SetValue(myAngle);
myRadius = 100.0; myRadius = 100.0;
Group3Spin->SpinBox_DY->SetValue(myRadius); Group3Spin->SpinBox_DY->SetValue(myRadius);
myLength = 30.0; myLength = 30.0;
Group3Spin->SpinBox_DZ->SetValue(myLength); Group3Spin->SpinBox_DZ->SetValue(myLength);
Group3Spin->show(); Group3Spin->show();
Group3Spin->buttonApply->setFocus(); Group3Spin->buttonApply->setFocus();
} }
} }
else if ( myConstructorDirId == 0 ) else if ( myConstructorDirId == 0 )
{ // Perpendicular { // Perpendicular
if ( constructorId == 2 ) if ( constructorId == 2 )
{ // Length { // Length
mySketchType = DIR_PER_LENGTH; mySketchType = DIR_PER_LENGTH;
Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY);
Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2"));
Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2"));
myRadius = 100.0; myRadius = 100.0;
Group2Spin->SpinBox_DX->SetValue(myRadius); Group2Spin->SpinBox_DX->SetValue(myRadius);
myLength = 30.0; myLength = 30.0;
Group2Spin->SpinBox_DY->SetValue(myLength); Group2Spin->SpinBox_DY->SetValue(myLength);
Group2Spin->show(); Group2Spin->show();
Group2Spin->buttonApply->setFocus(); Group2Spin->buttonApply->setFocus();
} }
} }
else if ( myConstructorDirId == 1 ) else if ( myConstructorDirId == 1 )
{ // Tangent { // Tangent
if ( constructorId == 2 ) if ( constructorId == 2 )
{ // Length { // Length
mySketchType = DIR_TAN_LENGTH; mySketchType = DIR_TAN_LENGTH;
Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., 3); Group2Spin->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5., DBL_DIGITS_DISPLAY);
Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2"));
Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2"));
myRadius = 100.0; myRadius = 100.0;
Group2Spin->SpinBox_DX->SetValue(myRadius); Group2Spin->SpinBox_DX->SetValue(myRadius);
myLength = 30.0; myLength = 30.0;
Group2Spin->SpinBox_DY->SetValue(myLength); Group2Spin->SpinBox_DY->SetValue(myLength);
Group2Spin->show(); Group2Spin->show();
Group2Spin->buttonApply->setFocus(); Group2Spin->buttonApply->setFocus();
} }
} }
else if ( myConstructorDirId == 3 ) else if ( myConstructorDirId == 3 )

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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_CenterMassDlg.h"
#include "MeasureGUI_1Sel3LineEdit_QTD.h" #include "MeasureGUI_1Sel3LineEdit_QTD.h"
#include "DlgRef_SpinBox.h"
#include "utilities.h" #include "utilities.h"
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SalomeApp_Application.h" #include "SalomeApp_Application.h"
@ -245,9 +247,9 @@ void MeasureGUI_CenterMassDlg::processObject()
getParameters( x, y, z ); getParameters( x, y, z );
myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) ); myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );
myGrp->LineEdit2->setText( QString( "%1" ).arg( x ) ); myGrp->LineEdit2->setText( DlgRef_SpinBox::PrintDoubleValue( x ) );
myGrp->LineEdit3->setText( QString( "%1" ).arg( y ) ); myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( y ) );
myGrp->LineEdit4->setText( QString( "%1" ).arg( z ) ); myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( z ) );
displayPreview(); displayPreview();
} }

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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 "MeasureGUI_2Sel1LineEdit_QTD.h"
#include "GEOMBase.h" #include "GEOMBase.h"
#include "GEOM_Displayer.h" #include "GEOM_Displayer.h"
#include "DlgRef_SpinBox.h"
#include "SUIT_Session.h" #include "SUIT_Session.h"
#include "SUIT_ViewWindow.h" #include "SUIT_ViewWindow.h"
@ -118,14 +119,13 @@ void MeasureGUI_DistanceDlg::Init()
mySelEdit = myGrp->LineEdit1; mySelEdit = myGrp->LineEdit1;
mySelBtn2 = myGrp->PushButton2; mySelBtn2 = myGrp->PushButton2;
mySelEdit2 = myGrp->LineEdit2; mySelEdit2 = myGrp->LineEdit2;
myEditCurrentArgument = mySelEdit; myEditCurrentArgument = mySelEdit;
connect( mySelEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( mySelEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
MeasureGUI_Skeleton::Init(); MeasureGUI_Skeleton::Init();
} }
@ -163,7 +163,7 @@ void MeasureGUI_DistanceDlg::processObject()
double aDist = 0.; double aDist = 0.;
if ( getParameters( aDist, aPnt1, aPnt2 ) ) if ( getParameters( aDist, aPnt1, aPnt2 ) )
{ {
myGrp->LineEdit3->setText( QString( "%1" ).arg( aDist ) ); myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( aDist ) );
redisplayPreview(); redisplayPreview();
} }
else else
@ -171,7 +171,6 @@ void MeasureGUI_DistanceDlg::processObject()
myGrp->LineEdit3->setText( "" ); myGrp->LineEdit3->setText( "" );
erasePreview(); erasePreview();
} }
} }
//================================================================================= //=================================================================================
@ -256,12 +255,14 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
{ {
double aDist = 0.; double aDist = 0.;
gp_Pnt aPnt1( 0, 0, 0 ), aPnt2( 0, 0, 0 ); gp_Pnt aPnt1( 0, 0, 0 ), aPnt2( 0, 0, 0 );
if ( myObj->_is_nil() || myObj2->_is_nil() || !getParameters( aDist, aPnt1, aPnt2 ) || SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() ) if ( myObj->_is_nil() || myObj2->_is_nil() ||
!getParameters( aDist, aPnt1, aPnt2 ) ||
vw->getViewManager()->getType() != OCCViewer_Viewer::Type() )
return 0; return 0;
try try
{ {
if( aDist <= 1.e-9 ) if( aDist <= 1.e-9 )
@ -282,7 +283,6 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
( aPnt1.Y() + aPnt2.Y() ) / 2, ( aPnt1.Y() + aPnt2.Y() ) / 2,
( aPnt1.Z() + aPnt2.Z() ) / 2 + 100 ); ( aPnt1.Z() + aPnt2.Z() ) / 2 + 100 );
gp_Vec va( aPnt3, aPnt1 ); gp_Vec va( aPnt3, aPnt1 );
gp_Vec vb( aPnt3, aPnt2 ); gp_Vec vb( aPnt3, aPnt2 );
@ -291,18 +291,15 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
aPnt3.SetY( ( aPnt1.Y() + aPnt2.Y() ) / 2 + 100 ); aPnt3.SetY( ( aPnt1.Y() + aPnt2.Y() ) / 2 + 100 );
aPnt3.SetZ( ( aPnt1.Z() + aPnt2.Z() ) / 2 ); aPnt3.SetZ( ( aPnt1.Z() + aPnt2.Z() ) / 2 );
} }
gce_MakePln gce_MP( aPnt1, aPnt2, aPnt3 ); gce_MakePln gce_MP( aPnt1, aPnt2, aPnt3 );
Handle( Geom_Plane ) P = new Geom_Plane( gce_MP.Value() ); Handle( Geom_Plane ) P = new Geom_Plane( gce_MP.Value() );
Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension( Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension
aVert1, aVert2, P, aDist, TCollection_ExtendedString( (Standard_CString)aLabel.latin1() ) ); (aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.latin1()));
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); SOCC_Prs* aPrs =
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) ); dynamic_cast<SOCC_Prs*>( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) );
//QAD_ViewFrame* vf = GEOM_Displayer::GetActiveView();
//OCCViewer_Prs* aPrs = dynamic_cast<OCCViewer_Prs*>( vf->CreatePrs( 0 ) );
if ( aPrs ) if ( aPrs )
aPrs->AddObject( anIO ); aPrs->AddObject( anIO );
@ -324,17 +321,3 @@ bool MeasureGUI_DistanceDlg::isValid( QString& msg )
{ {
return MeasureGUI_Skeleton::isValid( msg ) && !myObj2->_is_nil(); return MeasureGUI_Skeleton::isValid( msg ) && !myObj2->_is_nil();
} }

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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(); return getOperation()->IsDone();
} }
} }

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 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(); return getOperation()->IsDone();
} }
} }

View File

@ -61,14 +61,13 @@
//================================================================================= //=================================================================================
// class : MeasureGUI_PointDlg() // class : MeasureGUI_PointDlg()
// purpose : Constructs a MeasureGUI_PointDlg which is a child of 'parent' // purpose : Constructs a MeasureGUI_PointDlg which is a child of 'parent'
//
//================================================================================= //=================================================================================
MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent )
: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PointDlg" ) : MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PointDlg" )
{ {
QPixmap iconPnt( SUIT_Session::session()->resourceMgr()->loadPixmap( QPixmap iconPnt( SUIT_Session::session()->resourceMgr()->loadPixmap(
"GEOM",tr( "ICON_DLG_POINT" ) ) ); "GEOM",tr( "ICON_DLG_POINT" ) ) );
QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap(
"GEOM",tr( "ICON_SELECT" ) ) ); "GEOM",tr( "ICON_SELECT" ) ) );
@ -78,7 +77,7 @@ MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent )
RadioButton1->setPixmap( iconPnt ); RadioButton1->setPixmap( iconPnt );
QGroupBox* aGrp = new QGroupBox( 2, Qt::Horizontal, tr( "COORDINATES" ), this ); QGroupBox* aGrp = new QGroupBox( 2, Qt::Horizontal, tr( "COORDINATES" ), this );
new QLabel( tr( "POINT" ), aGrp ); new QLabel( tr( "POINT" ), aGrp );
QFrame* aFrame = new QFrame( aGrp ); QFrame* aFrame = new QFrame( aGrp );
mySelBtn = new QPushButton( aFrame ); mySelBtn = new QPushButton( aFrame );
@ -111,7 +110,7 @@ MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent )
//================================================================================= //=================================================================================
// function : ~MeasureGUI_PointDlg() // function : ~MeasureGUI_PointDlg()
// purpose : Destroys the object and frees any allocated resources // purpose : Destroys the object and frees any allocated resources
//======================myX->setReadOnly( true );=========================================================== //=================================================================================
MeasureGUI_PointDlg::~MeasureGUI_PointDlg() MeasureGUI_PointDlg::~MeasureGUI_PointDlg()
{ {
} }
@ -181,7 +180,7 @@ void MeasureGUI_PointDlg::SelectionIntoArgument()
TopTools_IndexedMapOfShape aShapes; TopTools_IndexedMapOfShape aShapes;
TopExp::MapShapes( aShape, aShapes ); TopExp::MapShapes( aShape, aShapes );
if ( aShape != aShapes( i ) ) if ( aShape != aShapes( i ) )
aName += QString( ":%1" ).arg( i ); aName += QString( ":%1" ).arg( i );
@ -206,23 +205,3 @@ void MeasureGUI_PointDlg::SelectionIntoArgument()
myZ->setText( "" ); myZ->setText( "" );
} }
} }

View File

@ -31,6 +31,7 @@
#include "GEOM_Displayer.h" #include "GEOM_Displayer.h"
#include "GEOMImpl_Types.hxx" #include "GEOMImpl_Types.hxx"
#include "GEOMBase.h" #include "GEOMBase.h"
#include "DlgRef_SpinBox.h"
#include "SalomeApp_Tools.h" #include "SalomeApp_Tools.h"
#include "utilities.h" #include "utilities.h"
@ -148,9 +149,9 @@ void MeasureGUI_PropertiesDlg::processObject()
} }
else else
{ {
myGrp->LineEdit2->setText( QString( "%1" ).arg( aLength ) ); myGrp->LineEdit2->setText( DlgRef_SpinBox::PrintDoubleValue( aLength ) );
myGrp->LineEdit3->setText( QString( "%1" ).arg( anArea ) ); myGrp->LineEdit3->setText( DlgRef_SpinBox::PrintDoubleValue( anArea ) );
myGrp->LineEdit4->setText( QString( "%1" ).arg( aVolume ) ); myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( aVolume ) );
} }
} }
@ -200,24 +201,3 @@ SALOME_Prs* MeasureGUI_PropertiesDlg::buildPrs()
return getDisplayer()->BuildPrs( aResult ); return getDisplayer()->BuildPrs( aResult );
} }

View File

@ -103,9 +103,9 @@ void OperationGUI_ArchimedeDlg::Init()
double SpecificStep1 = 0.1; double SpecificStep1 = 0.1;
double SpecificStep2 = 0.01; double SpecificStep2 = 0.01;
/* min, max, myStep and decimals for spin boxes & initial values */ /* min, max, myStep and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, myStep, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, 3); GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep1, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, 3); GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep2, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DX->SetValue( 100.0 ); GroupPoints->SpinBox_DX->SetValue( 100.0 );
GroupPoints->SpinBox_DY->SetValue( 1.0 ); GroupPoints->SpinBox_DY->SetValue( 1.0 );

View File

@ -146,7 +146,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QW
double SpecificStep = 10.0; double SpecificStep = 10.0;
QMap< int, DlgRef_SpinBox* >::iterator anIter; QMap< int, DlgRef_SpinBox* >::iterator anIter;
for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++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"); setHelpFileName("chamfer.htm");

View File

@ -24,7 +24,7 @@
// File : OperationGUI_ClippingDlg.cxx // File : OperationGUI_ClippingDlg.cxx
// Author : Michael Zorin // Author : Michael Zorin
// Module : GEOM // Module : GEOM
// $Header: // $Header$
#include "OperationGUI_ClippingDlg.h" #include "OperationGUI_ClippingDlg.h"
#include "DlgRef_SpinBox.h" #include "DlgRef_SpinBox.h"
@ -41,8 +41,6 @@
#include <V3d_View.hxx> #include <V3d_View.hxx>
#include <V3d.hxx> #include <V3d.hxx>
//#include <V3d_Plane.hxx>
// QT Includes // QT Includes
#include <qapplication.h> #include <qapplication.h>
#include <qgroupbox.h> #include <qgroupbox.h>
@ -109,8 +107,8 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg(GeometryGUI* theGeometryGUI,
Layout1->addWidget( GroupArguments, 2, 0 ); Layout1->addWidget( GroupArguments, 2, 0 );
/* Initialisations */ /* Initialisations */
SpinBox_Near->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, 3 ); SpinBox_Far->RangeStepAndValidator( COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY );
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
@ -141,13 +139,13 @@ void OperationGUI_ClippingDlg::Init()
SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
if (!anActiveWindow) if (!anActiveWindow)
return; return;
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() )
{ {
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow ); SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
if( !aVTKFrame ) if( !aVTKFrame )
return; return;
TextLabelNear->setText( tr( "Near" ) ); TextLabelNear->setText( tr( "Near" ) );
TextLabelFar->setText( tr( "Far" ) ); TextLabelFar->setText( tr( "Far" ) );
@ -155,40 +153,40 @@ void OperationGUI_ClippingDlg::Init()
vtkRenderer* aRenderer = aVTKFrame->getRenderer(); vtkRenderer* aRenderer = aVTKFrame->getRenderer();
if(!aRenderer) return; if(!aRenderer) return;
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
if( anActiveCamera == NULL ){ if( anActiveCamera == NULL ){
MESSAGE("Trying to reset clipping range of non-existant camera"); MESSAGE("Trying to reset clipping range of non-existant camera");
return; return;
} }
// Find the plane equation for the camera view plane // Find the plane equation for the camera view plane
double vn[3]; double vn[3];
anActiveCamera->GetViewPlaneNormal(vn); anActiveCamera->GetViewPlaneNormal(vn);
double position[3]; double position[3];
anActiveCamera->GetPosition(position); anActiveCamera->GetPosition(position);
vtkFloatingPointType bounds[6]; vtkFloatingPointType bounds[6];
aRenderer->ComputeVisiblePropBounds(bounds); aRenderer->ComputeVisiblePropBounds(bounds);
double center[3]; double center[3];
center[0] = (bounds[0] + bounds[1])/2.0; center[0] = (bounds[0] + bounds[1])/2.0;
center[1] = (bounds[2] + bounds[3])/2.0; center[1] = (bounds[2] + bounds[3])/2.0;
center[2] = (bounds[4] + bounds[5])/2.0; center[2] = (bounds[4] + bounds[5])/2.0;
double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
(bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
(bounds[5]-bounds[4])*(bounds[5]-bounds[4])); (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
(position[1]-center[1])*(position[1]-center[1]) + (position[1]-center[1])*(position[1]-center[1]) +
(position[2]-center[2])*(position[2]-center[2])); (position[2]-center[2])*(position[2]-center[2]));
vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0}; vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0};
SpinBox_Near->SetValue(range[0]); SpinBox_Near->SetValue(range[0]);
SpinBox_Far->SetValue(range[1]); SpinBox_Far->SetValue(range[1]);
return; return;
} }
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) 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(); Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView();
double depth, thickness; double depth, thickness;
int ztype= view3d->ZClipping(depth, thickness); int ztype= view3d->ZClipping(depth, thickness);
SpinBox_Near->SetValue(depth); SpinBox_Near->SetValue(depth);
SpinBox_Far->SetValue(thickness); SpinBox_Far->SetValue(thickness);
@ -221,26 +219,26 @@ bool OperationGUI_ClippingDlg::ClickOnApply()
SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
if (!anActiveWindow) if (!anActiveWindow)
return false; return false;
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() )
{ {
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow ); SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
if( !aVTKFrame ) if( !aVTKFrame )
return false; return false;
vtkRenderer* aRenderer = aVTKFrame->getRenderer(); vtkRenderer* aRenderer = aVTKFrame->getRenderer();
if(!aRenderer) return false; if(!aRenderer) return false;
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
if( anActiveCamera == NULL ){ if( anActiveCamera == NULL ){
MESSAGE("Trying to reset clipping range of non-existant camera"); MESSAGE("Trying to reset clipping range of non-existant camera");
return false; return false;
} }
vtkFloatingPointType range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() }; vtkFloatingPointType range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() };
if (range[0] < 0.0) range[0] = 0.0; if (range[0] < 0.0) range[0] = 0.0;
anActiveCamera->SetClippingRange( range ); anActiveCamera->SetClippingRange( range );
return true; return true;
} }
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() )
@ -248,11 +246,11 @@ bool OperationGUI_ClippingDlg::ClickOnApply()
OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow ); OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView();
double depth = SpinBox_Near->GetValue(); double depth = SpinBox_Near->GetValue();
double thickness = SpinBox_Far->GetValue(); double thickness = SpinBox_Far->GetValue();
int aType = TypeCB->currentItem(); int aType = TypeCB->currentItem();
view3d->SetZClippingType(V3d_TypeOfZclipping(aType)); view3d->SetZClippingType(V3d_TypeOfZclipping(aType));
view3d->SetZClippingDepth(depth); view3d->SetZClippingDepth(depth);
view3d->SetZClippingWidth(thickness); view3d->SetZClippingWidth(thickness);
@ -309,7 +307,7 @@ void OperationGUI_ClippingDlg::onReset()
SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
if (!anActiveWindow) if (!anActiveWindow)
return; return;
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() )
{ {
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow ); SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
@ -318,40 +316,40 @@ void OperationGUI_ClippingDlg::onReset()
vtkRenderer* aRenderer = aVTKFrame->getRenderer(); vtkRenderer* aRenderer = aVTKFrame->getRenderer();
if(!aRenderer) return; if(!aRenderer) return;
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera(); vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
if( anActiveCamera == NULL ){ if( anActiveCamera == NULL ){
MESSAGE("Trying to reset clipping range of non-existant camera"); MESSAGE("Trying to reset clipping range of non-existant camera");
return; return;
} }
// Find the plane equation for the camera view plane // Find the plane equation for the camera view plane
double vn[3]; double vn[3];
anActiveCamera->GetViewPlaneNormal(vn); anActiveCamera->GetViewPlaneNormal(vn);
double position[3]; double position[3];
anActiveCamera->GetPosition(position); anActiveCamera->GetPosition(position);
vtkFloatingPointType bounds[6]; vtkFloatingPointType bounds[6];
aRenderer->ComputeVisiblePropBounds(bounds); aRenderer->ComputeVisiblePropBounds(bounds);
double center[3]; double center[3];
center[0] = (bounds[0] + bounds[1])/2.0; center[0] = (bounds[0] + bounds[1])/2.0;
center[1] = (bounds[2] + bounds[3])/2.0; center[1] = (bounds[2] + bounds[3])/2.0;
center[2] = (bounds[4] + bounds[5])/2.0; center[2] = (bounds[4] + bounds[5])/2.0;
double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + double width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
(bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
(bounds[5]-bounds[4])*(bounds[5]-bounds[4])); (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + double distance = sqrt((position[0]-center[0])*(position[0]-center[0]) +
(position[1]-center[1])*(position[1]-center[1]) + (position[1]-center[1])*(position[1]-center[1]) +
(position[2]-center[2])*(position[2]-center[2])); (position[2]-center[2])*(position[2]-center[2]));
vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0}; vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0};
SpinBox_Near->SetValue(range[0]); SpinBox_Near->SetValue(range[0]);
SpinBox_Far->SetValue(range[1]); SpinBox_Far->SetValue(range[1]);
return; return;
} }
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() )
@ -360,12 +358,12 @@ void OperationGUI_ClippingDlg::onReset()
TextLabelNear->setText( tr( "Depth" ) ); TextLabelNear->setText( tr( "Depth" ) );
TextLabelFar->setText( tr( "Thickness" ) ); TextLabelFar->setText( tr( "Thickness" ) );
Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView();
view3d->SetZClippingType(V3d_TypeOfZclipping(0)); view3d->SetZClippingType(V3d_TypeOfZclipping(0));
view3d->ZFitAll(); view3d->ZFitAll();
double depth, thickness; double depth, thickness;
int ztype= view3d->ZClipping(depth, thickness); int ztype= view3d->ZClipping(depth, thickness);
SpinBox_Near->SetValue(0); SpinBox_Near->SetValue(0);
SpinBox_Far->SetValue(1000); SpinBox_Far->SetValue(1000);

View File

@ -105,9 +105,9 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg(GeometryGUI* theGeometryGUI, QWid
/***************************************************************/ /***************************************************************/
double SpecificStep = 10.0; double SpecificStep = 10.0;
Group1->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, 3); Group2->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, 3); Group3->SpinBox_DX->RangeStepAndValidator(0.001, COORD_MAX, SpecificStep, DBL_DIGITS_DISPLAY);
setHelpFileName("fillet.htm"); setHelpFileName("fillet.htm");

View File

@ -44,7 +44,7 @@ using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MultiRotationDlg() // 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'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -124,13 +124,13 @@ void TransformationGUI_MultiRotationDlg::Init()
double SpecificStep1 = 5; double SpecificStep1 = 5;
double SpecificStep2 = 1; double SpecificStep2 = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* 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); GroupPoints->SpinBox_DX->SetValue(myNbTimes1);
GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, 3); GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, SpecificStep1, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10);
GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 3); GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep2, 10);
GroupDimensions->SpinBox_DX1->SetValue(myAng); GroupDimensions->SpinBox_DX1->SetValue(myAng);
GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1);
GroupDimensions->SpinBox_DX2->SetValue(myStep); 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(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double)));
connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_MULTIROTATION" ) ); initName( tr( "GEOM_MULTIROTATION" ) );
@ -219,7 +219,7 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId)
GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2);
break; break;
} }
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
@ -248,7 +248,7 @@ bool TransformationGUI_MultiRotationDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
initName(); initName();
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
return true; return true;
@ -301,7 +301,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
@ -331,10 +331,10 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 || if(send == GroupPoints->LineEdit1 || send == GroupDimensions->LineEdit1 ||
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2) send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2)
{ {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
} }
@ -347,9 +347,9 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
void TransformationGUI_MultiRotationDlg::ActivateThisDialog() void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
} }
@ -381,7 +381,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue)
myStep = newValue; myStep = newValue;
else if(send == GroupDimensions->SpinBox_DY2) else if(send == GroupDimensions->SpinBox_DY2)
myNbTimes2 = (int)newValue; myNbTimes2 = (int)newValue;
displayPreview(); displayPreview();
} }
@ -431,10 +431,10 @@ bool TransformationGUI_MultiRotationDlg::isValid( QString& msg )
bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() )
{ {
case 0 : case 0 :
{ {
@ -456,10 +456,10 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects )
break; break;
} }
} }
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
return res; return res;
} }

View File

@ -45,7 +45,7 @@ using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_MultiTranslationDlg() // 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'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -127,18 +127,18 @@ void TransformationGUI_MultiTranslationDlg::Init()
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
double SpecificStep = 1; double SpecificStep = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10);
GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DX->SetValue(myStepU);
GroupPoints->SpinBox_DY->SetValue(myNbTimesU); GroupPoints->SpinBox_DY->SetValue(myNbTimesU);
GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX1->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10);
GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupDimensions->SpinBox_DX2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 3); GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, MAX_NUMBER, SpecificStep, 10);
GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DX1->SetValue(myStepU);
GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU); GroupDimensions->SpinBox_DY1->SetValue(myNbTimesU);
GroupDimensions->SpinBox_DX2->SetValue(myStepV); GroupDimensions->SpinBox_DX2->SetValue(myStepV);
@ -178,11 +178,10 @@ void TransformationGUI_MultiTranslationDlg::Init()
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU()));
connect(GroupDimensions->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(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV()));
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_MULTITRANSLATION" ) ); initName( tr( "GEOM_MULTITRANSLATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -195,7 +194,7 @@ void TransformationGUI_MultiTranslationDlg::Init()
void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId)
{ {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myStepU = myStepV = 50.0; myStepU = myStepV = 50.0;
myNbTimesU = myNbTimesV = 2; myNbTimesU = myNbTimesV = 2;
@ -238,10 +237,10 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorI
break; break;
} }
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
myBase = myVectorU = GEOM::GEOM_Object::_nil(); myBase = myVectorU = GEOM::GEOM_Object::_nil();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
} }
@ -265,7 +264,7 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
initName(); initName();
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
return true; return true;
@ -279,13 +278,15 @@ bool TransformationGUI_MultiTranslationDlg::ClickOnApply()
void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
if(IObjectCount() != 1) { if (IObjectCount() != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
myEditCurrentArgument == GroupDimensions->LineEdit1)
myBase = GEOM::GEOM_Object::_nil(); 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(); myVectorU = GEOM::GEOM_Object::_nil();
else if(myEditCurrentArgument == GroupDimensions->LineEdit3) else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
myVectorV = GEOM::GEOM_Object::_nil(); myVectorV = GEOM::GEOM_Object::_nil();
return; return;
} }
@ -297,15 +298,17 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) )
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
myBase = aSelectedObject; myEditCurrentArgument == GroupDimensions->LineEdit1)
else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) myBase = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupDimensions->LineEdit2)
myVectorU = aSelectedObject; myVectorU = aSelectedObject;
else if(myEditCurrentArgument == GroupDimensions->LineEdit3) else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
myVectorV = aSelectedObject; myVectorV = aSelectedObject;
myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
displayPreview(); displayPreview();
} }
@ -317,7 +320,6 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
@ -339,7 +341,7 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
myEditCurrentArgument = GroupDimensions->LineEdit3; myEditCurrentArgument = GroupDimensions->LineEdit3;
globalSelection( GEOM_LINE ); globalSelection( GEOM_LINE );
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -356,7 +358,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 || send == GroupPoints->LineEdit2 || send == GroupDimensions->LineEdit2 ||
send == GroupDimensions->LineEdit3) send == GroupDimensions->LineEdit3)
{ {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
} }
} }
@ -369,7 +371,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
@ -418,7 +420,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu
break; break;
} }
} }
displayPreview(); displayPreview();
} }
@ -430,14 +432,14 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValu
void TransformationGUI_MultiTranslationDlg::ReverseStepU() void TransformationGUI_MultiTranslationDlg::ReverseStepU()
{ {
myStepU = -myStepU; myStepU = -myStepU;
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
if(aConstructorId == 0) if(aConstructorId == 0)
GroupPoints->SpinBox_DX->SetValue(myStepU); GroupPoints->SpinBox_DX->SetValue(myStepU);
else if(aConstructorId == 1) else if(aConstructorId == 1)
GroupDimensions->SpinBox_DX1->SetValue(myStepU); GroupDimensions->SpinBox_DX1->SetValue(myStepU);
displayPreview(); displayPreview();
} }
@ -449,9 +451,9 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepU()
void TransformationGUI_MultiTranslationDlg::ReverseStepV() void TransformationGUI_MultiTranslationDlg::ReverseStepV()
{ {
myStepV = -myStepV; myStepV = -myStepV;
GroupDimensions->SpinBox_DX2->SetValue(myStepV); GroupDimensions->SpinBox_DX2->SetValue(myStepV);
displayPreview(); displayPreview();
} }
@ -473,12 +475,12 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg ) bool TransformationGUI_MultiTranslationDlg::isValid( QString& msg )
{ {
int aConstructorId = getConstructorId(); int aConstructorId = getConstructorId();
if(aConstructorId == 0) if(aConstructorId == 0)
return !(myBase->_is_nil() || myVectorU->_is_nil()); return !(myBase->_is_nil() || myVectorU->_is_nil());
else if(aConstructorId == 1) else if(aConstructorId == 1)
return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()); 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 TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() )
{ {
case 0 : case 0 :
{ {
@ -512,10 +514,10 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects )
break; break;
} }
} }
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
return res; return res;
} }

View File

@ -42,7 +42,7 @@ using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_OffsetDlg() // 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'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -62,7 +62,7 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr
RadioButton1->setPixmap(image0); RadioButton1->setPixmap(image0);
RadioButton2->close(TRUE); RadioButton2->close(TRUE);
RadioButton3->close(TRUE); RadioButton3->close(TRUE);
GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
@ -73,13 +73,13 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr
GroupPoints->CheckButton1->hide(); GroupPoints->CheckButton1->hide();
GroupPoints->PushButton1->setPixmap(image1); GroupPoints->PushButton1->setPixmap(image1);
Layout1->addWidget(GroupPoints, 2, 0); Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/ /***************************************************************/
setHelpFileName("offset_surface.htm"); setHelpFileName("offset_surface.htm");
Init(); Init();
} }
@ -89,7 +89,7 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(GeometryGUI* theGeometr
// purpose : Destroys the object and frees any allocated resources // purpose : Destroys the object and frees any allocated resources
//================================================================================= //=================================================================================
TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg() TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg()
{ {
/* no need to delete child widgets, Qt does it all for us */ /* no need to delete child widgets, Qt does it all for us */
} }
@ -99,20 +99,18 @@ TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_OffsetDlg::Init() void TransformationGUI_OffsetDlg::Init()
{ {
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setReadOnly( true ); GroupPoints->LineEdit1->setReadOnly( true );
/* Get setting of step value from file configuration */ /* Get setting of step value from file configuration */
double step = 1; double step = 1;
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupPoints->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox_DX->setPrecision(5);
//@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05);
GroupPoints->SpinBox_DX->SetValue(1e-05); GroupPoints->SpinBox_DX->SetValue(1e-05);
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked(true);
CreateCopyModeChanged(true); CreateCopyModeChanged(true);
@ -120,18 +118,17 @@ void TransformationGUI_OffsetDlg::Init()
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
initName( tr( "GEOM_OFFSET" ) ); initName( tr( "GEOM_OFFSET" ) );
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
} }
@ -154,7 +151,7 @@ bool TransformationGUI_OffsetDlg::ClickOnApply()
{ {
if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) ) if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
return false; return false;
initName(); initName();
return true; return true;
} }
@ -180,9 +177,9 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument()
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects);
if (!myObjects.length()) if (!myObjects.length())
return; return;
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
} }
@ -209,7 +206,7 @@ void TransformationGUI_OffsetDlg::LineEditReturnPressed()
void TransformationGUI_OffsetDlg::SetEditCurrentArgument() void TransformationGUI_OffsetDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) if(send == GroupPoints->PushButton1)
{ {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
@ -237,7 +234,7 @@ void TransformationGUI_OffsetDlg::enterEvent(QEvent * e)
void TransformationGUI_OffsetDlg::ActivateThisDialog() void TransformationGUI_OffsetDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
@ -292,28 +289,28 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg )
bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if (GroupPoints->CheckButton1->isChecked() || IsPreview()) if (GroupPoints->CheckButton1->isChecked() || IsPreview())
for (int i = 0; i < myObjects.length(); i++) for (int i = 0; i < myObjects.length(); i++)
{ {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); OffsetShapeCopy( myObjects[i], GetOffset() );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else else
for (int i = 0; i < myObjects.length(); i++) for (int i = 0; i < myObjects.length(); i++)
{ {
anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShape( myObjects[i], GetOffset() ); anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
if ( !anObj->_is_nil() ) OffsetShape( myObjects[i], GetOffset() );
objects.push_back( anObj._retn() ); if ( !anObj->_is_nil() )
} objects.push_back( anObj._retn() );
}
res = true; res = true;
return res; return res;
} }

View File

@ -44,7 +44,7 @@ using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_RotationDlg() // 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'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -88,16 +88,17 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
Layout1->addWidget(GroupPoints, 2, 0); Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/ /***************************************************************/
double anAngle = 0; double anAngle = 0;
double SpecificStep = 5; double SpecificStep = 5;
/* min, max, step and decimals for spin boxes & initial values */ /* 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); GroupPoints->SpinBox_DX->SetValue(anAngle);
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked(true);
CreateCopyModeChanged(true); CreateCopyModeChanged(true);
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); 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->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, 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->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
@ -143,9 +144,9 @@ void TransformationGUI_RotationDlg::Init()
/* init variables */ /* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myAxis = myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
initName( tr( "GEOM_ROTATION" ) ); initName( tr( "GEOM_ROTATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
} }
@ -157,14 +158,14 @@ void TransformationGUI_RotationDlg::Init()
void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId)
{ {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
switch (constructorId) switch (constructorId)
{ {
case 0: /* rotation an object angle and axis */ case 0: /* rotation an object angle and axis */
{ {
GroupPoints->ShowRows(2,3,false); GroupPoints->ShowRows(2,3,false);
resize(0,0); resize(0,0);
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
@ -186,11 +187,11 @@ void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId)
GroupPoints->LineEdit5->clear(); GroupPoints->LineEdit5->clear();
myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myCentPoint = myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
break; break;
} }
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
} }
@ -213,7 +214,7 @@ bool TransformationGUI_RotationDlg::ClickOnApply()
{ {
if ( !onAccept( GroupPoints->CheckButton1->isChecked()) ) if ( !onAccept( GroupPoints->CheckButton1->isChecked()) )
return false; return false;
initName(); initName();
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
return true; return true;
@ -228,7 +229,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aName; QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
{ {
int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName);
@ -241,7 +242,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
if (!myObjects.length()) if (!myObjects.length())
return; return;
} }
else else
{ {
if(IObjectCount() != 1) if(IObjectCount() != 1)
{ {
@ -273,7 +274,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
aName = GEOMBase::GetName( aSelectedObject ); aName = GEOMBase::GetName( aSelectedObject );
} }
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
} }
@ -285,7 +286,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
void TransformationGUI_RotationDlg::SetEditCurrentArgument() void TransformationGUI_RotationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
@ -316,7 +317,7 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::LineEditReturnPressed() void TransformationGUI_RotationDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1 || if(send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2) send == GroupPoints->LineEdit2)
@ -334,7 +335,7 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed()
void TransformationGUI_RotationDlg::ActivateThisDialog() void TransformationGUI_RotationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
@ -380,12 +381,12 @@ bool TransformationGUI_RotationDlg::isValid( QString& msg )
{ {
switch (getConstructorId()) switch (getConstructorId())
{ {
case 0: case 0:
{ {
return !(myObjects.length() == 0 || myAxis->_is_nil()); return !(myObjects.length() == 0 || myAxis->_is_nil());
break; break;
} }
case 1: case 1:
{ {
return !(myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() ); return !(myObjects.length() == 0 || myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil() );
break; break;
@ -405,22 +406,24 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked(); bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() )
{ {
case 0 : case 0 :
{ {
if (toCreateCopy) if (toCreateCopy)
for (int i = 0; i < myObjects.length(); i++) 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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else else
for (int i = 0; i < myObjects.length(); i++) 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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
@ -432,14 +435,16 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
if (toCreateCopy) if (toCreateCopy)
for (int i = 0; i < myObjects.length(); i++) 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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else else
for (int i = 0; i < myObjects.length(); i++) 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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
@ -447,7 +452,7 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
break; break;
} }
} }
return res; return res;
} }

View File

@ -44,7 +44,7 @@ using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_ScaleDlg() // 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'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -85,9 +85,9 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
double aFactor = 2.0; double aFactor = 2.0;
double SpecificStep = 0.5; double SpecificStep = 0.5;
/* min, max, step and decimals for spin boxes & initial values */ /* 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); GroupPoints->SpinBox_DX->SetValue(aFactor);
// Activate Create a Copy mode // Activate Create a Copy mode
GroupPoints->CheckButton1->setChecked(true); GroupPoints->CheckButton1->setChecked(true);
CreateCopyModeChanged(true); CreateCopyModeChanged(true);
@ -95,18 +95,18 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
/* signals and slots connections */ /* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->LineEdit2, 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->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
setHelpFileName("scale_transform.htm"); setHelpFileName("scale_transform.htm");
@ -120,7 +120,7 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
// purpose : Destroys the object and frees any allocated resources // purpose : Destroys the object and frees any allocated resources
//================================================================================= //=================================================================================
TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg() TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg()
{ {
/* no need to delete child widgets, Qt does it all for us */ /* no need to delete child widgets, Qt does it all for us */
} }
@ -133,9 +133,9 @@ void TransformationGUI_ScaleDlg::Init()
{ {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
myPoint = GEOM::GEOM_Object::_nil(); myPoint = GEOM::GEOM_Object::_nil();
initName( tr( "GEOM_SCALE" ) ); initName( tr( "GEOM_SCALE" ) );
} }
@ -200,7 +200,7 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
aName = GEOMBase::GetName( myPoint ); aName = GEOMBase::GetName( myPoint );
} }
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
displayPreview(); displayPreview();
} }
@ -228,7 +228,7 @@ void TransformationGUI_ScaleDlg::LineEditReturnPressed()
void TransformationGUI_ScaleDlg::SetEditCurrentArgument() void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if(send == GroupPoints->PushButton1) { if(send == GroupPoints->PushButton1) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); globalSelection();
@ -237,7 +237,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
myEditCurrentArgument = GroupPoints->LineEdit2; myEditCurrentArgument = GroupPoints->LineEdit2;
globalSelection( GEOM_POINT ); globalSelection( GEOM_POINT );
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -250,7 +250,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
void TransformationGUI_ScaleDlg::ActivateThisDialog() void TransformationGUI_ScaleDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
globalSelection(); globalSelection();
GroupPoints->LineEdit1->setFocus(); GroupPoints->LineEdit1->setFocus();
@ -305,25 +305,27 @@ bool TransformationGUI_ScaleDlg::isValid( QString& msg )
bool TransformationGUI_ScaleDlg::execute( ObjectList& objects ) bool TransformationGUI_ScaleDlg::execute( ObjectList& objects )
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
if (GroupPoints->CheckButton1->isChecked() || IsPreview()) if (GroupPoints->CheckButton1->isChecked() || IsPreview())
for (int i = 0; i < myObjects.length(); i++) 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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
else else
for (int i = 0; i < myObjects.length(); i++) 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() ) if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() ); objects.push_back( anObj._retn() );
} }
res = true; res = true;
return res; return res;
} }

View File

@ -44,7 +44,7 @@ using namespace std;
//================================================================================= //=================================================================================
// class : TransformationGUI_TranslationDlg() // 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'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -84,9 +84,9 @@ TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg
Layout1->addWidget(GroupPoints, 2, 0); Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/ /***************************************************************/
setHelpFileName("translation.htm"); setHelpFileName("translation.htm");
Init(); Init();
} }
@ -124,9 +124,9 @@ void TransformationGUI_TranslationDlg::Init()
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes & initial values */ /* min, max, step and decimals for spin boxes & initial values */
GroupPoints->SpinBox1->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, 3); GroupPoints->SpinBox2->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3); GroupPoints->SpinBox3->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
GroupPoints->SpinBox1->SetValue(0.0); GroupPoints->SpinBox1->SetValue(0.0);
GroupPoints->SpinBox2->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(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GEOM_TRANSLATION" ) ); initName( tr( "GEOM_TRANSLATION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
@ -176,7 +176,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
switch (constructorId) switch (constructorId)
{ {
case 0: /* translation an object by dx, dy, dz */ case 0: /* translation an object by dx, dy, dz */
{ {
GroupPoints->ShowRows(1,2,false); GroupPoints->ShowRows(1,2,false);
resize(0,0); resize(0,0);
GroupPoints->ShowRows(3,5,true); GroupPoints->ShowRows(3,5,true);
@ -192,7 +192,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
GroupPoints->LineEdit3->clear(); GroupPoints->LineEdit3->clear();
myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
break; break;
} }
case 2: /* translation an object by vector */ case 2: /* translation an object by vector */
{ {
GroupPoints->ShowRows(2,5,false); GroupPoints->ShowRows(2,5,false);
@ -206,7 +206,7 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
} }
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
} }
@ -269,7 +269,7 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
myPoint2 = GEOM::GEOM_Object::_nil(); myPoint2 = GEOM::GEOM_Object::_nil();
return; return;
} }
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult);
@ -281,7 +281,7 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
myVector = aSelectedObject; myVector = aSelectedObject;
else if (myEditCurrentArgument == GroupPoints->LineEdit3) else if (myEditCurrentArgument == GroupPoints->LineEdit3)
myPoint2 = aSelectedObject; myPoint2 = aSelectedObject;
aName = GEOMBase::GetName( aSelectedObject ); aName = GEOMBase::GetName( aSelectedObject );
} }
@ -311,7 +311,7 @@ void TransformationGUI_TranslationDlg::LineEditReturnPressed()
// purpose : // purpose :
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::SetEditCurrentArgument() void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if (send == GroupPoints->PushButton1) { if (send == GroupPoints->PushButton1) {
@ -341,7 +341,7 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(myGeomGUI->getApp()->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
@ -419,7 +419,7 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
switch ( getConstructorId() ) switch ( getConstructorId() )
{ {
case 0: case 0:
{ {