]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0016757: EDF 546 GEOM : Add Face and Disc in geom primitives
authordmv <dmv@opencascade.com>
Fri, 8 Aug 2008 13:43:36 +0000 (13:43 +0000)
committerdmv <dmv@opencascade.com>
Fri, 8 Aug 2008 13:43:36 +0000 (13:43 +0000)
21 files changed:
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/DlgRef/DlgRef.cxx
src/DlgRef/DlgRef.h
src/DlgRef/Makefile.am
src/GEOMGUI/GEOM_images.ts
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMImpl/GEOMImpl_FaceDriver.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
src/GEOMImpl/GEOMImpl_Types.hxx
src/GEOM_I/GEOM_I3DPrimOperations_i.cc
src/GEOM_I/GEOM_I3DPrimOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/GEOM_TestAll.py
src/GEOM_SWIG/geompyDC.py
src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h
src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h

index 06cf8084a693611397dcdeacf1af1071f1ecbdae..6220952c25cf94ff5c11354f0ba12962294b69d0 100644 (file)
@@ -839,7 +839,7 @@ module GEOM
      *  \param theW horisontal size (width). 
      *  \return New GEOM_Object, containing the created face.
      */
-    GEOM_Object MakeFaceVecHW (in GEOM_Object theVec, in double theH, in double theW);
+    GEOM_Object MakeFaceObjHW (in GEOM_Object theObj, in double theH, in double theW);
     /*!
      *  Create a Disk (circular face) with given center, normal vector and radius.
      *  \param thePnt disk center.
index 1b01d8dc7a9692db9b5e18d75398b4ee5b387921..0c1b2252d80fe372ef0494c3a76a24d74d5e1e5e 100644 (file)
@@ -129,7 +129,7 @@ module GEOM
     GEOM_Object MakeFaceHW (in double theH, 
                            in double theW,
                            in short  theOrientation) ;
-    GEOM_Object MakeFaceVecHW (in GEOM_Object theVec
+    GEOM_Object MakeFaceObjHW (in GEOM_Object theObj
                               in double      theH,
                               in double      theW) ;
     GEOM_Object MakeDiskPntVecR (in GEOM_Object thePnt,
index b29fdee59b472baadd54c50350a8ac5f49642b39..f93df1ac281416f08518c0d33627f2c718b585bb 100644 (file)
@@ -471,6 +471,20 @@ DlgRef_3Check::~DlgRef_3Check()
 {
 }
 
+//////////////////////////////////////////
+// DlgRef_3Radio
+//////////////////////////////////////////
+
+DlgRef_3Radio::DlgRef_3Radio( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+  setupUi( this );
+}
+
+DlgRef_3Radio::~DlgRef_3Radio()
+{
+}
+
 //////////////////////////////////////////
 // DlgRef_3Sel1Check
 //////////////////////////////////////////
index 9ff6b68696f4f9b8f4fd5bc24e8918c03c570409..4e677a32109f9ac7a6ecb3b1e26a309fc1ad1395 100644 (file)
@@ -194,6 +194,8 @@ public:
   ~DlgRef_1Sel3Check();
 };
 
+
+
 //////////////////////////////////////////
 // DlgRef_1Sel3Spin
 //////////////////////////////////////////
@@ -546,6 +548,22 @@ public:
   ~DlgRef_3Check();
 };
 
+//////////////////////////////////////////
+// DlgRef_1Sel3Radio
+//////////////////////////////////////////
+
+#include "ui_DlgRef_3Radio_QTD.h"
+
+class DLGREF_EXPORT DlgRef_3Radio : public QWidget, 
+                                    public Ui::DlgRef_3Radio_QTD
+{
+  Q_OBJECT
+
+public:
+  DlgRef_3Radio( QWidget* = 0, Qt::WindowFlags = 0 );
+  ~DlgRef_3Radio();
+};
+
 //////////////////////////////////////////
 // DlgRef_3Sel1Check
 //////////////////////////////////////////
index ed593f335071e8060ee32859f723e79dd2b2da02..bd8407d3d25c1e6bfeeeaf22cb65bcfb2e5b1775 100644 (file)
@@ -70,6 +70,7 @@ UIC_FILES = \
        ui_DlgRef_2SelExt_QTD.h                 \
        ui_DlgRef_2Spin_QTD.h                   \
        ui_DlgRef_3Check_QTD.h                  \
+       ui_DlgRef_3Radio_QTD.h                  \
        ui_DlgRef_3Sel1Check_QTD.h              \
        ui_DlgRef_3Sel1Spin_QTD.h               \
        ui_DlgRef_3Sel3Spin1Check_QTD.h         \
index 3442ba16025770bd4158daf3de9ba0cc81b86181..8f5801fd1996a227234d396b26ffde5e7aaa184f 100644 (file)
@@ -91,7 +91,7 @@
             <translation>face_hw.png</translation>
         </message>
        <message>
-            <source>ICON_DLG_FACE_VEC_HW</source>
+            <source>ICON_DLG_FACE_OBJ_HW</source>
             <translation>face_vechw.png</translation>
         </message>
         <message>
index 8188a2b317c8f42314628a5a74a679b951566b6c..b1b0753c98aea656c3394ab57de929e426c58759 100644 (file)
@@ -420,6 +420,10 @@ Please, select face, shell or solid and try again</translation>
             <source>GEOM_DISK</source>
             <translation>Disk</translation>
         </message>
+       <message>
+            <source>GEOM_DISK_TITLE</source>
+            <translation>Create A Disk</translation>
+        </message>
         <message>
             <source>GEOM_DIMENSIONS</source>
             <translation>Dimensions</translation>
@@ -924,6 +928,10 @@ Please, select face, shell or solid and try again</translation>
             <source>GEOM_OBJECT</source>
             <translation>Object</translation>
         </message>
+       <message>
+            <source>GEOM_OBJECT_TYPE</source>
+            <translation>Object Type</translation>
+        </message>
         <message>
             <source>GEOM_OBJECTS</source>
             <translation>Objects</translation>
index 9d8deefef8bf9fd0f3d7f7b0c3786ccadb96671c..f1a325c2ce2e1705dcf31f6640c5bfd3de798d0e 100755 (executable)
@@ -74,11 +74,11 @@ Standard_Integer GEOMImpl_FaceDriver::Execute(TFunction_Logbook& log) const
 
   TopoDS_Shape aShape;
 
-  if (aType == FACE_VEC_H_W) {
-    Handle(GEOM_Function) aRefVec = aFI.GetRef1();
-    TopoDS_Shape aShapeVec = aRefVec->GetValue();
-    if (aShapeVec.ShapeType() == TopAbs_EDGE) {
-      TopoDS_Edge anEdge = TopoDS::Edge(aShapeVec);
+  if (aType == FACE_OBJ_H_W) {
+    Handle(GEOM_Function) aRefFunct = aFI.GetRef1();
+    TopoDS_Shape aRefShape = aRefFunct->GetValue();
+    if (aRefShape.ShapeType() == TopAbs_EDGE) {
+      TopoDS_Edge anEdge = TopoDS::Edge(aRefShape);
       double aH = aFI.GetH() / 2.0;
       double aW = aFI.GetW() / 2.0;
       TopoDS_Vertex V1, V2;
@@ -87,6 +87,12 @@ Standard_Integer GEOMImpl_FaceDriver::Execute(TFunction_Logbook& log) const
       gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
       gp_Pln aPlane (aP, aV);
       aShape = BRepBuilderAPI_MakeFace(aPlane, -aH, +aH, -aW, +aW).Shape();
+    } else if (aRefShape.ShapeType() == TopAbs_FACE) {
+      double aH = aFI.GetH() / 2.0;
+      double aW = aFI.GetW() / 2.0;
+      gp_Ax3 anAx = GEOMImpl_IMeasureOperations::GetPosition(aRefShape);
+      gp_Pln aPln (anAx);
+      aShape = BRepBuilderAPI_MakeFace(aPln, -aH, +aH, -aW, +aW).Shape();
     }
   }
   else if (aType == FACE_H_W) {
index 37fafba5c8b176ff26faf52307bc614957ea5950..98397434385d953aa5d58b4f94273b74b5d66e09 100644 (file)
@@ -249,21 +249,21 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double
 
 //=============================================================================
 /*!
- *  MakeFaceVecHW
+ *  MakeFaceObjHW
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceVecHW (Handle(GEOM_Object) theVec,
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Object) theObj,
                                                               double theH, double theW)
 {
   SetErrorCode(KO);
 
-  if (theVec.IsNull()) return NULL;
+  if (theObj.IsNull()) return NULL;
 
   //Add a new Face object
   Handle(GEOM_Object) aFace = GetEngine()->AddObject(GetDocID(), GEOM_FACE);
 
   //Add a new Box function for creation a box relatively to two points
-  Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_VEC_H_W);
+  Handle(GEOM_Function) aFunction = aFace->AddFunction(GEOMImpl_FaceDriver::GetID(), FACE_OBJ_H_W);
   if (aFunction.IsNull()) return NULL;
 
   //Check if the function is set correctly
@@ -271,7 +271,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceVecHW (Handle(GEOM_Objec
 
   GEOMImpl_IFace aFI (aFunction);
 
-  Handle(GEOM_Function) aRefFunction1 = theVec->GetLastFunction();
+  Handle(GEOM_Function) aRefFunction1 = theObj->GetLastFunction();
 
   if (aRefFunction1.IsNull())
     return aFace;
@@ -297,8 +297,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceVecHW (Handle(GEOM_Objec
   }
 
   //Make a Python command
-  GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFaceVecHW("
-    << theVec << ", " << theH << ", " << theW << ")";
+  GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFaceObjHW("
+    << theObj << ", " << theH << ", " << theW << ")";
 
   SetErrorCode(OK);
   return aFace;
index ba2a0fbda2422a1e229933d40d74d597c8b19f7a..5099605fc35a7e2589c9e1fd596847eb0e153a4d 100644 (file)
@@ -37,7 +37,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakeBoxTwoPnt (Handle(GEOM_Object) thePnt1,
                                                     Handle(GEOM_Object) thePnt2);
   Standard_EXPORT Handle(GEOM_Object) MakeFaceHW (double theH, double theW, int theOrientation);
-  Standard_EXPORT Handle(GEOM_Object) MakeFaceVecHW (Handle(GEOM_Object) theVec,
+  Standard_EXPORT Handle(GEOM_Object) MakeFaceObjHW (Handle(GEOM_Object) theObj,
                                                     double theH, double theW);
   Standard_EXPORT Handle(GEOM_Object) MakeDiskThreePnt (Handle(GEOM_Object) thePnt1,
                                                        Handle(GEOM_Object) thePnt2,
index b2f3c58d110ee4db066127a49355e79ac5b666b7..4220d74884734d28bb7437f477367377d98c9eba 100755 (executable)
 #define BOX_DX_DY_DZ  1
 #define BOX_TWO_PNT   2
 
-#define FACE_VEC_H_W  1
+#define FACE_OBJ_H_W  1
 #define FACE_H_W        2
 
 #define DISK_PNT_VEC_R    1
index 7bd3eaa69f9aa35984ca7600de5ae05f5d98b97b..6e6a4b8be29745e73f4375c780639fb5eec0e4f3 100644 (file)
@@ -130,11 +130,11 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
 
 //=============================================================================
 /*!
- *  MakeFaceVecHW
+ *  MakeFaceObjHW
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceVecHW
-                                               (GEOM::GEOM_Object_ptr theVec,
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
+                                               (GEOM::GEOM_Object_ptr theObj,
                                                CORBA::Double theH,
                                                CORBA::Double theW)
 {
@@ -143,18 +143,18 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceVecHW
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theVec == NULL || theH == 0 || theW == 0)
+  if (theObj == NULL || theH == 0 || theW == 0)
     return aGEOMObject._retn();
 
   //Get the reference points
-  Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject
+    (theObj->GetStudyID(), theObj->GetEntry());
 
-  if (aFace.IsNull())
+  if (anObj.IsNull())
     return aGEOMObject._retn();
 
   //Create the Face
-  Handle(GEOM_Object) anObject = GetOperations()->MakeFaceVecHW(aFace, theH, theW);
+  Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
index 737c61305586373058d9643768cc8bdee68ce82f..0f5641eae6a536e2174d91ecfa851ae2b66c6472 100644 (file)
@@ -51,9 +51,9 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
                                    CORBA::Double theW,
                                    CORBA::Short  theOrientation);
 
-  GEOM::GEOM_Object_ptr MakeFaceVecHW (GEOM::GEOM_Object_ptr theFace,
-                                        CORBA::Double theH,
-                                        CORBA::Double theW);
+  GEOM::GEOM_Object_ptr MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj,
+                                      CORBA::Double theH,
+                                      CORBA::Double theW);
 
   GEOM::GEOM_Object_ptr MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter,
                                         GEOM::GEOM_Object_ptr theVector,
index 6f46ba2eaff8b58931d335a4528dbd8aeef8462e..97d7f17af36133b208b8f981c2dfa4a1f7c0abca 100644 (file)
@@ -787,17 +787,17 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceHW (CORBA::Double theH,
 }
 
 //=============================================================================
-//  MakeFaceVecHW:
+//  MakeFaceObjHW:
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceVecHW (GEOM::GEOM_Object_ptr theVec
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj
                                                    CORBA::Double theH,
                                                    CORBA::Double theW)
 {
-  beginService( " GEOM_Superv_i::MakeFaceVecHW" );
-  MESSAGE("GEOM_Superv_i::MakeFaceVecHW");
+  beginService( " GEOM_Superv_i::MakeFaceObjHW" );
+  MESSAGE("GEOM_Superv_i::MakeFaceObjHW");
   get3DPrimOp();
-  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFaceVecHW(theVec, theH, theW);
-  endService( " GEOM_Superv_i::MakeFaceVecHW" );
+  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeFaceObjHW(theObj, theH, theW);
+  endService( " GEOM_Superv_i::MakeFaceObjHW" );
   return anObj;
 }
 
index 39051115e1b92c9fb9b4b55581751b0f15905f35..75a66523e5f9fd15788da4d827220e6d81fb2d5a 100644 (file)
@@ -190,7 +190,7 @@ public:
   GEOM::GEOM_Object_ptr MakeFaceHW (CORBA::Double theH,
                                    CORBA::Double theW,
                                    CORBA::Short  theOrientation);
-  GEOM::GEOM_Object_ptr MakeFaceVecHW (GEOM::GEOM_Object_ptr theFace
+  GEOM::GEOM_Object_ptr MakeFaceObjHW (GEOM::GEOM_Object_ptr theObj
                                       CORBA::Double theH,
                                       CORBA::Double theW);
   GEOM::GEOM_Object_ptr MakeDiskPntVecR (GEOM::GEOM_Object_ptr theCenter,
index 49427ae289fc989c6df7adcc69dcac4037c3fb50..ca727edcbb7ed34a7fa73d2d14d9ed0b6eb8a9b3 100644 (file)
@@ -139,7 +139,7 @@ def TestAll (geompy, math):
                                   WantPlanarFace)    #(List of GEOM_Object_ptr, Boolean)->GEOM_Object_ptr
   Face2    = geompy.MakeFace(Sketcher, WantPlanarFace)
   Face3    = geompy.MakeFaceHW (100., 200., 1)       #(2 Doubles, 1 Int)->GEOM_Object_ptr
-  Face4    = geompy.MakeFaceVecHW (vz, 200., 100.)   #(1 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
+  Face4    = geompy.MakeFaceObjHW (vz, 200., 100.)   #(1 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
   Disk     = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object_ptr, 1 Double)->GEOM_Object_ptr
   Disk2    = geompy.MakeDiskThreePnt(p0, p200, pz)   #(3 GEOM_Object_ptr)->GEOM_Object_ptr
   Disk3    = geompy.MakeDiskR(100., 1)               #(1 Doubles, 1 Int)->GEOM_Object_ptr
index 907a0ee23e3112d0ac10cd00f89d480076cad968..d4f38a78bf0e6899fd78728f6d58fc7906fa8769 100644 (file)
@@ -696,16 +696,17 @@ class geompyDC(GEOM._objref_GEOM_Gen):
 
         ## Create a face from another plane and two sizes,
         #  vertical size and horisontal size.
-        #  @param theVec   Normale vector to the creating face.
+        #  @param theObj   Normale vector to the creating face or
+       #  the face object.
         #  @param theH     Height (vertical size).
         #  @param theW     Width (horisontal size).
         #  @return New GEOM_Object, containing the created face.
         #
         #  @ref tui_creation_face "Example"
-        def MakeFaceVecHW(self, theVec, theH, theW):
+        def MakeFaceObjHW(self, theObj, theH, theW):
             # Example: see GEOM_TestAll.py
-            anObj = self.PrimOp.MakeFaceVecHW(theVec, theH, theW)
-            RaiseIfFailed("MakeFaceVecHW", self.PrimOp)
+            anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
+            RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
             return anObj
 
         ## Create a disk with given center, normal vector and radius.
index daf7b78e768a336f042cd87f25490e9fed08d8fc..20f9ef21a9ac3762cef9895ce6bb50d84a504913 100755 (executable)
@@ -62,9 +62,9 @@ PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg( GeometryGUI* theGeometryGUI, QWidget
 
   /***************************************************************/
   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_DISK" ) );
