]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
EDF 1337: Angles management in the 3D sketcher
authorrnc <rnc@opencascade.com>
Wed, 11 Jul 2012 15:13:08 +0000 (15:13 +0000)
committerrnc <rnc@opencascade.com>
Wed, 11 Jul 2012 15:13:08 +0000 (15:13 +0000)
First part.
Some pieces of code placed in the GUI will have to be moved to the engine side but it has to be coordinated with issue 21392 (EDF 1631 GEOM: Dump study of sketcher 3D with relatives coordinates )

src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
src/EntityGUI/EntityGUI_3DSketcherDlg.h
src/EntityGUI/EntityGUI_Angles_QTD.ui [new file with mode: 0644]
src/EntityGUI/EntityGUI_Widgets.cxx
src/EntityGUI/EntityGUI_Widgets.h
src/EntityGUI/Makefile.am

index bc35ffad183e402328dd3d850be8f93acf71d773..771e17507cd83d4f51d0a90706c082c3b3b51cb4 100755 (executable)
 // File   : EntityGUI_3DSketcherDlg.cxx
 // Author : DMV, OCN
 //
+#include <cmath>
+
 #include "EntityGUI_3DSketcherDlg.h"
 #include "EntityGUI_Widgets.h"
 #include <SalomeApp_DoubleSpinBox.h>
 
 #include <GEOMBase.h>
 #include <GeometryGUI.h>
-#include <GEOMImpl_Types.hxx>
-#include <Precision.hxx>  
+#include <Precision.hxx> 
 
 #include <DlgRef.h>
-#include <SUIT_Desktop.h>
 #include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_ViewManager.h>
+#include <SOCC_Prs.h>
+#include <SOCC_ViewModel.h>
 #include <SalomeApp_Application.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
@@ -43,7 +48,7 @@
 //#include <TopExp.hxx>
 //#include <TopExp_Explorer.hxx>
 //#include <TopoDS_Vertex.hxx>
-//#include <TopoDS.hxx>
+#include <TopoDS.hxx>
 #include <TColStd_IndexedMapOfInteger.hxx>
 //#include <BRepBuilderAPI_Transform.hxx>
 //#include <BRepBuilderAPI_MakeWire.hxx>
 #include <BRepBuilderAPI_MakePolygon.hxx>
 #include <BRepBuilderAPI_MakeEdge.hxx>
 
+#include <AIS_Trihedron.hxx>
+#include <AIS_AngleDimension.hxx>
+#include <Geom_Axis2Placement.hxx>
+#include <Geom_Plane.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <gce_MakePln.hxx>
+
+// This include must be *AFTER* SOCC_ViewModel.h because
+// of the constant ROTATE which is a #define in
+// GEOMImpl_Types.hxx and an enum in SOCC_ViewModel.h
+#include <GEOMImpl_Types.hxx>
+
 class Locker
 {
 public:
@@ -94,10 +111,12 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q
   GroupType->GroupBox1->setTitle(tr("GEOM_COORDINATES_TYPE"));
   GroupType->RadioButton1->setText(tr("GEOM_SKETCHER_ABS"));
   GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL"));
-  GroupType->RadioButton3->close();
+  GroupType->RadioButton3->setText(tr("Angles")); //TODO translation
+//   GroupType->RadioButton3->close();
   myTypeGroup = new QButtonGroup( this );
   myTypeGroup->addButton( GroupType->RadioButton1, 0 );
   myTypeGroup->addButton( GroupType->RadioButton2, 1 );
+  myTypeGroup->addButton( GroupType->RadioButton3, 2 );
 
   Group3Spin = new EntityGUI_3Spin( centralWidget() );
   Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
@@ -107,14 +126,20 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, Q
   Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
   Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
   Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
+  
+  GroupAngles = new EntityGUI_Angles( centralWidget() );
 
   buttonOk()->setText( tr( "GEOM_BUT_END_SKETCH" ) );
   buttonApply()->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) );
   
   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
+  GroupAngles->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
+  GroupAngles->buttonUndo->setIcon( image1 );
+  GroupAngles->buttonRedo->setIcon( image2 );
   layout->setMargin( 0 ); layout->setSpacing( 6 );
   layout->addWidget( GroupType );
   layout->addWidget( Group3Spin );
+  layout->addWidget( GroupAngles );
 
   setHelpFileName( "create_3dsketcher_page.html" );
 
