Salome HOME
Dump Python extension
authorouv <ouv@opencascade.com>
Tue, 18 Nov 2008 15:42:06 +0000 (15:42 +0000)
committerouv <ouv@opencascade.com>
Tue, 18 Nov 2008 15:42:06 +0000 (15:42 +0000)
13 files changed:
src/DlgRef/DlgRef_1Spin_QTD.ui
src/DlgRef/DlgRef_2Sel3Spin_QTD.ui
src/DlgRef/DlgRef_2Spin_QTD.ui
src/GEOMBase/GEOMBase_Skeleton.cxx
src/GEOMBase/GEOMBase_Skeleton.h
src/GEOM_SWIG/geompyDC.py
src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx

index 1246d58e5b3db9ab8c1914ae0ccc5bb01c3ee2f2..1ede440a554b0d5d2090782bf6e2b0ce652fde78 100644 (file)
@@ -72,7 +72,7 @@
        </widget>
       </item>
       <item row="0" column="1" >
-       <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
       </item>
      </layout>
     </widget>
@@ -83,9 +83,9 @@
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
  <customwidgets>
   <customwidget>
-   <class>QtxDoubleSpinBox</class>
+   <class>SalomeApp_DoubleSpinBox</class>
    <extends>QDoubleSpinBox</extends>
-   <header location="global" >QtxDoubleSpinBox.h</header>
+   <header location="global" >SalomeApp_DoubleSpinBox.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
index 7de27946ef357e8e99c7333805999ae85b7df25f..b3f27fb8e517e3fce6ba0197099d3208ca61746b 100644 (file)
        </widget>
       </item>
       <item row="2" column="1" colspan="2" >
-       <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
       </item>
       <item row="4" column="1" colspan="2" >
-       <widget class="QtxDoubleSpinBox" name="SpinBox_DZ" />
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
       </item>
       <item row="3" column="1" colspan="2" >
-       <widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
       </item>
      </layout>
     </widget>
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
  <customwidgets>
   <customwidget>
-   <class>QtxDoubleSpinBox</class>
+   <class>SalomeApp_DoubleSpinBox</class>
    <extends>QDoubleSpinBox</extends>
-   <header location="global" >QtxDoubleSpinBox.h</header>
+   <header location="global" >SalomeApp_DoubleSpinBox.h</header>
   </customwidget>
  </customwidgets>
  <tabstops>
index 87d7c040e764d0dc0804bc0924d4f86128622b25..466bf527d3aa91c993da684f50f46b79d97aa0e2 100644 (file)
@@ -72,7 +72,7 @@
        </widget>
       </item>
       <item row="0" column="1" >
-       <widget class="QtxDoubleSpinBox" name="SpinBox_DX" />
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
       </item>
       <item row="1" column="0" >
        <widget class="QLabel" name="TextLabel2" >
@@ -91,7 +91,7 @@
        </widget>
       </item>
       <item row="1" column="1" >
-       <widget class="QtxDoubleSpinBox" name="SpinBox_DY" />
+       <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
       </item>
      </layout>
     </widget>
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
  <customwidgets>
   <customwidget>
-   <class>QtxDoubleSpinBox</class>
+   <class>SalomeApp_DoubleSpinBox</class>
    <extends>QDoubleSpinBox</extends>
-   <header location="global" >QtxDoubleSpinBox.h</header>
+   <header location="global" >SalomeApp_DoubleSpinBox.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
index 0b21530b4f35eeac350d843119ff77c26388cae3..2816192e6fe8d738c84b83f2ea492e6ee023745a 100644 (file)
@@ -30,6 +30,7 @@
 #include <GeometryGUI.h>
 
 #include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <SUIT_Desktop.h>
@@ -136,7 +137,7 @@ void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox,
   spinBox->setRange( min, max );
   spinBox->setSingleStep( step );
 }
-
+// TODO: to replace these method:
 void GEOMBase_Skeleton::initSpinBox( QDoubleSpinBox* spinBox, 
                                     double min,  double max, 
                                     double step, int decimals )
@@ -146,6 +147,16 @@ void GEOMBase_Skeleton::initSpinBox( QDoubleSpinBox* spinBox,
   spinBox->setRange( min, max );
   spinBox->setSingleStep( step );
 }
+// TODO: by the following:
+void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, 
+                                    double min,  double max, 
+                                    double step, int decimals )
+{
+  spinBox->setDecimals( decimals ); // it's necessary to set decimals before the range setting,
+                                    // by default Qt rounds boundaries to 2 decimals at setRange
+  spinBox->setRange( min, max );
+  spinBox->setSingleStep( step );
+}
 
 //=================================================================================
 // function : ClickOnCancel()