-  mainFrame()->RadioButton1->setIcon( image0 );
-  mainFrame()->RadioButton2->setIcon( image2 );
-  mainFrame()->RadioButton3->setIcon( image3 );
+  mainFrame()->RadioButton1->setIcon( image3 );
+  mainFrame()->RadioButton2->setIcon( image0 );
+  mainFrame()->RadioButton3->setIcon( image2 );
 
   GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() );
   GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
@@ -92,7 +92,7 @@ PrimitiveGUI_DiskDlg::PrimitiveGUI_DiskDlg( GeometryGUI* theGeometryGUI, QWidget
   GroupDimensions->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
   GroupDimensions->TextLabel1->setText( tr( "GEOM_RADIUS" ) );
 
-  GroupOrientation = new DlgRef_3Check( centralWidget() );
+  GroupOrientation = new DlgRef_3Radio( centralWidget() );
   GroupOrientation->GroupBox1->setTitle( tr( "GEOM_ORIENTATION" ) );
   GroupOrientation->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) );
   GroupOrientation->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) );
@@ -216,6 +216,16 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId )
 
   switch ( constructorId ) {
   case 0:
+    {
+      GroupPntVecR->hide();
+      Group3Pnts->hide();
+      GroupDimensions->show();
+      GroupOrientation->show();
+      GroupOrientation->RadioButton1->setChecked( true );
+      myOrientationType = 1;
+      break;
+    }
+  case 1:
     {
       Group3Pnts->hide();
       GroupPntVecR->show();
@@ -226,7 +236,7 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId )
       GroupPntVecR->LineEdit2->setText( "" );
       break;
     }