@@ -140,6 +165,7 @@ EntityGUI_3DSketcherDlg::~EntityGUI_3DSketcherDlg()
 void EntityGUI_3DSketcherDlg::Init()
 {
   myOK = false;
+  myOrientation = 1;
 
   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
@@ -150,10 +176,24 @@ void EntityGUI_3DSketcherDlg::Init()
   initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
   initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
   initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
+  
+  initSpinBox( GroupAngles->SpinBox_DA , -180.0, 180.0, step, "angular_precision" );
+  initSpinBox( GroupAngles->SpinBox_DA2,    0.0,  90.0, step, "angular_precision" );
+  initSpinBox( GroupAngles->SpinBox_DL, COORD_MIN, COORD_MAX, step, "length_precision" );
 
   Group3Spin->SpinBox_DX->setValue(0.0);
   Group3Spin->SpinBox_DY->setValue(0.0);
   Group3Spin->SpinBox_DZ->setValue(0.0);
+  
+  GroupAngles->SpinBox_DA->setValue(0.0);
+  GroupAngles->SpinBox_DA2->setValue(0.0);
+  GroupAngles->SpinBox_DL->setValue(0.0);
+  
+  GroupAngles->radioButton_1->setChecked(true);
+  GroupAngles->checkBox->setChecked(false);
+  GroupAngles->SpinBox_DA2->setEnabled(false); 
+   
+  GroupAngles->hide();
 
   /* signals and slots connections */
   connect( buttonOk(),     SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
@@ -164,12 +204,25 @@ void EntityGUI_3DSketcherDlg::Init()
   connect( Group3Spin->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) );
   connect( Group3Spin->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
   connect( Group3Spin->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
+  
+  connect( GroupAngles->buttonApply,  SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) );
+  connect( GroupAngles->buttonUndo,   SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
+  connect( GroupAngles->buttonRedo,   SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
 
   connect( myTypeGroup, SIGNAL( buttonClicked( int ) ),  this, SLOT( TypeClicked( int ) ) );
 
   connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  
+  connect( GroupAngles->SpinBox_DA,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupAngles->SpinBox_DA2, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupAngles->SpinBox_DL,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  
+  connect( GroupAngles->radioButton_1,   SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ;
+  connect( GroupAngles->radioButton_2,   SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ;
+  connect( GroupAngles->radioButton_3,   SIGNAL( clicked ( bool ) ), this, SLOT( ButtonClicked(bool) ) ) ;
+  connect( GroupAngles->checkBox,        SIGNAL( clicked ( bool ) ), this, SLOT( AngleChecked (bool) ) ) ;
 
   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
 
@@ -190,6 +243,9 @@ void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
 {
   if ( mode == myMode ) return;
 
+  Group3Spin->show();
+  GroupAngles->hide();
+  
   bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
   Group3Spin->SpinBox_DX->blockSignals(true);
   Group3Spin->SpinBox_DY->blockSignals(true);
@@ -209,7 +265,7 @@ void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
     if ( okz ) Group3Spin->SpinBox_DZ->setValue( xyz.z + Group3Spin->SpinBox_DZ->value() );
     Group3Spin->buttonApply->setFocus();
   }
-  else { // DXDY
+  else if ( mode == 1) { // DXDY
     Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
     Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
     Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
@@ -218,11 +274,18 @@ void EntityGUI_3DSketcherDlg::TypeClicked( int mode )
     if ( okz ) Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - xyz.z );
     Group3Spin->buttonApply->setFocus();
   }
+  else {
+    Group3Spin->hide();
+    GroupAngles->show();
+  }
+  
   Group3Spin->SpinBox_DX->blockSignals(blocked);
   Group3Spin->SpinBox_DY->blockSignals(blocked);
   Group3Spin->SpinBox_DZ->blockSignals(blocked);
 
   myMode = mode;
+  
+  resize(minimumSizeHint());
 }
 
 //=================================================================================
@@ -257,8 +320,11 @@ void EntityGUI_3DSketcherDlg::UpdateButtonsState()
 {
   if ( myPointsList.count() == 0 ) GroupType->RadioButton1->click();
   GroupType->RadioButton2->setEnabled( myPointsList.count() > 0 );
+  GroupType->RadioButton3->setEnabled( myPointsList.count() > 0 );
   Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 0 );
   Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 0 );
+  GroupAngles->buttonUndo->setEnabled( myPointsList.count() > 0 );
+  GroupAngles->buttonRedo->setEnabled( myRedoList.count() > 0 );
 }
 
 //=================================================================================
@@ -385,6 +451,60 @@ void EntityGUI_3DSketcherDlg::ActivateThisDialog()
 void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox( double newValue )
 {
   GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  if(GroupType->RadioButton3->isChecked() && GroupAngles->SpinBox_DL->value()>Precision::Confusion())
+  {
+    double anAngle2 = 0.0;
+    if (GroupAngles->checkBox->isChecked())
+      anAngle2 = GroupAngles->SpinBox_DA2->value();
+    
+    displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, GroupAngles->SpinBox_DL->value(), myOrientation);
+  }
+}
+
+
+//=================================================================================
+// function : AngleChecked()
+// purpose  :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::AngleChecked( bool checked )
+{
+  GroupAngles->SpinBox_DA2->setEnabled(checked); 
+  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  if(GroupAngles->SpinBox_DL->value()>Precision::Confusion())
+  {
+    double anAngle2 = 0.0;
+    if (checked)
+      anAngle2 = GroupAngles->SpinBox_DA2->value();
+    
+    displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, GroupAngles->SpinBox_DL->value(), myOrientation);
+  }
+  
+}
+
+//=================================================================================
+// function : ButtonClicked()
+// purpose  :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::ButtonClicked( bool checked )
+{
+  GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
+  if (GroupAngles->radioButton_1->isChecked())
+    myOrientation = 1;
+  else if (GroupAngles->radioButton_2->isChecked())
+    myOrientation = 2;
+  else
+    myOrientation = 3;
+  
+  if(GroupAngles->SpinBox_DL->value()>Precision::Confusion())
+  {
+    double anAngle2 = 0.0;
+    if (GroupAngles->checkBox->isChecked())
+      anAngle2 = GroupAngles->SpinBox_DA2->value();
+    
+    displayAngle(GroupAngles->SpinBox_DA->value(), anAngle2, GroupAngles->SpinBox_DL->value(), myOrientation);
+  }
+  
 }
 
 //=================================================================================
@@ -509,7 +629,7 @@ bool EntityGUI_3DSketcherDlg::ClickOnApply()
 
   if ( !onAccept() )
     return false;
-
+  
   ClickOnCancel();
   return true;
 }
@@ -529,21 +649,56 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getLastPoint() const
 //=================================================================================
 EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const
 {
-  XYZ xyz;
-  if ( myMode == 0 ) {
-    xyz.x = Group3Spin->SpinBox_DX->value();
-    xyz.y = Group3Spin->SpinBox_DY->value();
-    xyz.z = Group3Spin->SpinBox_DZ->value();
-  } 
-  else {
+  XYZ xyz; 
+  // Temporary way of doing this. To be changed with ordered improvement of the sketcher
+  if ( myMode == 2 )
+  {
+    double anAngle  = GroupAngles->SpinBox_DA->value() * M_PI/180.0;
+    double anAngle2 = 0.0;
+    double aLength          = GroupAngles->SpinBox_DL->value();
+    
+    if (GroupAngles->checkBox->isChecked())
+      anAngle2 = GroupAngles->SpinBox_DA2->value() * M_PI/180.0;
+    
+    double aProjectedLength = aLength * cos(anAngle2);
+    
     xyz = getLastPoint();
-    xyz.x += Group3Spin->SpinBox_DX->value();
-    xyz.y += Group3Spin->SpinBox_DY->value();
-    xyz.z += Group3Spin->SpinBox_DZ->value();
+    if (GroupAngles->radioButton_1->isChecked())
+    {
+      xyz.x += aProjectedLength * cos(anAngle);
+      xyz.y += aProjectedLength * sin(anAngle);
+      xyz.z += aLength * sin(anAngle2);
+    }
+    else if (GroupAngles->radioButton_2->isChecked())
+    {
+      xyz.y += aProjectedLength * cos(anAngle);
+      xyz.z += aProjectedLength * sin(anAngle);
+      xyz.x += aLength * sin(anAngle2);
+    }
+    else
+    {
+      xyz.z += aProjectedLength * sin(anAngle);
+      xyz.x += aProjectedLength * cos(anAngle);
+      xyz.y += aLength * sin(anAngle2);
+    }
+  }
+  else
+  {
+    if ( myMode == 0 ) {
+      xyz.x = Group3Spin->SpinBox_DX->value();
+      xyz.y = Group3Spin->SpinBox_DY->value();
+      xyz.z = Group3Spin->SpinBox_DZ->value();
+    } 
+    else{
+      xyz = getLastPoint();
+      xyz.x += Group3Spin->SpinBox_DX->value();
+      xyz.y += Group3Spin->SpinBox_DY->value();
+      xyz.z += Group3Spin->SpinBox_DZ->value();
+    }
+    xyz.xt = Group3Spin->SpinBox_DX->text();
+    xyz.yt = Group3Spin->SpinBox_DY->text();
+    xyz.zt = Group3Spin->SpinBox_DZ->text();
   }
-  xyz.xt = Group3Spin->SpinBox_DX->text();
-  xyz.yt = Group3Spin->SpinBox_DY->text();
-  xyz.zt = Group3Spin->SpinBox_DZ->text();
   return xyz;
 }
 
@@ -559,7 +714,7 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
                                               const double          lineWidth,
                                               const int             displayMode,
                                               const int             color )
-{
+{  
   // Set color for preview shape
   getDisplayer()->SetColor( Quantity_NOC_RED );
 
@@ -585,15 +740,134 @@ void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
 
   getDisplayer()->SetColor( Quantity_NOC_VIOLET );
   aPrs = getDisplayer()->BuildPrs( aLastSegment );
+    
   if ( aPrs != 0 && !aPrs->IsNull() )
     GEOMBase_Helper::displayPreview( aPrs, append, update );
 
+  if(GroupType->RadioButton3->isChecked())
+    displayTrihedron(3);
+  else
+    displayTrihedron(2);
+  
   getDisplayer()->UnsetName();
 
   // Enable activation of displayed objects
   getDisplayer()->SetToActivate( true );
 }
 
+//================================================================
+// Function : displayTrihedron()
+// Purpose  : Method for displaying trihedron
+//================================================================
+void EntityGUI_3DSketcherDlg::displayTrihedron(int selMode)
+{
+  // Add trihedron to preview
+  SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+  
+  gp_Pnt P(getLastPoint().x,getLastPoint().y,getLastPoint().z);
+  Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(P,gp::DZ(),gp::DX());
+  Handle(AIS_Trihedron) anIO = new AIS_Trihedron(anAxis);
+  anIO->SetSelectionMode(selMode);
+  
+  SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+  
+  if (aSPrs)
+  {
+    aSPrs->AddObject(anIO);
+    GEOMBase_Helper::displayPreview( aSPrs, true, true );
+  }
+}
+
+//================================================================
+// Function : displayAngle()
+// Purpose  : Method for displaying angle dimensions
+//================================================================
+void EntityGUI_3DSketcherDlg::displayAngle(double theAngle1, double theAngle2, double theLength, int theOrientation)
+{
+  if(Abs(theAngle2 - 90.0) < Precision::Confusion())
+    return;
+  // Add trihedron to preview
+  SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+  
+  XYZ Last    = getLastPoint();
+  XYZ Current = getCurrentPoint();
+    
+  gp_Pnt Last_Pnt(Last.x,Last.y,Last.z);
+  gp_Pnt Current_Pnt(Current.x,Current.y,Current.z);
+  gp_Pnt P1, P2; //, P3;
+  
+  bool twoAngles = GroupAngles->checkBox->isChecked();
+  
+  switch(theOrientation)
+  {
+    case 1: //OXY
+    {   
+      P1 = gp_Pnt(Last.x + theLength,Last.y,Last.z);    // X direction
+      P2 = gp_Pnt(Last.x + theLength * cos(theAngle1 * M_PI / 180.),
+                  Last.y + theLength * sin(theAngle1 * M_PI / 180.),
+                  Last.z); 
+//       P3 = gp_Pnt(Last.x,Last.y,theLength);     // Z direction (normal to the plane)
+      break;
+    }
+    case 2: //OYZ
+    {
+      P1 = gp_Pnt(Last.x, Last.y + theLength,Last.z);     // Y direction
+      P2 = gp_Pnt(Last.x, 
+                  Last.y + theLength * cos(theAngle1 * M_PI / 180.),
+                  Last.z + theLength * sin(theAngle1 * M_PI / 180.)); 
+//       P2 = gp_Pnt(Last.x,Current.y,Current.z);  // Projection in OYZ plane
+//       P3 = gp_Pnt(theLength,Last.y,Last.z);     // X direction
+      break;
+    }
+    case 3: //OXZ
+    {
+      P1 = gp_Pnt( Last.x + theLength,Last.y,Last.z);     // X direction
+      P2 = gp_Pnt( Last.x + theLength * cos(theAngle1 * M_PI / 180.) ,
+                   Last.y,
+                   Last.z + theLength * sin(theAngle1 * M_PI / 180.)); 
+//       P2 = gp_Pnt(Current.x,Last.y,Current.z);  // Projection in OXZ plane
+//       P3 = gp_Pnt(Last.x,theLength,Last.z);     // Y direction
+      break;
+    }
+  }
+  
+  MESSAGE("REPERE1 :  Last  x ="<<Last.x<<"y ="<<Last.y<<"z ="<<Last.z)
+  MESSAGE("Current  x ="<<Current.x<<"y ="<<Current.y<<"z ="<<Current.z)
+  TopoDS_Vertex V1    = BRepBuilderAPI_MakeVertex(P1);
+  TopoDS_Vertex V2    = BRepBuilderAPI_MakeVertex(P2);
+  TopoDS_Vertex LastV = BRepBuilderAPI_MakeVertex(Last_Pnt);
+  TopoDS_Vertex CurV  = BRepBuilderAPI_MakeVertex(Current_Pnt);
+  TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(LastV, V1);
+  TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(LastV, V2);
+  TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge(LastV, CurV);
+  
+  gce_MakePln gce_MP(Last_Pnt, P1, P2);
+        Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value());
+      
+  Standard_CString aStr = "45°";
+  Handle(AIS_AngleDimension) anAngleIO  = new AIS_AngleDimension(anEdge1, anEdge2, aPlane, theAngle1 * M_PI / 180.,
+           TCollection_ExtendedString(aStr));
+  
+  
+  SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+  
+  if (aSPrs)
+  {
+    aSPrs->AddObject(anAngleIO);
+    if (twoAngles)
+   {
+      gce_MakePln gce_MP2(Last_Pnt, P2, Current_Pnt);
+            Handle(Geom_Plane) aPlane2 = new Geom_Plane(gce_MP2.Value());
+            
+      Handle(AIS_AngleDimension) anAngle2IO = new AIS_AngleDimension(anEdge2, anEdge3, aPlane2, theAngle2 * M_PI / 180.,
+              TCollection_ExtendedString(aStr));
+      
+      aSPrs->AddObject(anAngle2IO);
+    }
+    GEOMBase_Helper::displayPreview( aSPrs, true, true );
+  }
+}
+
 //================================================================
 // Function : createShapes
 // Purpose  : Create applyed wire, and last segment from entry object
index b4969bbda772d9cec2fe8d15dc56ef1109acc795..e5bea75528bf14b307a91661fec17122135b0b07 100755 (executable)
@@ -29,6 +29,7 @@
 class QButtonGroup;
 class QDoubleSpinBox;
 class EntityGUI_3Spin;
+class EntityGUI_Angles;
 class DlgRef_3Radio;
 
 #ifndef COORD_MIN
@@ -76,6 +77,10 @@ private:
                                                      const double = -1,
                                                      const int  = -1,
                                                      const int  = -1);
