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.

This commit is contained in:
akl 2014-04-18 12:47:37 +04:00
parent c481b6871a
commit 4d92b761b3
4 changed files with 37 additions and 7 deletions

View File

@ -4605,9 +4605,13 @@ Please, select face, shell or solid and try again</translation>
<translation>Objects And Results</translation> <translation>Objects And Results</translation>
</message> </message>
<message> <message>
<source>GEOM_MEASURE_ANGLE_IS</source> <source>GEOM_MEASURE_ANGLE_DEG</source>
<translation>Angle in degrees :</translation> <translation>Angle in degrees :</translation>
</message> </message>
<message>
<source>GEOM_MEASURE_ANGLE_RAD</source>
<translation>Angle in radians :</translation>
</message>
<message> <message>
<source>GEOM_LINE_INTERSECTION</source> <source>GEOM_LINE_INTERSECTION</source>
<translation>Point On Lines Intersection</translation> <translation>Point On Lines Intersection</translation>

View File

@ -4593,9 +4593,13 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<translation>Objets et résultats</translation> <translation>Objets et résultats</translation>
</message> </message>
<message> <message>
<source>GEOM_MEASURE_ANGLE_IS</source> <source>GEOM_MEASURE_ANGLE_DEG</source>
<translation>Angle en degrés :</translation> <translation>Angle en degrés :</translation>
</message> </message>
<message>
<source>GEOM_MEASURE_ANGLE_RAD</source>
<translation type="unfinished">Angle in radians :</translation>
</message>
<message> <message>
<source>GEOM_LINE_INTERSECTION</source> <source>GEOM_LINE_INTERSECTION</source>
<translation>Point à l&apos;Intersection de deux lignes</translation> <translation>Point à l&apos;Intersection de deux lignes</translation>

View File

@ -4588,9 +4588,13 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>GEOM_MEASURE_ANGLE_IS</source> <source>GEOM_MEASURE_ANGLE_DEG</source>
<translation>(degree):</translation> <translation>(degree):</translation>
</message> </message>
<message>
<source>GEOM_MEASURE_ANGLE_RAD</source>
<translation type="unfinished">Angle in radians :</translation>
</message>
<message> <message>
<source>GEOM_LINE_INTERSECTION</source> <source>GEOM_LINE_INTERSECTION</source>
<translation></translation> <translation></translation>

View File

@ -57,6 +57,9 @@
#include <AIS.hxx> #include <AIS.hxx>
#include <AIS_Drawer.hxx> #include <AIS_Drawer.hxx>
#include <Prs3d_LineAspect.hxx> #include <Prs3d_LineAspect.hxx>
#include <IntTools_EdgeEdge.hxx>
#include <IntTools_SequenceOfCommonPrts.hxx>
#include <IntTools_CommonPrt.hxx>
// QT Includes // QT Includes
#include <qlineedit.h> #include <qlineedit.h>
@ -97,7 +100,7 @@ MeasureGUI_AngleDlg::MeasureGUI_AngleDlg (GeometryGUI* GUI, QWidget* parent)
myGrp->GroupBox1->setTitle(tr("GEOM_MEASURE_ANGLE_OBJ")); myGrp->GroupBox1->setTitle(tr("GEOM_MEASURE_ANGLE_OBJ"));
myGrp->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); myGrp->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
myGrp->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); 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->LineEdit3->setReadOnly(true);
myGrp->PushButton1->setIcon(image1); myGrp->PushButton1->setIcon(image1);
myGrp->PushButton2->setIcon(image1); myGrp->PushButton2->setIcon(image1);
@ -197,9 +200,8 @@ void MeasureGUI_AngleDlg::processObject()
double anAngle = 0.; double anAngle = 0.;
if (getParameters(anAngle)) { if (getParameters(anAngle)) {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); // To avoid the using different angle values in viewer and dialog,
int aPrecision = resMgr->integerValue( "Geometry", "angle_precision", 6 ); // the value from presentation is used in both cases (see buildPrs())
myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(anAngle, aPrecision));
redisplayPreview(); redisplayPreview();
} }
else { else {
@ -352,6 +354,7 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 ); int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 );
QString aUnitsAngle = resMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
aDimensionStyle->LineAspect()->SetWidth( w ); aDimensionStyle->LineAspect()->SetWidth( w );
aDimensionStyle->SetTextHorizontalPosition( Prs3d_DTHP_Center ); aDimensionStyle->SetTextHorizontalPosition( Prs3d_DTHP_Center );
@ -360,6 +363,9 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
aDimensionStyle->MakeArrows3d( Standard_True ); aDimensionStyle->MakeArrows3d( Standard_True );
anIO->SetDimensionAspect( aDimensionStyle ); anIO->SetDimensionAspect( aDimensionStyle );
anIO->SetDisplayUnits( aUnitsAngle.toLatin1().data() );
if (aUnitsAngle == "rad")
anIO->SetDisplaySpecialSymbol(AIS_DSS_No);
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));
@ -367,6 +373,18 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
if (aPrs) if (aPrs)
aPrs->AddObject(anIO); 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; return aPrs;
} }
} }