-  case 1:
+  case 2:
     {
       GroupPntVecR->hide();
       Group3Pnts->show();
@@ -238,15 +248,6 @@ void PrimitiveGUI_DiskDlg::ConstructorsClicked( int constructorId )
       Group3Pnts->LineEdit3->setText( "" );
       break;
     }
-  case 2:
-    {
-      GroupPntVecR->hide();
-      Group3Pnts->hide();
-      GroupDimensions->show();
-      GroupOrientation->show();
-      GroupOrientation->RadioButton1->setChecked( true );
-      myOrientationType = 1;
-    }
   }
   
   qApp->processEvents();
@@ -292,7 +293,7 @@ bool PrimitiveGUI_DiskDlg::ClickOnApply()
 //=================================================================================
 void PrimitiveGUI_DiskDlg::SelectionIntoArgument()
 {
-  if (getConstructorId() == 2) {
+  if (getConstructorId() == 0) {
     displayPreview();
     return;
   }
@@ -467,9 +468,9 @@ double PrimitiveGUI_DiskDlg::getRadius() const
   double r = 0.;
   switch ( getConstructorId() ) {
   case 0:
-    r = GroupPntVecR->SpinBox_DX->value(); break;
-  case 2:
     r = GroupDimensions->SpinBox_DX->value(); break;
+  case 1:
+    r = GroupPntVecR->SpinBox_DX->value(); break;
   }
   return r;
 }
@@ -500,12 +501,12 @@ bool PrimitiveGUI_DiskDlg::isValid( QString& msg )
 {
   const int id = getConstructorId();
   if ( id == 0 )
-    return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
+    return true;
   else if ( id == 1 )
+    return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
+  else if ( id == 2 )
     return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
       !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
-  else if ( id == 2 )
-    return true;
   return false;
 }
 
@@ -521,15 +522,15 @@ bool PrimitiveGUI_DiskDlg::execute( ObjectList& objects )
   
   switch ( getConstructorId() ) {
   case 0 :
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskPntVecR( myPoint, myDir, getRadius() );
+    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskR( getRadius(), myOrientationType );
     res = true;
     break;
   case 1 :
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskThreePnt( myPoint1, myPoint2, myPoint3 );
+    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskPntVecR( myPoint, myDir, getRadius() );
     res = true;
     break;
   case 2 :
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskR( getRadius(), myOrientationType );
+    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeDiskThreePnt( myPoint1, myPoint2, myPoint3 );
     res = true;
     break;
   }
@@ -552,11 +553,11 @@ void PrimitiveGUI_DiskDlg::addSubshapesToStudy()
   QMap<QString, GEOM::GEOM_Object_var> objMap;
 
   switch ( getConstructorId() ) {
-  case 0:
+  case 1:
     objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
     objMap[GroupPntVecR->LineEdit2->text()] = myDir;
     break;
-  case 1:
+  case 2:
     objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
     objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
     objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
index fb9413ebf31b968274c2eb58c1a7f458afb3f691..da2630b314ed4407523256a825995cace376aac3 100755 (executable)
@@ -31,7 +31,7 @@
 class DlgRef_3Sel;
 class DlgRef_2Sel1Spin;
 class DlgRef_1Spin;
-class DlgRef_3Check;
+class DlgRef_3Radio;
 
 //=================================================================================
 // class    : PrimitiveGUI_DiskDlg
@@ -65,7 +65,7 @@ private:
   DlgRef_2Sel1Spin*                  GroupPntVecR;
   DlgRef_3Sel*                       Group3Pnts;
   DlgRef_1Spin*                      GroupDimensions;
-  DlgRef_3Check*                     GroupOrientation;
+  DlgRef_3Radio*                     GroupOrientation;
 
 private slots:
   void                               ClickOnOk();
index 93a5036aa7965d57dcc6f144da3d5fbba36ec19d..011ceb53b128f49915eb3bcfe4228f5cb32be8de 100755 (executable)
@@ -53,7 +53,7 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
                                    bool modal, Qt::WindowFlags fl )
   : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
 {
-  QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_VEC_HW" ) ) );
+  QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_OBJ_HW" ) ) );
   QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
   QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FACE_HW" ) ) );
 
@@ -61,8 +61,8 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
  
   /***************************************************************/
   mainFrame()->GroupConstructors->setTitle( tr( "GEOM_FACE" ) );
-  mainFrame()->RadioButton1->setIcon( image0 );
-  mainFrame()->RadioButton2->setIcon( image2 );
+  mainFrame()->RadioButton1->setIcon( image2 );
+  mainFrame()->RadioButton2->setIcon( image0 );
   mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
   mainFrame()->RadioButton3->close();
 
@@ -74,12 +74,19 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
   GroupPlane->PushButton1->setIcon( image1 );
   GroupPlane->LineEdit1->setReadOnly( true );
 
+  GroupType = new DlgRef_3Radio( centralWidget() );
+  GroupType->GroupBox1->setTitle( tr( "GEOM_OBJECT_TYPE" ) );
+  GroupType->RadioButton1->setText( tr( "GEOM_EDGE" ) );
+  GroupType->RadioButton2->setText( tr( "GEOM_FACE" ) );
+  GroupType->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+  GroupType->RadioButton3->close();
+
   GroupDimensions = new DlgRef_2Spin( centralWidget() );
   GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) );
   GroupDimensions->TextLabel1->setText( tr( "GEOM_HEIGHT" ) );
   GroupDimensions->TextLabel2->setText( tr( "GEOM_WIDTH" ) );
 