+  
+  void                               displayTrihedron( int );
+  
+  void                               displayAngle( double, double, double, int );
 
   bool                               createShapes( GEOM::GEOM_Object_ptr,
                                                    TopoDS_Shape&,
@@ -89,10 +94,12 @@ private:
   XYZList                            myRedoList;
 
   EntityGUI_3Spin*                   Group3Spin;
+  EntityGUI_Angles*                  GroupAngles;
   DlgRef_3Radio*                     GroupType;
   QButtonGroup*                      myTypeGroup;
 
   int                                myMode;
+  int                                myOrientation;
   bool                               myOK;
   double                             myLineWidth;
   GeometryGUI*                       myGeometryGUI;
@@ -112,6 +119,8 @@ private slots:
   void                               ActivateThisDialog();
   void                               TypeClicked( int );
   void                               ValueChangedInSpinBox( double );
+  void                               ButtonClicked( bool );
+  void                               AngleChecked ( bool );
   void                               SetDoubleSpinBoxStep( double );
 };
 
diff --git a/src/EntityGUI/EntityGUI_Angles_QTD.ui b/src/EntityGUI/EntityGUI_Angles_QTD.ui
new file mode 100644 (file)
index 0000000..4119956
--- /dev/null
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EntityGUI_Angles_QTD</class>
+ <widget class="QWidget" name="EntityGUI_Angles_QTD">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>351</width>
+    <height>148</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>EntityGUI_Angles_QTD</string>
+  </property>
+  <layout class="QGridLayout">
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QGroupBox" name="GroupBox1">
+     <property name="title">
+      <string>Values</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="TextLabel4">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Length</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DL"/>
+      </item>
+      <item row="0" column="2">
+       <widget class="QPushButton" name="buttonApply">
+        <property name="text">
+         <string>Create</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="TextLabel1">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="text">
+         <string>Angle</string>
+        </property>
+        <property name="wordWrap">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DA"/>
+      </item>
+      <item row="1" column="2">
+       <layout class="QGridLayout" name="gridLayout_2">
+        <property name="margin">
+         <number>0</number>
+        </property>
+        <property name="spacing">
+         <number>6</number>
+        </property>
+        <item row="0" column="1">
+         <widget class="QPushButton" name="buttonRedo">
+          <property name="text">
+           <string>Redo</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="0">
+         <widget class="QPushButton" name="buttonUndo">
+          <property name="text">
+           <string>Undo</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="2" column="0" colspan="2">
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QRadioButton" name="radioButton_1">
+          <property name="text">
+           <string>OXY</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioButton_2">
+          <property name="text">
+           <string>OYZ</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioButton_3">
+          <property name="text">
+           <string>OXZ</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item row="3" column="0">
+       <widget class="QCheckBox" name="checkBox">
+        <property name="text">
+         <string>CheckBox</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DA2"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>SalomeApp_DoubleSpinBox</class>
+   <extends>QDoubleSpinBox</extends>
+   <header location="global">SalomeApp_DoubleSpinBox.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>SpinBox_DL</tabstop>
+  <tabstop>SpinBox_DA</tabstop>
+  <tabstop>radioButton_1</tabstop>
+  <tabstop>radioButton_2</tabstop>
+  <tabstop>radioButton_3</tabstop>
+  <tabstop>checkBox</tabstop>
+  <tabstop>SpinBox_DA2</tabstop>
+  <tabstop>buttonApply</tabstop>
+  <tabstop>buttonUndo</tabstop>
+  <tabstop>buttonRedo</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
index 5416df1bee2cff46d38748547058d4cd3887db71..4e2096dee07e93abf9096268e8c835605ef05efd 100644 (file)
@@ -210,6 +210,20 @@ EntityGUI_Point::~EntityGUI_Point()
 {
 }
 