index b41134016337cb854d2e5336e0c40a046e1ad468..0252aad94b7e60d5b73517fcec8e06f97851c3e5 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <QDialog>
 
+class SalomeApp_DoubleSpinBox;
 class GeometryGUI;
 class DlgRef_Skeleton;
 class QSpinBox;
@@ -59,7 +60,10 @@ private:
 
 protected:
     void                initSpinBox( QSpinBox*, int, int, int = 1 );
+    // TODO: to replace these method:
     void                initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 3 );
+    // TODO: by the following:
+    void                initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, int = 3 );
     
     void                closeEvent( QCloseEvent* );
     void                keyPressEvent( QKeyEvent* );
index 1cc8b94e7e09513d994175c666e90d114274c57d..4d7ed650505d3e2e261d157b317b4747a882d89a 100644 (file)
@@ -732,9 +732,9 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
             # Example: see GEOM_TestAll.py
             theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ)
-            self.PrimOp.SetParameters(Parameters)
             anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
             RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a box with two specified opposite vertices,
@@ -760,8 +760,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_face "Example"
         def MakeFaceHW(self,theH, theW, theOrientation):
             # Example: see GEOM_TestAll.py
+            theH,theW,Parameters = ParseParameters(theH, theW)
             anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
             RaiseIfFailed("MakeFaceHW", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a face from another plane and two sizes,
@@ -775,8 +777,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_face "Example"
         def MakeFaceObjHW(self, theObj, theH, theW):
             # Example: see GEOM_TestAll.py
+            theH,theW,Parameters = ParseParameters(theH, theW)
             anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
             RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a disk with given center, normal vector and radius.
@@ -788,8 +792,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_disk "Example"
         def MakeDiskPntVecR(self,thePnt, theVec, theR):
             # Example: see GEOM_TestAll.py
+            theR,Parameters = ParseParameters(theR)
             anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
             RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a disk, passing through three given points
@@ -811,8 +817,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_face "Example"
         def MakeDiskR(self,theR, theOrientation):
             # Example: see GEOM_TestAll.py
+            theR,Parameters = ParseParameters(theR)
             anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
             RaiseIfFailed("MakeDiskR", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a cylinder with given base point, axis, radius and height.
@@ -825,8 +833,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_cylinder "Example"
         def MakeCylinder(self,thePnt, theAxis, theR, theH):
             # Example: see GEOM_TestAll.py
+            theR,theH,Parameters = ParseParameters(theR, theH)
             anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
             RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a cylinder with given radius and height at
@@ -839,8 +849,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_cylinder "Example"
         def MakeCylinderRH(self,theR, theH):
             # Example: see GEOM_TestAll.py
+            theR,theH,Parameters = ParseParameters(theR, theH)
             anObj = self.PrimOp.MakeCylinderRH(theR, theH)
             RaiseIfFailed("MakeCylinderRH", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a sphere with given center and radius.
@@ -851,8 +863,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_sphere "Example"
         def MakeSpherePntR(self, thePnt, theR):
             # Example: see GEOM_TestAll.py
+            theR,Parameters = ParseParameters(theR)
             anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
             RaiseIfFailed("MakeSpherePntR", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a sphere with given center and radius.
@@ -874,8 +888,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_sphere "Example"
         def MakeSphereR(self, theR):
             # Example: see GEOM_TestAll.py
+            theR,Parameters = ParseParameters(theR)
             anObj = self.PrimOp.MakeSphereR(theR)
             RaiseIfFailed("MakeSphereR", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a cone with given base point, axis, height and radiuses.
@@ -891,8 +907,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_cone "Example"
         def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
             # Example: see GEOM_TestAll.py
+            theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
             anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
             RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a cone with given height and radiuses at
@@ -908,8 +926,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_cone "Example"
         def MakeConeR1R2H(self,theR1, theR2, theH):
             # Example: see GEOM_TestAll.py
+            theR1,theR2,theH,Parameters = ParseParameters(theR1,theR2,theH)
             anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
             RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a torus with given center, normal vector and radiuses.
@@ -922,8 +942,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_torus "Example"
         def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
             # Example: see GEOM_TestAll.py
+            theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
             anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
             RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         ## Create a torus with given radiuses at the origin of coordinate system.
@@ -934,8 +956,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         #  @ref tui_creation_torus "Example"
         def MakeTorusRR(self, theRMajor, theRMinor):
             # Example: see GEOM_TestAll.py
+            theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
             anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
             RaiseIfFailed("MakeTorusRR", self.PrimOp)
+            anObj.SetParameters(Parameters)
             return anObj
 
         # end of l3_3d_primitives
index 8617438149e4b0b9d48ea06644b1eeaececb4091..7910450bca622b47eccaf445a280249eafba25d1 100644 (file)
@@ -462,13 +462,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
       double y = GroupDimensions->SpinBox_DY->value();
       double z = GroupDimensions->SpinBox_DZ->value();
 
+      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
+
       QStringList aParameters;
       aParameters << GroupDimensions->SpinBox_DX->text();
       aParameters << GroupDimensions->SpinBox_DY->text();
       aParameters << GroupDimensions->SpinBox_DZ->text();
-      getOperation()->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
+      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
 
-      anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z);
       res = true;
     }
     break;
index 1642271ab18b2b82ae370fb6ea910175582c855c..8e85515bc04132fc71ea1860e000660250779fba 100644 (file)
@@ -436,9 +436,22 @@ GEOM::GEOM_IOperations_ptr  PrimitiveGUI_ConeDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool  PrimitiveGUI_ConeDlg::isValid (QString&)
+bool  PrimitiveGUI_ConeDlg::isValid (QString& msg)
 {
-  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
+  bool ok = true;
+  if( getConstructorId() == 0 )
+  {
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+  }
+  else if( getConstructorId() == 1 )
+  {
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+  }
+  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
 }
 
 //=================================================================================
@@ -456,12 +469,26 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects)
     if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
       anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
         MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
+
+      QStringList aParameters;
+      aParameters << GroupPoints->SpinBox_DX->text();
+      aParameters << GroupPoints->SpinBox_DY->text();
+      aParameters << GroupPoints->SpinBox_DZ->text();
+      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
       res = true;
     }
     break;
   case 1:
     anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
       MakeConeR1R2H(getRadius1(), getRadius2(), getHeight());
+
+    QStringList aParameters;
+    aParameters << GroupDimensions->SpinBox_DX->text();
+    aParameters << GroupDimensions->SpinBox_DY->text();
+    aParameters << GroupDimensions->SpinBox_DZ->text();
+    anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
     res = true;
     break;
   }