-  GroupOrientation = new DlgRef_3Check( centralWidget() );
+  GroupOrientation = new DlgRef_3Radio( centralWidget() );
 
   GroupOrientation->GroupBox1->setTitle( tr( "GEOM_ORIENTATION" ) );
   GroupOrientation->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) );
@@ -88,6 +95,7 @@ PrimitiveGUI_FaceDlg::PrimitiveGUI_FaceDlg( GeometryGUI* theGeometryGUI, QWidget
 
   QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
   layout->setMargin( 0 ); layout->setSpacing( 6 );
+  layout->addWidget( GroupType );
   layout->addWidget( GroupPlane );
   layout->addWidget( GroupDimensions );
   layout->addWidget( GroupOrientation );
@@ -117,9 +125,11 @@ void PrimitiveGUI_FaceDlg::Init()
 {
   /* init variables */
   myEditCurrentArgument = GroupPlane->LineEdit1;
+  GroupType->RadioButton1->setChecked(true);
   myEdge = GEOM::GEOM_Object::_nil();
+  myFace = GEOM::GEOM_Object::_nil();
   globalSelection(); // close local contexts, if any
-  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+  //  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
   myOrientationType = 1;
 
@@ -162,6 +172,9 @@ void PrimitiveGUI_FaceDlg::Init()
   connect( GroupOrientation->RadioButton2, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
   connect( GroupOrientation->RadioButton3, SIGNAL( clicked() ), this, SLOT( RadioButtonClicked() ) );
 
+  connect( GroupType->RadioButton1, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) );
+  connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) );
+
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
           this, SLOT( SelectionIntoArgument() ) );
   