+//////////////////////////////////////////
+// EntityGUI_Angles
+//////////////////////////////////////////
+
+EntityGUI_Angles::EntityGUI_Angles( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+  setupUi( this );
+}
+
+EntityGUI_Angles::~EntityGUI_Angles()
+{
+}
+
 //////////////////////////////////////////
 // EntityGUI_Skeleton
 //////////////////////////////////////////
index c7a37cf1348eb1b61b77d5e8bd373d13e5f568c5..9d84d3cad942a0dbe2da79fac52d970544e7b18a 100644 (file)
@@ -222,6 +222,22 @@ public:
   QButtonGroup* ButtonGroup;
 };
 
+//////////////////////////////////////////
+// EntityGUI_Angles
+//////////////////////////////////////////
+
+#include "ui_EntityGUI_Angles_QTD.h"
+
+class EntityGUI_Angles : public QWidget, 
+                        public Ui::EntityGUI_Angles_QTD
+{
+  Q_OBJECT
+
+public:
+  EntityGUI_Angles( QWidget* = 0, Qt::WindowFlags = 0 );
+  ~EntityGUI_Angles();
+};
+
 //////////////////////////////////////////
 // EntityGUI_Skeleton
 //////////////////////////////////////////
index f6671ee65f27bd3d048873e893dc3ca9f4cb19bb..55cafc56b10a9fbf3631636fab631836dc605fdb 100644 (file)
@@ -84,7 +84,8 @@ UIC_FILES =                           \
        ui_EntityGUI_Dir1_QTD.h         \
        ui_EntityGUI_Dir2_QTD.h         \
        ui_EntityGUI_Point_QTD.h        \
-       ui_EntityGUI_Skeleton_QTD.h
+       ui_EntityGUI_Skeleton_QTD.h     \
+       ui_EntityGUI_Angles_QTD.h
 
 BUILT_SOURCES = $(UIC_FILES)