From 4d92b761b3f13b9502c50064c2c4c1a71a8c66e5 Mon Sep 17 00:00:00 2001 From: akl Date: Fri, 18 Apr 2014 12:47:37 +0400 Subject: [PATCH] INT PAL 0052384: TC7.4.0:Angle between two edges: 1) using single angle value from the built presentation in viewer and dialog; 2) switch angle units depending on preferences. --- src/GEOMGUI/GEOM_msg_en.ts | 6 +++++- src/GEOMGUI/GEOM_msg_fr.ts | 6 +++++- src/GEOMGUI/GEOM_msg_ja.ts | 6 +++++- src/MeasureGUI/MeasureGUI_AngleDlg.cxx | 26 ++++++++++++++++++++++---- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 797c629ff..6ab8140a0 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -4605,9 +4605,13 @@ Please, select face, shell or solid and try again Objects And Results - GEOM_MEASURE_ANGLE_IS + GEOM_MEASURE_ANGLE_DEG Angle in degrees : + + GEOM_MEASURE_ANGLE_RAD + Angle in radians : + GEOM_LINE_INTERSECTION Point On Lines Intersection diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 25f857109..fd3458859 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -4593,9 +4593,13 @@ Choisissez une face, une coque ou un solide et essayez de nouveau Objets et résultats - GEOM_MEASURE_ANGLE_IS + GEOM_MEASURE_ANGLE_DEG Angle en degrés : + + GEOM_MEASURE_ANGLE_RAD + Angle in radians : + GEOM_LINE_INTERSECTION Point à l'Intersection de deux lignes diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts index 7837cffaf..d445fab84 100644 --- a/src/GEOMGUI/GEOM_msg_ja.ts +++ b/src/GEOMGUI/GEOM_msg_ja.ts @@ -4588,9 +4588,13 @@ オブジェクトと結果 - GEOM_MEASURE_ANGLE_IS + GEOM_MEASURE_ANGLE_DEG 角度(degree): + + GEOM_MEASURE_ANGLE_RAD + Angle in radians : + GEOM_LINE_INTERSECTION 線の交点 diff --git a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx index 8a7407a29..ccce76eb6 100644 --- a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx @@ -57,6 +57,9 @@ #include #include #include +#include +#include +#include // QT Includes #include @@ -97,7 +100,7 @@ MeasureGUI_AngleDlg::MeasureGUI_AngleDlg (GeometryGUI* GUI, QWidget* parent) myGrp->GroupBox1->setTitle(tr("GEOM_MEASURE_ANGLE_OBJ")); myGrp->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); myGrp->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); - myGrp->TextLabel3->setText(tr("GEOM_MEASURE_ANGLE_IS")); + myGrp->TextLabel3->setText(tr(aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" ) == "deg" ? "GEOM_MEASURE_ANGLE_DEG" : "GEOM_MEASURE_ANGLE_RAD")); myGrp->LineEdit3->setReadOnly(true); myGrp->PushButton1->setIcon(image1); myGrp->PushButton2->setIcon(image1); @@ -197,9 +200,8 @@ void MeasureGUI_AngleDlg::processObject() double anAngle = 0.; if (getParameters(anAngle)) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - int aPrecision = resMgr->integerValue( "Geometry", "angle_precision", 6 ); - myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(anAngle, aPrecision)); + // To avoid the using different angle values in viewer and dialog, + // the value from presentation is used in both cases (see buildPrs()) redisplayPreview(); } else { @@ -352,6 +354,7 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 ); + QString aUnitsAngle = resMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" ); aDimensionStyle->LineAspect()->SetWidth( w ); aDimensionStyle->SetTextHorizontalPosition( Prs3d_DTHP_Center ); @@ -360,6 +363,9 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() aDimensionStyle->MakeArrows3d( Standard_True ); anIO->SetDimensionAspect( aDimensionStyle ); + anIO->SetDisplayUnits( aUnitsAngle.toLatin1().data() ); + if (aUnitsAngle == "rad") + anIO->SetDisplaySpecialSymbol(AIS_DSS_No); SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); @@ -367,6 +373,18 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs() if (aPrs) aPrs->AddObject(anIO); + // set angle value into dialog + double anAngle = anIO->GetValue(); + QString anAngleLabel = "GEOM_MEASURE_ANGLE_RAD"; + if (aUnitsAngle == "deg") { + // using degrees instead of radians + anAngle *= 180. / M_PI; + anAngleLabel = "GEOM_MEASURE_ANGLE_DEG"; + } + myGrp->TextLabel3->setText(tr(anAngleLabel.toLatin1().data())); + int aPrecision = resMgr->integerValue( "Geometry", "angle_precision", 6 ); + myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(anAngle, aPrecision)); + return aPrs; } } -- 2.39.2