index 377a4e46053eb76063ee523d2d7dcc7cf2564109..76f5ec915185b4d3378e969dd050a713c6c7afb3 100644 (file)
@@ -432,9 +432,20 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_CylinderDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool PrimitiveGUI_CylinderDlg::isValid (QString&)
+bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
 {
-  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
+  bool ok = true;
+  if( getConstructorId() == 0 )
+  {
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+  }
+  else if( getConstructorId() == 1 )
+  {
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+  }
+  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
 }
 
 //=================================================================================
@@ -452,12 +463,24 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
     if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
       anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
         MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
+
+      QStringList aParameters;
+      aParameters << GroupPoints->SpinBox_DX->text();
+      aParameters << GroupPoints->SpinBox_DY->text();
+      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
       res = true;
     }
     break;
   case 1:
     anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
       MakeCylinderRH(getRadius(), getHeight());
+
+    QStringList aParameters;
+    aParameters << GroupDimensions->SpinBox_DX->text();
+    aParameters << GroupDimensions->SpinBox_DY->text();
+    anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
     res = true;
     break;
   }
index e2d9006b4152dcf0b10696610276c931722fe749..eb883ad5eec0b5fc3839f9e2d9d9725f2bb9a813 100755 (executable)
@@ -541,13 +541,19 @@ static bool isEqual (const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje
 // function : isValid
 // purpose  :
 //=================================================================================
-bool PrimitiveGUI_DiskDlg::isValid (QString&)
+bool PrimitiveGUI_DiskDlg::isValid (QString& msg)
 {
+  bool ok = true;
+  if( getConstructorId() == 0 )
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+  else if( getConstructorId() == 1 )
+    ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+
   const int id = getConstructorId();
   if (id == 0)
-    return true;
+    return ok;
   else if (id == 1)
-    return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
+    return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0 && ok;
   else if (id == 2)
     return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
       !isEqual(myPoint1, myPoint2) && !isEqual(myPoint1, myPoint3) && !isEqual(myPoint2, myPoint3);
@@ -561,6 +567,7 @@ bool PrimitiveGUI_DiskDlg::isValid (QString&)
 bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
 {
   bool res = false;
+  QStringList aParameters;
 
   GEOM::GEOM_Object_var anObj;
 
@@ -568,11 +575,19 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
   case 0:
     anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
       MakeDiskR(getRadius(), myOrientationType);
+
+    aParameters << GroupDimensions->SpinBox_DX->text();
+    anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
     res = true;
     break;
   case 1:
     anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
       MakeDiskPntVecR(myPoint, myDir, getRadius());
+
+    aParameters << GroupPntVecR->SpinBox_DX->text();
+    anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
     res = true;
     break;
   case 2:
index 601dbb37d33ecdc89298c4d74a7cd649cd43a5ba..2b20a429fe16cf01873f4c5d0fe70efb22bf0d5e 100755 (executable)
@@ -459,14 +459,26 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_FaceDlg::createOperation()
 //=================================================================================
 bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
 {
+  bool ok = true;
+  if( getConstructorId() == 0 )
+  {
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+  }
+  else if( getConstructorId() == 1 )
+  {
+    ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+  }
+
   const int id = getConstructorId();
   if ( id == 0 )
-    return true;
+    return ok;
   else if ( id == 1 ) {
     if (GroupType->RadioButton1->isChecked())
-      return !myEdge->_is_nil();
+      return !myEdge->_is_nil() && ok;
     else if (GroupType->RadioButton2->isChecked())
-      return !myFace->_is_nil();
+      return !myFace->_is_nil() && ok;
   }
   return false;
 }
@@ -478,12 +490,18 @@ bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
 bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
 {
   bool res = false;
+  QStringList aParameters;
   GEOM::GEOM_Object_var anObj;
   switch (getConstructorId()) {
   case 0:
     anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
       MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
                  GroupDimensions->SpinBox_DY->value(), myOrientationType);
+
+    aParameters << GroupDimensions->SpinBox_DX->text();
+    aParameters << GroupDimensions->SpinBox_DY->text();
+    anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
     res = true;
     break;
   case 1:
@@ -493,6 +511,11 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
     else if (GroupType->RadioButton2->isChecked())
       anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
         MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
+
+    aParameters << GroupPlane->SpinBox_DX->text();
+    aParameters << GroupPlane->SpinBox_DY->text();
+    anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
     res = true;
     break;
   }
index 8922e36e8e545f2484514d2a8fc68da06103c37e..5d662591c9b99c11b9695f9fcea059d9547151f2 100644 (file)
@@ -378,7 +378,12 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_SphereDlg::createOperation()
 //=================================================================================
 bool PrimitiveGUI_SphereDlg::isValid( QString& msg  )
 {
-  return getConstructorId() == 0 ? !myPoint->_is_nil() : true;
+  bool ok = true;
+  if( getConstructorId() == 0 )
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+  else if( getConstructorId() == 1 )
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+  return getConstructorId() == 0 ? !myPoint->_is_nil() && ok : ok;
 }
 
 //=================================================================================
@@ -396,6 +401,11 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
     {
       if ( !CORBA::is_nil( myPoint ) ) {
        anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() );
+
+       QStringList aParameters;
+       aParameters << GroupPoints->SpinBox_DX->text();
+       anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
        res = true;
       }
       break;
@@ -403,6 +413,11 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
   case 1 :
     {
       anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() );
+
+      QStringList aParameters;
+      aParameters << GroupDimensions->SpinBox_DX->text();
+      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
       res = true;
       break;
     }
index 2a9958eaa33cf610974e9576ba79d4e5b8090a42..6b988d0f665e912fe27a0f06077e3b2abc733422 100644 (file)
@@ -429,9 +429,20 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_TorusDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool PrimitiveGUI_TorusDlg::isValid (QString&)
+bool PrimitiveGUI_TorusDlg::isValid (QString& msg)
 {
-  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) : true;
+  bool ok = true;
+  if( getConstructorId() == 0 )
+  {
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+  }
+  else if( getConstructorId() == 1 )
+  {
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+  }
+  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
 }
 
 //=================================================================================
@@ -449,12 +460,24 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects)
     if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
       anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
         MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
+
+      QStringList aParameters;
+      aParameters << GroupPoints->SpinBox_DX->text();
+      aParameters << GroupPoints->SpinBox_DY->text();
+      anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
       res = true;
     }
     break;
   case 1:
     anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->
       MakeTorusRR(getRadius1(), getRadius2());
+
+    QStringList aParameters;
+    aParameters << GroupDimensions->SpinBox_DX->text();
+    aParameters << GroupDimensions->SpinBox_DY->text();
+    anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters));
+
     res = true;
     break;
   }