@@ -204,6 +217,24 @@ void PrimitiveGUI_FaceDlg::RadioButtonClicked()
   displayPreview();
 }
 
+//=================================================================================
+// function : TypeBittonClicked()
+// purpose  : Radio button management
+//=================================================================================
+void PrimitiveGUI_FaceDlg::TypeButtonClicked()
+{
+  if ( GroupType->RadioButton1->isChecked() ) {
+    globalSelection(); // close local contexts, if any
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+    GroupPlane->TextLabel1->setText( tr( "GEOM_EDGE" ) );
+  }
+  else if ( GroupType->RadioButton2->isChecked() ) {
+    globalSelection(); // close local contexts, if any
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+    GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) );
+  }
+}
+
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
@@ -239,28 +270,32 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId )
 {  
   switch ( constructorId ) {
   case 0:
+    {
+      globalSelection(); // close local contexts, if any
+      GroupPlane->hide();
+      GroupDimensions->show();
+      GroupOrientation->show();
+      GroupType->hide();
+      GroupOrientation->RadioButton1->setChecked( true );
+      myOrientationType = 1;
+      break;
+    }
+  case 1:
     {
       globalSelection(); // close local contexts, if any
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
-
       myEditCurrentArgument = GroupPlane->LineEdit1;
       myEditCurrentArgument->setText("");
       myEdge = GEOM::GEOM_Object::_nil();
+      myFace = GEOM::GEOM_Object::_nil();
+      GroupType->RadioButton1->setChecked( true );
+      TypeButtonClicked();
       GroupDimensions->hide();
       GroupOrientation->hide();
+      GroupType->show();
       GroupPlane->show();
       break;
     }
-  case 1:
-    {
-      globalSelection(); // close local contexts, if any
-      GroupPlane->hide();
-      GroupDimensions->show();
-      GroupOrientation->show();
-      GroupOrientation->RadioButton1->setChecked( true );
-      myOrientationType = 1;
-      break;
-    }
   }
 
   qApp->processEvents();
@@ -276,7 +311,7 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId )
 //=================================================================================
 void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
 {
-  if (getConstructorId() != 0) {
+  if (getConstructorId() == 0) {
     displayPreview();
     return;
   }
@@ -290,18 +325,25 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
 
   // nbSel == 1 
   Standard_Boolean aRes = Standard_False;
+  TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
   if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
     QString aName = GEOMBase::GetName( aSelectedObject );
     
     TopoDS_Shape aShape;
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
+      if (GroupType->RadioButton2->isChecked())
+       aNeedType = TopAbs_FACE;
+
       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
       TColStd_IndexedMapOfInteger aMap;
       aSelMgr->GetIndexes( firstIObject(), aMap );
       if ( aMap.Extent() == 1 ) { // Local Selection
        int anIndex = aMap( 1 );
-       aName += QString( ":edge_%1" ).arg( anIndex );
+       if ( aNeedType == TopAbs_EDGE )
+          aName += QString( ":edge_%1" ).arg( anIndex );
+        else
+         aName += QString( ":face_%1" ).arg( anIndex );
 
        //Find SubShape Object in Father
        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
@@ -314,7 +356,7 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
          aSelectedObject = aFindedObject; // get Object from study
       }
       else { // Global Selection
-        if ( aShape.ShapeType() != TopAbs_EDGE ) {
+        if ( aShape.ShapeType() != aNeedType ) {
           aSelectedObject = GEOM::GEOM_Object::_nil();
           aName = "";
         }
@@ -322,7 +364,10 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
     }
 
     myEditCurrentArgument->setText( aName );
-    if ( myEditCurrentArgument == GroupPlane->LineEdit1 )  myEdge = aSelectedObject;
+    if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_EDGE )
+      myEdge = aSelectedObject;
+    else if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_FACE )
+      myFace = aSelectedObject;
   }
   displayPreview();
 }
