From: ouv Date: Wed, 28 Jan 2009 16:31:12 +0000 (+0000) Subject: Merge from BR_DumpPython_Extension branch (from tag mergeto_BR_V5_Dev_28Jan09) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0d6107569c9910d991ec8712a82964bbf0e3af45;p=modules%2Fgeom.git Merge from BR_DumpPython_Extension branch (from tag mergeto_BR_V5_Dev_28Jan09) --- diff --git a/doc/salome/gui/GEOM/images/box3.png b/doc/salome/gui/GEOM/images/box3.png new file mode 100755 index 000000000..b64fdf983 Binary files /dev/null and b/doc/salome/gui/GEOM/images/box3.png differ diff --git a/doc/salome/gui/GEOM/input/creating_box.doc b/doc/salome/gui/GEOM/input/creating_box.doc index 0991b6029..817088463 100644 --- a/doc/salome/gui/GEOM/input/creating_box.doc +++ b/doc/salome/gui/GEOM/input/creating_box.doc @@ -30,6 +30,10 @@ accessible only via \b TUI commands. this way you don't need to create them in advance). \n TUI Command: geompy.MakeBox(x1,y1,z1,x2,y2,z2) \n Arguments: Name + X, Y and Z coordinates of both points. +\note You can also use variables defined in the SALOME \b NoteBook +to specify any numerical parameters of the box. + +\image html box3.png Example: diff --git a/doc/salome/gui/GEOM/input/index.doc b/doc/salome/gui/GEOM/input/index.doc index 6ae767547..c5121cabb 100644 --- a/doc/salome/gui/GEOM/input/index.doc +++ b/doc/salome/gui/GEOM/input/index.doc @@ -14,6 +14,7 @@ using a wide range of functions; various algorithms;
  • \subpage repairing_operations_page "optimization of geometrical objects";
  • \subpage using_measurement_tools_page "provision of information about geometrical objects".
  • +
  • \subpage using_notebook_geom_page.
  • Almost all geometry module functionalities are accessible via diff --git a/doc/salome/gui/GEOM/input/using_notebook_geom_page.doc b/doc/salome/gui/GEOM/input/using_notebook_geom_page.doc new file mode 100644 index 000000000..d793d55a5 --- /dev/null +++ b/doc/salome/gui/GEOM/input/using_notebook_geom_page.doc @@ -0,0 +1,18 @@ +/*! + +\page using_notebook_geom_page Using SALOME NoteBook + +It is possible to use variables defined through SALOME NoteBook for +creation and modification of objects in the Geometry module with the following +limitations: + + +*/ + diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 25e732748..7a64111e2 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -233,6 +233,18 @@ module GEOM * For example, method return false for GEOM_MARKER */ boolean IsShape(); + + /*! + * Set list of parameters + * \param theParameters is a string containing the notebook variables separated by ":" symbol, + * used for object creation + */ + void SetParameters (in string theParameters); + + /*! + * Return list of notebook variables used for object creation separated by ":" symbol + */ + string GetParameters(); }; diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index a5bc2a3f8..9cb015a9c 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -617,11 +617,13 @@ static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje bool BasicGUI_CircleDlg::isValid( QString& msg ) { const int id = getConstructorId(); - if ( id == 0 ) + if ( id == 0 ) { //return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0; //nil point means origin of global CS //nil vector means Z axis - return getRadius() > 0; + bool ok = GroupPntVecR->SpinBox_DX->isValid(msg, !IsPreview()); + return getRadius() > 0 && ok; + } else if ( id == 1 ) return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); @@ -643,9 +645,15 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) switch ( getConstructorId() ) { case 0 : - anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() ); - res = true; - break; + { + QStringList aParameters; + aParameters << GroupPntVecR->SpinBox_DX->text(); + anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCirclePntVecR( myPoint, myDir, getRadius() ); + if ( !anObj->_is_nil() && !IsPreview() ) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + res = true; + break; + } case 1 : anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 ); res = true; diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index a7485a675..9b9eb6c07 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -410,7 +410,10 @@ bool BasicGUI_EllipseDlg::isValid( QString& msg ) //return !myPoint->_is_nil() && !myDir->_is_nil(); //nil point means origin of global CS //nil vector means Z axis - return true; + bool ok = true; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + return ok; } //================================================================================= @@ -421,11 +424,17 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects ) { double aMajorR = GroupPoints->SpinBox_DX->value(); double aMinorR = GroupPoints->SpinBox_DY->value(); - GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR ); - if ( !anObj->_is_nil() ) + QStringList aParameters; + aParameters<SpinBox_DX->text(); + aParameters<SpinBox_DY->text(); + + GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeEllipse( myPoint, myDir, aMajorR, aMinorR ); + if ( !anObj->_is_nil() ) { + if ( !IsPreview() ) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back( anObj._retn() ); - + } return true; } diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 6ccb05689..9e9d46b64 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -99,13 +99,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th QVBoxLayout* anOriGrpLayout = new QVBoxLayout( anOriGrp ); anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), anOriGrp ) ); - myData[ X ] = new QtxDoubleSpinBox( anOriGrp ); + myData[ X ] = new SalomeApp_DoubleSpinBox( anOriGrp ); anOriGrpLayout->addWidget( myData[ X ] ); anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), anOriGrp ) ); - myData[ Y ] = new QtxDoubleSpinBox( anOriGrp ); + myData[ Y ] = new SalomeApp_DoubleSpinBox( anOriGrp ); anOriGrpLayout->addWidget( myData[ Y ] ); anOriGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), anOriGrp ) ); - myData[ Z ] = new QtxDoubleSpinBox( anOriGrp ); + myData[ Z ] = new SalomeApp_DoubleSpinBox( anOriGrp ); anOriGrpLayout->addWidget( myData[ Z ] ); aMainGrpLayout->addWidget( anOriGrp ); @@ -114,13 +114,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th QVBoxLayout* aXAxisGrpLayout = new QVBoxLayout( aXAxisGrp ); aXAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), aXAxisGrp ) ); - myData[ DX1 ] = new QtxDoubleSpinBox( aXAxisGrp ); + myData[ DX1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp ); aXAxisGrpLayout->addWidget( myData[ DX1 ] ); aXAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), aXAxisGrp ) ); - myData[ DY1 ] = new QtxDoubleSpinBox( aXAxisGrp ); + myData[ DY1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp ); aXAxisGrpLayout->addWidget( myData[ DY1 ] ); aXAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), aXAxisGrp ) ); - myData[ DZ1 ] = new QtxDoubleSpinBox( aXAxisGrp ); + myData[ DZ1 ] = new SalomeApp_DoubleSpinBox( aXAxisGrp ); aXAxisGrpLayout->addWidget( myData[ DZ1 ] ); aMainGrpLayout->addWidget( aXAxisGrp ); @@ -129,13 +129,13 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* th QVBoxLayout* anYAxisGrpLayout = new QVBoxLayout( anYAxisGrp ); anYAxisGrpLayout->addWidget( new QLabel( tr( "DX" ), anYAxisGrp ) ); - myData[ DX2 ] = new QtxDoubleSpinBox( anYAxisGrp ); + myData[ DX2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp ); anYAxisGrpLayout->addWidget( myData[ DX2 ] ); anYAxisGrpLayout->addWidget( new QLabel( tr( "DY" ), anYAxisGrp ) ); - myData[ DY2 ] = new QtxDoubleSpinBox( anYAxisGrp ); + myData[ DY2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp ); anYAxisGrpLayout->addWidget( myData[ DY2 ] ); anYAxisGrpLayout->addWidget( new QLabel( tr( "DZ" ), anYAxisGrp ) ); - myData[ DZ2 ] = new QtxDoubleSpinBox( anYAxisGrp ); + myData[ DZ2 ] = new SalomeApp_DoubleSpinBox( anYAxisGrp ); anYAxisGrpLayout->addWidget( myData[ DZ2 ] ); aMainGrpLayout->addWidget( anYAxisGrp ); @@ -698,8 +698,12 @@ bool BasicGUI_MarkerDlg::isValid( QString& msg ) } switch ( id ) { - case 0: - return isOk; + case 0: { + bool ok = true; + for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) + ok = anIter.value()->isValid( msg, !IsPreview()) && ok; + return isOk && ok; + } case 1: return !Group1->LineEdit1->text().isEmpty() && isOk; case 2: @@ -720,9 +724,22 @@ bool BasicGUI_MarkerDlg::execute( ObjectList& objects ) getOperation() )->MakeMarker( myData[ X ]->value(), myData[ Y ]->value(), myData[ Z ]->value(), myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value(), myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() ); - - if ( !anObj->_is_nil() ) + QStringList aParameters; + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + aParameters<text(); + + if ( !anObj->_is_nil() ) { + if ( !IsPreview() ) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back( anObj._retn() ); + } return true; } diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.h b/src/BasicGUI/BasicGUI_MarkerDlg.h index d9d1c9320..364b0d737 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.h +++ b/src/BasicGUI/BasicGUI_MarkerDlg.h @@ -32,7 +32,7 @@ class DlgRef_1Sel; class DlgRef_3Sel; -class QtxDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QFrame; class BasicGUI_MarkerDlg : public GEOMBase_Skeleton @@ -41,7 +41,7 @@ class BasicGUI_MarkerDlg : public GEOMBase_Skeleton private: enum { X, Y, Z, DX1, DY1, DZ1, DX2, DY2, DZ2 }; - typedef QMap< int, QtxDoubleSpinBox* > DataMap; + typedef QMap< int, SalomeApp_DoubleSpinBox* > DataMap; public: BasicGUI_MarkerDlg( GeometryGUI*, QWidget* ); diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index 6387a6558..6e9aaa1f5 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -600,6 +600,20 @@ double BasicGUI_PlaneDlg::getSize() const return 0.; } +//================================================================================= +// function : getSize() +// purpose : +//================================================================================= +QString BasicGUI_PlaneDlg::getSizeAsString() const +{ + switch ( getConstructorId() ) { + case 0 : return GroupPntDir->SpinBox_DX->text(); + case 1 : return Group3Pnts->SpinBox_DX->text(); + case 2 : return GroupFace->SpinBox_DX->text(); + } + return QString(); +} + //================================================================================= // function : createOperation // purpose : @@ -629,13 +643,20 @@ bool BasicGUI_PlaneDlg::isValid( QString& msg ) msg = QString( "Please, enter size greater than 0." ); return false; } - if ( id == 0 ) - return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ); - else if ( id == 1 ) + + if ( id == 0 ) { + bool ok = GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() ); + return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) && ok; + } + else if ( id == 1 ) { + bool ok = Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() ); return !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) && - !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); - else if ( id == 2 ) - return !CORBA::is_nil( myFace ); + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ) && ok; + } + else if ( id == 2 ) { + bool ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() ); + return !CORBA::is_nil( myFace ) && ok; + } return false; } @@ -663,10 +684,12 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects ) res = true; break; } - - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); + if ( !anObj->_is_nil() ) { + if ( !IsPreview() ) + anObj->SetParameters(getSizeAsString().toLatin1().constData()); + objects.push_back( anObj._retn() ); + } return res; } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.h b/src/BasicGUI/BasicGUI_PlaneDlg.h index 58bc24bd2..5d83df4e3 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.h +++ b/src/BasicGUI/BasicGUI_PlaneDlg.h @@ -56,6 +56,7 @@ private: void Init(); void enterEvent( QEvent* ); double getSize() const; + QString getSizeAsString() const; private: GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace; diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 41cb5a756..b2475da60 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -689,19 +689,37 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool BasicGUI_PointDlg::isValid( QString& /*msg*/ ) +bool BasicGUI_PointDlg::isValid( QString& msg ) { const int id = getConstructorId(); - if ( id == 0 ) - return true; - else if ( id == 1 ) - return !myRefPoint->_is_nil(); - else if ( id == 2 ) - return !myEdge->_is_nil(); + if ( id == 0 ) { + bool ok = true; + ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + return ok; + } + else if ( id == 1 ) { + bool ok = true; + ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + ok = GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok; + + return !myRefPoint->_is_nil() && ok; + } + else if ( id == 2 ) { + bool ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() ); + return !myEdge->_is_nil() && ok; + } else if ( id == 3 ) return ( !myLine1->_is_nil() && !myLine2->_is_nil() ); - else if ( id == 4 ) - return !myFace->_is_nil(); + else if ( id == 4 ) { + bool ok = true; + ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + return !myFace->_is_nil() && ok; + + } return false; } @@ -714,6 +732,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) bool res = false; GEOM::GEOM_Object_var anObj; + QStringList aParameters; switch ( getConstructorId() ) { case 0 : @@ -721,6 +740,10 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) double x = GroupXYZ->SpinBox_DX->value(); double y = GroupXYZ->SpinBox_DY->value(); double z = GroupXYZ->SpinBox_DZ->value(); + + aParameters << GroupXYZ->SpinBox_DX->text(); + aParameters << GroupXYZ->SpinBox_DY->text(); + aParameters << GroupXYZ->SpinBox_DZ->text(); anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointXYZ( x, y, z ); res = true; @@ -731,6 +754,10 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) double dx = GroupRefPoint->SpinBox_DX->value(); double dy = GroupRefPoint->SpinBox_DY->value(); double dz = GroupRefPoint->SpinBox_DZ->value(); + + aParameters << GroupRefPoint->SpinBox_DX->text(); + aParameters << GroupRefPoint->SpinBox_DY->text(); + aParameters << GroupRefPoint->SpinBox_DZ->text(); anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> MakePointWithReference( myRefPoint, dx, dy, dz ); @@ -740,6 +767,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) case 2 : anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> MakePointOnCurve( myEdge, getParameter() ); + aParameters<SpinBox_DX->text(); res = true; break; case 3 : @@ -750,10 +778,20 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) case 4 : anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )-> MakePointOnSurface( myFace, getUParameter(), getVParameter() ); + aParameters<SpinBox_DX->text(); + aParameters<SpinBox_DY->text(); res = true; break; } + if(!anObj->_is_nil() && !IsPreview() && (getConstructorId()==0 || + getConstructorId() == 1 || + getConstructorId() == 2 || + getConstructorId() == 4) ) { + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } + + if ( getConstructorId() == 1 || getConstructorId() == 2 || getConstructorId() == 4 ) { TopoDS_Shape aShape; diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 132b7822d..d441ce891 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -453,7 +453,17 @@ GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation() //================================================================================= bool BasicGUI_VectorDlg::isValid( QString& msg ) { - return getConstructorId() == 0 ? !myPoint1->_is_nil() && !myPoint2->_is_nil() : true; + if(getConstructorId() == 0) + return !myPoint1->_is_nil() && !myPoint2->_is_nil(); + else if(getConstructorId() == 1) + { + bool ok = true; + 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 ok; + } + return false; } //================================================================================= @@ -478,7 +488,16 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects ) double dx = GroupDimensions->SpinBox_DX->value(); double dy = GroupDimensions->SpinBox_DY->value(); double dz = GroupDimensions->SpinBox_DZ->value(); + + QStringList aParameters; + aParameters << GroupDimensions->SpinBox_DX->text(); + aParameters << GroupDimensions->SpinBox_DY->text(); + aParameters << GroupDimensions->SpinBox_DZ->text(); anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeVectorDXDYDZ( dx, dy, dz ); + + if ( !anObj->_is_nil() && !IsPreview() ) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + res = true; break; } diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx index 960bd9288..8dcbdbbeb 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -366,8 +366,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: @@ -386,7 +390,7 @@ bool BlocksGUI_ExplodeDlg::isValid (QString&) break; } - return ok; + return ok && okSP; } //================================================================================= @@ -421,6 +425,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() ) { @@ -442,7 +450,11 @@ 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() ) ) ) + { + if ( !IsPreview() ) + (*anIter)->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back( *anIter ); + } else toRemoveFromEngine.push_back( *anIter ); } @@ -457,7 +469,12 @@ 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] ); + if ( !IsPreview() ) + 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 2796b5233..fc7a5f720 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -112,7 +112,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, 999, SpecificStep, 3); @@ -128,9 +128,9 @@ 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))); + connect(anIterSpin.value(), SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); // init controls and fields initName(tr("GEOM_BLOCK_MULTITRSF")); @@ -410,7 +410,7 @@ void BlocksGUI_TrsfDlg::enterEvent (QEvent*) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BlocksGUI_TrsfDlg::ValueChangedInSpinBox(double) +void BlocksGUI_TrsfDlg::ValueChangedInSpinBox(int) { displayPreview(); } @@ -453,7 +453,7 @@ void BlocksGUI_TrsfDlg::createSpinWg (const QString& theLbl, const int theId) { QLabel* lab = new QLabel(theLbl, theParent); - mySpinBox[theId] = new QtxDoubleSpinBox(theParent); + mySpinBox[theId] = new SalomeApp_DoubleSpinBox(theParent); QGridLayout* l = 0; if (!theParent->layout()) { l = new QGridLayout(theParent); @@ -550,20 +550,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; } //================================================================================= @@ -581,16 +584,32 @@ bool BlocksGUI_TrsfDlg::execute (ObjectList& objects) anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> MakeMultiTransformation1D(myShape, myFaces[Face1], myFaces[Face2], - (int)mySpinBox[SpinBox1]->value()); + mySpinBox[SpinBox1]->value()); + if (!anObj->_is_nil() && !IsPreview()) + { + QStringList aParameters; + aParameters << "" << ""; + aParameters << mySpinBox[SpinBox1]->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; break; case 1: anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())-> MakeMultiTransformation2D (myShape, myFaces[Face1U], myFaces[Face2U], - (int)mySpinBox[SpinBox2U]->value(), + mySpinBox[SpinBox2U]->value(), myFaces[Face1V], myFaces[Face2V], - (int)mySpinBox[SpinBox2V]->value()); + mySpinBox[SpinBox2V]->value()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 8d4e68f4b..a0f823f14 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.h +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.h @@ -30,7 +30,7 @@ #include -class QtxDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QGroupBox; class QPushButton; class QLineEdit; @@ -79,7 +79,7 @@ private: QMap mySelBtn; QMap mySelName; - QMap mySpinBox; + QMap mySpinBox; private slots: void ClickOnOk(); @@ -90,7 +90,7 @@ private slots: void SelectionIntoArgument(); void SetEditCurrentArgument(); - void ValueChangedInSpinBox (double); + void ValueChangedInSpinBox (int); }; #endif // BLOCKSGUI_TRSFDLG_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui index 9001ffd15..ab8c89f83 100644 --- a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.ui @@ -79,7 +79,7 @@ - + @@ -122,9 +122,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui index 4df5a4e6d..06d9d7c13 100644 --- a/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel1Spin_QTD.ui @@ -104,7 +104,7 @@
    - + @@ -115,9 +115,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    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_1Sel2Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel2Spin_QTD.ui index 25d1a9baf..432160bea 100644 --- a/src/DlgRef/DlgRef_1Sel2Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel2Spin_QTD.ui @@ -56,10 +56,10 @@ 6 - + - + @@ -134,9 +134,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    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_1Sel3Spin_QTD.ui b/src/DlgRef/DlgRef_1Sel3Spin_QTD.ui index 9cabaf01d..6ec567c6e 100644 --- a/src/DlgRef/DlgRef_1Sel3Spin_QTD.ui +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.ui @@ -56,13 +56,13 @@ 6 - + - + - + @@ -153,9 +153,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_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_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_2Sel1Spin_QTD.ui b/src/DlgRef/DlgRef_2Sel1Spin_QTD.ui index b932c276e..76fc2d494 100644 --- a/src/DlgRef/DlgRef_2Sel1Spin_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel1Spin_QTD.ui @@ -56,7 +56,7 @@ 6
    - + @@ -153,9 +153,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui index 40f733590..07800a567 100644 --- a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.ui @@ -63,10 +63,10 @@
    - + - + @@ -173,9 +173,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_2Sel2Spin_QTD.ui b/src/DlgRef/DlgRef_2Sel2Spin_QTD.ui index 5a9f36adb..f9df9178f 100644 --- a/src/DlgRef/DlgRef_2Sel2Spin_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel2Spin_QTD.ui @@ -56,10 +56,10 @@ 6 - + - + @@ -166,9 +166,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/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_2Sel4Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui index a25d1159e..27e0b7e56 100644 --- a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui @@ -63,16 +63,16 @@
    - + - + - + - + @@ -211,9 +211,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/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui b/src/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui index a1c14757d..74e1d6bcc 100644 --- a/src/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui +++ b/src/DlgRef/DlgRef_3Radio1Sel1Spin_QTD.ui @@ -111,7 +111,7 @@ - + @@ -135,9 +135,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_3Sel1Spin_QTD.ui b/src/DlgRef/DlgRef_3Sel1Spin_QTD.ui index b533a05c0..d1f2f04f4 100644 --- a/src/DlgRef/DlgRef_3Sel1Spin_QTD.ui +++ b/src/DlgRef/DlgRef_3Sel1Spin_QTD.ui @@ -180,7 +180,7 @@
    - + @@ -191,10 +191,10 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    -
    +
    SalomeApp_DoubleSpinBox.h
    +
    PushButton1 diff --git a/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui index e2c68c662..10ee30bc3 100644 --- a/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_3Sel3Spin2Check_QTD.ui @@ -144,7 +144,7 @@ - + @@ -163,7 +163,7 @@ - + @@ -182,7 +182,7 @@ - + @@ -207,9 +207,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui index 9329141a8..41fcdd0d0 100644 --- a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.ui @@ -56,16 +56,16 @@ 6 - + - + - + - + @@ -250,9 +250,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_3Spin1Check_QTD.ui b/src/DlgRef/DlgRef_3Spin1Check_QTD.ui index 6a4c001b2..7408ae941 100644 --- a/src/DlgRef/DlgRef_3Spin1Check_QTD.ui +++ b/src/DlgRef/DlgRef_3Spin1Check_QTD.ui @@ -111,13 +111,13 @@
    - + - + - +
    @@ -128,9 +128,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_3Spin_QTD.ui b/src/DlgRef/DlgRef_3Spin_QTD.ui index 10959ed5d..4ac7e5d12 100644 --- a/src/DlgRef/DlgRef_3Spin_QTD.ui +++ b/src/DlgRef/DlgRef_3Spin_QTD.ui @@ -56,13 +56,13 @@ 6 - + - + - + @@ -121,9 +121,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui b/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui index 131736af7..83501ec05 100644 --- a/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui +++ b/src/DlgRef/DlgRef_4Sel1Spin2Check_QTD.ui @@ -32,7 +32,7 @@ 6 - + 0 @@ -230,9 +230,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/DlgRef/DlgRef_4Sel1Spin3Check_QTD.ui b/src/DlgRef/DlgRef_4Sel1Spin3Check_QTD.ui index 4e6e09c64..7dc96d006 100755 --- a/src/DlgRef/DlgRef_4Sel1Spin3Check_QTD.ui +++ b/src/DlgRef/DlgRef_4Sel1Spin3Check_QTD.ui @@ -32,7 +32,7 @@ 6
    - + 0 @@ -243,9 +243,9 @@ qPixmapFromMimeSource - QtxDoubleSpinBox + SalomeApp_DoubleSpinBox QDoubleSpinBox -
    QtxDoubleSpinBox.h
    +
    SalomeApp_DoubleSpinBox.h
    diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.ui b/src/EntityGUI/EntityGUI_1Spin_QTD.ui index e9260a30b..687f962dc 100644 --- a/src/EntityGUI/EntityGUI_1Spin_QTD.ui +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.ui @@ -32,7 +32,7 @@ 6
    - + @@ -90,6 +90,13 @@
    qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    SpinBox_DX buttonApply diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.ui b/src/EntityGUI/EntityGUI_2Spin_QTD.ui index 61378e2d7..f28257dd4 100644 --- a/src/EntityGUI/EntityGUI_2Spin_QTD.ui +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.ui @@ -32,10 +32,10 @@ 6 - + - + @@ -111,6 +111,13 @@ qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    SpinBox_DX SpinBox_DY diff --git a/src/EntityGUI/EntityGUI_3Spin_QTD.ui b/src/EntityGUI/EntityGUI_3Spin_QTD.ui index 907eebc6e..51dd64cfd 100644 --- a/src/EntityGUI/EntityGUI_3Spin_QTD.ui +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.ui @@ -32,7 +32,7 @@ 6 - + @@ -66,10 +66,10 @@
    - + - + @@ -132,6 +132,13 @@ qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    SpinBox_DX SpinBox_DY diff --git a/src/EntityGUI/EntityGUI_4Spin_QTD.ui b/src/EntityGUI/EntityGUI_4Spin_QTD.ui index 279969008..661beab41 100644 --- a/src/EntityGUI/EntityGUI_4Spin_QTD.ui +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.ui @@ -32,16 +32,16 @@ 6 - + - + - + - + @@ -153,6 +153,13 @@
    qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
    SalomeApp_DoubleSpinBox.h
    +
    +
    SpinBox_DX SpinBox_DY diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index c86520311..7f07b966f 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -62,6 +62,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent, const double lineWidth ) : QDialog( parent, fl ), myIsAllAdded( false ), + myIsApply( false ), GEOMBase_Helper( dynamic_cast( parent ) ), myGeometryGUI( GUI ), myLineWidth( lineWidth ) @@ -275,14 +276,8 @@ bool EntityGUI_SketcherDlg::eventFilter (QObject* object, QEvent* event) } } - if (event->type() == QEvent::KeyRelease) { - // NPAL16010 (Sketcher Apply non available if only one line is modified) - // To have Apply active as soon as value text changed - QtxDoubleSpinBox* aDoubleSpinBox = (QtxDoubleSpinBox*)object; - if (aDoubleSpinBox) - ValueChangedInSpinBox( aDoubleSpinBox->value() ); - } - + // Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x + return QDialog::eventFilter(object, event); } @@ -679,7 +674,8 @@ void EntityGUI_SketcherDlg::ClickOnEnd() return; } - QString Command = myCommand.join( "" ) + GetNewCommand(); + QString Parameters; + QString Command = myCommand.join( "" ) + GetNewCommand( Parameters ); Sketcher_Profile aProfile( Command.toAscii() ); Command = myCommand.join( "" ); @@ -719,18 +715,24 @@ bool EntityGUI_SketcherDlg::ClickOnApply() if ( sender() && sender()->inherits( "QPushButton" ) ) ( (QPushButton*)sender() )->setFocus(); // to update value of currently edited spin-box (PAL11948) - myCommand.append( GetNewCommand() ); + QString aParameters; + myCommand.append( GetNewCommand( aParameters ) ); mySketchState = NEXT_POINT; myUndoCommand.clear(); myUndoCommand.append( "Sketcher" ); + myParameters.append( aParameters ); + myUndoParameters.clear(); + MainWidget->GroupConstructors->setEnabled( true ); MainWidget->GroupDest1->setEnabled( true ); setEnabledUndo( true ); setEnabledRedo( false ); + myIsApply = true; GEOMBase_Helper::displayPreview( false, true, true, myLineWidth ); + myIsApply = false; // Set focus to SpinBox_DX if ( sender() == Group1Spin->buttonApply ) { @@ -786,6 +788,9 @@ void EntityGUI_SketcherDlg::ClickOnUndo() myUndoCommand.append( myCommand.last() ); myCommand.pop_back(); + myUndoParameters.append( myParameters.last() ); + myParameters.pop_back(); + if ( myCommand.count() == 1 ) { mySketchState = FIRST_POINT; @@ -811,6 +816,9 @@ void EntityGUI_SketcherDlg::ClickOnRedo() myCommand.append( myUndoCommand.last() ); myUndoCommand.pop_back(); + myParameters.append( myUndoParameters.last() ); + myUndoParameters.pop_back(); + mySketchState = NEXT_POINT; MainWidget->GroupConstructors->setEnabled( true ); @@ -1002,162 +1010,142 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) Standard_Real vx, vy, vz, vs; vx = vy = vz = vs = 0.0; + QString vxStr, vyStr, vzStr, vsStr; + + QString newValueStr; + if( SalomeApp_DoubleSpinBox* aDoubleSpinBox = (SalomeApp_DoubleSpinBox*)send ) + newValueStr = aDoubleSpinBox->text(); + if ( send == Group1Spin->SpinBox_DX ) { - vx = newValue; + vx = newValue; vxStr = newValueStr; } else if ( send == Group2Spin->SpinBox_DX ) { - vx = newValue; - vy = Group2Spin->SpinBox_DY->value(); + vx = newValue; vxStr = newValueStr; + vy = Group2Spin->SpinBox_DY->value(); vyStr = Group2Spin->SpinBox_DY->text(); } else if ( send == Group2Spin->SpinBox_DY ) { - vx = Group2Spin->SpinBox_DX->value(); - vy = newValue; + vx = Group2Spin->SpinBox_DX->value(); vxStr = Group2Spin->SpinBox_DX->text(); + vy = newValue; vyStr = newValueStr; } else if ( send == Group3Spin->SpinBox_DX ) { - vx = newValue; - vy = Group3Spin->SpinBox_DY->value(); - vz = Group3Spin->SpinBox_DZ->value(); + vx = newValue; vxStr = newValueStr; + vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text(); + vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text(); } else if ( send == Group3Spin->SpinBox_DY ) { - vx = Group3Spin->SpinBox_DX->value(); - vy = newValue; - vz = Group3Spin->SpinBox_DZ->value(); + vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text(); + vy = newValue; vyStr = newValueStr; + vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text(); } else if ( send == Group3Spin->SpinBox_DZ ) { - vx = Group3Spin->SpinBox_DX->value(); - vy = Group3Spin->SpinBox_DY->value(); - vz = newValue; + vx = Group3Spin->SpinBox_DX->value(); vxStr = Group3Spin->SpinBox_DX->text(); + vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text(); + vz = newValue; vzStr = newValueStr; } else if ( send == Group4Spin->SpinBox_DX ) { - vx = newValue; - vy = Group4Spin->SpinBox_DY->value(); - vz = Group4Spin->SpinBox_DZ->value(); - vs = Group4Spin->SpinBox_DS->value(); + vx = newValue; vxStr = newValueStr; + vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text(); + vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text(); + vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text(); } else if ( send == Group4Spin->SpinBox_DY ) { - vx = Group4Spin->SpinBox_DX->value(); - vy = newValue; - vz = Group4Spin->SpinBox_DZ->value(); - vs = Group4Spin->SpinBox_DS->value(); + vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text(); + vy = newValue; vyStr = newValueStr; + vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text(); + vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text(); } else if ( send == Group4Spin->SpinBox_DZ ) { - vx = Group4Spin->SpinBox_DX->value(); - vy = Group4Spin->SpinBox_DY->value(); - vz = newValue; - vs = Group4Spin->SpinBox_DS->value(); + vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text(); + vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text(); + vz = newValue; vzStr = newValueStr; + vs = Group4Spin->SpinBox_DS->value(); vsStr = Group4Spin->SpinBox_DS->text(); } else if ( send == Group4Spin->SpinBox_DS ) { - vx = Group4Spin->SpinBox_DX->value(); - vy = Group4Spin->SpinBox_DY->value(); - vz = Group4Spin->SpinBox_DZ->value(); - vs = newValue; - } - // NPAL16010 (Sketcher Apply non available if only one line is modified) - // if ValueChangedInSpinBox() called from eventFilter() - else if ( Group1Spin->SpinBox_DX->hasFocus() ) { - vx = newValue; - } - else if ( Group2Spin->SpinBox_DX ->hasFocus() ) { - vx = newValue; - vy = Group2Spin->SpinBox_DY->value(); - } - else if ( Group2Spin->SpinBox_DY->hasFocus() ) { - vx = Group2Spin->SpinBox_DX->value(); - vy = newValue; - } - else if ( Group3Spin->SpinBox_DX->hasFocus() ) { - vx = newValue; - vy = Group3Spin->SpinBox_DY->value(); - vz = Group3Spin->SpinBox_DZ->value(); - } - else if ( Group3Spin->SpinBox_DY->hasFocus() ) { - vx = Group3Spin->SpinBox_DX->value(); - vy = newValue; - vz = Group3Spin->SpinBox_DZ->value(); - } - else if ( Group3Spin->SpinBox_DZ->hasFocus() ) { - vx = Group3Spin->SpinBox_DX->value(); - vy = Group3Spin->SpinBox_DY->value(); - vz = newValue; - } - else if ( Group4Spin->SpinBox_DX->hasFocus() ) { - vx = newValue; - vy = Group4Spin->SpinBox_DY->value(); - vz = Group4Spin->SpinBox_DZ->value(); - vs = Group4Spin->SpinBox_DS->value(); - } - else if ( Group4Spin->SpinBox_DY->hasFocus() ) { - vx = Group4Spin->SpinBox_DX->value(); - vy = newValue; - vz = Group4Spin->SpinBox_DZ->value(); - vs = Group4Spin->SpinBox_DS->value(); - } - else if ( Group4Spin->SpinBox_DZ->hasFocus() ) { - vx = Group4Spin->SpinBox_DX->value(); - vy = Group4Spin->SpinBox_DY->value(); - vz = newValue; - vs = Group4Spin->SpinBox_DS->value(); - } - else if ( Group4Spin->SpinBox_DS->hasFocus() ) { - vx = Group4Spin->SpinBox_DX->value(); - vy = Group4Spin->SpinBox_DY->value(); - vz = Group4Spin->SpinBox_DZ->value(); - vs = newValue; + vx = Group4Spin->SpinBox_DX->value(); vxStr = Group4Spin->SpinBox_DX->text(); + vy = Group4Spin->SpinBox_DY->value(); vyStr = Group4Spin->SpinBox_DY->text(); + vz = Group4Spin->SpinBox_DZ->value(); vzStr = Group4Spin->SpinBox_DZ->text(); + vs = newValue; vsStr = newValueStr; } + // Fix of the NPAL16010 bug is removed, because it's not actual with the Qt-4.x if ( myConstructorId == 0 ) { // SEGMENT if ( mySketchType == PT_ABS ) { myX = vx; myY = vy; + myXStr = vxStr; + myYStr = vyStr; } else if ( mySketchType == PT_RELATIVE ) { myDX = vx; myDY = vy; + myDXStr = vxStr; + myDYStr = vyStr; } else if ( mySketchType == DIR_ANGLE_LENGTH ) { myAngle = vx; myLength = vy; + myAngleStr = vxStr; + myLengthStr = vyStr; } else if ( mySketchType == DIR_ANGLE_X ) { myAngle = vx; myX = vy; + myAngleStr = vxStr; + myXStr = vyStr; } else if ( mySketchType == DIR_ANGLE_Y ) { myAngle = vx; myY = vy; + myAngleStr = vxStr; + myYStr = vyStr; } else if ( mySketchType == DIR_PER_LENGTH ) { myLength = vx; + myLengthStr = vxStr; } else if ( mySketchType == DIR_PER_X ) { myX = vx; + myXStr = vxStr; } else if ( mySketchType == DIR_PER_Y ) { myY = vx; + myYStr = vxStr; } else if ( mySketchType == DIR_TAN_LENGTH ) { myLength = vx; + myLengthStr = vxStr; } else if ( mySketchType == DIR_TAN_X ) { myX = vx; + myXStr = vxStr; } else if ( mySketchType == DIR_TAN_Y ) { myY = vx; + myYStr = vxStr; } else if ( mySketchType == DIR_DXDY_LENGTH ) { myDX = vx; myDY = vy; myLength = vz; + myDXStr = vxStr; + myDYStr = vyStr; + myLengthStr = vzStr; } else if ( mySketchType == DIR_DXDY_X ) { myDX = vx; myDY = vy; myX = vz; + myDXStr = vxStr; + myDYStr = vyStr; + myXStr = vzStr; } else if ( mySketchType == DIR_DXDY_Y ) { myDX = vx; myDY = vy; myY = vz; + myDXStr = vxStr; + myDYStr = vyStr; + myYStr = vzStr; } } else if ( myConstructorId == 1 ) { // ARC @@ -1165,20 +1153,31 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) myAngle = vx; myRadius = vy; myLength = vz; + myAngleStr = vxStr; + myRadiusStr = vyStr; + myLengthStr = vzStr; } else if ( mySketchType == DIR_PER_LENGTH ) { myRadius = vx; myLength = vy; + myRadiusStr = vxStr; + myLengthStr = vyStr; } else if ( mySketchType == DIR_TAN_LENGTH ) { myRadius = vx; myLength = vy; + myRadiusStr = vxStr; + myLengthStr = vyStr; } else if ( mySketchType == DIR_DXDY_LENGTH ) { myDX = vx; myDY = vy; myRadius = vz; myLength = vs; + myDXStr = vxStr; + myDYStr = vyStr; + myRadiusStr = vzStr; + myLengthStr = vsStr; } } @@ -1190,80 +1189,108 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue ) // function : GetNewCommand() // purpose : Build the new command with context //================================================================================= -QString EntityGUI_SketcherDlg::GetNewCommand() +QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters ) { + theParameters.clear(); QString myNewCommand = ":"; if ( mySketchState == FIRST_POINT ) { - if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) + if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) { myNewCommand = myNewCommand + "F " + QString::number( myX ) + " " + QString::number( myY ); - if ( mySketchType == PT_RELATIVE) + theParameters = myXStr + ":" + myYStr; + } + if ( mySketchType == PT_RELATIVE) { myNewCommand = myNewCommand + "F " + QString::number( myDX ) + " " + QString::number( myDY ); + theParameters = myDXStr + ":" + myDYStr; + } return myNewCommand; } if ( myConstructorId == 0 ) { // SEGMENT - if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) + if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) { myNewCommand = myNewCommand + "TT " + QString::number( myX ) + " " + QString::number( myY ); - if ( mySketchType == PT_RELATIVE) + theParameters = myXStr + ":" + myYStr; + } + if ( mySketchType == PT_RELATIVE) { myNewCommand = myNewCommand + "T " + QString::number( myDX ) + " " + QString::number( myDY ); + theParameters = myDXStr + ":" + myDYStr; + } if ( mySketchType == DIR_ANGLE_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength ); + theParameters = myAngleStr + ":" + myLengthStr; } if ( mySketchType == DIR_ANGLE_X ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX ); + theParameters = myAngleStr + ":" + myXStr; } if ( mySketchType == DIR_ANGLE_Y ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY ); + theParameters = myAngleStr + ":" + myYStr; } if ( mySketchType == DIR_PER_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength ); + theParameters = QString::number( 90.0 ) + ":" + myLengthStr; } if ( mySketchType == DIR_PER_X ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX ); + theParameters = QString::number( 90.0 ) + ":" + myXStr; } if ( mySketchType == DIR_PER_Y ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY ); + theParameters = QString::number( 90.0 ) + ":" + myYStr; } - if ( mySketchType == DIR_TAN_LENGTH ) + if ( mySketchType == DIR_TAN_LENGTH ) { myNewCommand = myNewCommand + "L " + QString::number( myLength ); - if ( mySketchType == DIR_TAN_X ) + theParameters = myLengthStr; + } + if ( mySketchType == DIR_TAN_X ) { myNewCommand = myNewCommand + "IX " + QString::number( myX ); - if ( mySketchType == DIR_TAN_Y) + theParameters = myXStr; + } + if ( mySketchType == DIR_TAN_Y) { myNewCommand = myNewCommand + "IY " + QString::number(myY); + theParameters = myYStr; + } if ( mySketchType == DIR_DXDY_LENGTH ) { myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); myNewCommand = myNewCommand + ":" + "L " + QString::number( myLength ); + theParameters = myDXStr + ":" + myDYStr + ":" + myLengthStr; } if ( mySketchType == DIR_DXDY_X ) { myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); myNewCommand = myNewCommand + ":" + "IX " + QString::number( myX ); + theParameters = myDXStr + ":" + myDYStr + ":" + myXStr; } if ( mySketchType == DIR_DXDY_Y ) { myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); myNewCommand = myNewCommand + ":" + "IY " + QString::number( myY ); + theParameters = myDXStr + ":" + myDYStr + ":" + myYStr; } } else if ( myConstructorId == 1 ) { // ARC if ( mySketchType == DIR_ANGLE_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( myAngle ); myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + theParameters = myAngleStr + ":" + myRadiusStr + ":" + myLengthStr; } if ( mySketchType == DIR_PER_LENGTH ) { myNewCommand = myNewCommand + "R " + QString::number( 90.0 ); myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + theParameters = QString::number( 90.0 ) + ":" + myRadiusStr + ":" + myLengthStr; } if ( mySketchType == DIR_TAN_LENGTH ) { myNewCommand = myNewCommand + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + theParameters = myRadiusStr + ":" + myLengthStr; } if ( mySketchType == DIR_DXDY_LENGTH ) { myNewCommand = myNewCommand + "D " + QString::number( myDX ) + " " + QString::number( myDY ); myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength ); + theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr + ":" + myLengthStr; } } return myNewCommand; @@ -1284,7 +1311,32 @@ GEOM::GEOM_IOperations_ptr EntityGUI_SketcherDlg::createOperation() //================================================================================= bool EntityGUI_SketcherDlg::isValid( QString& msg ) { - return true; + bool ok = true; + bool toCorrect = !IsPreview() || myIsApply; + + if( Group1Spin->isVisible() ) { + ok = Group1Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok; + } + else if( Group2Spin->isVisible() ) { + ok = Group2Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok; + ok = Group2Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok; + } + else if( Group3Spin->isVisible() ) { + ok = Group3Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok; + ok = Group3Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok; + ok = Group3Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok; + } + else if( Group4Spin->isVisible() ) { + ok = Group4Spin->SpinBox_DX->isValid( msg, toCorrect ) && ok; + ok = Group4Spin->SpinBox_DY->isValid( msg, toCorrect ) && ok; + ok = Group4Spin->SpinBox_DZ->isValid( msg, toCorrect ) && ok; + ok = Group4Spin->SpinBox_DS->isValid( msg, toCorrect ) && ok; + } + + if( myIsApply && !ok ) + showError( msg ); + + return ok; } //================================================================================= @@ -1293,6 +1345,8 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg ) //================================================================================= bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) { + QString aParameters; + if ( mySketchState == FIRST_POINT ) { myLastX2 = myX; myLastY2 = myY; @@ -1308,7 +1362,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) myShape1 = aProfile1.GetShape(); //Current Shape - QString Command2 = Command1 + GetNewCommand(); + QString Command2 = Command1 + GetNewCommand( aParameters ); Sketcher_Profile aProfile2( Command2.toAscii() ); if ( aProfile2.IsDone() ) myShape2 = aProfile2.GetShape(); @@ -1367,7 +1421,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) } } else { - cmd = myCommand.join( "" ) + GetNewCommand(); + cmd = myCommand.join( "" ) + GetNewCommand( aParameters ); if ( Group1Sel->isVisible() ) { Group1Sel->buttonApply->setEnabled( true ); @@ -1410,7 +1464,15 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeSketcher( cmd.toLatin1(), WPlane ); if ( !anObj->_is_nil() ) + { + if( !IsPreview() ) { + QStringList aCurrentParameters = myParameters; + aCurrentParameters << aParameters; + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aCurrentParameters)); + } + objects.push_back( anObj._retn() ); + } return true; } @@ -1519,7 +1581,7 @@ void EntityGUI_SketcherDlg::keyPressEvent( QKeyEvent* e ) } } -void EntityGUI_SketcherDlg::initSpinBox( QDoubleSpinBox* spinBox, +void EntityGUI_SketcherDlg::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, double min, double max, double step, int decimals ) { diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h index 4ca3841db..3a304abf1 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.h +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -31,7 +31,7 @@ #include class QLineEdit; -class QDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class EntityGUI_1Sel; class EntityGUI_1Spin; class EntityGUI_2Spin; @@ -66,7 +66,7 @@ public: bool eventFilter (QObject* object, QEvent* event); protected: - void initSpinBox( QDoubleSpinBox*, + void initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, int = 3 ); @@ -85,7 +85,7 @@ private: void setEnabledUndo( bool ); void setEnabledRedo( bool ); - QString GetNewCommand(); + QString GetNewCommand( QString& ); virtual void displayPreview( GEOM::GEOM_Object_ptr, const bool = false, @@ -106,17 +106,26 @@ private: int mySketchState; bool myIsAllAdded; + bool myIsApply; QLineEdit* myEditCurrentArgument; /* Current LineEdit */ QStringList myCommand; QStringList myUndoCommand; + QStringList myParameters; + QStringList myUndoParameters; + Standard_Real myX, myY, myDX, myDY; Standard_Real myLength, myAngle, myRadius; Standard_Real myLastX1, myLastY1; Standard_Real myLastX2, myLastY2; + QString myXStr, myYStr, myDXStr, myDYStr; + QString myLengthStr, myAngleStr, myRadiusStr; + QString myLastX1Str, myLastY1Str; + QString myLastX2Str, myLastY2Str; + EntityGUI_Skeleton* MainWidget; EntityGUI_Point* GroupPt; diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 8d785045d..033c2a310 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -58,12 +58,28 @@ #include #include #include +#include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +#define COMMA ',' +#define O_BRACKET '(' +#define C_BRACKET ')' +#define O_SQR_BRACKET '[' +#define C_SQR_BRACKET ']' +#define PY_NULL "None" + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + static GEOM_Engine* TheEngine = NULL; +using namespace std; + static TCollection_AsciiString BuildIDFromObject(Handle(GEOM_Object)& theObject) { TCollection_AsciiString anID(theObject->GetDocID()), anEntry; @@ -88,11 +104,18 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID) void ProcessFunction(Handle(GEOM_Function)& theFunction, TCollection_AsciiString& theScript, + TVariablesList theVariables, TDF_LabelMap& theProcessed, std::set& theDumpedObjs); +void ReplaceVariables(TCollection_AsciiString& theCommand, + TVariablesList theVariables); + + + Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString); + //============================================================================= /*! * GetEngine @@ -425,6 +448,7 @@ void GEOM_Engine::Close(int theDocID) //============================================================================= TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + TVariablesList theVariables, bool isPublished, bool& aValidScript) { @@ -455,7 +479,7 @@ TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, MESSAGE ( "Null function !!!!" ); continue; } - ProcessFunction(aFunction, aScript, aFuncMap, anObjMap); + ProcessFunction(aFunction, aScript, theVariables, aFuncMap, anObjMap); } } @@ -682,6 +706,7 @@ Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const //=========================================================================== void ProcessFunction(Handle(GEOM_Function)& theFunction, TCollection_AsciiString& theScript, + TVariablesList theVariables, TDF_LabelMap& theProcessed, std::set& theDumpedObjs) { @@ -741,6 +766,8 @@ void ProcessFunction(Handle(GEOM_Function)& theFunction, //Check if its internal function which doesn't requires dumping if(aDescr == "None") return; + //Replace parameter by notebook variables + ReplaceVariables(aDescr,theVariables); theScript += "\n\t"; theScript += aDescr; @@ -787,3 +814,305 @@ Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theStrin return aSeq; } + +//============================================================================= +/*! + * ReplaceVariables: Replace parameters of the function by variales from + * Notebook if need + */ +//============================================================================= +void ReplaceVariables(TCollection_AsciiString& theCommand, + TVariablesList theVariables) +{ + if (MYDEBUG) + cout<<"Command : "<GetCurrectState(); + + if(MYDEBUG) { + cout<<"Variables from SObject:"<= aVariables.size()) + continue; + + aReplacedParameter = aVariables[iVar].myVariable; + if(aReplacedParameter.IsEmpty()) { + iVar++; + continue; + } + + if(aVariables[iVar].isVariable) { + aReplacedParameter.InsertBefore(1,"'"); + aReplacedParameter.InsertAfter(aReplacedParameter.Length(),"'"); + } + + if(MYDEBUG) + cout<<"aSection before : "<= aVariables.size()) + continue; + + aReplacedVar = aVariables[iVar].myVariable; + if(aReplacedVar.IsEmpty()) { + iVar++; + continue; + } + + if(aVariables[iVar].isVariable) { + aReplacedVar.InsertBefore(1,"\""); + aReplacedVar.InsertAfter(aReplacedVar.Length(),"\""); + } + + aCommand.Remove(aStartPos, aEndPos - aStartPos); + aCommand.Insert(aStartPos, aReplacedVar); + iVar++; + } + + theCommand.Remove(aStartCommandPos, aEndCommandPos - aStartCommandPos); + theCommand.Insert(aStartCommandPos, aCommand); + + aCommandIndex++; + + aStates->IncrementState(); + } + + if (MYDEBUG) + cout<<"Command : "< _dumpstate) + return _states[_dumpstate]; + return TState(); +} + +//================================================================================ +/*! + * \brief Add new object state + * \param theState - Object state (vector of notebook variable) + */ +//================================================================================ +void ObjectStates::AddState(const TState &theState) +{ + _states.push_back(theState); +} + +//================================================================================ +/*! + * \brief Increment object state + */ +//================================================================================ +void ObjectStates::IncrementState() +{ + _dumpstate++; +} diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx index 9ce2a4f7f..a9951b26c 100644 --- a/src/GEOM/GEOM_Engine.hxx +++ b/src/GEOM/GEOM_Engine.hxx @@ -33,6 +33,40 @@ #include #include +#include +#include + +struct TVariable{ + TCollection_AsciiString myVariable; + bool isVariable; + + TVariable(const TCollection_AsciiString& theVariable, bool theFlag = true): + myVariable(theVariable), + isVariable(theFlag){} +}; + +typedef std::vector TState; +typedef std::vector TAllStates; + +class ObjectStates +{ +public: + ObjectStates(); + ~ObjectStates(); + + TAllStates GetAllStates() const { return _states; } + + TState GetCurrectState() const; + void AddState(const TState &theState); + void IncrementState(); + +private: + TAllStates _states; + int _dumpstate; +}; + +typedef std::map TVariablesList; + class GEOM_Engine { public: @@ -85,6 +119,7 @@ class GEOM_Engine Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID, Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + TVariablesList theVariables, bool isPublished, bool& aValidScript); @@ -94,7 +129,7 @@ class GEOM_Engine protected: Standard_EXPORT static void SetEngine(GEOM_Engine* theEngine); - + private: Handle(GEOM_Application) _OCAFApp; diff --git a/src/GEOM/GEOM_Object.cxx b/src/GEOM/GEOM_Object.cxx index fa40ae257..672ce7835 100644 --- a/src/GEOM/GEOM_Object.cxx +++ b/src/GEOM/GEOM_Object.cxx @@ -382,6 +382,31 @@ TCollection_AsciiString GEOM_Object::GetAuxData() return aData; } +//============================================================================= +/*! + * SetParameters + */ +//============================================================================= +void GEOM_Object::SetParameters(const TCollection_AsciiString& theParameters) +{ + if( _parameters.IsEmpty() ) + _parameters = theParameters; + else { + _parameters += "|"; + _parameters += theParameters; + } +} + +//============================================================================= +/*! + * GetParameters + */ +//============================================================================= +TCollection_AsciiString GEOM_Object::GetParameters() const +{ + return _parameters; +} + //============================================================================= /*! diff --git a/src/GEOM/GEOM_Object.hxx b/src/GEOM/GEOM_Object.hxx index d89e0f9f3..67f309bb0 100644 --- a/src/GEOM/GEOM_Object.hxx +++ b/src/GEOM/GEOM_Object.hxx @@ -221,6 +221,12 @@ class GEOM_Object : public MMgt_TShared //Returns an auxiliary data Standard_EXPORT TCollection_AsciiString GetAuxData(); + //Set a notebook variables used for object creation + Standard_EXPORT void SetParameters(const TCollection_AsciiString& theParameters); + + //Get a notebook variables used for object creation + Standard_EXPORT TCollection_AsciiString GetParameters() const; + //########################################################### // Sub shape methods //########################################################### @@ -272,6 +278,7 @@ class GEOM_Object : public MMgt_TShared Handle(TDataStd_TreeNode) _root; TDF_Label _label; TCollection_AsciiString _ior; + TCollection_AsciiString _parameters; }; #endif diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 4b2f49b4f..ad5d365d0 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -30,6 +30,8 @@ #include #include +#include +#include #include #include #include @@ -130,6 +132,10 @@ void GEOMBase_Skeleton::Init() myMainFrame->GroupBoxPublish->hide(); } +//================================================================================= +// function : initSpinBox() +// purpose : +//================================================================================= void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, int min, int max, int step ) { @@ -137,16 +143,48 @@ void GEOMBase_Skeleton::initSpinBox( QSpinBox* spinBox, spinBox->setSingleStep( step ); } -void GEOMBase_Skeleton::initSpinBox( QDoubleSpinBox* spinBox, +//================================================================================= +// function : initSpinBox() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::initSpinBox( SalomeApp_DoubleSpinBox* spinBox, double min, double max, double step, int decimals ) { + spinBox->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 ); spinBox->setSingleStep( step ); } +//================================================================================= +// function : updateAttributes() +// purpose : Workaround for Translation and Rotation operations with unchecked option "Create a copy". +// In this case PublishInStudy isn't called, so we need to update object's attributes manually +//================================================================================= +void GEOMBase_Skeleton::updateAttributes( GEOM::GEOM_Object_ptr theObj, + const QStringList& theParameters) +{ + SALOMEDS::Study_var aStudy = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS()); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theObj->GetStudyEntry()); + SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString"); + SALOMEDS::AttributeString_var aStringAttrib = SALOMEDS::AttributeString::_narrow(anAttr); + + std::string aValue = aStringAttrib->Value(); + if( aValue != "" ) + aValue += "|"; + for( int i = 0, n = theParameters.count(); i < n; i++ ) { + std::string aParameter = theParameters[i].toStdString(); + if(aStudy->IsVariable(aParameter.c_str())) + aValue += aParameter; + if(i != n-1) + aValue += ":"; + } + aStringAttrib->SetValue(aValue.c_str()); +} + //================================================================================= // function : ClickOnCancel() // purpose : diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index 3cc5945b3..a9f2c5aa2 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,8 +60,10 @@ private: protected: void initSpinBox( QSpinBox*, int, int, int = 1 ); - void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 3 ); + void initSpinBox( SalomeApp_DoubleSpinBox*, double, double, double = 0.1, int = 3 ); + void updateAttributes( GEOM::GEOM_Object_ptr, const QStringList& ); + void closeEvent( QCloseEvent* ); void keyPressEvent( QKeyEvent* ); diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 8c1114274..54722fe93 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -149,6 +149,14 @@ SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy) return aDSStudy._retn(); } +//======================================================================= +// function : JoinObjectParameters +// purpose : +//======================================================================= +char* GeometryGUI::JoinObjectParameters(const QStringList& theParametersList) +{ + return theParametersList.join(":").toLatin1().data(); +} //======================================================================= // function : GeometryGUI::GeometryGUI() // purpose : Constructor diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 35dd68853..36d06fd55 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -81,6 +81,8 @@ public: static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject); static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy); + static char* JoinObjectParameters(const QStringList& theParametersList); + GEOM_Client& GetShapeReader() { return myShapeReader; } Standard_CString& GetFatherior() { return myFatherior; } //void SetState( const int state ) { myState = state; } diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx index dd08ea611..5150f0a1c 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -180,7 +180,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ } //Make a Python command - GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateDXDYDZ(" + GEOM::TPythonDump(aFunction) << "geompy.TranslateDXDYDZ(" << theObject << ", " << theX << ", " << theY << ", " << theZ << ")"; SetErrorCode(OK); @@ -467,7 +467,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorDistance return aCopy; } - GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVectorDistance(" + GEOM::TPythonDump(aFunction) << "geompy.TranslateVectorDistance(" << theObject << ", " << theVector << ", " << theDistance << ", " << theCopy << ")"; SetErrorCode(OK); return theObject; @@ -1208,7 +1208,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeAlongAxes (Handle(G //Make a Python command if (doCopy) { - GEOM::TPythonDump(aFunction) << "geompy.MakeScaleAlongAxes(" + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleAlongAxes(" << theObject << ", " << thePoint << ", " << theFactorX << ", " << theFactorY << ", " << theFactorZ << ")"; return aCopy; @@ -1454,7 +1454,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t } //Make a Python command - GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.Rotate(" << theObject + GEOM::TPythonDump(aFunction) << "geompy.Rotate(" << theObject << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; SetErrorCode(OK); diff --git a/src/GEOM_I/GEOM_DumpPython.cc b/src/GEOM_I/GEOM_DumpPython.cc index 4bba0eb20..82f5f5d44 100644 --- a/src/GEOM_I/GEOM_DumpPython.cc +++ b/src/GEOM_I/GEOM_DumpPython.cc @@ -26,11 +26,15 @@ #include #include "GEOM_Gen_i.hh" + #include #include #include #include +#include +#include + //======================================================================= //function : DumpPython //purpose : @@ -50,6 +54,8 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, Resource_DataMapOfAsciiStringAsciiString aMap; + TVariablesList aVariableMap; + SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO); for(Itr->InitEx(true); Itr->More(); Itr->Next()) { SALOMEDS::SObject_var aValue = Itr->Value(); @@ -61,14 +67,34 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::String_var aName = aValue->GetName(); CORBA::String_var anEntry = GO->GetEntry(); aMap.Bind( (char*)anEntry.in(), (char*)aName.in() ); + + //Find attribute with list of used notebook variables + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeString_var anAttrStr; + if(aValue->FindAttribute(anAttr,"AttributeString")){ + anAttrStr = SALOMEDS::AttributeString::_narrow(anAttr); + SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(anAttrStr->Value()); + ObjectStates* aStates = new ObjectStates(); + for(int i = 0; i < aSections->length(); i++) { + TState aState; + SALOMEDS::ListOfStrings aListOfVars = aSections[i]; + for(int j = 0; j < aListOfVars.length(); j++) { + bool isVar = aStudy->IsVariable(aListOfVars[j].in()); + TVariable aVar = TVariable( (char*)aListOfVars[j].in(), isVar ); + aState.push_back(aVar); + } + aStates->AddState(aState); + } + aVariableMap.insert(pair(TCollection_AsciiString(anEntry),aStates)); + } } } } - + TCollection_AsciiString aScript = "### This file is generated by SALOME automatically by dump python functionality\n" "### of GEOM component\n\n"; - aScript += _impl->DumpPython(aStudy->StudyId(), aMap, isPublished, isValidScript); + aScript += _impl->DumpPython(aStudy->StudyId(), aMap, aVariableMap, isPublished, isValidScript); if (isPublished) { diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 9743e8614..6e8e4e430 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -273,7 +273,25 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName"); SALOMEDS::AttributeName_var aNameAttrib = SALOMEDS::AttributeName::_narrow(anAttr); aNameAttrib->SetValue(aShapeName.ToCString()); - + + //Set NoteBook variables used in the object creation + TCollection_AsciiString aVars; + SALOMEDS::ListOfListOfStrings_var aSections = theStudy->ParseVariables(aShape->GetParameters()); + for(int i = 0, n = aSections->length(); i < n; i++) { + SALOMEDS::ListOfStrings aListOfVars = aSections[i]; + for(int j = 0, m = aListOfVars.length(); j < m; j++) { + if(theStudy->IsVariable(aListOfVars[j].in())) + aVars += TCollection_AsciiString(aListOfVars[j].in()); + if(j != m-1) + aVars += ":"; + } + if(i != n-1) + aVars += "|"; + } + 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_I/GEOM_Object_i.cc b/src/GEOM_I/GEOM_Object_i.cc index 395ea360e..12ea73a99 100644 --- a/src/GEOM_I/GEOM_Object_i.cc +++ b/src/GEOM_I/GEOM_Object_i.cc @@ -362,3 +362,14 @@ bool GEOM_Object_i::IsShape() { return !_impl->GetValue().IsNull() && _impl->GetType() != GEOM_MARKER; } + +void GEOM_Object_i::SetParameters(const char* theParameters) +{ + _impl->SetParameters((char*)theParameters); +} + +char* GEOM_Object_i::GetParameters() +{ + return CORBA::string_dup(_impl->GetParameters().ToCString()); +} + diff --git a/src/GEOM_I/GEOM_Object_i.hh b/src/GEOM_I/GEOM_Object_i.hh index d40c993fe..13bb0290f 100644 --- a/src/GEOM_I/GEOM_Object_i.hh +++ b/src/GEOM_I/GEOM_Object_i.hh @@ -82,6 +82,10 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual bool IsShape(); + virtual void SetParameters(const char* theParameters); + + virtual char* GetParameters(); + Handle(GEOM_Object) GetImpl() { return _impl; } private: diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 787ccc005..849095d4e 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -78,6 +78,8 @@ import salome salome.salome_init() from salome import * +from salome_notebook import * + import GEOM import math @@ -90,6 +92,80 @@ ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE" def RaiseIfFailed (Method_name, Operation): if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY": raise RuntimeError, Method_name + " : " + Operation.GetErrorCode() + +## Return list of variables value from salome notebook +## @ingroup l1_geompy_auxiliary +def ParseParameters(*parameters): + Result = [] + StringResult = "" + for parameter in parameters: + if isinstance(parameter,str): + if notebook.isVariable(parameter): + Result.append(notebook.get(parameter)) + else: + raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!" + else: + Result.append(parameter) + pass + + StringResult = StringResult + str(parameter) + StringResult = StringResult + ":" + pass + StringResult = StringResult[:len(StringResult)-1] + 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 + +## Return list of variables value from salome notebook +## @ingroup l1_geompy_auxiliary +def ParseSketcherCommand(command): + Result = "" + StringResult = "" + sections = command.split(":") + for section in sections: + parameters = section.split(" ") + paramIndex = 1 + for parameter in parameters: + if paramIndex > 1 and parameter.find("'") != -1: + parameter = parameter.replace("'","") + if notebook.isVariable(parameter): + Result = Result + str(notebook.get(parameter)) + " " + pass + else: + raise RuntimeError, "Variable with name '" + parameter + "' doesn't exist!!!" + pass + pass + else: + Result = Result + str(parameter) + " " + pass + if paramIndex > 1: + StringResult = StringResult + parameter + StringResult = StringResult + ":" + pass + paramIndex = paramIndex + 1 + pass + Result = Result[:len(Result)-1] + ":" + pass + Result = Result[:len(Result)-1] + return Result, StringResult ## Kinds of shape enumeration # @ingroup l1_geompy_auxiliary @@ -253,8 +329,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_point "Example" def MakeVertex(self,theX, theY, theZ): # Example: see GEOM_TestAll.py + theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ) anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ) RaiseIfFailed("MakePointXYZ", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a point, distant from the referenced point @@ -268,8 +346,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_point "Example" def MakeVertexWithRef(self,theReference, theX, theY, theZ): # Example: see GEOM_TestAll.py + theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ) anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ) RaiseIfFailed("MakePointWithReference", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a point, corresponding to the given parameter on the given curve. @@ -280,8 +360,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_point "Example" def MakeVertexOnCurve(self,theRefCurve, theParameter): # Example: see GEOM_TestAll.py + theParameter, Parameters = ParseParameters(theParameter) anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter) RaiseIfFailed("MakePointOnCurve", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a point, corresponding to the given parameters on the @@ -293,9 +375,11 @@ class geompyDC(GEOM._objref_GEOM_Gen): # # @ref swig_MakeVertexOnSurface "Example" def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter): + theUParameter, theVParameter, Parameters = ParseParameters(theUParameter, theVParameter) # Example: see GEOM_TestAll.py anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter) RaiseIfFailed("MakePointOnSurface", self.BasicOp) + anObj.SetParameters(Parameters); return anObj ## Create a point on intersection of two lines. @@ -329,8 +413,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_vector "Example" def MakeVectorDXDYDZ(self,theDX, theDY, theDZ): # Example: see GEOM_TestAll.py + theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ) RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a vector between two points. @@ -392,8 +478,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_plane "Example" def MakePlane(self,thePnt, theVec, theTrimSize): # Example: see GEOM_TestAll.py + theTrimSize, Parameters = ParseParameters(theTrimSize); anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize) RaiseIfFailed("MakePlanePntVec", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a plane, passing through the three given points @@ -406,8 +494,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_plane "Example" def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize): # Example: see GEOM_TestAll.py + theTrimSize, Parameters = ParseParameters(theTrimSize); anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize) RaiseIfFailed("MakePlaneThreePnt", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a plane, similar to the existing one, but with another size of representing face. @@ -418,8 +508,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_plane "Example" def MakePlaneFace(self,theFace, theTrimSize): # Example: see GEOM_TestAll.py + theTrimSize, Parameters = ParseParameters(theTrimSize); anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize) RaiseIfFailed("MakePlaneFace", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a local coordinate system. @@ -431,8 +523,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref swig_MakeMarker "Example" def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ): # Example: see GEOM_TestAll.py + OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, Parameters = ParseParameters(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ); anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ) RaiseIfFailed("MakeMarker", self.BasicOp) + anObj.SetParameters(Parameters) return anObj ## Create a local coordinate system. @@ -513,8 +607,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_circle "Example" def MakeCircle(self, thePnt, theVec, theR): # Example: see GEOM_TestAll.py + theR, Parameters = ParseParameters(theR) anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR) RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp) + anObj.SetParameters(Parameters) return anObj ## Create a circle with given radius. @@ -561,8 +657,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_ellipse "Example" def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor): # Example: see GEOM_TestAll.py + theRMajor, theRMinor, Parameters = ParseParameters(theRMajor, theRMinor) anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor) RaiseIfFailed("MakeEllipse", self.CurvesOp) + anObj.SetParameters(Parameters) return anObj ## Create an ellipse with given radiuses. @@ -651,8 +749,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_sketcher_page "Example" def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]): # Example: see GEOM_TestAll.py + theCommand,Parameters = ParseSketcherCommand(theCommand) anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane) RaiseIfFailed("MakeSketcher", self.CurvesOp) + anObj.SetParameters(Parameters) return anObj ## Create a sketcher (wire or face), following the textual description, @@ -707,8 +807,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_creation_box "Example" def MakeBoxDXDYDZ(self,theDX, theDY, theDZ): # Example: see GEOM_TestAll.py + theDX,theDY,theDZ,Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ) RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp) + anObj.SetParameters(Parameters) return anObj ## Create a box with two specified opposite vertices, @@ -734,8 +836,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, @@ -749,8 +853,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. @@ -762,8 +868,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 @@ -785,8 +893,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. @@ -799,8 +909,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 @@ -813,8 +925,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. @@ -825,8 +939,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. @@ -848,8 +964,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. @@ -865,8 +983,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 @@ -882,8 +1002,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. @@ -896,8 +1018,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. @@ -908,8 +1032,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 @@ -942,8 +1068,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, @@ -957,8 +1085,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 @@ -969,8 +1099,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 @@ -983,8 +1115,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 @@ -998,14 +1132,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. @@ -1025,9 +1163,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. @@ -1739,8 +1880,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). @@ -1771,8 +1917,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). @@ -1829,8 +1977,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. @@ -1877,9 +2027,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. @@ -2085,6 +2237,20 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp) return anObj + ## Translate the given object along the vector, specified by its components. + # @param theObject The object to be translated. + # @param theDX,theDY,theDZ Components of translation vector. + # @return Translated GEOM_Object. + # + # @ref tui_translation "Example" + def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ): + # Example: see GEOM_TestAll.py + theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ) + anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ) + anObj.SetParameters(Parameters) + RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp) + return anObj + ## Translate the given object along the vector, specified # by its components, creating its copy before the translation. # @param theObject The object to be translated. @@ -2094,7 +2260,9 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_translation "Example" def MakeTranslation(self,theObject, theDX, theDY, theDZ): # Example: see GEOM_TestAll.py + theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ) anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ) + anObj.SetParameters(Parameters) RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp) return anObj @@ -2111,6 +2279,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("TranslateVectorCopy", self.TrsfOp) return anObj + ## Translate the given object along the given vector on given distance. + # @param theObject The object to be translated. + # @param theVector The translation vector. + # @param theDistance The translation distance. + # @param theCopy Flag used to translate object itself or create a copy. + # @return Translated GEOM_Object. + # + # @ref tui_translation "Example" + def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy): + # Example: see GEOM_TestAll.py + theDistance,Parameters = ParseParameters(theDistance) + anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, theCopy) + RaiseIfFailed("TranslateVectorDistance", self.TrsfOp) + anObj.SetParameters(Parameters) + return anObj + ## Translate the given object along the given vector on given distance, # creating its copy before the translation. # @param theObject The object to be translated. @@ -2121,8 +2305,30 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_translation "Example" def MakeTranslationVectorDistance(self, theObject, theVector, theDistance): # Example: see GEOM_TestAll.py + theDistance,Parameters = ParseParameters(theDistance) anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1) RaiseIfFailed("TranslateVectorDistance", self.TrsfOp) + anObj.SetParameters(Parameters) + return anObj + + ## Rotate the given object around the given axis on the given angle. + # @param theObject The object to be rotated. + # @param theAxis Rotation axis. + # @param theAngle Rotation angle in radians. + # @return Rotated GEOM_Object. + # + # @ref tui_rotation "Example" + def Rotate(self,theObject, theAxis, theAngle): + # Example: see GEOM_TestAll.py + flag = False + if isinstance(theAngle,str): + flag = True + theAngle, Parameters = ParseParameters(theAngle) + if flag: + theAngle = theAngle*math.pi/180.0 + anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle) + RaiseIfFailed("RotateCopy", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate the given object around the given axis @@ -2135,8 +2341,15 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_rotation "Example" def MakeRotation(self,theObject, theAxis, theAngle): # Example: see GEOM_TestAll.py + flag = False + if isinstance(theAngle,str): + flag = True + theAngle, Parameters = ParseParameters(theAngle) + if flag: + theAngle = theAngle*math.pi/180.0 anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle) RaiseIfFailed("RotateCopy", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate given object around vector perpendicular to plane @@ -2164,8 +2377,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_scale "Example" def MakeScaleTransform(self, theObject, thePoint, theFactor): # Example: see GEOM_TestAll.py + theFactor, Parameters = ParseParameters(theFactor) anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor) RaiseIfFailed("ScaleShapeCopy", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Scale the given object by different factors along coordinate axes, @@ -2179,9 +2394,11 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref swig_scale "Example" def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ): # Example: see GEOM_TestAll.py + theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ) anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint, theFactorX, theFactorY, theFactorZ) RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Create an object, symmetrical @@ -2264,8 +2481,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_offset "Example" def MakeOffset(self,theObject, theOffset): # Example: see GEOM_TestAll.py + theOffset, Parameters = ParseParameters(theOffset) anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset) RaiseIfFailed("OffsetShapeCopy", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj # ----------------------------------------------------------------------------- @@ -2283,8 +2502,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_multi_translation "Example" def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes): # Example: see GEOM_TestAll.py + theStep, theNbTimes, Parameters = ParseParameters(theStep, theNbTimes) anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes) RaiseIfFailed("MultiTranslate1D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Conseqently apply two specified translations to theObject specified number of times. @@ -2302,9 +2523,11 @@ class geompyDC(GEOM._objref_GEOM_Gen): def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1, theVector2, theStep2, theNbTimes2): # Example: see GEOM_TestAll.py + theStep1,theNbTimes1,theStep2,theNbTimes2, Parameters = ParseParameters(theStep1,theNbTimes1,theStep2,theNbTimes2) anObj = self.TrsfOp.MultiTranslate2D(theObject, theVector1, theStep1, theNbTimes1, theVector2, theStep2, theNbTimes2) RaiseIfFailed("MultiTranslate2D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate the given object around the given axis a given number times. @@ -2318,8 +2541,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_multi_rotation "Example" def MultiRotate1D(self,theObject, theAxis, theNbTimes): # Example: see GEOM_TestAll.py + theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes) anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes) RaiseIfFailed("MultiRotate1D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## Rotate the given object around the @@ -2339,8 +2564,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @ref tui_multi_rotation "Example" def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2): # Example: see GEOM_TestAll.py + theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2) anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2) RaiseIfFailed("MultiRotate2D", self.TrsfOp) + anObj.SetParameters(Parameters) return anObj ## The same, as MultiRotate1D(), but axis is given by direction and point @@ -2374,8 +2601,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 @@ -2389,6 +2618,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) @@ -2396,10 +2626,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) @@ -2407,6 +2639,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 fillet on the specified edges/faces of the given shape @@ -2432,8 +2665,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, @@ -2448,15 +2683,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, @@ -2473,17 +2717,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, @@ -2495,15 +2748,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() @@ -2536,8 +2798,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 @@ -3176,8 +3441,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. @@ -3229,8 +3498,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. @@ -3244,9 +3515,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 5edbf1125..4f46e1962 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,20 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects ) anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation() )->MakeFilling( myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D, myNbIter, myIsApprox ); - if ( !anObj->_is_nil() ) + { + if ( !IsPreview() ) + { + 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 613f38ce8..85cc51d31 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -622,14 +622,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 myOkBase; + return myOkBase && ok; return false; } @@ -640,6 +650,7 @@ bool GenerationGUI_PrismDlg::isValid (QString&) //================================================================================= bool GenerationGUI_PrismDlg::execute (ObjectList& objects) { + QStringList aParameters; GEOM::GEOM_Object_var anObj; switch (getConstructorId()) { @@ -652,6 +663,13 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects) anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakePrismVecH2Ways(myBase, myVec, getHeight()); } + + if (!anObj->_is_nil() && !IsPreview()) + { + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } + break; case 1: if (!myBothway2) { @@ -676,6 +694,15 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects) anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakePrismDXDYDZ2Ways(myBase, dx, dy, dz); } + + if (!anObj->_is_nil() && !IsPreview()) + { + 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 7172dcff3..2a5d00b43 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -390,9 +390,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; } //================================================================================= @@ -413,7 +414,15 @@ bool GenerationGUI_RevolDlg::execute (ObjectList& objects) } if (!anObj->_is_nil()) + { + if (!IsPreview()) + { + 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 5c6383a4b..fdf1778e3 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,17 @@ bool OperationGUI_ArchimedeDlg::execute( ObjectList& objects ) getOperation() )->MakeArchimede( myShape, aWeight, aWaterDensity, aMeshDeflection ); if ( !anObj->_is_nil() ) + { + if ( !IsPreview() ) + { + 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 4b2b0ea47..b75458ec9 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -85,7 +85,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 QtxDoubleSpinBox(myGrp1)), row++, 2); + aLayout->addWidget((mySpinBox[ SpinBox1 ] = new SalomeApp_DoubleSpinBox(myGrp1)), row++, 2); aLayout->setRowStretch(row, 10); // Create second group @@ -146,7 +146,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg (GeometryGUI* theGeometryGUI, Q // Set range of spinboxes double SpecificStep = 10.0; - QMap< int, QtxDoubleSpinBox* >::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); @@ -176,7 +176,7 @@ OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg() void OperationGUI_ChamferDlg::Init() { // Set Initial values of spinboxes - QMap< int, QtxDoubleSpinBox* >::iterator anIter; + QMap< int, SalomeApp_DoubleSpinBox* >::iterator anIter; for (anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter) anIter.value()->setValue(5); @@ -214,7 +214,7 @@ void OperationGUI_ChamferDlg::Init() this, SLOT(LineEditReturnPressed())); // spin boxes - QMap< int, QtxDoubleSpinBox* >::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))); @@ -250,26 +250,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; @@ -280,38 +280,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; @@ -643,8 +643,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 QtxDoubleSpinBox(theParent); - mySpinBox[ theSpin2Id ] = new QtxDoubleSpinBox(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); @@ -740,14 +740,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; } } @@ -758,6 +794,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() && @@ -767,6 +804,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) { @@ -776,6 +815,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())-> @@ -784,6 +828,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) @@ -794,18 +843,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; @@ -818,6 +879,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())-> @@ -825,11 +891,20 @@ 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()) + { + if (!IsPreview()) + 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 2a043f33d..dfbe25d92 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -32,10 +32,10 @@ #include +class SalomeApp_DoubleSpinBox; class QGroupBox; class QPushButton; class QLineEdit; -class QtxDoubleSpinBox; class QGridLayout; class QRadioButton; @@ -105,7 +105,7 @@ private: QMap< int, QPushButton* > mySelBtn; QMap< int, QLineEdit* > mySelName; - QMap< int, QtxDoubleSpinBox* > mySpinBox; + QMap< int, SalomeApp_DoubleSpinBox* > mySpinBox; QMap< int, QRadioButton* > myRadioButton; }; diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.cxx b/src/OperationGUI/OperationGUI_ClippingDlg.cxx index 004513262..b24298447 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.cxx +++ b/src/OperationGUI/OperationGUI_ClippingDlg.cxx @@ -74,13 +74,13 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI, TextLabelNear = new QLabel( tr( "Near" ), GroupArguments ); GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 ); - SpinBox_Near = new QtxDoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments ); + SpinBox_Near = new SalomeApp_DoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments ); GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 ); TextLabelFar = new QLabel( tr( "Far" ), GroupArguments ); GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 ); - SpinBox_Far = new QtxDoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments ); + SpinBox_Far = new SalomeApp_DoubleSpinBox( COORD_MIN, COORD_MAX, 10.0, 3, 10, GroupArguments ); GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 ); resetButton = new QPushButton( tr( "Reset" ), GroupArguments ); diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.h b/src/OperationGUI/OperationGUI_ClippingDlg.h index 0d794cd0c..1e6cba6c6 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.h +++ b/src/OperationGUI/OperationGUI_ClippingDlg.h @@ -32,7 +32,7 @@ class QGroupBox; class QLabel; class QPushButton; class QComboBox; -class QtxDoubleSpinBox; +class SalomeApp_DoubleSpinBox; enum ViewerTypes { VTK, OCC, OTHER }; @@ -58,9 +58,9 @@ private: QGroupBox* GroupArguments; QLabel* TextLabelNear; - QtxDoubleSpinBox* SpinBox_Near; + SalomeApp_DoubleSpinBox* SpinBox_Near; QLabel* TextLabelFar; - QtxDoubleSpinBox* SpinBox_Far; + SalomeApp_DoubleSpinBox* SpinBox_Far; QPushButton* resetButton; QComboBox* TypeCB; diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 358c3db6d..4fd97b6be 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; @@ -586,13 +586,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; } } @@ -603,12 +622,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()); @@ -617,14 +640,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; @@ -636,17 +670,28 @@ 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()) + { + if (!IsPreview()) + 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 641f983d5..aaf190676 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -422,9 +422,20 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_BoxDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool PrimitiveGUI_BoxDlg::isValid (QString&) +bool PrimitiveGUI_BoxDlg::isValid (QString& msg) { - return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : true; + bool ok = true; + 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; + + 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; } //================================================================================= @@ -453,6 +464,14 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects) double z = GroupDimensions->SpinBox_DZ->value(); anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())->MakeBoxDXDYDZ(x, y, z); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 f37eebd93..21afcbac5 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -438,11 +438,26 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_ConeDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool PrimitiveGUI_ConeDlg::isValid (QString&) +bool PrimitiveGUI_ConeDlg::isValid (QString& msg) { if (!getRadius1() && !getRadius2()) return false; - 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; + } + ok = fabs( getHeight() ) > Precision::Confusion() && ok; + return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok; } //================================================================================= @@ -460,12 +475,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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 98002f49a..e5d76a05b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -434,9 +434,21 @@ 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; + } + ok = fabs( getHeight() ) > Precision::Confusion() && ok; + return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok; } //================================================================================= @@ -454,12 +466,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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 86d3e4395..b6131514c 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx @@ -542,13 +542,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); @@ -562,6 +568,7 @@ bool PrimitiveGUI_DiskDlg::isValid (QString&) bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects) { bool res = false; + QStringList aParameters; GEOM::GEOM_Object_var anObj; @@ -569,11 +576,21 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects) case 0: anObj = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation())-> MakeDiskR(getRadius(), myOrientationType); + if (!anObj->_is_nil() && !IsPreview()) + { + 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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 6e85ad516..27e362206 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,19 @@ 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); + if (!anObj->_is_nil() && !IsPreview()) + { + aParameters << GroupDimensions->SpinBox_DX->text(); + aParameters << GroupDimensions->SpinBox_DY->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; break; case 1: @@ -493,6 +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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 79a9cf443..32192677b 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,12 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) { if ( !CORBA::is_nil( myPoint ) ) { anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSpherePntR( myPoint, getRadius() ); + if (!anObj->_is_nil() && !IsPreview()) + { + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } res = true; } break; @@ -403,6 +414,12 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) case 1 : { anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeSphereR( getRadius() ); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 cae40c21d..7ca9f5d40 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -431,9 +431,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; } //================================================================================= @@ -451,12 +462,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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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()); + if (!anObj->_is_nil() && !IsPreview()) + { + 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 430cdf158..e70168621 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx @@ -84,7 +84,7 @@ RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg( GeometryGUI* theGeometryGUI, Q myIsParameterGr->addButton( rb2, 1 ); rb1->setChecked( true ); - myValEdt = new QtxDoubleSpinBox( 0., 1., 0.1, 3, 32, GroupPoints->Box ); + myValEdt = new SalomeApp_DoubleSpinBox( 0., 1., 0.1, 3, 32, GroupPoints->Box ); myValEdt->setValue( 0.5 ); QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->Box ); @@ -338,9 +338,10 @@ 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(); + bool ok = myValEdt->isValid( msg, !IsPreview() ); + return !myObject->_is_nil() && ok; } //================================================================================= @@ -353,7 +354,17 @@ bool RepairGUI_DivideEdgeDlg::execute( ObjectList& objects ) ( myObject, -1, myValEdt->value(), getIsByParameter() ); bool aResult = !anObj->_is_nil(); if ( aResult ) + { + if ( !IsPreview() ) + { + 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 1dbbe05e1..d7ceed40e 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h @@ -29,7 +29,7 @@ #include class DlgRef_1SelExt; -class QtxDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QButtonGroup; //================================================================================= @@ -63,7 +63,7 @@ private: DlgRef_1SelExt* GroupPoints; QButtonGroup* myIsParameterGr; - QtxDoubleSpinBox* myValEdt; + SalomeApp_DoubleSpinBox* myValEdt; protected slots: void ClickOnOk(); diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index 8cebf173a..b1c641131 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -82,7 +82,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare GroupPoints->LineEdit1->setReadOnly( true ); QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box ); - myTolEdt = new QtxDoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 7, GroupPoints->Box ); + myTolEdt = new SalomeApp_DoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 7, GroupPoints->Box ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); QGridLayout* boxLayout = new QGridLayout( GroupPoints->Box ); @@ -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 QtxDoubleSpinBox( 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; } //================================================================================= @@ -408,8 +413,14 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj = GEOM::GEOM_IShapesOperations::_narrow ( getOperation() )->MakeGlueFaces( myObject, myTolEdt->value(), true ); aResult = !anObj->_is_nil(); - if ( aResult ) + if ( aResult && !IsPreview() ) + { + QStringList aParameters; + aParameters << myTolEdt->text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + objects.push_back( anObj._retn() ); + } break; } case 1: @@ -456,7 +467,15 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects ) aResult = !anObj->_is_nil(); if ( aResult ) + { + if ( !IsPreview() ) + { + 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 431a43c96..8d838ab85 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.h +++ b/src/RepairGUI/RepairGUI_GlueDlg.h @@ -29,7 +29,7 @@ #include class DlgRef_1SelExt; -class QtxDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QPushButton; class QCheckBox; @@ -73,8 +73,8 @@ private: DlgRef_1SelExt* GroupPoints; DlgRef_1SelExt* GroupPoints2; - QtxDoubleSpinBox* myTolEdt; - QtxDoubleSpinBox* 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 6686cf6d6..a5d6465d9 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -75,7 +75,7 @@ RepairGUI_SewingDlg::RepairGUI_SewingDlg( GeometryGUI* theGeometryGUI, QWidget* QGridLayout* aLay = new QGridLayout( GroupPoints->Box ); aLay->setMargin( 0 ); aLay->setSpacing( 6 ); - myTolEdt = new QtxDoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 10, GroupPoints->Box ); + myTolEdt = new SalomeApp_DoubleSpinBox( 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, 7, 10, GroupPoints->Box ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box ); myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ), @@ -263,10 +263,11 @@ 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. ); + bool ok = myTolEdt->isValid( msg, !IsPreview() ); + return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && ok; } //================================================================================= @@ -297,7 +298,15 @@ 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 ) + { + if ( !IsPreview() ) + { + 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 5268ce6df..3bd6dfb7e 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.h +++ b/src/RepairGUI/RepairGUI_SewingDlg.h @@ -29,7 +29,7 @@ #include class DlgRef_1SelExt; -class QtxDoubleSpinBox; +class SalomeApp_DoubleSpinBox; class QPushButton; //================================================================================= @@ -59,7 +59,7 @@ private: GEOM::GEOM_Object_var myObject; DlgRef_1SelExt* GroupPoints; - QtxDoubleSpinBox* 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 e72ae676e..1c4761341 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx @@ -32,6 +32,8 @@ #include #include +#include +#include #include #include #include @@ -124,8 +126,8 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myFixShapeTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); - myFixShapeMaxTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myFixShapeTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myFixShapeMaxTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( myFixShapeTol3D, 0, 1 ); @@ -139,7 +141,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myFixFaceSizeTol = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myFixFaceSizeTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); aLay->addWidget( new QLabel( tr( "GEOM_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( myFixFaceSizeTol, 0, 1 ); @@ -151,7 +153,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - myDropSmallEdgesTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myDropSmallEdgesTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 ); @@ -163,8 +165,8 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySplitAngleAngle = new QtxDoubleSpinBox( 0, 360, 1, 10, 10, w ); - mySplitAngleMaxTol = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + mySplitAngleAngle = new SalomeApp_DoubleSpinBox( 0, 360, 1, 10, 10, w ); + mySplitAngleMaxTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); aLay->addWidget( new QLabel( tr( "GEOM_ANGLE_1" ), w ), 0, 0 ); aLay->addWidget( mySplitAngleAngle, 0, 1 ); @@ -178,7 +180,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 ); @@ -190,7 +192,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySplitContTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + mySplitContTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); mySplitContSurfCont = new QComboBox( w ); mySplitContSurfCont->addItems( aContinueties ); mySplitContCurvCont = new QComboBox( w ); @@ -214,12 +216,12 @@ void RepairGUI_ShapeProcessDlg::init() myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), w ); myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), w ); - myBSplineTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myBSplineTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); - myBSplineTol2D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myBSplineTol2D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); - 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 ); @@ -256,7 +258,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 QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + myToBezierMaxTol = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); aLay->addWidget( myToBezierSurfModeChk, 0, 0 ); aLay->addWidget( myToBezier3DCurveChk, 1, 0 ); @@ -271,7 +273,7 @@ void RepairGUI_ShapeProcessDlg::init() QGridLayout* aLay = new QGridLayout( w ); aLay->setMargin( 9 ); aLay->setSpacing( 6 ); - mySameParameterTol3D = new QtxDoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); + mySameParameterTol3D = new SalomeApp_DoubleSpinBox( 0., 100., 1e-7, 10, 10, w ); aLay->addWidget( new QLabel( tr( "GEOM_3D_TOLERANCE" ), w ), 0, 0 ); aLay->addWidget( mySameParameterTol3D, 0, 1 ); @@ -498,10 +500,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 ) ) @@ -516,10 +518,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 ) ) @@ -528,6 +530,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 : @@ -543,6 +560,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() ) { @@ -555,7 +588,7 @@ bool RepairGUI_ShapeProcessDlg::isValid( QString& msg ) msg += tr( "ERROR_NO_OPERATORS" ); error = true; } - return !error; + return !error && ok; } //================================================================================= @@ -593,7 +626,22 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects ) if ( anObj->_is_nil() ) anErrorObjNames << GEOMBase::GetName( obj ); else + { + if ( !IsPreview() ) + { + 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() ) @@ -754,6 +802,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 6afeea1df..e5fd0e902 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.h +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.h @@ -31,8 +31,8 @@ #include class DlgRef_1Sel; -class QSpinBox; -class QtxDoubleSpinBox; +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; - QtxDoubleSpinBox* myFixShapeTol3D; - QtxDoubleSpinBox* myFixShapeMaxTol3D; + SalomeApp_DoubleSpinBox* myFixShapeTol3D; + SalomeApp_DoubleSpinBox* myFixShapeMaxTol3D; - QtxDoubleSpinBox* myFixFaceSizeTol; + SalomeApp_DoubleSpinBox* myFixFaceSizeTol; - QtxDoubleSpinBox* myDropSmallEdgesTol3D; + SalomeApp_DoubleSpinBox* myDropSmallEdgesTol3D; - QtxDoubleSpinBox* mySplitAngleAngle; - QtxDoubleSpinBox* mySplitAngleMaxTol; + SalomeApp_DoubleSpinBox* mySplitAngleAngle; + SalomeApp_DoubleSpinBox* mySplitAngleMaxTol; - QSpinBox* mySplitClosedFacesNum; + SalomeApp_IntSpinBox* mySplitClosedFacesNum; - QtxDoubleSpinBox* mySplitContTol3D; + SalomeApp_DoubleSpinBox* mySplitContTol3D; QComboBox* mySplitContSurfCont; QComboBox* mySplitContCurvCont; QCheckBox* myBSplineSurfModeChk; QCheckBox* myBSpline3DCurveChk; QCheckBox* myBSpline2DCurveChk; - QtxDoubleSpinBox* myBSplineTol3D; - QtxDoubleSpinBox* 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; - QtxDoubleSpinBox* myToBezierMaxTol; + SalomeApp_DoubleSpinBox* myToBezierMaxTol; - QtxDoubleSpinBox* mySameParameterTol3D; + SalomeApp_DoubleSpinBox* mySameParameterTol3D; private slots: void onOk(); diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 5bce037a9..471fdd0fa 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -177,6 +177,9 @@ void TransformationGUI_MultiRotationDlg::Init() connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )), + this, SLOT(TextValueChangedInSpinBox( const QString& ))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); @@ -464,6 +467,17 @@ void TransformationGUI_MultiRotationDlg::enterEvent (QEvent*) ActivateThisDialog(); } +//================================================================================= +// function : TextValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString& s){ + bool isDigit; + s.toDouble(&isDigit); + if(!isDigit) + GroupDimensions->CheckButton1->setChecked(false); + GroupDimensions->CheckButton1->setEnabled(isDigit); +} //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -515,9 +529,21 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_MultiRotationDlg::isValid (QString& /*msg*/) +bool TransformationGUI_MultiRotationDlg::isValid (QString& msg) { - return !(myBase->_is_nil() || myVector->_is_nil()); + bool ok = true; + switch(getConstructorId()){ + case 0: + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + break; + case 1: + ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok; + break; + } + return !(myBase->_is_nil() || myVector->_is_nil()) && ok; } //================================================================================= @@ -529,12 +555,15 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects) bool res = false; GEOM::GEOM_Object_var anObj; + QStringList aParameters; switch (getConstructorId()) { case 0: if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) { anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> MultiRotate1D(myBase, myVector, myNbTimes1); + if(!IsPreview()) + aParameters<SpinBox_DX->text(); res = true; } break; @@ -542,13 +571,22 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects) if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVector)) { anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> MultiRotate2D(myBase, myVector, myAng, myNbTimes1, myStep, myNbTimes2); + if(!IsPreview()) { + aParameters<SpinBox_DX1->text(); + aParameters<SpinBox_DY1->text(); + aParameters<SpinBox_DX2->text(); + aParameters<SpinBox_DY2->text(); + } res = true; } break; } - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back(anObj._retn()); + } return res; } diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h index b1df2cb25..1134f7cfc 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h @@ -77,6 +77,7 @@ private slots: void SetEditCurrentArgument(); void ReverseAngle(); void ValueChangedInSpinBox( double ); + void TextValueChangedInSpinBox( const QString& ); void ConstructorsClicked( int ); void SetDoubleSpinBoxStep( double ); }; diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index d86cd23bd..6cd252598 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -187,6 +187,13 @@ void TransformationGUI_MultiTranslationDlg::Init() connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )), + this, SLOT(TextValueChangedInSpinBox(const QString& ))); + connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )), + this, SLOT(TextValueChangedInSpinBox(const QString& ))); + connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )), + this, SLOT(TextValueChangedInSpinBox(const QString& ))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); @@ -509,6 +516,40 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*) ActivateThisDialog(); } +//================================================================================= +// function : TextValueChangedInSpinBox +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QString& s) +{ + QObject* send = (QObject*)sender(); + bool isDigit = true; + + switch (getConstructorId()) { + case 0: + GroupPoints->SpinBox_DX->text().toDouble(&isDigit); + if(!isDigit){ + GroupPoints->CheckButton1->setChecked(false); + } + GroupPoints->CheckButton1->setEnabled(isDigit); + break; + case 1: + if (send == GroupDimensions->SpinBox_DX1) { + GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit); + if(!isDigit) + GroupDimensions->CheckButton1->setChecked(false); + GroupDimensions->CheckButton1->setEnabled(isDigit); + } + else if(send == GroupDimensions->SpinBox_DX2){ + GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit); + if(!isDigit) + GroupDimensions->CheckButton2->setChecked(false); + GroupDimensions->CheckButton2->setEnabled(isDigit); + } + break; + } +} + //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -516,7 +557,6 @@ void TransformationGUI_MultiTranslationDlg::enterEvent (QEvent*) void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox (double newValue) { QObject* send = (QObject*)sender(); - switch (getConstructorId()) { case 0: if (send == GroupPoints->SpinBox_DX) @@ -583,14 +623,24 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio // function : isValid // purpose : //================================================================================= -bool TransformationGUI_MultiTranslationDlg::isValid (QString& /*msg*/) +bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg) { int aConstructorId = getConstructorId(); - - if (aConstructorId == 0) - return !(myBase->_is_nil() || myVectorU->_is_nil()); - else if (aConstructorId == 1) - return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()); + + if (aConstructorId == 0) { + bool ok = true; + ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; + ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok; + return !(myBase->_is_nil() || myVectorU->_is_nil()) && ok; + } + else if (aConstructorId == 1) { + bool ok = true; + ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok; + return !(myBase->_is_nil() || myVectorU->_is_nil() || myVectorV->_is_nil()) && ok; + } return 0; } @@ -604,11 +654,17 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; + QStringList aParameters; + switch (getConstructorId()) { case 0: if (!CORBA::is_nil(myBase) && !CORBA::is_nil(myVectorU)) { anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> MultiTranslate1D(myBase, myVectorU, myStepU, myNbTimesU); + if(!IsPreview()) { + aParameters<SpinBox_DX->text(); + aParameters<SpinBox_DY->text(); + } res = true; } break; @@ -618,13 +674,22 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects) anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> MultiTranslate2D(myBase, myVectorU, myStepU, myNbTimesU, myVectorV, myStepV, myNbTimesV); + if(!IsPreview()) { + aParameters<SpinBox_DX1->text(); + aParameters<SpinBox_DY1->text(); + aParameters<SpinBox_DX2->text(); + aParameters<SpinBox_DY2->text(); + } res = true; } break; } - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back(anObj._retn()); + } return res; } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h index 00f9bf430..ab7d67b6a 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h @@ -78,6 +78,7 @@ private slots: void ReverseStepU(); void ReverseStepV(); void ValueChangedInSpinBox( double ); + void TextValueChangedInSpinBox( const QString& ); void ConstructorsClicked( int ); void SetDoubleSpinBoxStep( double ); }; diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx index 49eabdf70..f548ca48e 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -278,7 +278,7 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg ) return false; } } - return true; + return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ); } //================================================================================= @@ -295,8 +295,12 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) for ( int i = 0; i < myObjects.length(); i++ ) { anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->OffsetShapeCopy( myObjects[i], GetOffset() ); - if ( !anObj->_is_nil() ) + if ( !anObj->_is_nil() ) { + if(!IsPreview()) { + anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData()); + } objects.push_back( anObj._retn() ); + } } } else { diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index a409d2497..fda7909f4 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -151,6 +151,9 @@ void TransformationGUI_RotationDlg::Init() connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged( const QString& )), + this, SLOT(TextValueChangedInSpinBox( const QString&))); + connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); @@ -465,6 +468,16 @@ void TransformationGUI_RotationDlg::enterEvent (QEvent*) ActivateThisDialog(); } +void TransformationGUI_RotationDlg::TextValueChangedInSpinBox( const QString& s) +{ + bool isDigit = true; + s.toDouble(&isDigit); + if(!isDigit) { + GroupPoints->CheckButton2->setChecked(false); + } + GroupPoints->CheckButton2->setEnabled(isDigit); +} + //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -487,16 +500,16 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_RotationDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_RotationDlg::isValid (QString& /*msg*/) +bool TransformationGUI_RotationDlg::isValid (QString& msg) { - if (myObjects.length() < 1) return false; - switch (getConstructorId()) { - case 0: - return !(myAxis->_is_nil()); + case 0: { + bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ); + return myObjects.length() > 0 && !(myAxis->_is_nil()) && ok; break; + } case 1: - return !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil()); + return myObjects.length() > 0 && !(myCentPoint->_is_nil() || myPoint1->_is_nil() || myPoint2->_is_nil()); break; default: break; @@ -518,13 +531,19 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects) switch (getConstructorId()) { case 0: { + QStringList aParameters; + aParameters<SpinBox_DX->text(); if (toCreateCopy) { for (int i = 0; i < myObjects.length(); i++) { myCurrObject = myObjects[i]; anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> RotateCopy(myObjects[i], myAxis, GetAngle() * PI180); - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) { + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } objects.push_back(anObj._retn()); + } } } else { @@ -532,8 +551,13 @@ bool TransformationGUI_RotationDlg::execute (ObjectList& objects) myCurrObject = myObjects[i]; anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> Rotate(myObjects[i], myAxis, GetAngle() * PI180); - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) { + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + updateAttributes(anObj, aParameters); + } objects.push_back(anObj._retn()); + } } } res = true; diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.h b/src/TransformationGUI/TransformationGUI_RotationDlg.h index a3edfb5b7..9b774f704 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.h @@ -74,6 +74,7 @@ private slots: void SelectionIntoArgument(); void SetEditCurrentArgument(); void ValueChangedInSpinBox(); + void TextValueChangedInSpinBox( const QString& ); void CreateCopyModeChanged( bool ); void ConstructorsClicked( int ); void onReverse(); diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index e0b248dd7..c441f6204 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include @@ -93,13 +93,13 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg (GeometryGUI* theGeometry LineEdit2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); TextLabel3 = new QLabel(tr("GEOM_SCALE_FACTOR"), GroupBox1); - SpinBox_FX = new QtxDoubleSpinBox(GroupBox1); + SpinBox_FX = new SalomeApp_DoubleSpinBox(GroupBox1); TextLabel4 = new QLabel(tr("GEOM_SCALE_FACTOR_Y"), GroupBox1); - SpinBox_FY = new QtxDoubleSpinBox(GroupBox1); + SpinBox_FY = new SalomeApp_DoubleSpinBox(GroupBox1); TextLabel5 = new QLabel(tr("GEOM_SCALE_FACTOR_Z"), GroupBox1); - SpinBox_FZ = new QtxDoubleSpinBox(GroupBox1); + SpinBox_FZ = new SalomeApp_DoubleSpinBox(GroupBox1); CheckBoxCopy = new QCheckBox(tr("GEOM_CREATE_COPY"), GroupBox1); CheckBoxCopy->setChecked(true); @@ -460,18 +460,22 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_ScaleDlg::isValid (QString& /*msg*/) +bool TransformationGUI_ScaleDlg::isValid (QString& msg) { - if (myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001) - { - // && !myPoint->_is_nil() - if (getConstructorId() == 0) - return true; - if (fabs(SpinBox_FY->value()) > 0.00001 && - fabs(SpinBox_FZ->value()) > 0.00001) - return true; + // && !myPoint->_is_nil() + if (getConstructorId() == 0) { + bool ok = SpinBox_FX->isValid( msg, !IsPreview() ); + return myObjects.length() > 0 && fabs(SpinBox_FX->value()) > 0.00001 && ok; } - return false; + + bool ok = true; + ok = SpinBox_FX->isValid( msg, !IsPreview() ) && ok; + ok = SpinBox_FY->isValid( msg, !IsPreview() ) && ok; + ok = SpinBox_FZ->isValid( msg, !IsPreview() ) && ok; + return myObjects.length() > 0 && + fabs(SpinBox_FX->value()) > 0.00001 && + fabs(SpinBox_FY->value()) > 0.00001 && + fabs(SpinBox_FZ->value()) > 0.00001 && ok; } //================================================================================= @@ -494,8 +498,11 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects) { anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> ScaleShapeCopy(myObjects[i], myPoint, SpinBox_FX->value()); - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) + anObj->SetParameters(SpinBox_FX->text().toLatin1().constData()); objects.push_back(anObj._retn()); + } } } else @@ -520,6 +527,13 @@ bool TransformationGUI_ScaleDlg::execute (ObjectList& objects) ScaleShapeAlongAxesCopy(myObjects[i], myPoint, SpinBox_FX->value(), SpinBox_FY->value(), SpinBox_FZ->value()); if (!anObj->_is_nil()) + if(!IsPreview()) { + QStringList aParameters; + aParameters<text(); + aParameters<text(); + aParameters<text(); + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + } objects.push_back(anObj._retn()); } } diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.h b/src/TransformationGUI/TransformationGUI_ScaleDlg.h index 54d42f77b..0c22428d0 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.h +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.h @@ -33,7 +33,7 @@ class QGroupBox; class QLabel; class QLineEdit; class QPushButton; -class QtxDoubleSpinBox; +class SalomeApp_DoubleSpinBox; //================================================================================= // class : TransformationGUI_ScaleDlg @@ -77,9 +77,9 @@ private: QLabel* TextLabel3; QLabel* TextLabel4; QLabel* TextLabel5; - QtxDoubleSpinBox* SpinBox_FX; - QtxDoubleSpinBox* SpinBox_FY; - QtxDoubleSpinBox* SpinBox_FZ; + SalomeApp_DoubleSpinBox* SpinBox_FX; + SalomeApp_DoubleSpinBox* SpinBox_FY; + SalomeApp_DoubleSpinBox* SpinBox_FZ; QCheckBox* CheckBoxCopy; private slots: diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 17ee150b4..0ded760cb 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -517,19 +517,26 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() // function : isValid // purpose : //================================================================================= -bool TransformationGUI_TranslationDlg::isValid (QString& /*msg*/) +bool TransformationGUI_TranslationDlg::isValid (QString& msg) { int aConstructorId = getConstructorId(); - if (myObjects.length() < 1) return false; - switch (aConstructorId) { - case 0: - return true; + case 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; + return myObjects.length() > 0 && ok; + } case 1: - return !(myPoint1->_is_nil() || myPoint2->_is_nil()); + return myObjects.length() > 0 && !(myPoint1->_is_nil() || myPoint2->_is_nil()); case 2: - return !(myVector->_is_nil()); + { + bool ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ); + return myObjects.length() > 0 && !(myVector->_is_nil()) && ok; + } default: break; } @@ -554,13 +561,21 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) double dy = GroupPoints->SpinBox2->value(); double dz = GroupPoints->SpinBox3->value(); + QStringList aParameters; + aParameters<SpinBox1->text(); + aParameters<SpinBox2->text(); + aParameters<SpinBox3->text(); + if (toCreateCopy) { for (int i = 0; i < myObjects.length(); i++) { myCurrObject = myObjects[i]; anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> TranslateDXDYDZCopy(myObjects[i], dx, dy, dz); - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); objects.push_back(anObj._retn()); + } } } else { @@ -568,8 +583,13 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) myCurrObject = myObjects[i]; anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> TranslateDXDYDZ(myObjects[i], dx, dy, dz); - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) { + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + updateAttributes(anObj, aParameters); + } objects.push_back(anObj._retn()); + } } } res = true; @@ -600,6 +620,8 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) } case 2: { + QStringList aParameters; + aParameters<SpinBox3->text(); bool byDistance = GroupPoints->CheckBox1->isChecked(); if (byDistance) { double aDistance = GroupPoints->SpinBox3->value(); @@ -607,8 +629,13 @@ bool TransformationGUI_TranslationDlg::execute (ObjectList& objects) myCurrObject = myObjects[i]; anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())-> TranslateVectorDistance(myObjects[i], myVector, aDistance, toCreateCopy); - if (!anObj->_is_nil()) + if (!anObj->_is_nil()) { + if(!IsPreview()) { + anObj->SetParameters(GeometryGUI::JoinObjectParameters(aParameters)); + updateAttributes(anObj, aParameters); + } objects.push_back(anObj._retn()); + } } } else {