mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 01:22:05 +05:00
NPAL16123: EDF435: 3 significant digits in Point Creation dialog.
This commit is contained in:
parent
97fc7b1c06
commit
eb3ecf9eba
@ -157,22 +157,22 @@ void BasicGUI_PointDlg::Init()
|
|||||||
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
|
double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
|
||||||
|
|
||||||
/* min, max, step and decimals for spin boxes */
|
/* min, max, step and decimals for spin boxes */
|
||||||
GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
|
GroupXYZ->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
|
||||||
GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
|
GroupXYZ->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
|
||||||
GroupXYZ->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
|
GroupXYZ->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
|
||||||
GroupXYZ->SpinBox_DX->SetValue(0.0);
|
GroupXYZ->SpinBox_DX->SetValue(0.0);
|
||||||
GroupXYZ->SpinBox_DY->SetValue(0.0);
|
GroupXYZ->SpinBox_DY->SetValue(0.0);
|
||||||
GroupXYZ->SpinBox_DZ->SetValue(0.0);
|
GroupXYZ->SpinBox_DZ->SetValue(0.0);
|
||||||
|
|
||||||
GroupRefPoint->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
|
GroupRefPoint->SpinBox_DX->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
|
||||||
GroupRefPoint->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
|
GroupRefPoint->SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
|
||||||
GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, 3);
|
GroupRefPoint->SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY);
|
||||||
GroupRefPoint->SpinBox_DX->SetValue(0.0);
|
GroupRefPoint->SpinBox_DX->SetValue(0.0);
|
||||||
GroupRefPoint->SpinBox_DY->SetValue(0.0);
|
GroupRefPoint->SpinBox_DY->SetValue(0.0);
|
||||||
GroupRefPoint->SpinBox_DZ->SetValue(0.0);
|
GroupRefPoint->SpinBox_DZ->SetValue(0.0);
|
||||||
|
|
||||||
step = 0.1;
|
step = 0.1;
|
||||||
GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, 3);
|
GroupOnCurve->SpinBox_DX->RangeStepAndValidator(0., 1., step, DBL_DIGITS_DISPLAY);
|
||||||
GroupOnCurve->SpinBox_DX->SetValue( 0.5 );
|
GroupOnCurve->SpinBox_DX->SetValue( 0.5 );
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
|
@ -102,3 +102,28 @@ void DlgRef_SpinBox::RangeStepAndValidator(double min, double max,double step,
|
|||||||
setLineStep(step);
|
setLineStep(step);
|
||||||
((QDoubleValidator*)validator())->setRange(min, max, decimals);
|
((QDoubleValidator*)validator())->setRange(min, max, decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DlgRef_SpinBox::PrintDoubleValue (double theValue, int thePrecision)
|
||||||
|
{
|
||||||
|
QString aRes;
|
||||||
|
aRes.setNum(theValue, 'g', thePrecision);
|
||||||
|
|
||||||
|
// remove trailing zeroes
|
||||||
|
QString delim( "." );
|
||||||
|
|
||||||
|
int idx = aRes.findRev( delim );
|
||||||
|
if ( idx == -1 )
|
||||||
|
return aRes;
|
||||||
|
|
||||||
|
QString iPart = aRes.left( idx );
|
||||||
|
QString fPart = aRes.mid( idx + 1 );
|
||||||
|
|
||||||
|
while ( !fPart.isEmpty() && fPart.at( fPart.length() - 1 ) == '0' )
|
||||||
|
fPart.remove( fPart.length() - 1, 1 );
|
||||||
|
|
||||||
|
aRes = iPart;
|
||||||
|
if ( !fPart.isEmpty() )
|
||||||
|
aRes += delim + fPart;
|
||||||
|
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
@ -30,11 +30,7 @@
|
|||||||
#define GEOMSPINBOX_H
|
#define GEOMSPINBOX_H
|
||||||
|
|
||||||
#include "QtxDblSpinBox.h"
|
#include "QtxDblSpinBox.h"
|
||||||
//#if defined WNT
|
|
||||||
//#include <SALOME_WNT.hxx>
|
|
||||||
//#else
|
|
||||||
//#define SALOME_WNT_EXPORT
|
|
||||||
//#endif
|
|
||||||
#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS
|
#if defined WNT && defined WIN32 && defined SALOME_WNT_EXPORTS
|
||||||
#define DLGREF_WNT_EXPORT __declspec( dllexport )
|
#define DLGREF_WNT_EXPORT __declspec( dllexport )
|
||||||
#else
|
#else
|
||||||
@ -44,6 +40,7 @@
|
|||||||
#define COORD_MIN -1e+15
|
#define COORD_MIN -1e+15
|
||||||
#define COORD_MAX +1e+15
|
#define COORD_MAX +1e+15
|
||||||
#define MAX_NUMBER 100000
|
#define MAX_NUMBER 100000
|
||||||
|
#define DBL_DIGITS_DISPLAY 16
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : DlgRef_SpinBox
|
// class : DlgRef_SpinBox
|
||||||
@ -62,10 +59,11 @@ public :
|
|||||||
void SetValue(double v);
|
void SetValue(double v);
|
||||||
double GetValue();
|
double GetValue();
|
||||||
QString GetString();
|
QString GetString();
|
||||||
|
|
||||||
|
static QString PrintDoubleValue (double theValue, int Precision = DBL_DIGITS_DISPLAY);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SetStep(double newStep);
|
void SetStep(double newStep);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GEOMSPINBOX_H
|
#endif // GEOMSPINBOX_H
|
||||||
|
@ -29,7 +29,10 @@
|
|||||||
#include "MeasureGUI_PointDlg.h"
|
#include "MeasureGUI_PointDlg.h"
|
||||||
#include "GEOMBase.h"
|
#include "GEOMBase.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"
|
||||||
#include "LightApp_SelectionMgr.h"
|
#include "LightApp_SelectionMgr.h"
|
||||||
@ -189,9 +192,9 @@ void MeasureGUI_PointDlg::SelectionIntoArgument()
|
|||||||
{
|
{
|
||||||
gp_Pnt aPnt = BRep_Tool::Pnt( aPoint );
|
gp_Pnt aPnt = BRep_Tool::Pnt( aPoint );
|
||||||
mySelEdit->setText( aName );
|
mySelEdit->setText( aName );
|
||||||
myX->setText( QString( "%1" ).arg( aPnt.X() ) );
|
myX->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.X()));
|
||||||
myY->setText( QString( "%1" ).arg( aPnt.Y() ) );
|
myY->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.Y()));
|
||||||
myZ->setText( QString( "%1" ).arg( aPnt.Z() ) );
|
myZ->setText(DlgRef_SpinBox::PrintDoubleValue(aPnt.Z()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user