@@ -339,7 +384,10 @@ void PrimitiveGUI_FaceDlg::SetEditCurrentArgument()
   globalSelection(); // close previous local contexts
   if ( send == GroupPlane->PushButton1 ) {
     myEditCurrentArgument = GroupPlane->LineEdit1;
-    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+    if (GroupType->RadioButton1->isChecked())
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+    else if (GroupType->RadioButton1->isChecked())
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
   }
 
   myEditCurrentArgument->setFocus();
@@ -409,9 +457,13 @@ bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
 {
   const int id = getConstructorId();
   if ( id == 0 )
-    return !myEdge->_is_nil();
-  else if ( id == 1 )
     return true;
+  else if ( id == 1 ) {
+    if (GroupType->RadioButton1->isChecked())
+      return !myEdge->_is_nil();
+    else if (GroupType->RadioButton2->isChecked())
+      return !myFace->_is_nil();
+  }
   return false;
 }
 
@@ -425,11 +477,14 @@ bool PrimitiveGUI_FaceDlg::execute( ObjectList& objects )
   GEOM::GEOM_Object_var anObj;
   switch ( getConstructorId() ) {
   case 0 :
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceVecHW( myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value() );
+    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceHW( GroupDimensions->SpinBox_DX->value(), GroupDimensions->SpinBox_DY->value(), myOrientationType );
     res = true;
     break;
   case 1 :
-    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceHW( GroupDimensions->SpinBox_DX->value(), GroupDimensions->SpinBox_DY->value(), myOrientationType );
+    if ( GroupType->RadioButton1->isChecked() )
+      anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceObjHW( myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value() );
+    else if (GroupType->RadioButton2->isChecked())
+      anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeFaceObjHW( myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value() );
     res = true;
     break;
   }
