From: ouv Date: Tue, 18 Nov 2008 15:42:06 +0000 (+0000) Subject: Dump Python extension X-Git-Tag: TG_DumpPython_Extension_3~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a83d11fd0fcfaadc526f7611f4d18bc3a8499337;p=modules%2Fgeom.git Dump Python extension --- diff --git a/src/DlgRef/DlgRef_1Spin_QTD.ui b/src/DlgRef/DlgRef_1Spin_QTD.ui index 1246d58e5..1ede440a5 100644 --- a/src/DlgRef/DlgRef_1Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Spin_QTD.ui @@ -72,7 +72,7 @@ - + @@ -83,9 +83,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_2Sel3Spin_QTD.ui b/src/DlgRef/DlgRef_2Sel3Spin_QTD.ui index 7de27946e..b3f27fb8e 100644 --- a/src/DlgRef/DlgRef_2Sel3Spin_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel3Spin_QTD.ui @@ -168,13 +168,13 @@ - + - + - + @@ -185,9 +185,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_2Spin_QTD.ui b/src/DlgRef/DlgRef_2Spin_QTD.ui index 87d7c040e..466bf527d 100644 --- a/src/DlgRef/DlgRef_2Spin_QTD.ui +++ b/src/DlgRef/DlgRef_2Spin_QTD.ui @@ -72,7 +72,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -102,9 +102,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 0b21530b4..2816192e6 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -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() diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index b41134016..0252aad94 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -31,6 +31,7 @@ #include +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* ); diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 1cc8b94e7..4d7ed6505 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -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 diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 861743814..7910450bc 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -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; diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 1642271ab..8e85515bc 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -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; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 377a4e460..76f5ec915 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -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; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx index e2d9006b4..eb883ad5e 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx @@ -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: diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx index 601dbb37d..2b20a429f 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx @@ -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; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index 8922e36e8..5d662591c 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -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; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 2a9958eaa..6b988d0f6 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -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; }