Salome HOME
Update GUI documentation for bugs 16559
[modules/geom.git] / src / MeasureGUI / MeasureGUI_DistanceDlg.cxx
index 5762c0606e23d8e3dfa2f7293a3e2cb2eeba4c6a..2591b69816106c7265681166db520e37b512d112 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 //  $Header$
 
 #include "MeasureGUI_DistanceDlg.h"
-#include "MeasureGUI_2Sel1LineEdit_QTD.h"
+#include "MeasureGUI_2Sel4LineEdit_QTD.h"
 #include "GEOMBase.h"
 #include "GEOM_Displayer.h"
+#include "DlgRef_SpinBox.h"
 
 #include "SUIT_Session.h"
 #include "SUIT_ViewWindow.h"
@@ -77,12 +78,18 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( GeometryGUI* GUI, QWidget* paren
   GroupConstructors->setTitle( tr( "GEOM_DISTANCE" ) );
   RadioButton1->setPixmap( image0 );
 
-  myGrp = new MeasureGUI_2Sel1LineEdit_QTD( this, "myGrp" );
+  myGrp = new MeasureGUI_2Sel4LineEdit_QTD( this, "myGrp" );
   myGrp->GroupBox1->setTitle( tr( "GEOM_MINDIST_OBJ" ) );
   myGrp->TextLabel1->setText( tr( "GEOM_OBJECT_I" ).arg( "1" ) );
   myGrp->TextLabel2->setText( tr( "GEOM_OBJECT_I" ).arg( "2" ) );
   myGrp->TextLabel3->setText( tr( "GEOM_LENGTH" ) );
+  myGrp->TextLabel4->setText( tr( "GEOM_DX" ) );
+  myGrp->TextLabel5->setText( tr( "GEOM_DY" ) );
+  myGrp->TextLabel6->setText( tr( "GEOM_DZ" ) );
   myGrp->LineEdit3->setReadOnly( TRUE );
+  myGrp->LineEdit4->setReadOnly( TRUE );
+  myGrp->LineEdit5->setReadOnly( TRUE );
+  myGrp->LineEdit6->setReadOnly( TRUE );
   myGrp->PushButton1->setPixmap( image1 );
   myGrp->PushButton2->setPixmap( image1 );
   myGrp->LineEdit1->setReadOnly( true );
@@ -92,6 +99,8 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( GeometryGUI* GUI, QWidget* paren
 
   /***************************************************************/
 
+  myHelpFileName = "using_measurement_tools_page.html#min_distance_anchor";
+
   /* Initialisation */
   Init();
 }
@@ -116,14 +125,13 @@ void MeasureGUI_DistanceDlg::Init()
   mySelEdit  = myGrp->LineEdit1;
   mySelBtn2  = myGrp->PushButton2;
   mySelEdit2 = myGrp->LineEdit2;
-  
+
   myEditCurrentArgument = mySelEdit;
 
   connect( mySelEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
   connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
 
   MeasureGUI_Skeleton::Init();
-
 }
 
 
@@ -150,7 +158,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
 
 //=================================================================================
 // function : processObject()
-// purpose  : Fill dialogs fileds in accordance with myObj and myObj2
+// purpose  : Fill dialogs fields in accordance with myObj and myObj2
 //=================================================================================
 void MeasureGUI_DistanceDlg::processObject()
 {
@@ -159,17 +167,25 @@ void MeasureGUI_DistanceDlg::processObject()
 
   gp_Pnt aPnt1, aPnt2;
   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 ) );
+
+    gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ();
+    myGrp->LineEdit4->setText( DlgRef_SpinBox::PrintDoubleValue( aVec.X() ) );
+    myGrp->LineEdit5->setText( DlgRef_SpinBox::PrintDoubleValue( aVec.Y() ) );
+    myGrp->LineEdit6->setText( DlgRef_SpinBox::PrintDoubleValue( aVec.Z() ) );
+
     redisplayPreview();
   }
   else
   {
     myGrp->LineEdit3->setText( "" );
+    myGrp->LineEdit4->setText( "" );
+    myGrp->LineEdit5->setText( "" );
+    myGrp->LineEdit6->setText( "" );
     erasePreview();
   }
-    
 }
 
 //=================================================================================
@@ -254,12 +270,14 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
 {
   double aDist = 0.;
   gp_Pnt aPnt1( 0, 0, 0 ), aPnt2( 0, 0, 0 );
-  
-  if ( myObj->_is_nil() || myObj2->_is_nil() || !getParameters( aDist, aPnt1, aPnt2 ) ||
-       SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() 
-       != OCCViewer_Viewer::Type() )
+
+  SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+
+  if ( myObj->_is_nil() || myObj2->_is_nil() ||
+       !getParameters( aDist, aPnt1, aPnt2 ) ||
+       vw->getViewManager()->getType() != OCCViewer_Viewer::Type() )
     return 0;
-  
+
   try
   {
     if( aDist <= 1.e-9 )
@@ -280,7 +298,6 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
                     ( aPnt1.Y() + aPnt2.Y() ) / 2,
                     ( aPnt1.Z() + aPnt2.Z() ) / 2 + 100 );
 
-
       gp_Vec va( aPnt3, aPnt1 );
       gp_Vec vb( aPnt3, aPnt2 );
 
@@ -289,18 +306,15 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
         aPnt3.SetY( ( aPnt1.Y() + aPnt2.Y() ) / 2 + 100 );
         aPnt3.SetZ( ( aPnt1.Z() + aPnt2.Z() ) / 2 );
       }
-      
+
       gce_MakePln gce_MP( aPnt1, aPnt2, aPnt3 );
       Handle( Geom_Plane ) P = new Geom_Plane( gce_MP.Value() );
 
-      Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension(
-        aVert1, aVert2, P, aDist, TCollection_ExtendedString( (Standard_CString)aLabel.latin1() ) );
+      Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension
+        (aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.latin1()));
 
-      SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
-      SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) );
-      
-      //QAD_ViewFrame* vf = GEOM_Displayer::GetActiveView();
-      //OCCViewer_Prs* aPrs = dynamic_cast<OCCViewer_Prs*>( vf->CreatePrs( 0 ) );
+      SOCC_Prs* aPrs =
+        dynamic_cast<SOCC_Prs*>( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) );
 
       if ( aPrs )
         aPrs->AddObject( anIO );
@@ -322,17 +336,3 @@ bool MeasureGUI_DistanceDlg::isValid( QString& msg )
 {
   return MeasureGUI_Skeleton::isValid( msg ) && !myObj2->_is_nil();
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-