@@ -448,8 +503,11 @@ void PrimitiveGUI_FaceDlg::addSubshapesToStudy()
 {
   QMap<QString, GEOM::GEOM_Object_var> objMap;
   switch ( getConstructorId() ) {
-  case 0 :
-    objMap[GroupPlane->LineEdit1->text()] = myEdge;
+  case 1 :
+    if ( GroupType->RadioButton1->isChecked() )
+      objMap[GroupPlane->LineEdit1->text()] = myEdge;
+    if ( GroupType->RadioButton2->isChecked() )
+      objMap[GroupPlane->LineEdit1->text()] = myFace;
     break;
   }
   addSubshapesToFather( objMap );
index 79676748d8d160614532c07802072420a92b5359..c9e59f7ae578a8da9568a3a71f7d80520c3df5cf 100755 (executable)
@@ -30,7 +30,7 @@
 
 class DlgRef_2Spin;
 class DlgRef_1Sel2Spin;
-class DlgRef_3Check;
+class DlgRef_3Radio;
 
 //=================================================================================
 // class    : PrimitiveGUI_FaceDlg
@@ -60,12 +60,14 @@ private:
   GEOM::GEOM_Object_var              myPoint2;
   GEOM::GEOM_Object_var              myVector;
   GEOM::GEOM_Object_var              myEdge;
+  GEOM::GEOM_Object_var              myFace;
 
   int                                myOrientationType;
   
   DlgRef_2Spin*                      GroupDimensions;
   DlgRef_1Sel2Spin*                  GroupPlane;
-  DlgRef_3Check*                     GroupOrientation;
+  DlgRef_3Radio*                     GroupOrientation;
+  DlgRef_3Radio*                     GroupType;
     
 private slots:
   void                               ClickOnOk();
@@ -81,6 +83,7 @@ private slots:
   void                               ValueChangedInSpinBox( double );
   void                               SetDoubleSpinBoxStep( double );
   void                               RadioButtonClicked();
+  void                               TypeButtonClicked();
 };
 
 #endif // BASICGUI_FACEDLG_H