From a5e6595533c838ad0d1ae3373c7b05ecfd149089 Mon Sep 17 00:00:00 2001 From: ouv Date: Fri, 21 Nov 2008 14:48:48 +0000 Subject: [PATCH] Dump Python extension --- src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx | 21 +- src/BlocksGUI/BlocksGUI_TrsfDlg.cxx | 31 ++- src/BlocksGUI/BlocksGUI_TrsfDlg.h | 4 +- src/DlgRef/DlgRef_1Sel2Spin1View1Check_QTD.ui | 11 +- src/DlgRef/DlgRef_1Sel3Spin1Check_QTD.ui | 10 +- src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui | 14 +- src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.ui | 6 +- src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.ui | 10 +- src/GEOM/GEOM_Engine.cxx | 196 +++++++++++------- src/GEOMBase/GEOMBase_Skeleton.cxx | 1 + src/GEOM_I/GEOM_Gen_i.cc | 38 ++-- src/GEOM_SWIG/geompyDC.py | 98 ++++++++- .../GenerationGUI_FillingDlg.cxx | 22 +- src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 34 ++- src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 11 +- .../OperationGUI_ArchimedeDlg.cxx | 16 +- src/OperationGUI/OperationGUI_ChamferDlg.cxx | 176 +++++++++++----- src/OperationGUI/OperationGUI_ChamferDlg.h | 4 +- src/OperationGUI/OperationGUI_FilletDlg.cxx | 84 ++++++-- src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx | 19 +- src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx | 31 +-- src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx | 27 +-- src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx | 18 +- src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx | 22 +- src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx | 22 +- src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx | 26 +-- src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx | 14 +- src/RepairGUI/RepairGUI_DivideEdgeDlg.h | 4 +- src/RepairGUI/RepairGUI_GlueDlg.cxx | 29 ++- src/RepairGUI/RepairGUI_GlueDlg.h | 6 +- src/RepairGUI/RepairGUI_SewingDlg.cxx | 12 +- src/RepairGUI/RepairGUI_SewingDlg.h | 4 +- src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx | 113 ++++++++-- src/RepairGUI/RepairGUI_ShapeProcessDlg.h | 35 ++-- 34 files changed, 825 insertions(+), 344 deletions(-) diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx index 1b03969cf..0a6d834b3 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -365,8 +365,12 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_ExplodeDlg::createOperation() // function : isValid() // purpose : Verify validity of input data //================================================================================= -bool BlocksGUI_ExplodeDlg::isValid (QString&) +bool BlocksGUI_ExplodeDlg::isValid (QString& msg) { + bool okSP = true; + okSP = myGrp1->SpinBox1->isValid( msg, !IsPreview() ) && okSP; + okSP = myGrp1->SpinBox2->isValid( msg, !IsPreview() ) && okSP; + bool ok = false; switch ( getConstructorId() ) { case 0: @@ -385,7 +389,7 @@ bool BlocksGUI_ExplodeDlg::isValid (QString&) break; } - return ok; + return ok && okSP; } //================================================================================= @@ -420,6 +424,10 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects ) return objects.size() > 0; } + QStringList aParameters; + aParameters << myGrp1->SpinBox1->text(); + aParameters << myGrp1->SpinBox2->text(); + // Throw away sub-shapes not selected by user if not in preview mode // and manual selection is active if ( !isAllSubShapes() ) { @@ -441,7 +449,10 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects ) for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) { CORBA::String_var objStr = myGeomGUI->getApp()->orb()->object_to_string( *anIter ); if ( selected.contains( QString( objStr.in() ) ) ) + { + (*anIter)->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back( *anIter ); + } else toRemoveFromEngine.push_back( *anIter ); } @@ -456,7 +467,11 @@ bool BlocksGUI_ExplodeDlg::execute( ObjectList& objects ) } else { for ( int i = 0, n = aList->length(); i < n; i++ ) - objects.push_back( GEOM::GEOM_Object::_duplicate( aList[i] ) ); + { + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_duplicate( aList[i] ); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } } return objects.size(); diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx index 040a64e90..4953c18db 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -111,7 +111,7 @@ void BlocksGUI_TrsfDlg::Init() { // Set range of spinboxes double SpecificStep = 1.0; - QMap::iterator anIter; + QMap::iterator anIter; for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) { //anIter.data()->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); initSpinBox(anIter.value(), 1.0, MAX_NUMBER, SpecificStep, 3); @@ -127,7 +127,7 @@ void BlocksGUI_TrsfDlg::Init() for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn) connect(anIterBtn.value(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - QMap::iterator anIterSpin; + QMap::iterator anIterSpin; for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin) connect(anIterSpin.value(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); @@ -449,7 +449,7 @@ void BlocksGUI_TrsfDlg::createSpinWg (const QString& theLbl, const int theId) { QLabel* lab = new QLabel(theLbl, theParent); - mySpinBox[theId] = new QDoubleSpinBox(theParent); + mySpinBox[theId] = new SalomeApp_DoubleSpinBox(theParent); QGridLayout* l = 0; if (!theParent->layout()) { l = new QGridLayout(theParent); @@ -546,20 +546,23 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_TrsfDlg::createOperation() // function : isValid // purpose : Verify validity of input data //================================================================================= -bool BlocksGUI_TrsfDlg::isValid (QString&) +bool BlocksGUI_TrsfDlg::isValid (QString& msg) { - bool ok = false; + bool ok = false, okSP = true; switch (getConstructorId()) { case 0: ok = !myShape->_is_nil() && myFaces[Face1] > 0; + okSP = mySpinBox[SpinBox1]->isValid( msg, !IsPreview() ); break; case 1: ok = !myShape->_is_nil() && myFaces[Face1U] > 0 && myFaces[Face1V] > 0; + okSP = mySpinBox[SpinBox2U]->isValid( msg, !IsPreview() ) && okSP; + okSP = mySpinBox[SpinBox2V]->isValid( msg, !IsPreview() ) && okSP; break; default: break; } - return ok; + return ok && okSP; } //================================================================================= @@ -578,6 +581,13 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects) MakeMultiTransformation1D(myShape, myFaces[Face1], myFaces[Face2], (int)mySpinBox[SpinBox1]->value()); + if (!anObj->_is_nil()) + { + QStringList aParameters; + aParameters << "" << ""; + aParameters << mySpinBox[SpinBox1]->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; break; case 1: @@ -587,6 +597,15 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects) (int)mySpinBox[SpinBox2U]->value(), myFaces[Face1V], myFaces[Face2V], (int)mySpinBox[SpinBox2V]->value()); + if (!anObj->_is_nil()) + { + QStringList aParameters; + aParameters << "" << ""; + aParameters << mySpinBox[SpinBox2U]->text(); + aParameters << "" << ""; + aParameters << mySpinBox[SpinBox2V]->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; break; default: diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.h b/src/BlocksGUI/BlocksGUI_TrsfDlg.h index 2087d481b..453bf1d2c 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.h +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.h @@ -29,7 +29,7 @@ #include -class QDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QGroupBox; class QPushButton; class QLineEdit; @@ -78,7 +78,7 @@ private: QMap mySelBtn; QMap mySelName; - QMap mySpinBox; + QMap mySpinBox; private slots: void ClickOnOk(); diff --git a/src/DlgRef/DlgRef_1Sel2Spin1View1Check_QTD.ui b/src/DlgRef/DlgRef_1Sel2Spin1View1Check_QTD.ui index 522369808..675626f54 100644 --- a/src/DlgRef/DlgRef_1Sel2Spin1View1Check_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel2Spin1View1Check_QTD.ui @@ -35,10 +35,10 @@ - + - + @@ -126,6 +126,13 @@ qPixmapFromMimeSource + + + SalomeApp_IntSpinBox + QSpinBox +
SalomeApp_IntSpinBox.h
+
+
PushButton1 LineEdit1 diff --git a/src/DlgRef/DlgRef_1Sel3Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Sel3Spin1Check_QTD.ui index f8501134c..37a9f4a66 100644 --- a/src/DlgRef/DlgRef_1Sel3Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel3Spin1Check_QTD.ui @@ -56,13 +56,13 @@ 6 - + - + - + @@ -160,9 +160,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui index 1a248292f..3c50b200c 100644 --- a/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel5Spin1Check_QTD.ui @@ -82,7 +82,7 @@
- + @@ -101,7 +101,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -158,7 +158,7 @@ - + @@ -176,9 +176,9 @@ - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.ui b/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.ui index 7998e3abd..5bb1b8e38 100644 --- a/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel1Spin2Check_QTD.ui @@ -56,7 +56,7 @@ 6 - + 0 @@ -174,9 +174,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.ui b/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.ui index 69722216e..050f8baae 100644 --- a/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel3Spin2Rb_QTD.ui @@ -128,7 +128,7 @@
- + @@ -154,7 +154,7 @@ - + false @@ -177,7 +177,7 @@ - + false @@ -190,9 +190,9 @@ - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
QtxDoubleSpinBox.h
+
SalomeApp_DoubleSpinBox.h
diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 6b5a752d5..f6e8709b3 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -63,6 +63,8 @@ #define COMMA ',' #define O_BRACKET '(' #define C_BRACKET ')' +#define O_SQR_BRACKET '[' +#define C_SQR_BRACKET ']' #define PY_NULL "None" #ifdef _DEBUG_ @@ -778,8 +780,8 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin void ReplaceVariables(TCollection_AsciiString& theCommand, TVariablesList theVariables) { - //Get Entry of the result object - TCollection_AsciiString anEntry = theCommand.Token("=",1); + if (MYDEBUG) + cout<<"Command : "< aVariables; - TVariablesList::const_iterator it = theVariables.find(anEntry); - if( it != theVariables.end() ) - aVariables = (*it).second; - if(aVariables.empty()) { + //Additional case - multi-row commands + int aCommandIndex = 1; + while( aCommandIndex < 10 ) { // tmp check + TCollection_AsciiString aCommand = theCommand.Token("\n",aCommandIndex); + if( aCommand.Length() == 0 ) + break; + + if (MYDEBUG) + cout<<"Sub-command : "< aVariables; + TVariablesList::const_iterator it = theVariables.find(anEntry); + if( it != theVariables.end() ) + aVariables = (*it).second; + + if(aVariables.empty()) { + if(MYDEBUG) + cout<<"Valiables list empty!!!"<= aVariables.size()) + continue; + + aReplasedVar = aVariables[iVar].myVariable; - if(aReplasedVar.IsEmpty()) { + if(aReplasedVar.IsEmpty()) { + iVar++; + continue; + } + + if(aVariables[iVar].isVariable) { + aReplasedVar.InsertBefore(1,"\""); + aReplasedVar.InsertAfter(aReplasedVar.Length(),"\""); + } + + aCommand.Remove(aStartPos, aEndPos - aStartPos); + aCommand.Insert(aStartPos, aReplasedVar); iVar++; - continue; } - if(aVariables[iVar].isVariable) { - aReplasedVar.InsertBefore(1,"\""); - aReplasedVar.InsertAfter(aReplasedVar.Length(),"\""); - } + theCommand.Remove(aStartCommandPos, aEndCommandPos - aStartCommandPos); + theCommand.Insert(aStartCommandPos, aCommand); - theCommand.Remove(aStartPos, aEndPos - aStartPos); - theCommand.Insert(aStartPos,aReplasedVar); - iVar++; + aCommandIndex++; } + + if (MYDEBUG) + cout<<"Command : "<setPrecision( 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 ); diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index b36a652f7..ce76a6fad 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -274,31 +274,23 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, aNameAttrib->SetValue(aShapeName.ToCString()); //Set NoteBook variables used in the object creation - TCollection_AsciiString aParams(aShape->GetParameters()); - if(!aParams.IsEmpty()) { - TCollection_AsciiString aVars; - int nbVars = 0; - int n = 1; - TCollection_AsciiString aParam = aParams.Token(":",1); - while( aParam.Length() != 0 ) { - aParam = aParams.Token(":",n); - if(theStudy->IsVariable(aParam.ToCString())){ - aVars+=aParam; - nbVars++; - } - if(aParam.Length() == 0) - break; - aVars+=":"; - n++; - } - aVars.Remove(aVars.Length(),1); - if(nbVars > 0 ) { - anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString"); - SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr); - aStringAttrib->SetValue(aVars.ToCString()); + bool isFound = false; + TCollection_AsciiString aVars; + SALOMEDS::ListOfStrings_var aListOfVars = theStudy->ParseVariables(aShape->GetParameters()); + for(int i = 0, n = aListOfVars->length(); i < n; i++) { + if(theStudy->IsVariable(aListOfVars[i].in())) { + aVars += TCollection_AsciiString(aListOfVars[i].in()); + isFound = true; } + if(i != n-1) + aVars += ":"; } - + if(isFound) { + anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString"); + SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr); + aStringAttrib->SetValue(aVars.ToCString()); + } + //Set a name of the GEOM object aShape->SetName(theName); diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 4d7ed6505..7438859ff 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -117,6 +117,25 @@ def ParseParameters(*parameters): Result.append(StringResult) return Result +## Return list of variables value from salome notebook +## @ingroup l1_geompy_auxiliary +def ParseList(list): + Result = [] + StringResult = "" + for parameter in list: + if isinstance(parameter,str) and notebook.isVariable(parameter): + Result.append(str(notebook.get(parameter))) + pass + else: + Result.append(str(parameter)) + pass + + StringResult = StringResult + str(parameter) + StringResult = StringResult + ":" + pass + StringResult = StringResult[:len(StringResult)-1] + return Result,StringResult + ## Kinds of shape enumeration # @ingroup l1_geompy_auxiliary @@ -992,8 +1011,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_prism "Example" def MakePrismVecH(self, theBase, theVec, theH): # Example: see GEOM_TestAll.py + theH,Parameters = ParseParameters(theH) anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH) RaiseIfFailed("MakePrismVecH", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## Create a shape by extrusion of the base shape along the vector, @@ -1007,8 +1028,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_prism "Example" def MakePrismVecH2Ways(self, theBase, theVec, theH): # Example: see GEOM_TestAll.py + theH,Parameters = ParseParameters(theH) anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH) RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## Create a shape by extrusion of the base shape along the dx, dy, dz direction @@ -1019,8 +1042,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_prism "Example" def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ): # Example: see GEOM_TestAll.py + theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ) RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## Create a shape by extrusion of the base shape along the dx, dy, dz direction @@ -1033,8 +1058,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_prism "Example" def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ): # Example: see GEOM_TestAll.py + theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ) RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## Create a shape by revolution of the base shape around the axis @@ -1048,14 +1075,18 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_revolution "Example" def MakeRevolution(self, theBase, theAxis, theAngle): # Example: see GEOM_TestAll.py + theAngle,Parameters = ParseParameters(theAngle) anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle) RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## The Same Revolution but in both ways forward&backward. def MakeRevolution2Ways(self, theBase, theAxis, theAngle): + theAngle,Parameters = ParseParameters(theAngle) anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle) RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## Create a filling from the given compound of contours. @@ -1075,9 +1106,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_filling "Example" def MakeFilling(self, theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox=0): # Example: see GEOM_TestAll.py + theMinDeg,theMaxDeg,theTol2D,theTol3D,theNbIter,Parameters = ParseParameters(theMinDeg, theMaxDeg, + theTol2D, theTol3D, theNbIter) anObj = self.PrimOp.MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, isApprox) RaiseIfFailed("MakeFilling", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices. @@ -1789,8 +1823,13 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_shape_processing "Example" def ProcessShape(self,theShape, theOperators, theParameters, theValues): # Example: see GEOM_TestHealing.py + theValues,Parameters = ParseList(theValues) anObj = self.HealOp.ProcessShape(theShape, theOperators, theParameters, theValues) RaiseIfFailed("ProcessShape", self.HealOp) + for string in (theOperators + theParameters): + Parameters = ":" + Parameters + pass + anObj.SetParameters(Parameters) return anObj ## Remove faces from the given object (shape). @@ -1821,8 +1860,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return New GEOM_Object, containing processed shape. def Sew(self, theObject, theTolerance): # Example: see MakeSewing() above + theTolerance,Parameters = ParseParameters(theTolerance) anObj = self.HealOp.Sew(theObject, theTolerance) RaiseIfFailed("Sew", self.HealOp) + anObj.SetParameters(Parameters) return anObj ## Remove internal wires and edges from the given object (face). @@ -1879,8 +1920,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_add_point_on_edge "Example" def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter): # Example: see GEOM_TestHealing.py + theEdgeIndex,theValue,isByParameter,Parameters = ParseParameters(theEdgeIndex,theValue,isByParameter) anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter) RaiseIfFailed("DivideEdge", self.HealOp) + anObj.SetParameters(Parameters) return anObj ## Change orientation of the given object. Updates given shape. @@ -1927,9 +1970,11 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_glue_faces "Example" def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True): # Example: see GEOM_Spanner.py + theTolerance,Parameters = ParseParameters(theTolerance) anObj = self.ShapesOp.MakeGlueFaces(theShape, theTolerance, doKeepNonSolids) if anObj is None: raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode() + anObj.SetParameters(Parameters) return anObj ## Find coincident faces in theShape for possible gluing. @@ -2409,8 +2454,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # \n @ref swig_MakeFilletAll "Example 2" def MakeFilletAll(self,theShape, theR): # Example: see GEOM_TestOthers.py + theR,Parameters = ParseParameters(theR) anObj = self.LocalOp.MakeFilletAll(theShape, theR) RaiseIfFailed("MakeFilletAll", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## Perform a fillet on the specified edges/faces of the given shape @@ -2424,6 +2471,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_fillet "Example" def MakeFillet(self,theShape, theR, theShapeType, theListShapes): # Example: see GEOM_TestAll.py + theR,Parameters = ParseParameters(theR) anObj = None if theShapeType == ShapeType["EDGE"]: anObj = self.LocalOp.MakeFilletEdges(theShape, theR, theListShapes) @@ -2431,10 +2479,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): else: anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes) RaiseIfFailed("MakeFilletFaces", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## The same that MakeFillet but with two Fillet Radius R1 and R2 def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes): + theR1,theR2,Parameters = ParseParameters(theR1,theR2) anObj = None if theShapeType == ShapeType["EDGE"]: anObj = self.LocalOp.MakeFilletEdgesR1R2(theShape, theR1, theR2, theListShapes) @@ -2442,6 +2492,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): else: anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes) RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## Perform a symmetric chamfer on all edges of the given shape. @@ -2453,8 +2504,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # \n @ref swig_MakeChamferAll "Example 2" def MakeChamferAll(self,theShape, theD): # Example: see GEOM_TestOthers.py + theD,Parameters = ParseParameters(theD) anObj = self.LocalOp.MakeChamferAll(theShape, theD) RaiseIfFailed("MakeChamferAll", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## Perform a chamfer on edges, common to the specified faces, @@ -2469,15 +2522,24 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_chamfer "Example" def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2): # Example: see GEOM_TestAll.py + theD1,theD2,Parameters = ParseParameters(theD1,theD2) anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2) RaiseIfFailed("MakeChamferEdge", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## The Same that MakeChamferEdge but with params theD is chamfer length and - # theAngle is Angle of chamfer (angle in radians) + # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2): + flag = False + if isinstance(theAngle,str): + flag = True + theD,theAngle,Parameters = ParseParameters(theD,theAngle) + if flag: + theAngle = theAngle*math.pi/180.0 anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2) RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## Perform a chamfer on all edges of the specified faces, @@ -2494,17 +2556,26 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_chamfer "Example" def MakeChamferFaces(self,theShape, theD1, theD2, theFaces): # Example: see GEOM_TestAll.py + theD1,theD2,Parameters = ParseParameters(theD1,theD2) anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces) RaiseIfFailed("MakeChamferFaces", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## The Same that MakeChamferFaces but with params theD is chamfer lenght and - # theAngle is Angle of chamfer (angle in radians) + # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) # # @ref swig_FilletChamfer "Example" def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces): + flag = False + if isinstance(theAngle,str): + flag = True + theD,theAngle,Parameters = ParseParameters(theD,theAngle) + if flag: + theAngle = theAngle*math.pi/180.0 anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces) RaiseIfFailed("MakeChamferFacesAD", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## Perform a chamfer on edges, @@ -2516,15 +2587,24 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_FilletChamfer "Example" def MakeChamferEdges(self, theShape, theD1, theD2, theEdges): + theD1,theD2,Parameters = ParseParameters(theD1,theD2) anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges) RaiseIfFailed("MakeChamferEdges", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## The Same that MakeChamferEdges but with params theD is chamfer lenght and - # theAngle is Angle of chamfer (angle in radians) + # theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees) def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges): + flag = False + if isinstance(theAngle,str): + flag = True + theD,theAngle,Parameters = ParseParameters(theD,theAngle) + if flag: + theAngle = theAngle*math.pi/180.0 anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges) RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp) + anObj.SetParameters(Parameters) return anObj ## Shortcut to MakeChamferEdge() and MakeChamferFaces() @@ -2557,8 +2637,11 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_archimede "Example" def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection): # Example: see GEOM_TestAll.py + theWeight,theWaterDensity,theMeshDeflection,Parameters = ParseParameters( + theWeight,theWaterDensity,theMeshDeflection) anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection) RaiseIfFailed("MakeArchimede", self.LocalOp) + anObj.SetParameters(Parameters) return anObj # end of l3_basic_op @@ -3197,8 +3280,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # \n @ref swig_MakeBlockExplode "Example 2" def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces): # Example: see GEOM_TestOthers.py + theMinNbFaces,theMaxNbFaces,Parameters = ParseParameters(theMinNbFaces,theMaxNbFaces) aList = self.BlocksOp.ExplodeCompoundOfBlocks(theCompound, theMinNbFaces, theMaxNbFaces) RaiseIfFailed("ExplodeCompoundOfBlocks", self.BlocksOp) + for anObj in aList: + anObj.SetParameters(Parameters) + pass return aList ## Find block, containing the given point inside its volume or on boundary. @@ -3250,8 +3337,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_multi_transformation "Example" def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes): # Example: see GEOM_Spanner.py + DirFace1,DirFace2,NbTimes,Parameters = ParseParameters(DirFace1,DirFace2,NbTimes) anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes) RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp) + anObj.SetParameters(Parameters) return anObj ## Multi-transformate block and glue the result. @@ -3265,9 +3354,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU, DirFace1V, DirFace2V, NbTimesV): # Example: see GEOM_Spanner.py + DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV,Parameters = ParseParameters( + DirFace1U,DirFace2U,NbTimesU,DirFace1V,DirFace2V,NbTimesV) anObj = self.BlocksOp.MakeMultiTransformation2D(Block, DirFace1U, DirFace2U, NbTimesU, DirFace1V, DirFace2V, NbTimesV) RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp) + anObj.SetParameters(Parameters) return anObj ## Build all possible propagation groups. diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index ae4f0251a..b0dfacc51 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -336,9 +336,16 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_FillingDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool GenerationGUI_FillingDlg::isValid( QString& ) +bool GenerationGUI_FillingDlg::isValid( QString& msg ) { - return myOkCompound > 0; + bool ok = true; + ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox4->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox5->isValid( msg, !IsPreview() ) && ok; + + return myOkCompound > 0 && ok; } //================================================================================= @@ -351,9 +358,18 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects ) anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling( myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter, myIsApprox ); - if ( !anObj->_is_nil() ) + { + QStringList aParameters; + aParameters << GroupPoints->SpinBox1->text(); + aParameters << GroupPoints->SpinBox2->text(); + aParameters << GroupPoints->SpinBox3->text(); + aParameters << GroupPoints->SpinBox4->text(); + aParameters << GroupPoints->SpinBox5->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } return true; } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index 7d6eacefc..ebf53a93c 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -476,6 +476,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() QString aName = GEOMBase::GetName(aSelectedObject); myBase = aSelectedObject; + myOkBase = true; myEditCurrentArgument->setText(aName); } @@ -619,14 +620,24 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool GenerationGUI_PrismDlg::isValid (QString&) +bool GenerationGUI_PrismDlg::isValid (QString& msg) { + bool ok = true; + if( getConstructorId() == 0 ) + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + else if( getConstructorId() == 2 ) + { + ok = GroupPoints3->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + } + if (getConstructorId() == 0) - return (myOkBase && myOkVec); // by vector and height + return (myOkBase && myOkVec) && ok; // by vector and height else if (getConstructorId() == 1) return (myOkBase && myOkPnt1 && myOkPnt2); // by two points else if (getConstructorId() == 2) - return true; + return myOkBase && ok; return false; } @@ -637,6 +648,7 @@ bool GenerationGUI_PrismDlg::isValid (QString&) //================================================================================= bool GenerationGUI_PrismDlg::execute (ObjectList& objects) { + QStringList aParameters; GEOM::GEOM_Object_var anObj; switch (getConstructorId()) { @@ -649,6 +661,13 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects) anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakePrismVecH2Ways(myBase, myVec, getHeight()); } + + if (!anObj->_is_nil()) + { + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } + break; case 1: if (!myBothway2) { @@ -673,6 +692,15 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects) anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakePrismDXDYDZ2Ways(myBase, dx, dy, dz); } + + if (!anObj->_is_nil()) + { + aParameters << GroupPoints3->SpinBox_DX->text(); + aParameters << GroupPoints3->SpinBox_DY->text(); + aParameters << GroupPoints3->SpinBox_DZ->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } + break; } diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 0c4a91703..9abb8e770 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -389,9 +389,10 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_RevolDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool GenerationGUI_RevolDlg::isValid (QString&) +bool GenerationGUI_RevolDlg::isValid (QString& msg) { - return myOkBase && myOkAxis; + bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ); + return myOkBase && myOkAxis && ok; } //================================================================================= @@ -412,7 +413,13 @@ bool GenerationGUI_RevolDlg::execute (ObjectList& objects) } if (!anObj->_is_nil()) + { + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back(anObj._retn()); + } return true; } diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index 853cee04b..909c79444 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -248,9 +248,13 @@ GEOM::GEOM_IOperations_ptr OperationGUI_ArchimedeDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool OperationGUI_ArchimedeDlg::isValid( QString& ) +bool OperationGUI_ArchimedeDlg::isValid( QString& msg ) { - return !myShape->_is_nil(); + bool ok = true; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + return !myShape->_is_nil() && ok; } //================================================================================= @@ -269,7 +273,15 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); if ( !anObj->_is_nil() ) + { + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + aParameters << GroupPoints->SpinBox_DY->text(); + aParameters << GroupPoints->SpinBox_DZ->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } return true; } diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 02519e434..bfb9cf905 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -84,7 +84,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q int row = aLayout->rowCount(); aLayout->addWidget(new QLabel(tr("D"), myGrp1), row, 0); - aLayout->addWidget((mySpinBox[ SpinBox1 ] = new QDoubleSpinBox(myGrp1)), row++, 2); + aLayout->addWidget((mySpinBox[ SpinBox1 ] = new SalomeApp_DoubleSpinBox(myGrp1)), row++, 2); aLayout->setRowStretch(row, 10); // Create second group @@ -145,7 +145,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q // Set range of spinboxes double SpecificStep = 10.0; - QMap< int, QDoubleSpinBox* >::iterator anIter; + QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter; for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) { if (anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24) initSpinBox(anIter.value(), 0.001, 89.999, 5, 0); @@ -175,7 +175,7 @@ OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg() void OperationGUI_ChamferDlg::Init() { // Set Initial values of spinboxes - QMap< int, QDoubleSpinBox* >::iterator anIter; + QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter; for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) anIter.value()->setValue(5); @@ -213,7 +213,7 @@ void OperationGUI_ChamferDlg::Init() this, SLOT(LineEditReturnPressed())); // spin boxes - QMap< int, QDoubleSpinBox* >::iterator anIterSpin; + QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIterSpin; for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin) connect(anIterSpin.value(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); @@ -249,26 +249,26 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId) //disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); // Get values from previous widget - double D1 = 5, D2 = 5, D = 5, Angle = 5; + QString D1 = "5", D2 = "5", D = "5", Angle = "5"; if (myConstructorId == 0) - D1 = D2 = mySpinBox[ SpinBox1 ]->value(); + D1 = D2 = mySpinBox[ SpinBox1 ]->text(); else if (myConstructorId == 1) { - D1 = mySpinBox[ SpinBox21 ]->value(); - D2 = mySpinBox[ SpinBox22 ]->value(); - D = mySpinBox[ SpinBox23 ]->value(); - Angle = mySpinBox[ SpinBox24 ]->value(); + D1 = mySpinBox[ SpinBox21 ]->text(); + D2 = mySpinBox[ SpinBox22 ]->text(); + D = mySpinBox[ SpinBox23 ]->text(); + Angle = mySpinBox[ SpinBox24 ]->text(); } else if (myConstructorId == 2) { - D1 = mySpinBox[ SpinBox31 ]->value(); - D2 = mySpinBox[ SpinBox32 ]->value(); - D = mySpinBox[ SpinBox33 ]->value(); - Angle = mySpinBox[ SpinBox34 ]->value(); + D1 = mySpinBox[ SpinBox31 ]->text(); + D2 = mySpinBox[ SpinBox32 ]->text(); + D = mySpinBox[ SpinBox33 ]->text(); + Angle = mySpinBox[ SpinBox34 ]->text(); } else if (myConstructorId == 3) { - D1 = mySpinBox[ SpinBox41 ]->value(); - D2 = mySpinBox[ SpinBox42 ]->value(); - D = mySpinBox[ SpinBox43 ]->value(); - Angle = mySpinBox[ SpinBox44 ]->value(); + D1 = mySpinBox[ SpinBox41 ]->text(); + D2 = mySpinBox[ SpinBox42 ]->text(); + D = mySpinBox[ SpinBox43 ]->text(); + Angle = mySpinBox[ SpinBox44 ]->text(); } myConstructorId = constructorId; @@ -279,38 +279,38 @@ void OperationGUI_ChamferDlg::ConstructorsClicked (int constructorId) myGrp3->hide(); myGrp4->hide(); myGrp1->show(); - mySpinBox[ SpinBox1 ]->setValue(D1); + mySpinBox[ SpinBox1 ]->setText(D1); break; case 1: myGrp1->hide(); myGrp3->hide(); myGrp4->hide(); myGrp2->show(); - mySpinBox[ SpinBox21 ]->setValue(D1); - mySpinBox[ SpinBox22 ]->setValue(D2); - mySpinBox[ SpinBox23 ]->setValue(D); - mySpinBox[ SpinBox24 ]->setValue(Angle); + mySpinBox[ SpinBox21 ]->setText(D1); + mySpinBox[ SpinBox22 ]->setText(D2); + mySpinBox[ SpinBox23 ]->setText(D); + mySpinBox[ SpinBox24 ]->setText(Angle); break; case 2: myGrp1->hide(); myGrp2->hide(); myGrp4->hide(); myGrp3->show(); - mySpinBox[ SpinBox31 ]->setValue(D1); - mySpinBox[ SpinBox32 ]->setValue(D2); - mySpinBox[ SpinBox32 ]->setValue(D2); - mySpinBox[ SpinBox33 ]->setValue(D); - mySpinBox[ SpinBox34 ]->setValue(Angle); + mySpinBox[ SpinBox31 ]->setText(D1); + mySpinBox[ SpinBox32 ]->setText(D2); + mySpinBox[ SpinBox32 ]->setText(D2); + mySpinBox[ SpinBox33 ]->setText(D); + mySpinBox[ SpinBox34 ]->setText(Angle); break; case 3: myGrp1->hide(); myGrp2->hide(); myGrp3->hide(); myGrp4->show(); - mySpinBox[ SpinBox41 ]->setValue(D1); - mySpinBox[ SpinBox42 ]->setValue(D2); - mySpinBox[ SpinBox43 ]->setValue(D); - mySpinBox[ SpinBox44 ]->setValue(Angle); + mySpinBox[ SpinBox41 ]->setText(D1); + mySpinBox[ SpinBox42 ]->setText(D2); + mySpinBox[ SpinBox43 ]->setText(D); + mySpinBox[ SpinBox44 ]->setText(Angle); break; default: break; @@ -641,8 +641,8 @@ void OperationGUI_ChamferDlg::createRadioWg(const QString& theLbl1, myRadioButton[ theRbId ] = new QRadioButton(theParent); QLabel* lab1 = new QLabel(theLbl1, theParent); QLabel* lab2 = new QLabel(theLbl2, theParent); - mySpinBox[ theSpin1Id ] = new QDoubleSpinBox(theParent); - mySpinBox[ theSpin2Id ] = new QDoubleSpinBox(theParent); + mySpinBox[ theSpin1Id ] = new SalomeApp_DoubleSpinBox(theParent); + mySpinBox[ theSpin2Id ] = new SalomeApp_DoubleSpinBox(theParent); int row = theLayout->rowCount(); theLayout->addWidget(myRadioButton[ theRbId ], row, 0); theLayout->addWidget(lab1, row, 2); @@ -738,14 +738,50 @@ GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation() // function : isValid() // purpose : Verify validity of input data //================================================================================= -bool OperationGUI_ChamferDlg::isValid (QString&) +bool OperationGUI_ChamferDlg::isValid (QString& msg) { + bool ok = true; switch (getConstructorId()) { - case 0: return !myShape->_is_nil(); - case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0; - case 2: return !myShape->_is_nil() && myFaces.Extent() > 0; - case 3: return !myShape->_is_nil() && myEdges.Extent() > 0; + case 0: + ok = mySpinBox[ SpinBox1 ]->isValid( msg, !IsPreview() ); + return !myShape->_is_nil() && ok; + case 1: + if (myRadioButton[ RadioButton21 ]->isChecked()) + { + ok = mySpinBox[ SpinBox21 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox22 ]->isValid( msg, !IsPreview() ) && ok; + } + else + { + ok = mySpinBox[ SpinBox23 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox24 ]->isValid( msg, !IsPreview() ) && ok; + } + return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0 && ok; + case 2: + if (myRadioButton[ RadioButton31 ]->isChecked()) + { + ok = mySpinBox[ SpinBox31 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox32 ]->isValid( msg, !IsPreview() ) && ok; + } + else + { + ok = mySpinBox[ SpinBox33 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox34 ]->isValid( msg, !IsPreview() ) && ok; + } + return !myShape->_is_nil() && myFaces.Extent() > 0 && ok; + case 3: + if (myRadioButton[ RadioButton41 ]->isChecked()) + { + ok = mySpinBox[ SpinBox41 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox42 ]->isValid( msg, !IsPreview() ) && ok; + } + else + { + ok = mySpinBox[ SpinBox43 ]->isValid( msg, !IsPreview() ) && ok; + ok = mySpinBox[ SpinBox44 ]->isValid( msg, !IsPreview() ) && ok; + } + return !myShape->_is_nil() && myEdges.Extent() > 0 && ok; default: return false; } } @@ -756,6 +792,7 @@ bool OperationGUI_ChamferDlg::isValid (QString&) //================================================================================= bool OperationGUI_ChamferDlg::execute (ObjectList& objects) { + QStringList aParameters; GEOM::GEOM_Object_var anObj; bool flag = (myRadioButton[ RadioButton21 ]->isChecked() && myRadioButton[ RadioButton31 ]->isChecked() && @@ -765,6 +802,8 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) if (anId == 0) { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> MakeChamferAll(myShape, mySpinBox[ SpinBox1 ]->value()); + if (!anObj->_is_nil()) + aParameters << mySpinBox[ SpinBox1 ]->text(); } else if (anId == 1) { if (flag) { @@ -774,6 +813,11 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) mySpinBox[ SpinBox22 ]->value(), myFace[ Face1 ], myFace[ Face2 ]); + if (!anObj->_is_nil()) + { + aParameters << mySpinBox[ SpinBox21 ]->text(); + aParameters << mySpinBox[ SpinBox22 ]->text(); + } } else { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> @@ -782,6 +826,11 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) mySpinBox[ SpinBox24 ]->value() * PI180, myFace[ Face1 ], myFace[ Face2 ]); + if (!anObj->_is_nil()) + { + aParameters << mySpinBox[ SpinBox23 ]->text(); + aParameters << mySpinBox[ SpinBox24 ]->text(); + } } } else if (anId == 2) @@ -792,18 +841,30 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) for (int i = 1, n = myFaces.Extent(); i <= n; i++) anArray[ i - 1 ] = myFaces(i); - if (flag) - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferFaces(myShape, - mySpinBox[ SpinBox31 ]->value(), - mySpinBox[ SpinBox32 ]->value(), - anArray); - else - anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> - MakeChamferFacesAD(myShape, - mySpinBox[ SpinBox33 ]->value(), - mySpinBox[ SpinBox34 ]->value() * PI180, - anArray); + if (flag) { + anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> + MakeChamferFaces(myShape, + mySpinBox[ SpinBox31 ]->value(), + mySpinBox[ SpinBox32 ]->value(), + anArray); + if (!anObj->_is_nil()) + { + aParameters << mySpinBox[ SpinBox31 ]->text(); + aParameters << mySpinBox[ SpinBox32 ]->text(); + } + } + else { + anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> + MakeChamferFacesAD(myShape, + mySpinBox[ SpinBox33 ]->value(), + mySpinBox[ SpinBox34 ]->value() * PI180, + anArray); + if (!anObj->_is_nil()) + { + aParameters << mySpinBox[ SpinBox33 ]->text(); + aParameters << mySpinBox[ SpinBox34 ]->text(); + } + } } else if (anId == 3) { GEOM::ListOfLong_var anArray = new GEOM::ListOfLong; @@ -816,6 +877,11 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) mySpinBox[ SpinBox41 ]->value(), mySpinBox[ SpinBox42 ]->value(), anArray); + if (!anObj->_is_nil()) + { + aParameters << mySpinBox[ SpinBox41 ]->text(); + aParameters << mySpinBox[ SpinBox42 ]->text(); + } } else { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> @@ -823,11 +889,19 @@ bool OperationGUI_ChamferDlg::execute (ObjectList& objects) mySpinBox[ SpinBox43 ]->value(), mySpinBox[ SpinBox44 ]->value() * PI180, anArray); + if (!anObj->_is_nil()) + { + aParameters << mySpinBox[ SpinBox43 ]->text(); + aParameters << mySpinBox[ SpinBox44 ]->text(); + } } } if (!anObj->_is_nil()) + { + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back(anObj._retn()); + } return true; } diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h index eb81ae377..bfc4a318e 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -32,7 +32,7 @@ #include -class QDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QGroupBox; class QPushButton; class QLineEdit; @@ -106,7 +106,7 @@ private: QMap< int, QPushButton* > mySelBtn; QMap< int, QLineEdit* > mySelName; - QMap< int, QDoubleSpinBox* > mySpinBox; + QMap< int, SalomeApp_DoubleSpinBox* > mySpinBox; QMap< int, QRadioButton* > myRadioButton; }; diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 447374237..7b79a146b 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -217,19 +217,19 @@ void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId) return; // Get radius from previous widget - double R = 5, R1 = 5, R2 = 5; + QString R = "5", R1 = "5", R2 = "5"; if (myConstructorId == 0) { - R = Group1->SpinBox_DX->value(); + R = Group1->SpinBox_DX->text(); } else if (myConstructorId == 1) { - R = Group2->SpinBox_DX->value(); - R1 = Group2->SpinBox_DY->value(); - R2 = Group2->SpinBox_DZ->value(); + R = Group2->SpinBox_DX->text(); + R1 = Group2->SpinBox_DY->text(); + R2 = Group2->SpinBox_DZ->text(); } else { - R = Group3->SpinBox_DX->value(); - R1 = Group3->SpinBox_DY->value(); - R2 = Group3->SpinBox_DZ->value(); + R = Group3->SpinBox_DX->text(); + R1 = Group3->SpinBox_DY->text(); + R2 = Group3->SpinBox_DZ->text(); } myConstructorId = constructorId; @@ -239,23 +239,23 @@ void OperationGUI_FilletDlg::ConstructorsClicked (int constructorId) Group2->hide(); Group3->hide(); Group1->show(); - Group1->SpinBox_DX->setValue(R); + Group1->SpinBox_DX->setText(R); break; case 1: Group1->hide(); Group3->hide(); Group2->show(); - Group2->SpinBox_DX->setValue(R); - Group2->SpinBox_DY->setValue(R1); - Group2->SpinBox_DZ->setValue(R2); + Group2->SpinBox_DX->setText(R); + Group2->SpinBox_DY->setText(R1); + Group2->SpinBox_DZ->setText(R2); break; case 2: Group1->hide(); Group2->hide(); Group3->show(); - Group3->SpinBox_DX->setValue(R); - Group3->SpinBox_DY->setValue(R1); - Group3->SpinBox_DZ->setValue(R2); + Group3->SpinBox_DX->setText(R); + Group3->SpinBox_DY->setText(R1); + Group3->SpinBox_DZ->setText(R2); break; default: break; @@ -585,13 +585,32 @@ GEOM::GEOM_IOperations_ptr OperationGUI_FilletDlg::createOperation() // function : isValid() // purpose : Verify validity of input data //================================================================================= -bool OperationGUI_FilletDlg::isValid (QString&) +bool OperationGUI_FilletDlg::isValid (QString& msg) { + bool ok = true; switch (getConstructorId()) { - case 0: return !myShape->_is_nil(); - case 1: return !myShape->_is_nil() && myEdges.Extent() > 0; - case 2: return !myShape->_is_nil() && myFaces.Extent() > 0; + case 0: + ok = Group1->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + return !myShape->_is_nil() && ok; + case 1: + if (Group2->RadioButton1->isChecked()) + ok = Group2->SpinBox_DX->isValid( msg, !IsPreview() ); + else + { + ok = Group2->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = Group2->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + } + return !myShape->_is_nil() && myEdges.Extent() > 0 && ok; + case 2: + if (Group3->RadioButton1->isChecked()) + ok = Group3->SpinBox_DX->isValid( msg, !IsPreview() ); + else + { + ok = Group3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = Group3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + } + return !myShape->_is_nil() && myFaces.Extent() > 0 && ok; default: return false; } } @@ -602,12 +621,16 @@ bool OperationGUI_FilletDlg::isValid (QString&) //================================================================================= bool OperationGUI_FilletDlg::execute (ObjectList& objects) { + QStringList aParameters; GEOM::GEOM_Object_var anObj; int anId = getConstructorId(); - if (anId == 0) + if (anId == 0) { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> MakeFilletAll(myShape, getRadius()); + if (!anObj->_is_nil()) + aParameters << Group1->SpinBox_DX->text(); + } else if (anId == 1) { GEOM::ListOfLong_var aList = new GEOM::ListOfLong; aList->length(myEdges.Extent()); @@ -616,14 +639,25 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) aList[ i - 1 ] = myEdges(i); if (Group2->RadioButton1->isChecked()) + { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> MakeFilletEdges(myShape, getRadius(), aList); + if (!anObj->_is_nil()) + aParameters << Group2->SpinBox_DX->text(); + } else + { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> MakeFilletEdgesR1R2(myShape, Group2->SpinBox_DY->value(), Group2->SpinBox_DZ->value(), aList); + if (!anObj->_is_nil()) + { + aParameters << Group2->SpinBox_DY->text(); + aParameters << Group2->SpinBox_DZ->text(); + } + } } else if (anId == 2) { GEOM::ListOfLong_var aList = new GEOM::ListOfLong; @@ -635,17 +669,27 @@ bool OperationGUI_FilletDlg::execute (ObjectList& objects) if (Group3->RadioButton1->isChecked()) { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> MakeFilletFaces(myShape, getRadius(), aList); + if (!anObj->_is_nil()) + aParameters << Group3->SpinBox_DX->text(); } else { anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())-> MakeFilletFacesR1R2(myShape, Group3->SpinBox_DY->value(), Group3->SpinBox_DZ->value(), aList); + if (!anObj->_is_nil()) + { + aParameters << Group3->SpinBox_DY->text(); + aParameters << Group3->SpinBox_DZ->text(); + } } } if (!anObj->_is_nil()) + { + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back(anObj._retn()); + } return true; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 7910450bc..85d3d810b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -433,6 +433,10 @@ bool PrimitiveGUI_BoxDlg::isValid (QString& msg) ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + + ok = fabs( GroupDimensions->SpinBox_DX->value() ) > Precision::Confusion() && ok; + ok = fabs( GroupDimensions->SpinBox_DY->value() ) > Precision::Confusion() && ok; + ok = fabs( GroupDimensions->SpinBox_DZ->value() ) > Precision::Confusion() && ok; } return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : ok; } @@ -463,13 +467,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects) 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(); - anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); - + if (!anObj->_is_nil()) + { + 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_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 8e85515bc..b6cb0ef17 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -451,6 +451,7 @@ bool PrimitiveGUI_ConeDlg::isValid (QString& msg) ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; } + ok = fabs( getHeight() ) > Precision::Confusion() && ok; return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok; } @@ -469,26 +470,28 @@ 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)); - + if (!anObj->_is_nil()) + { + 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)); - + if (!anObj->_is_nil()) + { + 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 76f5ec915..4f2536393 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -445,6 +445,7 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg) ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; } + ok = fabs( getHeight() ) > Precision::Confusion() && ok; return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok; } @@ -463,24 +464,26 @@ 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)); - + if (!anObj->_is_nil()) + { + 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)); - + if (!anObj->_is_nil()) + { + 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 eb883ad5e..0cb1a61f3 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx @@ -575,19 +575,21 @@ 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)); - + if (!anObj->_is_nil()) + { + 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)); - + if (!anObj->_is_nil()) + { + 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 2b20a429f..e4a77f4fd 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx @@ -497,11 +497,12 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects) 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)); - + if (!anObj->_is_nil()) + { + aParameters << GroupDimensions->SpinBox_DX->text(); + aParameters << GroupDimensions->SpinBox_DY->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; break; case 1: @@ -511,11 +512,12 @@ 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)); - + if (!anObj->_is_nil()) + { + 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 5d662591c..be4e7ca0b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -401,11 +401,12 @@ 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)); - + if (!anObj->_is_nil()) + { + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; } break; @@ -413,11 +414,12 @@ 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)); - + if (!anObj->_is_nil()) + { + 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 6b988d0f6..ba8288a82 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -460,24 +460,26 @@ 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)); - + if (!anObj->_is_nil()) + { + 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)); - + if (!anObj->_is_nil()) + { + QStringList aParameters; + aParameters << GroupDimensions->SpinBox_DX->text(); + aParameters << GroupDimensions->SpinBox_DY->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; break; } diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx index 7cea1fd99..90ab2c9b4 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx @@ -83,7 +83,7 @@ RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg( GeometryGUI* theGeometryGUI, Q myIsParameterGr->addButton( rb2, 1 ); rb1->setChecked( true ); - myValEdt = new QDoubleSpinBox( GroupPoints->Box ); + myValEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box ); initSpinBox( myValEdt, 0., 1., 0.1, 3 ); myValEdt->setValue( 0.5 ); QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box ); @@ -338,9 +338,9 @@ GEOM::GEOM_IOperations_ptr RepairGUI_DivideEdgeDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool RepairGUI_DivideEdgeDlg::isValid( QString& ) +bool RepairGUI_DivideEdgeDlg::isValid( QString& msg ) { - return !myObject->_is_nil(); + return !myObject->_is_nil() && myValEdt->isValid( msg, !IsPreview() ); } //================================================================================= @@ -353,7 +353,15 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects ) ( myObject, -1, myValEdt->value(), getIsByParameter() ); bool aResult = !anObj->_is_nil(); if ( aResult ) + { + QStringList aParameters; + aParameters << ""; + aParameters << myValEdt->text(); + aParameters << ""; + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } return aResult; } diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h index 59de84f19..93af6dfa9 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h @@ -29,7 +29,7 @@ #include class DlgRef_1SelExt; -class QDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QButtonGroup; //================================================================================= @@ -63,7 +63,7 @@ private: DlgRef_1SelExt* GroupPoints; QButtonGroup* myIsParameterGr; - QDoubleSpinBox* myValEdt; + SalomeApp_DoubleSpinBox* myValEdt; protected slots: void ClickOnOk(); diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index c3ddfef0e..bdd2eaabb 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -81,7 +81,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupPoints->LineEdit1->setReadOnly( true ); QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box ); - myTolEdt = new QDoubleSpinBox( GroupPoints->Box ); + myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box ); initSpinBox( myTolEdt, 0, 100, 1e-7, 7 ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); @@ -98,7 +98,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupPoints2->LineEdit1->setReadOnly( true ); QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box ); - myTolEdt2 = new QDoubleSpinBox( GroupPoints2->Box ); + myTolEdt2 = new SalomeApp_DoubleSpinBox( GroupPoints2->Box ); initSpinBox( myTolEdt2, 0, 100, 1e-7, 7 ); myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE ); @@ -380,17 +380,22 @@ GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool RepairGUI_GlueDlg::isValid( QString& ) +bool RepairGUI_GlueDlg::isValid( QString& msg ) { + bool ok = true; double v = 0; switch ( getConstructorId() ) { case 0: - v = myTolEdt->value(); break; + v = myTolEdt->value(); + ok = myTolEdt->isValid( msg, !IsPreview() ); + break; case 1: - v = myTolEdt2->value(); break; + v = myTolEdt2->value(); + ok = myTolEdt2->isValid( msg, !IsPreview() ); + break; } - return !myObject->_is_nil() && ( IsPreview() || v > 0. ); + return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok; } //================================================================================= @@ -409,7 +414,13 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) ( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value(), true ); aResult = !anObj->_is_nil(); if ( aResult ) + { + QStringList aParameters; + aParameters << myTolEdt->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } break; } case 1: @@ -456,7 +467,13 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) aResult = !anObj->_is_nil(); if ( aResult ) + { + QStringList aParameters; + aParameters << myTolEdt2->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } // Remove from engine useless objects clearTemporary(); diff --git a/src/RepairGUI/RepairGUI_GlueDlg.h b/src/RepairGUI/RepairGUI_GlueDlg.h index efdd034d2..ff3c7026d 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.h +++ b/src/RepairGUI/RepairGUI_GlueDlg.h @@ -29,7 +29,7 @@ #include class DlgRef_1SelExt; -class QDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QPushButton; class QCheckBox; @@ -73,8 +73,8 @@ private: DlgRef_1SelExt* GroupPoints; DlgRef_1SelExt* GroupPoints2; - QDoubleSpinBox* myTolEdt; - QDoubleSpinBox* myTolEdt2; + SalomeApp_DoubleSpinBox* myTolEdt; + SalomeApp_DoubleSpinBox* myTolEdt2; QPushButton* myDetectBtn; QCheckBox* mySubShapesChk; diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx index a6d8f1cba..e285fdfac 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -74,7 +74,7 @@ RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget* QGridLayout* aLay = new QGridLayout( GroupPoints->Box ); aLay->setMargin( 0 ); aLay->setSpacing( 6 ); - myTolEdt = new QDoubleSpinBox( GroupPoints->Box ); + myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box ); initSpinBox( myTolEdt, 0, 100, 1e-7, 10 ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box ); @@ -263,10 +263,10 @@ GEOM::GEOM_IOperations_ptr RepairGUI_SewingDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool RepairGUI_SewingDlg::isValid( QString& ) +bool RepairGUI_SewingDlg::isValid( QString& msg ) { myClosed = -1; - return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ); + return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && myTolEdt->isValid( msg, !IsPreview() ); } //================================================================================= @@ -297,7 +297,13 @@ bool RepairGUI_SewingDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj = GEOM::GEOM_IHealingOperations::_narrow( getOperation() )->Sew( myObject, myTolEdt->value() ); aResult = !anObj->_is_nil(); if ( aResult ) + { + QStringList aParameters; + aParameters << myTolEdt->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } } return aResult; diff --git a/src/RepairGUI/RepairGUI_SewingDlg.h b/src/RepairGUI/RepairGUI_SewingDlg.h index 4830d979c..fa7fb2868 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.h +++ b/src/RepairGUI/RepairGUI_SewingDlg.h @@ -29,7 +29,7 @@ #include class DlgRef_1SelExt; -class QDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QPushButton; //================================================================================= @@ -59,7 +59,7 @@ private: GEOM::GEOM_Object_var myObject; DlgRef_1SelExt* GroupPoints; - QDoubleSpinBox* myTolEdt; + SalomeApp_DoubleSpinBox* myTolEdt; QPushButton* myFreeBoundBtn; int myClosed; // Number of free closed boundaries detected. Calculated in execute(), used in onDetect(). diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx index 1abf61dc1..9536fefb5 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx @@ -31,6 +31,8 @@ #include #include +#include +#include #include #include #include @@ -123,9 +125,9 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myFixShapeTol3D = new QDoubleSpinBox( w ); + myFixShapeTol3D = new SalomeApp_DoubleSpinBox( w ); initSpinBox( myFixShapeTol3D, 0, 100, 1e-7, 10 ); - myFixShapeMaxTol3D = new QDoubleSpinBox( w ); + myFixShapeMaxTol3D = new SalomeApp_DoubleSpinBox( w ); initSpinBox( myFixShapeMaxTol3D, 0, 100, 1e-7, 10 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); @@ -140,7 +142,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myFixFaceSizeTol = new QDoubleSpinBox( w ); + myFixFaceSizeTol = new SalomeApp_DoubleSpinBox( w ); initSpinBox( myFixFaceSizeTol, 0, 100, 1e-7, 10 ); aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 ); @@ -153,7 +155,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myDropSmallEdgesTol3D = new QDoubleSpinBox( w ); + myDropSmallEdgesTol3D = new SalomeApp_DoubleSpinBox( w ); initSpinBox( myDropSmallEdgesTol3D, 0, 100, 1e-7, 10 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); @@ -166,9 +168,9 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySplitAngleAngle = new QDoubleSpinBox( w ); + mySplitAngleAngle = new SalomeApp_DoubleSpinBox( w ); initSpinBox( mySplitAngleAngle, 0, 360, 1 ); - mySplitAngleMaxTol = new QDoubleSpinBox( w ); + mySplitAngleMaxTol = new SalomeApp_DoubleSpinBox( w ); initSpinBox( mySplitAngleMaxTol, 0, 100, 1e-7, 10 ); aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 ); @@ -183,7 +185,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySplitClosedFacesNum = new QSpinBox( w ); + mySplitClosedFacesNum = new SalomeApp_IntSpinBox( w ); aLay->addWidget( new QLabel( tr( "GEOM_NUM_SPLIT_POINTS" ), w ), 0, 0 ); aLay->addWidget( mySplitClosedFacesNum, 0, 1 ); @@ -195,7 +197,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySplitContTol3D = new QDoubleSpinBox( w ); + mySplitContTol3D = new SalomeApp_DoubleSpinBox( w ); initSpinBox( mySplitContTol3D, 0, 100, 1e-7, 10 ); mySplitContSurfCont = new QComboBox( w ); mySplitContSurfCont->addItems( aContinueties ); @@ -220,14 +222,14 @@ void RepairGUI_ShapeProcessDlg::init() myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w ); myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w ); - myBSplineTol3D = new QDoubleSpinBox( w ); + myBSplineTol3D = new SalomeApp_DoubleSpinBox( w ); initSpinBox( myBSplineTol3D, 0, 100, 1e-7, 10 ); - myBSplineTol2D = new QDoubleSpinBox( w ); + myBSplineTol2D = new SalomeApp_DoubleSpinBox( w ); initSpinBox( myBSplineTol2D, 0, 100, 1e-7, 10 ); - myBSplineDegree = new QSpinBox( w ); - myBSplineSegments = new QSpinBox( w ); + myBSplineDegree = new SalomeApp_IntSpinBox( w ); + myBSplineSegments = new SalomeApp_IntSpinBox( w ); myBSpline2DCont = new QComboBox( w ); myBSpline2DCont->addItems( aContinueties ); myBSpline3DCont = new QComboBox( w ); @@ -264,7 +266,7 @@ void RepairGUI_ShapeProcessDlg::init() myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w ); myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w ); - myToBezierMaxTol = new QDoubleSpinBox( w ); + myToBezierMaxTol = new SalomeApp_DoubleSpinBox( w ); initSpinBox( myToBezierMaxTol, 0, 100, 1e-7, 10 ); aLay->addWidget( myToBezierSurfModeChk, 0, 0 ); @@ -280,7 +282,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySameParameterTol3D = new QDoubleSpinBox( w ); + mySameParameterTol3D = new SalomeApp_DoubleSpinBox( w ); initSpinBox( mySameParameterTol3D, 0, 100, 1e-7, 10 ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); @@ -508,10 +510,10 @@ void RepairGUI_ShapeProcessDlg::loadDefaults() void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& theValue ) { if ( theControl && !theValue.isNull() ) { - if ( qobject_cast( theControl ) ) - qobject_cast( theControl )->setValue( theValue.toDouble() ); - else if ( qobject_cast( theControl ) ) - qobject_cast( theControl )->setValue( theValue.toInt() ); + if ( qobject_cast( theControl ) ) + qobject_cast( theControl )->setValue( theValue.toDouble() ); + else if ( qobject_cast( theControl ) ) + qobject_cast( theControl )->setValue( theValue.toInt() ); else if ( qobject_cast( theControl ) ) qobject_cast( theControl )->setEditText( theValue ); else if ( qobject_cast( theControl ) ) @@ -526,10 +528,10 @@ void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const QString& th QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const { if ( theControl ) { - if ( qobject_cast( theControl ) ) - return QString::number( qobject_cast( theControl )->value() ); - else if ( qobject_cast( theControl ) ) - return QString::number( qobject_cast( theControl )->value() ); + if ( qobject_cast( theControl ) ) + return QString::number( qobject_cast( theControl )->value() ); + else if ( qobject_cast( theControl ) ) + return QString::number( qobject_cast( theControl )->value() ); else if ( qobject_cast( theControl ) ) return qobject_cast( theControl )->currentText(); else if ( qobject_cast( theControl ) ) @@ -538,6 +540,21 @@ QString RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const return 0; } +//================================================================================= +// function : getText() +// purpose : get text in the proper way +//================================================================================= +QString RepairGUI_ShapeProcessDlg::getText( QWidget* theControl ) const +{ + if ( theControl ) { + if ( qobject_cast( theControl ) ) + return qobject_cast( theControl )->text(); + else if ( qobject_cast( theControl ) ) + return qobject_cast( theControl )->text(); + } + return QString::null; +} + //================================================================================= // function : createOperation // purpose : @@ -553,6 +570,22 @@ GEOM::GEOM_IOperations_ptr RepairGUI_ShapeProcessDlg::createOperation() //================================================================================= bool RepairGUI_ShapeProcessDlg::isValid( QString& msg ) { + bool ok = true; + QMapIterator aMapIter( myValMap ); + while( aMapIter.hasNext() ) { + aMapIter.next(); + const QStringList& aList = aMapIter.value(); + QListIterator aListIter( aList ); + while( aListIter.hasNext() ) { + const QString& aParam = aListIter.next(); + QWidget* aControl = getControl( aParam ); + if ( qobject_cast( aControl ) ) + ok = qobject_cast( aControl )->isValid( msg, !IsPreview() ) && ok; + else if ( qobject_cast( aControl ) ) + ok = qobject_cast( aControl )->isValid( msg, !IsPreview() ) && ok; + } + } + bool error = false; GEOM::string_array_var anOperators = getActiveOperators(); if ( !myObjects->length() ) { @@ -565,7 +598,7 @@ bool RepairGUI_ShapeProcessDlg::isValid( QString& msg ) msg += tr( "ERROR_NO_OPERATORS" ); error = true; } - return !error; + return !error && ok; } //================================================================================= @@ -603,7 +636,20 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects ) if ( anObj->_is_nil() ) anErrorObjNames << GEOMBase::GetName( obj ); else + { + QStringList aParameters; + + for ( int i = 0; i < anOperators->length(); i++ ) + aParameters << QString( anOperators[i] ); + + for ( int i = 0; i < aParams->length(); i++ ) + aParameters << QString( aParams[i] ); + + aParameters << getTexts( aParams ); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } } if ( !anErrorObjNames.empty() ) @@ -764,6 +810,27 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getValues( const GEOM::string_arr return aValues._retn(); } +//================================================================================= +// function : getTexts +// purpose : +//================================================================================= +QStringList RepairGUI_ShapeProcessDlg::getTexts( const GEOM::string_array& theParams ) +{ + QStringList aTexts; + + for ( int i = 0; i < theParams.length(); i++ ) { + QWidget* aCtrl = getControl( (const char*)theParams[i] ); + if ( aCtrl ) + { + QString aText = getText( aCtrl ); + if( !aText.isNull() ) + aTexts.append( aText ); + } + } + + return aTexts; +} + //================================================================================= // function : initSelection // purpose : set selection of ALL shape types except vertexes diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.h b/src/RepairGUI/RepairGUI_ShapeProcessDlg.h index 4cfd35302..0d35a3665 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.h +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.h @@ -31,8 +31,8 @@ #include class DlgRef_1Sel; -class QSpinBox; -class QDoubleSpinBox; +class SalomeApp_IntSpinBox; +class SalomeApp_DoubleSpinBox; class QComboBox; class QCheckBox; class QListWidget; @@ -64,12 +64,15 @@ private: GEOM::string_array* getParameters( const GEOM::string_array& ); GEOM::string_array* getValues( const GEOM::string_array& ); + QStringList getTexts( const GEOM::string_array& ); + void enterEvent( QEvent* ); QWidget* getControl( const QString& ); void setValue( QWidget*, const QString& ); // initialize the given control in the proper way // (analize its class and convert the value string) QString getValue( QWidget* ) const; // retrieve value of the control in the proper way + QString getText( QWidget* ) const; // retrieve text of the control (for spin-boxes only) //QDict myCtrlMap; // map of controls (values) of parameters void initParamsValues(); // initialize the data structures @@ -84,38 +87,38 @@ private: DlgRef_1Sel* mySelectWdgt; QListWidget* myOpList; - QDoubleSpinBox* myFixShapeTol3D; - QDoubleSpinBox* myFixShapeMaxTol3D; + SalomeApp_DoubleSpinBox* myFixShapeTol3D; + SalomeApp_DoubleSpinBox* myFixShapeMaxTol3D; - QDoubleSpinBox* myFixFaceSizeTol; + SalomeApp_DoubleSpinBox* myFixFaceSizeTol; - QDoubleSpinBox* myDropSmallEdgesTol3D; + SalomeApp_DoubleSpinBox* myDropSmallEdgesTol3D; - QDoubleSpinBox* mySplitAngleAngle; - QDoubleSpinBox* mySplitAngleMaxTol; + SalomeApp_DoubleSpinBox* mySplitAngleAngle; + SalomeApp_DoubleSpinBox* mySplitAngleMaxTol; - QSpinBox* mySplitClosedFacesNum; + SalomeApp_IntSpinBox* mySplitClosedFacesNum; - QDoubleSpinBox* mySplitContTol3D; + SalomeApp_DoubleSpinBox* mySplitContTol3D; QComboBox* mySplitContSurfCont; QComboBox* mySplitContCurvCont; QCheckBox* myBSplineSurfModeChk; QCheckBox* myBSpline3DCurveChk; QCheckBox* myBSpline2DCurveChk; - QDoubleSpinBox* myBSplineTol3D; - QDoubleSpinBox* myBSplineTol2D; - QSpinBox* myBSplineDegree; - QSpinBox* myBSplineSegments; + SalomeApp_DoubleSpinBox* myBSplineTol3D; + SalomeApp_DoubleSpinBox* myBSplineTol2D; + SalomeApp_IntSpinBox* myBSplineDegree; + SalomeApp_IntSpinBox* myBSplineSegments; QComboBox* myBSpline2DCont; QComboBox* myBSpline3DCont; QCheckBox* myToBezierSurfModeChk; QCheckBox* myToBezier3DCurveChk; QCheckBox* myToBezier2DCurveChk; - QDoubleSpinBox* myToBezierMaxTol; + SalomeApp_DoubleSpinBox* myToBezierMaxTol; - QDoubleSpinBox* mySameParameterTol3D; + SalomeApp_DoubleSpinBox* mySameParameterTol3D; private slots: void onOk(); -- 2.39.2