From: yfr Date: Tue, 23 Sep 2003 14:47:48 +0000 (+0000) Subject: Dcq : Add MakeShell MakeSolid and New GUI Architecture X-Git-Tag: ihm_1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=07a0b9e17c9c784d2f194834ba1e4ed1e1377e79;p=modules%2Fgeom.git Dcq : Add MakeShell MakeSolid and New GUI Architecture --- diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index c8460ca50..b66693702 100644 --- a/src/GEOM/GEOM_Gen_i.cc +++ b/src/GEOM/GEOM_Gen_i.cc @@ -4243,6 +4243,93 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCompound( const GEOM::GEOM_Gen::ListOfIOR& } +//================================================================================= +// function : MakeShell() +// purpose : Make a compound from a list containing one or more shapes +//================================================================================= +GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeShell( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) + throw (SALOME::SALOME_Exception) +{ + GEOM::GEOM_Shape_var result ; + BRepTools_Quilt Glue; + TopoDS_Shape C; + + for ( unsigned int i = 0; i < ListShapes.length(); i++) { + GEOM::GEOM_Shape_var aShape = GetIORFromString( ListShapes[i] ); + TopoDS_Shape Shape = GetTopoShape(aShape) ; + if( Shape.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Shell aborted : null shape during operation", SALOME::BAD_PARAM); + } + Glue.Add(Shape) ; + } + + TopExp_Explorer exp(Glue.Shells(), TopAbs_SHELL); + Standard_Integer ish = 0; + for (; exp.More(); exp.Next()) { + C = exp.Current(); + ish++; + } + + if (ish != 1) + C = Glue.Shells(); + + if ( C.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Null result : Shell operation aborted", SALOME::BAD_PARAM); + } + else { + result = CreateObject(C) ; + InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc) ; + } + return result; +} + + +//================================================================================= +// function : MakeSolid() +// purpose : Make a compound from a list containing one or more shapes +//================================================================================= +GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSolid( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) + throw (SALOME::SALOME_Exception) +{ + GEOM::GEOM_Shape_var result ; + Standard_Integer ish = 0; + TopoDS_Compound Res; + TopoDS_Solid Sol; + BRep_Builder B; + TopoDS_Shape Shape; + + B.MakeCompound(Res); + + for ( unsigned int i = 0; i < ListShapes.length(); i++) { + GEOM::GEOM_Shape_var aShape = GetIORFromString( ListShapes[i] ); + TopoDS_Shape Sh = GetTopoShape(aShape) ; + if( Sh.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Solid aborted : null shape during operation", SALOME::BAD_PARAM); + } + B.MakeSolid(Sol); + B.Add(Sol,Sh); + BRepClass3d_SolidClassifier SC(Sol); + SC.PerformInfinitePoint(Precision::Confusion()); + if (SC.State() == TopAbs_IN) { + B.MakeSolid(Sol); + B.Add(Sol,Sh.Reversed()); + } + B.Add(Res,Sol); + ish++; + } + if (ish == 1) { Shape = Sol;} + else { Shape = Res;} + + if ( Shape.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Null result : Solid operation aborted", SALOME::BAD_PARAM); + } + else { + result = CreateObject(Shape) ; + InsertInLabelMoreArguments(Shape, result, ListShapes, myCurrentOCAFDoc) ; + } + return result; +} + //================================================================================ // function : MakeEdge() diff --git a/src/GEOM/GEOM_Gen_i.hh b/src/GEOM/GEOM_Gen_i.hh index 34ad61d8f..753e98e89 100644 --- a/src/GEOM/GEOM_Gen_i.hh +++ b/src/GEOM/GEOM_Gen_i.hh @@ -586,6 +586,10 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, throw (SALOME::SALOME_Exception) ; GEOM::GEOM_Shape_ptr MakeFace (GEOM::GEOM_Shape_ptr wire, CORBA::Boolean wantplanarface) throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakeShell (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) + throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakeSolid (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) + throw (SALOME::SALOME_Exception) ; //-------------------------------------------------------------------// diff --git a/src/GEOMGUI/GEOM_icons.po b/src/GEOMGUI/GEOM_icons.po index ae40262ff..3195286cc 100644 --- a/src/GEOMGUI/GEOM_icons.po +++ b/src/GEOMGUI/GEOM_icons.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "POT-Creation-Date: 2001-06-14 09:11:49 PM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" +"PO-Revision-Date: 2003-09-22 16:39+0200\n" "Last-Translator: FULLNAME \n" "Content-Type: text/plain; charset=iso-8859-1\n" @@ -190,6 +190,10 @@ msgstr "build_face.png" msgid "ICON_DLG_BUILD_SHELL" msgstr "build_shell.png" +#SolidDlg +msgid "ICON_DLG_BUILD_SOLID" +msgstr "build_solid.png" + #WireDlg msgid "ICON_DLG_BUILD_WIRE" msgstr "build_wire.png" diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 665a35438..3c2b93cc8 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" -"PO-Revision-Date: YYYY-MM-DD\n" +"PO-Revision-Date: 2003-09-22 16:38+0200\n" "Last-Translator: FULLNAME \n" "Content-Type: text/plain; charset=iso-8859-1\n" @@ -1005,9 +1005,9 @@ msgstr "Sewing Topologies" msgid "GEOM_SHELL_TITLE" msgstr "Shell Construction" -#: GeometryGUI_ShellDlg.cxx:74 -msgid "GEOM_SHELL_LIST" -msgstr "List Of Connected Faces" +#: GeometryGUI_SolidDlg.cxx:74 +msgid "GEOM_SOLID_TITLE" +msgstr "Solid Construction" #: GeometryGUI_SphereDlg.cxx:50 msgid "GEOM_SPHERE_TITLE" diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 0aa9b4ffc..3130e612a 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -138,20 +138,20 @@ using namespace std; // QT Includes #define INCLUDE_MENUITEM_DEF -#include -#include -#include -#include -#include -#include -#include +// #include +// #include +// #include +// #include +// #include +// #include +// #include #include #include #include -#include -#include -#include -#include +// #include +// #include +// #include +// #include #include "VTKViewer_RenderWindowInteractor.h" #include "VTKViewer_ViewFrame.h" @@ -203,6 +203,8 @@ using namespace std; #include "GeometryGUI_CenterMassDlg.h" // Method CENTER MASS #include "GeometryGUI_InertiaDlg.h" // Method INERTIA #include "GeometryGUI_FaceDlg.h" // Method GEOM::FACE +#include "GeometryGUI_ShellDlg.h" // Method GEOM::SHELL +#include "GeometryGUI_SolidDlg.h" // Method GEOM::SOLID #include "GeometryGUI_FilletDlg.h" // Method FILLET #include "GeometryGUI_ChamferDlg.h" // Method CHAMFER #include "GeometryGUI_FillingHoleDlg.h" // Method FILLING HOLE @@ -1467,6 +1469,51 @@ void GeometryGUI::MakeFaceAndDisplay( GEOM::GEOM_Shape_ptr aWire, const Standard } +//===================================================================================== +// function : MakeShellAndDisplay() +// purpose : +//===================================================================================== +void GeometryGUI::MakeShellAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) +{ + try { + GEOM::GEOM_Shape_var result = myComponentGeom->MakeShell(listShapesIOR) ; + if( result->_is_nil() ) { + myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; + return ; + } + result->NameType(tr("GEOM_SHELL")); + if( Display( result, "" )) + myDesktop->putInfo(tr("GEOM_PRP_DONE")) ; + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return ; +} + + +//===================================================================================== +// function : MakeSolidAndDisplay() +// purpose : +//===================================================================================== +void GeometryGUI::MakeSolidAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) +{ + try { + GEOM::GEOM_Shape_var result = myComponentGeom->MakeSolid(listShapesIOR) ; + if( result->_is_nil() ) { + myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; + return ; + } + result->NameType(tr("GEOM_SOLID")); + if( Display( result, "" )) + myDesktop->putInfo(tr("GEOM_PRP_DONE")) ; + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return ; +} + //===================================================================================== // function : MakeLinearEdgeAndDisplay() @@ -2782,6 +2829,22 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) GeometryGUI_FaceDlg *aDlg = new GeometryGUI_FaceDlg ( parent, "", Sel ) ; break ; } + + case 315: // GEOM::SHELL + { + GeomGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); + GeometryGUI_ShellDlg *aDlg = new GeometryGUI_ShellDlg ( parent, "", Sel ) ; + break ; + } + + case 316: // GEOM::SOLID + { + GeomGUI->EmitSignalDeactivateDialog() ; + SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); + GeometryGUI_SolidDlg *aDlg = new GeometryGUI_SolidDlg ( parent, "", Sel ) ; + break ; + } case 308: // GEOM::COMPOUND { diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 756f2d1d4..ce3eacd0f 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -200,6 +200,8 @@ public : void MakeSewingAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, const Standard_Real precision ) ; void MakeCompoundAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ; + void MakeShellAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ; + void MakeSolidAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ; void MakeLinearEdgeAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) ; void MakeOrientationChangeAndDisplay( GEOM::GEOM_Shape_ptr Shape ) ; diff --git a/src/GEOMGUI/GeometryGUI_1Sel1Spin.cxx b/src/GEOMGUI/GeometryGUI_1Sel1Spin.cxx new file mode 100644 index 000000000..56ee26b90 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel1Spin.cxx @@ -0,0 +1,57 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_1Sel1Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "GeometryGUI_1Sel1Spin.h" + +#include +#include +#include + +/* + * Constructs a GeometryGUI_1Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +GeometryGUI_1Sel1Spin::GeometryGUI_1Sel1Spin( QWidget* parent, const char* name, WFlags fl ) + : GeometryGUI_1Sel1Spin_QTD( parent, name, fl ) +{ + + SpinBox1->close( TRUE ); + + SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ; + Layout2->addWidget( SpinBox_DX, 0, 1 ); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_1Sel1Spin::~GeometryGUI_1Sel1Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/GEOMGUI/GeometryGUI_1Sel1Spin.h b/src/GEOMGUI/GeometryGUI_1Sel1Spin.h new file mode 100644 index 000000000..410b1b96f --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel1Spin.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_1Sel1Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMETRYGUI_1SEL1SPIN_H +#define GEOMETRYGUI_1SEL1SPIN_H + +#include "GeometryGUI_1Sel1Spin_QTD.h" +#include "GeometryGUI_SpinBox.h" + +class GeometryGUI_1Sel1Spin : public GeometryGUI_1Sel1Spin_QTD +{ + Q_OBJECT + +public: + GeometryGUI_1Sel1Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_1Sel1Spin(); + + GeometryGUI_SpinBox* SpinBox_DX; + +}; + +#endif // GEOMETRYGUI_1SEL1SPIN_H diff --git a/src/GEOMGUI/GeometryGUI_1Sel1Spin_QTD.cxx b/src/GEOMGUI/GeometryGUI_1Sel1Spin_QTD.cxx new file mode 100644 index 000000000..90b8d7402 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel1Spin_QTD.cxx @@ -0,0 +1,89 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'GeometryGUI_1Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "GeometryGUI_1Sel1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a GeometryGUI_1Sel1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +GeometryGUI_1Sel1Spin_QTD::GeometryGUI_1Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "GeometryGUI_1Sel1Spin_QTD" ); + resize( 129, 87 ); + setCaption( trUtf8( "GeometryGUI_1Sel1Spin_QTD" ) ); + GeometryGUI_1Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Sel1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + GeometryGUI_1Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_1Sel1Spin_QTD::~GeometryGUI_1Sel1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/GEOMGUI/GeometryGUI_1Sel1Spin_QTD.h b/src/GEOMGUI/GeometryGUI_1Sel1Spin_QTD.h new file mode 100644 index 000000000..f82126363 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel1Spin_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'GeometryGUI_1Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef GEOMETRYGUI_1SEL1SPIN_QTD_H +#define GEOMETRYGUI_1SEL1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class GeometryGUI_1Sel1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + GeometryGUI_1Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_1Sel1Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLabel* TextLabel1; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QSpinBox* SpinBox1; + + +protected: + QGridLayout* GeometryGUI_1Sel1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // GEOMETRYGUI_1SEL1SPIN_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_1Sel4Spin.cxx b/src/GEOMGUI/GeometryGUI_1Sel4Spin.cxx new file mode 100644 index 000000000..11d895791 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel4Spin.cxx @@ -0,0 +1,69 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_1Sel4Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "GeometryGUI_1Sel4Spin.h" + +#include +#include +#include + +/* + * Constructs a GeometryGUI_1Sel4Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +GeometryGUI_1Sel4Spin::GeometryGUI_1Sel4Spin( QWidget* parent, const char* name, WFlags fl ) + : GeometryGUI_1Sel4Spin_QTD( parent, name, fl ) +{ + + SpinBox1->close( TRUE ); + SpinBox2->close( TRUE ); + SpinBox3->close( TRUE ); + SpinBox4->close( TRUE ); + + SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ; + Layout3->addWidget( SpinBox_DX, 0, 2 ); + + SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY" ) ; + Layout3->addWidget( SpinBox_DY, 0, 4 ); + + SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ" ) ; + Layout3->addWidget( SpinBox_DZ, 0, 6 ); + + SpinBox_S = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_S" ) ; + Layout4->addWidget( SpinBox_S, 0, 1 ); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_1Sel4Spin::~GeometryGUI_1Sel4Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/GEOMGUI/GeometryGUI_1Sel4Spin.h b/src/GEOMGUI/GeometryGUI_1Sel4Spin.h new file mode 100644 index 000000000..fae6bdbb2 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel4Spin.h @@ -0,0 +1,51 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_1Sel4Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMETRYGUI_1SEL4SPIN_H +#define GEOMETRYGUI_1SEL4SPIN_H + +#include "GeometryGUI_1Sel4Spin_QTD.h" +#include "GeometryGUI_SpinBox.h" + +class GeometryGUI_1Sel4Spin : public GeometryGUI_1Sel4Spin_QTD +{ + Q_OBJECT + +public: + GeometryGUI_1Sel4Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_1Sel4Spin(); + + GeometryGUI_SpinBox* SpinBox_DX; + GeometryGUI_SpinBox* SpinBox_DY; + GeometryGUI_SpinBox* SpinBox_DZ; + + GeometryGUI_SpinBox* SpinBox_S; + +}; + +#endif // GEOMETRYGUI_1SEL4SPIN_H diff --git a/src/GEOMGUI/GeometryGUI_1Sel4Spin_QTD.cxx b/src/GEOMGUI/GeometryGUI_1Sel4Spin_QTD.cxx new file mode 100644 index 000000000..428d0fa8f --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel4Spin_QTD.cxx @@ -0,0 +1,132 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'GeometryGUI_1Sel4Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "GeometryGUI_1Sel4Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a GeometryGUI_1Sel4Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +GeometryGUI_1Sel4Spin_QTD::GeometryGUI_1Sel4Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "GeometryGUI_1Sel4Spin_QTD" ); + resize( 284, 119 ); + setCaption( trUtf8( "GeometryGUI_1Sel4Spin_QTD" ) ); + GeometryGUI_1Sel4Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Sel4Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout3->addWidget( TextLabel5, 0, 5 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout3->addWidget( TextLabel3, 0, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout3->addWidget( TextLabel4, 0, 3 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox3, 0, 6 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox1, 0, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout3->addWidget( TextLabel2, 0, 0 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox2, 0, 4 ); + + Layout1->addLayout( Layout3, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 0 ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout4->addWidget( TextLabel6, 0, 0 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + + Layout4->addWidget( SpinBox4, 0, 1 ); + + Layout1->addLayout( Layout4, 2, 0 ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + Layout2->addWidget( TextLabel1 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + Layout2->addWidget( PushButton1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + Layout2->addWidget( LineEdit1 ); + + Layout1->addLayout( Layout2, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + GeometryGUI_1Sel4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_1Sel4Spin_QTD::~GeometryGUI_1Sel4Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/GEOMGUI/GeometryGUI_1Sel4Spin_QTD.h b/src/GEOMGUI/GeometryGUI_1Sel4Spin_QTD.h new file mode 100644 index 000000000..a072ab249 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel4Spin_QTD.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'GeometryGUI_1Sel4Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef GEOMETRYGUI_1SEL4SPIN_QTD_H +#define GEOMETRYGUI_1SEL4SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class GeometryGUI_1Sel4Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + GeometryGUI_1Sel4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_1Sel4Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel5; + QLabel* TextLabel3; + QLabel* TextLabel4; + QSpinBox* SpinBox3; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QSpinBox* SpinBox2; + QLabel* TextLabel6; + QSpinBox* SpinBox4; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* GeometryGUI_1Sel4Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout3; + QGridLayout* Layout4; + QHBoxLayout* Layout2; +}; + +#endif // GEOMETRYGUI_1SEL4SPIN_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_1Sel_QTD.cxx b/src/GEOMGUI/GeometryGUI_1Sel_QTD.cxx new file mode 100644 index 000000000..85d7d8ef5 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel_QTD.cxx @@ -0,0 +1,74 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'GeometryGUI_1Sel_QTD.ui' +** +** Created: lun sep 22 17:38:06 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "GeometryGUI_1Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a GeometryGUI_1Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +GeometryGUI_1Sel_QTD::GeometryGUI_1Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "GeometryGUI_1Sel_QTD" ); + resize( 129, 57 ); + setCaption( trUtf8( "GeometryGUI_1Sel_QTD" ) ); + GeometryGUI_1Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_1Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 1, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + GeometryGUI_1Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_1Sel_QTD::~GeometryGUI_1Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/GEOMGUI/GeometryGUI_1Sel_QTD.h b/src/GEOMGUI/GeometryGUI_1Sel_QTD.h new file mode 100644 index 000000000..3850db4b1 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_1Sel_QTD.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'GeometryGUI_1Sel_QTD.ui' +** +** Created: lun sep 22 17:38:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef GEOMETRYGUI_1SEL_QTD_H +#define GEOMETRYGUI_1SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class GeometryGUI_1Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + GeometryGUI_1Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_1Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + + +protected: + QGridLayout* GeometryGUI_1Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // GEOMETRYGUI_1SEL_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_2Sel1Spin.cxx b/src/GEOMGUI/GeometryGUI_2Sel1Spin.cxx new file mode 100644 index 000000000..54ba70102 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_2Sel1Spin.cxx @@ -0,0 +1,57 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_2Sel1Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "GeometryGUI_2Sel1Spin.h" + +#include +#include +#include + +/* + * Constructs a GeometryGUI_2Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +GeometryGUI_2Sel1Spin::GeometryGUI_2Sel1Spin( QWidget* parent, const char* name, WFlags fl ) + : GeometryGUI_2Sel1Spin_QTD( parent, name, fl ) +{ + + SpinBox1->close( TRUE ); + + SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ; + Layout2->addWidget( SpinBox_DX, 0, 1 ); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_2Sel1Spin::~GeometryGUI_2Sel1Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/GEOMGUI/GeometryGUI_2Sel1Spin.h b/src/GEOMGUI/GeometryGUI_2Sel1Spin.h new file mode 100644 index 000000000..d495e696d --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_2Sel1Spin.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_2Sel1Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMETRYGUI_2SEL1SPIN_H +#define GEOMETRYGUI_2SEL1SPIN_H + +#include "GeometryGUI_2Sel1Spin_QTD.h" +#include "GeometryGUI_SpinBox.h" + +class GeometryGUI_2Sel1Spin : public GeometryGUI_2Sel1Spin_QTD +{ + Q_OBJECT + +public: + GeometryGUI_2Sel1Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_2Sel1Spin(); + + GeometryGUI_SpinBox* SpinBox_DX; + +}; + +#endif // GEOMETRYGUI_2SEL1SPIN_H diff --git a/src/GEOMGUI/GeometryGUI_2Sel1Spin_QTD.cxx b/src/GEOMGUI/GeometryGUI_2Sel1Spin_QTD.cxx new file mode 100644 index 000000000..bbaa84e50 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_2Sel1Spin_QTD.cxx @@ -0,0 +1,105 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'GeometryGUI_2Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "GeometryGUI_2Sel1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a GeometryGUI_2Sel1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +GeometryGUI_2Sel1Spin_QTD::GeometryGUI_2Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "GeometryGUI_2Sel1Spin_QTD" ); + resize( 129, 117 ); + setCaption( trUtf8( "GeometryGUI_2Sel1Spin_QTD" ) ); + GeometryGUI_2Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + GeometryGUI_2Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_2Sel1Spin_QTD::~GeometryGUI_2Sel1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/GEOMGUI/GeometryGUI_2Sel1Spin_QTD.h b/src/GEOMGUI/GeometryGUI_2Sel1Spin_QTD.h new file mode 100644 index 000000000..75fd43adc --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_2Sel1Spin_QTD.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'GeometryGUI_2Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef GEOMETRYGUI_2SEL1SPIN_QTD_H +#define GEOMETRYGUI_2SEL1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class GeometryGUI_2Sel1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + GeometryGUI_2Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_2Sel1Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLineEdit* LineEdit2; + QPushButton* PushButton1; + QLabel* TextLabel2; + QSpinBox* SpinBox1; + QLabel* TextLabel3; + + +protected: + QGridLayout* GeometryGUI_2Sel1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // GEOMETRYGUI_2SEL1SPIN_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_2Sel_QTD.cxx b/src/GEOMGUI/GeometryGUI_2Sel_QTD.cxx new file mode 100644 index 000000000..0e0f4c23e --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_2Sel_QTD.cxx @@ -0,0 +1,90 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'GeometryGUI_2Sel_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "GeometryGUI_2Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a GeometryGUI_2Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +GeometryGUI_2Sel_QTD::GeometryGUI_2Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "GeometryGUI_2Sel_QTD" ); + resize( 129, 87 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "GeometryGUI_2Sel_QTD" ) ); + GeometryGUI_2Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_2Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + GeometryGUI_2Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_2Sel_QTD::~GeometryGUI_2Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/GEOMGUI/GeometryGUI_2Sel_QTD.h b/src/GEOMGUI/GeometryGUI_2Sel_QTD.h new file mode 100644 index 000000000..95e04bfbd --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_2Sel_QTD.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'GeometryGUI_2Sel_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef GEOMETRYGUI_2SEL_QTD_H +#define GEOMETRYGUI_2SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class GeometryGUI_2Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + GeometryGUI_2Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_2Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* GeometryGUI_2Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // GEOMETRYGUI_2SEL_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_3Spin.cxx b/src/GEOMGUI/GeometryGUI_3Spin.cxx new file mode 100644 index 000000000..16fbbb980 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_3Spin.cxx @@ -0,0 +1,65 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_3Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "GeometryGUI_3Spin.h" + +#include +#include +#include + +/* + * Constructs a GeometryGUI_3Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +GeometryGUI_3Spin::GeometryGUI_3Spin( QWidget* parent, const char* name, WFlags fl ) + : GeometryGUI_3Spin_QTD( parent, name, fl ) +{ + + SpinBox1->close( TRUE ); + SpinBox2->close( TRUE ); + SpinBox3->close( TRUE ); + + SpinBox_DX = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DX" ) ; + Layout1->addWidget( SpinBox_DX, 0, 1 ); + + SpinBox_DY = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DY" ) ; + Layout1->addWidget( SpinBox_DY, 1, 1 ); + + SpinBox_DZ = new GeometryGUI_SpinBox( GroupBox1, "SpinBox_DZ" ) ; + Layout1->addWidget( SpinBox_DZ, 2, 1 ); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_3Spin::~GeometryGUI_3Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/GEOMGUI/GeometryGUI_3Spin.h b/src/GEOMGUI/GeometryGUI_3Spin.h new file mode 100644 index 000000000..6407f4861 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_3Spin.h @@ -0,0 +1,49 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_3Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMETRYGUI_3SPIN_H +#define GEOMETRYGUI_3SPIN_H + +#include "GeometryGUI_3Spin_QTD.h" +#include "GeometryGUI_SpinBox.h" + +class GeometryGUI_3Spin : public GeometryGUI_3Spin_QTD +{ + Q_OBJECT + +public: + GeometryGUI_3Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_3Spin(); + + GeometryGUI_SpinBox* SpinBox_DX; + GeometryGUI_SpinBox* SpinBox_DY; + GeometryGUI_SpinBox* SpinBox_DZ; + +}; + +#endif // GEOMETRYGUI_3SPIN_H diff --git a/src/GEOMGUI/GeometryGUI_3Spin_QTD.cxx b/src/GEOMGUI/GeometryGUI_3Spin_QTD.cxx new file mode 100644 index 000000000..472015dbc --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_3Spin_QTD.cxx @@ -0,0 +1,90 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'GeometryGUI_3Spin_QTD.ui' +** +** Created: mar sep 23 16:05:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "GeometryGUI_3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a GeometryGUI_3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +GeometryGUI_3Spin_QTD::GeometryGUI_3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "GeometryGUI_3Spin_QTD" ); + resize( 124, 111 ); + setCaption( trUtf8( "GeometryGUI_3Spin_QTD" ) ); + GeometryGUI_3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "GeometryGUI_3Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + GeometryGUI_3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_3Spin_QTD::~GeometryGUI_3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/GEOMGUI/GeometryGUI_3Spin_QTD.h b/src/GEOMGUI/GeometryGUI_3Spin_QTD.h new file mode 100644 index 000000000..18dc38960 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_3Spin_QTD.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'GeometryGUI_3Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef GEOMETRYGUI_3SPIN_QTD_H +#define GEOMETRYGUI_3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QSpinBox; + +class GeometryGUI_3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + GeometryGUI_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~GeometryGUI_3Spin_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QSpinBox* SpinBox3; + QLabel* TextLabel1; + QLabel* TextLabel2; + + +protected: + QGridLayout* GeometryGUI_3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // GEOMETRYGUI_3SPIN_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_BoxDlg.cxx b/src/GEOMGUI/GeometryGUI_BoxDlg.cxx index 659dc19b2..ec3bccf9a 100644 --- a/src/GEOMGUI/GeometryGUI_BoxDlg.cxx +++ b/src/GEOMGUI/GeometryGUI_BoxDlg.cxx @@ -28,32 +28,13 @@ using namespace std; #include "GeometryGUI_BoxDlg.h" -#include "GeometryGUI_SpinBox.h" + +#include +#include #include "GeometryGUI.h" -#include "QAD_Application.h" #include "QAD_Desktop.h" #include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - //================================================================================= // class : GeometryGUI_BoxDlg() @@ -62,154 +43,40 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GeometryGUI_BoxDlg::GeometryGUI_BoxDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +GeometryGUI_BoxDlg::GeometryGUI_BoxDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BOX_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BOX_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_BoxDlg" ); - resize( 335, 220 ); - setCaption( tr( "GEOM_BOX_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_BoxDlgLayout = new QGridLayout( this ); - GeometryGUI_BoxDlgLayout->setSpacing( 6 ); - GeometryGUI_BoxDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_BOX" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_1, 0, 3 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); - GeometryGUI_BoxDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_BoxDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupPoints = new QGroupBox( this, "GroupPoints" ); - GroupPoints->setGeometry( QRect( 10, 10, 280, 90 ) ); - GroupPoints->setTitle( tr( "GEOM_DIAGONAL_POINTS" ) ); - GroupPoints->setFrameShape( QGroupBox::Box ); - GroupPoints->setFrameShadow( QGroupBox::Sunken ); - GroupPoints->setColumnLayout(0, Qt::Vertical ); - GroupPoints->layout()->setSpacing( 0 ); - GroupPoints->layout()->setMargin( 0 ); - GroupPointsLayout = new QGridLayout( GroupPoints->layout() ); - GroupPointsLayout->setAlignment( Qt::AlignTop ); - GroupPointsLayout->setSpacing( 6 ); - GroupPointsLayout->setMargin( 11 ); - SelectButtonPt2 = new QPushButton( GroupPoints, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - GroupPointsLayout->addWidget( SelectButtonPt2, 1, 1 ); - LineEditPt1 = new QLineEdit( GroupPoints, "LineEditPt1" ); - GroupPointsLayout->addWidget( LineEditPt1, 0, 2 ); - LineEditPt2 = new QLineEdit( GroupPoints, "LineEditPt2" ); - GroupPointsLayout->addWidget( LineEditPt2, 1, 2 ); - SelectButtonPt1 = new QPushButton( GroupPoints, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - SelectButtonPt1->setToggleButton( FALSE ); - GroupPointsLayout->addWidget( SelectButtonPt1, 0, 1 ); - TextLabelPt1 = new QLabel( GroupPoints, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointsLayout->addWidget( TextLabelPt1, 0, 0 ); - TextLabelPt2 = new QLabel( GroupPoints, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT_I" ).arg("2") ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - GroupPointsLayout->addWidget( TextLabelPt2, 1, 0 ); - GeometryGUI_BoxDlgLayout->addWidget( GroupPoints, 1, 0 ); - - /***************************************************************/ - GroupDimensions = new QGroupBox( this, "GroupDimensions" ); - GroupDimensions->setGeometry( QRect( 11, 75, 310, 80 ) ); - GroupDimensions->setTitle( tr( "GEOM_BOX_OBJ" ) ); - GroupDimensions->setColumnLayout(0, Qt::Vertical ); - GroupDimensions->setMinimumSize( QSize( 0, 90 ) ); - GroupDimensions->layout()->setSpacing( 0 ); - GroupDimensions->layout()->setMargin( 0 ); - GroupDimensionsLayout = new QGridLayout( GroupDimensions->layout() ); - GroupDimensionsLayout->setAlignment( Qt::AlignTop ); - GroupDimensionsLayout->setSpacing( 6 ); - GroupDimensionsLayout->setMargin( 11 ); - - TextLabel_DZ = new QLabel( GroupDimensions, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DZ, 0, 4 ); - TextLabel_DY = new QLabel( GroupDimensions, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DY, 0, 2 ); - TextLabel_DX = new QLabel( GroupDimensions, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DX, 0, 0 ); - - /* Spin boxes construction */ - SpinBox_DX = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DX" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DX, 0, 1 ); - SpinBox_DY = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DY" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DY, 0, 3 ); - SpinBox_DZ = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DZ" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DZ, 0, 5 ); - - QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed ); - GroupDimensionsLayout->addItem( spacer1, 1, 3 ); - - GeometryGUI_BoxDlgLayout->addWidget( GroupDimensions, 1, 0 ); - - /* Initialisations */ - Init(Sel) ; + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_BOX_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_BOX")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new GeometryGUI_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_DIAGONAL_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new GeometryGUI_3Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_DX")); + GroupDimensions->TextLabel2->setText(tr("GEOM_DY")); + GroupDimensions->TextLabel3->setText(tr("GEOM_DZ")); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + Init(Sel); } @@ -220,7 +87,6 @@ GeometryGUI_BoxDlg::GeometryGUI_BoxDlg( QWidget* parent, const char* name, SALOM GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg() { // no need to delete child widgets, Qt does it all for us - this->destroy(TRUE, TRUE) ; } @@ -228,73 +94,58 @@ GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg() // function : Init() // purpose : //================================================================================= -void GeometryGUI_BoxDlg::Init(SALOME_Selection *Sel) +void GeometryGUI_BoxDlg::Init(SALOME_Selection* Sel) { + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkPoint2 = false; + + /* Vertices Filter for all arguments */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); /* Get setting of step value from file configuration */ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 200.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 200.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 200.0 ) ; + GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + + double initValue = 200.0; + GroupDimensions->SpinBox_DX->SetValue(initValue); + GroupDimensions->SpinBox_DY->SetValue(initValue); + GroupDimensions->SpinBox_DZ->SetValue(initValue); - GroupPoints->show(); - GroupDimensions->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditPt1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Vertices Filter for all arguments */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter( myVertexFilter ); /* filter for next selection */ - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ) ; - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) ) ; - connect( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditPt2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( mySelection, SIGNAL ( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; - /* To close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - this->show() ; /* displays Dialog */ -} + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return ; +} //================================================================================= @@ -303,115 +154,96 @@ void GeometryGUI_BoxDlg::Init(SALOME_Selection *Sel) //================================================================================= void GeometryGUI_BoxDlg::ConstructorsClicked(int constructorId) { - - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomGUI->EraseSimulationShape(); + disconnect(mySelection, 0, this, 0); + myOkPoint1 = myOkPoint2 = false; switch (constructorId) { case 0: { + GroupDimensions->hide(); + resize(0, 0); GroupPoints->show(); - GroupDimensions->hide() ; - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditPt1 ; - Constructor1->setChecked( TRUE ); - LineEditPt1->setText("") ; - LineEditPt2->setText("") ; - myOkPoint1 = myOkPoint2 = false ; - + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + /* filter for next selection */ - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + mySelection->AddFilter(myVertexFilter); + connect (mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1: { GroupPoints->hide(); + resize( 0, 0 ); GroupDimensions->show(); - myConstructorId = constructorId ; - myOkPoint1 = myOkPoint2 = false ; - disconnect( mySelection, 0, this, 0 ); - - double initValue = 200.0 ; - SpinBox_DX->SetValue( initValue ) ; - SpinBox_DY->SetValue( initValue ) ; - SpinBox_DZ->SetValue( initValue ) ; + double initValue = 200.0; + GroupDimensions->SpinBox_DX->SetValue(initValue); + GroupDimensions->SpinBox_DY->SetValue(initValue); + GroupDimensions->SpinBox_DZ->SetValue(initValue); - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myPoint2.SetCoord( initValue, initValue,initValue ) ; + myPoint1.SetCoord(0.0, 0.0, 0.0) ; + myPoint2.SetCoord(initValue, initValue, initValue); - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); + myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); break; } } - return ; + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void GeometryGUI_BoxDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void GeometryGUI_BoxDlg::ClickOnApply() { -//NRI+ : 02/12/2202 - BugID 1065 -// if (mySimulationTopoDs.IsNull()) -// return; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomGUI->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); switch(myConstructorId) - { + { case 0 : { - //NRI+ : 02/12/2202 - BugID 1065 mySelection->ClearFilters() ; - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ; - break ; + if(myOkPoint1 && myOkPoint2) + myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2); + break; } case 1 : { /* Recup args and call method */ - double vx = SpinBox_DX->GetValue() ; - double vy = SpinBox_DY->GetValue() ; - double vz = SpinBox_DZ->GetValue() ; - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(vx, vy, vz) ; - myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ; - break ; + double vx = GroupDimensions->SpinBox_DX->GetValue(); + double vy = GroupDimensions->SpinBox_DY->GetValue(); + double vz = GroupDimensions->SpinBox_DZ->GetValue(); + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(vx, vy, vz); + myGeomGUI->MakeBoxAndDisplay(myPoint1, myPoint2); + break; } } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -421,42 +253,38 @@ void GeometryGUI_BoxDlg::ClickOnCancel() //================================================================================= void GeometryGUI_BoxDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = "" ; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditPt1 ) { - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditPt2 ) { - myOkPoint2 = false ; - } - return ; + myGeomGUI->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint2 = false; + return; } // nbSel == 1 TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; + if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + return; - if ( myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText( aString ) ; - myOkPoint1 = true ; + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + myEditCurrentArgument->setText(aString); + myOkPoint1 = true; } - else if ( myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - myEditCurrentArgument->setText( aString ) ; - myOkPoint2 = true ; + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint2)) { + myEditCurrentArgument->setText(aString); + myOkPoint2 = true; } - if( myOkPoint1 && myOkPoint2 && TestBoxDimensions( myPoint1, myPoint2 ) ) { - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + if(myOkPoint1 && myOkPoint2 && TestBoxDimensions(myPoint1, myPoint2)) { + mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); + myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); } - return ; + return; } @@ -466,69 +294,23 @@ void GeometryGUI_BoxDlg::SelectionIntoArgument() //================================================================================= void GeometryGUI_BoxDlg::SetEditCurrentArgument() { - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: // default constructor - { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - } - else if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - case 1: - { - /* nothing to do here */ - break; - } - } - return ; -} + if(myConstructorId != 0) + return; -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ValueChangedInSpinBox( double newValue ) -{ - if(myConstructorId != 1) - return ; - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; + QPushButton* send = (QPushButton*)sender(); - QObject* send = (QObject*)sender() ; - double vx, vy, vz ; - - if( send == SpinBox_DX ) { - vx = newValue ; - vy = SpinBox_DY->GetValue() ; - vz = SpinBox_DZ->GetValue() ; - } else if ( send == SpinBox_DY ) { - vx = SpinBox_DX->GetValue() ; - vy = newValue ; - vz = SpinBox_DZ->GetValue() ; - } else if (send == SpinBox_DZ ) { - vx = SpinBox_DX->GetValue() ; - vy = SpinBox_DY->GetValue() ; - vz = newValue ; + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; } - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(vx, vy, vz) ; - - if ( TestBoxDimensions( myPoint1, myPoint2 ) ) { - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; } - return ; + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + + return; } @@ -538,45 +320,16 @@ void GeometryGUI_BoxDlg::ValueChangedInSpinBox( double newValue ) //================================================================================= void GeometryGUI_BoxDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupDimensions->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupPoints->setEnabled(false) ; + return; - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->EraseSimulationShape() ; - } - return ; + GeometryGUI_Skeleton::LineEditReturnPressed(); + return; } @@ -586,20 +339,11 @@ void GeometryGUI_BoxDlg::DeactivateActiveDialog() //================================================================================= void GeometryGUI_BoxDlg::ActivateThisDialog() { - - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupDimensions->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupPoints->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; + GeometryGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -609,19 +353,46 @@ void GeometryGUI_BoxDlg::ActivateThisDialog() //================================================================================= void GeometryGUI_BoxDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } //================================================================================= -// function : closeEvent() +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void GeometryGUI_BoxDlg::closeEvent( QCloseEvent* e ) +void GeometryGUI_BoxDlg::ValueChangedInSpinBox(double newValue) { - this->ClickOnCancel() ; /* same than click on cancel button */ + myGeomGUI->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + double vx, vy, vz; + + if(send == GroupDimensions->SpinBox_DX ) { + vx = newValue; + vy = GroupDimensions->SpinBox_DY->GetValue(); + vz = GroupDimensions->SpinBox_DZ->GetValue(); + } else if (send == GroupDimensions->SpinBox_DY) { + vx = GroupDimensions->SpinBox_DX->GetValue(); + vy = newValue; + vz = GroupDimensions->SpinBox_DZ->GetValue(); + } else if (send == GroupDimensions->SpinBox_DZ) { + vx = GroupDimensions->SpinBox_DX->GetValue(); + vy = GroupDimensions->SpinBox_DY->GetValue(); + vz = newValue; + } + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(vx, vy, vz); + + if(TestBoxDimensions(myPoint1, myPoint2)) { + mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); + myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + } + return; } @@ -629,11 +400,11 @@ void GeometryGUI_BoxDlg::closeEvent( QCloseEvent* e ) // function : TestBoxDimensions() // purpose : //================================================================================= -bool GeometryGUI_BoxDlg::TestBoxDimensions(gp_Pnt P1, gp_Pnt P2) +bool GeometryGUI_BoxDlg::TestBoxDimensions(gp_Pnt P1, gp_Pnt P2) { - if ( ( fabs( P1.X() - P2.X() ) > Precision::Confusion() ) && - ( fabs( P1.Y() - P2.Y() ) > Precision::Confusion() ) && - ( fabs( P1.Z() - P2.Z() ) > Precision::Confusion() ) ) - return true ; - return false ; + if ((fabs(P1.X() - P2.X()) > Precision::Confusion()) && + (fabs(P1.Y() - P2.Y()) > Precision::Confusion()) && + (fabs(P1.Z() - P2.Z()) > Precision::Confusion())) + return true; + return false; } diff --git a/src/GEOMGUI/GeometryGUI_BoxDlg.h b/src/GEOMGUI/GeometryGUI_BoxDlg.h index 062591582..e22552931 100644 --- a/src/GEOMGUI/GeometryGUI_BoxDlg.h +++ b/src/GEOMGUI/GeometryGUI_BoxDlg.h @@ -29,110 +29,50 @@ #ifndef DIALOGBOX_BOX_H #define DIALOGBOX_BOX_H -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" +#include "GeometryGUI_Skeleton.h" +#include "GeometryGUI_2Sel_QTD.h" +#include "GeometryGUI_3Spin.h" #include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QLabel; -class QPushButton; -class GeometryGUI_SpinBox; -class GeometryGUI; - //================================================================================= // class : GeometryGUI_BoxDlg // purpose : //================================================================================= -class GeometryGUI_BoxDlg : public QDialog -{ +class GeometryGUI_BoxDlg : public GeometryGUI_Skeleton +{ Q_OBJECT public: - GeometryGUI_BoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + GeometryGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~GeometryGUI_BoxDlg(); private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e ); - void Init(SALOME_Selection* Sel) ; - bool TestBoxDimensions( gp_Pnt P1, gp_Pnt P2 ) ; + void Init(SALOME_Selection* Sel); + void enterEvent(QEvent* e); + bool TestBoxDimensions(gp_Pnt P1, gp_Pnt P2); - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Points containing the vector */ - gp_Pnt myPoint2 ; - bool myOkPoint1 ; /* true when myPoint is defined */ - bool myOkPoint2 ; - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + double step; + int myConstructorId; Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ + gp_Pnt myPoint1; /* Points containing the vector */ + gp_Pnt myPoint2; + bool myOkPoint1; /* true when myPoint is defined */ + bool myOkPoint2; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - - QGroupBox* GroupPoints; - QPushButton* SelectButtonPt1; - QPushButton* SelectButtonPt2; - QLineEdit* LineEditPt2; - QLineEdit* LineEditPt1; - QLabel* TextLabelPt1; - QLabel* TextLabelPt2; - - QGroupBox* GroupDimensions ; - QLabel* TextLabel_DX ; - QLabel* TextLabel_DY ; - QLabel* TextLabel_DZ ; - - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; + GeometryGUI_2Sel_QTD* GroupPoints; + GeometryGUI_3Spin* GroupDimensions; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_BoxDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupPointsLayout; - QGridLayout* GroupDimensionsLayout; + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); }; diff --git a/src/GEOMGUI/GeometryGUI_FuseDlg.cxx b/src/GEOMGUI/GeometryGUI_FuseDlg.cxx index e42d61c7e..371d927c6 100644 --- a/src/GEOMGUI/GeometryGUI_FuseDlg.cxx +++ b/src/GEOMGUI/GeometryGUI_FuseDlg.cxx @@ -30,25 +30,7 @@ using namespace std; #include "GeometryGUI_FuseDlg.h" #include "GeometryGUI.h" -#include "QAD_Application.h" #include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - //================================================================================= // class : GeometryGUI_FuseDlg() @@ -57,111 +39,32 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GeometryGUI_FuseDlg::GeometryGUI_FuseDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +GeometryGUI_FuseDlg::GeometryGUI_FuseDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FUSE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FuseDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_FUSE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - GeometryGUI_FuseDlgLayout = new QGridLayout( this ); - GeometryGUI_FuseDlgLayout->setSpacing( 6 ); - GeometryGUI_FuseDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FUSE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - GeometryGUI_FuseDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupConstructor1->setColumnLayout(0, Qt::Vertical ); - GroupConstructor1->layout()->setSpacing( 0 ); - GroupConstructor1->layout()->setMargin( 0 ); - GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); - GroupConstructor1Layout->setAlignment( Qt::AlignTop ); - GroupConstructor1Layout->setSpacing( 6 ); - GroupConstructor1Layout->setMargin( 11 ); - LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" ); - LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 ); - LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" ); - LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 ); - SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" ); - SelectButtonC1A1Shape->setText( tr( "" ) ); - SelectButtonC1A1Shape->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 ); - SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" ); - SelectButtonC1A2Shape->setText( tr( "" ) ); - SelectButtonC1A2Shape->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 ); - TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" ); - TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I" ).arg("2") ); - TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2Shape->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 ); - TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" ); - TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I" ).arg("1") ); - TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1Shape->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 ); - GeometryGUI_FuseDlgLayout->addWidget( GroupConstructor1, 1, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_1, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_FuseDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FUSE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FUSE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FUSE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupFuse = new GeometryGUI_2Sel_QTD(this, "GroupFuse"); + GroupFuse->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupFuse->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); + GroupFuse->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + GroupFuse->PushButton1->setPixmap(image1); + GroupFuse->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupFuse, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(Sel); } @@ -170,196 +73,114 @@ GeometryGUI_FuseDlg::GeometryGUI_FuseDlg( QWidget* parent, const char* name, SAL // purpose : Destroys the object and frees any allocated resources //================================================================================= GeometryGUI_FuseDlg::~GeometryGUI_FuseDlg() -{ +{ /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; } - //================================================================================= // function : Init() // purpose : //================================================================================= -void GeometryGUI_FuseDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - GroupConstructor1->show(); - myConstructorId = 0 ; - myEditCurrentArgument = LineEditC1A1Shape ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - // TODO previous selection into argument ? - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - - connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ +void GeometryGUI_FuseDlg::Init(SALOME_Selection* Sel) +{ + /* init variables */ + myEditCurrentArgument = GroupFuse->LineEdit1; - return ; -} + myShape1.Nullify(); + myShape2.Nullify(); + myOkShape1 = myOkShape2 = false; + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupFuse->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupFuse->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FuseDlg::ConstructorsClicked(int constructorId) -{ - GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; + connect(GroupFuse->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupFuse->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument())); + + /* displays Dialog */ + GroupFuse->show(); + this->show(); + + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void GeometryGUI_FuseDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - + this->ClickOnApply(); + ClickOnCancel(); return ; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void GeometryGUI_FuseDlg::ClickOnApply() { - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3 ) ; - } - break ; - } - } - - // accept(); - return ; -} + myGeomGUI->GetDesktop()->putInfo(tr("")); + if(myOkShape1 && myOkShape2) + myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3); -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection has changed //================================================================================= void GeometryGUI_FuseDlg::SelectionIntoArgument() { - - myEditCurrentArgument->setText("") ; /* by default */ - QString aString = ""; /* the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myOkShape2 = false ; - } - break ; - } - } - return ; + myEditCurrentArgument->setText(""); + QString aString = ""; + + int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupFuse->LineEdit1) + myOkShape1 = false; + else if( myEditCurrentArgument == GroupFuse->LineEdit2) + myOkShape2 = false; + return; } - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1Shape->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2Shape->setText(aString) ; - myOkShape2 = true ; + /* nbSel == 1 */ + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupFuse->LineEdit1) { + myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + GroupFuse->LineEdit1->setText(aString); + myOkShape1 = true; } - - return ; + else if(myEditCurrentArgument == GroupFuse->LineEdit2) { + myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape2 = S; + GroupFuse->LineEdit2->setText(aString); + myOkShape2 = true; + } + return; } @@ -371,25 +192,18 @@ void GeometryGUI_FuseDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( send == SelectButtonC1A1Shape ) { - LineEditC1A1Shape->setFocus() ; - myEditCurrentArgument = LineEditC1A1Shape ; - } - else if(send == SelectButtonC1A2Shape) { - LineEditC1A2Shape->setFocus() ; - myEditCurrentArgument = LineEditC1A2Shape; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupFuse->PushButton1) { + GroupFuse->LineEdit1->setFocus(); + myEditCurrentArgument = GroupFuse->LineEdit1; + } + else if(send == GroupFuse->PushButton2) { + GroupFuse->LineEdit2->setFocus(); + myEditCurrentArgument = GroupFuse->LineEdit2; + } + SelectionIntoArgument(); + return; +} //================================================================================= @@ -398,52 +212,28 @@ void GeometryGUI_FuseDlg::SetEditCurrentArgument() //================================================================================= void GeometryGUI_FuseDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupFuse->LineEdit1) + myEditCurrentArgument = GroupFuse->LineEdit1; + else if(send == GroupFuse->LineEdit2) + myEditCurrentArgument = GroupFuse->LineEdit2; else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} + return; - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; + GeometryGUI_Skeleton::LineEditReturnPressed(); + return; } - //================================================================================= -// function : closeEvent() +// function : ActivateThisDialog() // purpose : //================================================================================= -void GeometryGUI_FuseDlg::closeEvent( QCloseEvent* e ) +void GeometryGUI_FuseDlg::ActivateThisDialog() { - this->ClickOnCancel() ; /* same than click on cancel button */ + GeometryGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; } @@ -451,27 +241,10 @@ void GeometryGUI_FuseDlg::closeEvent( QCloseEvent* e ) // function : enterEvent() // purpose : when mouse enter onto the QWidget //================================================================================= -void GeometryGUI_FuseDlg::enterEvent( QEvent * ) +void GeometryGUI_FuseDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate any active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } diff --git a/src/GEOMGUI/GeometryGUI_FuseDlg.h b/src/GEOMGUI/GeometryGUI_FuseDlg.h index 67a2911b1..ca47a5e75 100644 --- a/src/GEOMGUI/GeometryGUI_FuseDlg.h +++ b/src/GEOMGUI/GeometryGUI_FuseDlg.h @@ -29,91 +29,44 @@ #ifndef DIALOGBOX_FUSE_H #define DIALOGBOX_FUSE_H -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" +#include "GeometryGUI_Skeleton.h" +#include "GeometryGUI_2Sel_QTD.h" #include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - //================================================================================= // class : GeometryGUI_FuseDlg // purpose : //================================================================================= -class GeometryGUI_FuseDlg : public QDialog +class GeometryGUI_FuseDlg : public GeometryGUI_Skeleton { Q_OBJECT public: - GeometryGUI_FuseDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + GeometryGUI_FuseDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~GeometryGUI_FuseDlg(); private: + void Init(SALOME_Selection* Sel); + void enterEvent(QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; /* topology used to fuse */ - TopoDS_Shape myShape2 ; /* topology used to fuse */ - GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + TopoDS_Shape myShape1; /* topology used to fuse */ + TopoDS_Shape myShape2; /* topology used to fuse */ + GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ + GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ + bool myOkShape1; /* to check when arguments are defined */ + bool myOkShape2; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1Shape; - QLineEdit* LineEditC1A2Shape; - QPushButton* SelectButtonC1A1Shape; - QPushButton* SelectButtonC1A2Shape; - QLabel* TextLabelC1A2Shape; - QLabel* TextLabelC1A1Shape; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + GeometryGUI_2Sel_QTD* GroupFuse ; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); void SetEditCurrentArgument() ; void SelectionIntoArgument() ; void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; void ActivateThisDialog() ; -protected: - QGridLayout* GeometryGUI_FuseDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; }; #endif // DIALOGBOX_FUSE_H diff --git a/src/GEOMGUI/GeometryGUI_PlaneDlg.cxx b/src/GEOMGUI/GeometryGUI_PlaneDlg.cxx index 4132cbc03..83446080c 100644 --- a/src/GEOMGUI/GeometryGUI_PlaneDlg.cxx +++ b/src/GEOMGUI/GeometryGUI_PlaneDlg.cxx @@ -29,35 +29,16 @@ using namespace std; #include "GeometryGUI_PlaneDlg.h" -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - +#include +#include #include #include -#include #include #include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "GeometryGUI.h" +#include "QAD_Desktop.h" +#include "QAD_Config.h" //================================================================================= // class : GeometryGUI_PlaneDlg() @@ -66,258 +47,53 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GeometryGUI_PlaneDlg::GeometryGUI_PlaneDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +GeometryGUI_PlaneDlg::GeometryGUI_PlaneDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - /***************************************************************/ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_PLANE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_PLANE_DXYZ"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_PLANE_FACE"))); - - if ( !name ) - setName( "GeometryGUI_PlaneDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_PLANE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PlaneDlgLayout = new QGridLayout( this ); - GeometryGUI_PlaneDlgLayout->setSpacing( 6 ); - GeometryGUI_PlaneDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PLANE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupPointDirection = new QGroupBox( this, "GroupPointDirection" ); - GroupPointDirection->setTitle( tr( "GEOM_PLANE_PV" ) ); - GroupPointDirection->setColumnLayout(0, Qt::Vertical ); - GroupPointDirection->layout()->setSpacing( 0 ); - GroupPointDirection->layout()->setMargin( 0 ); - GroupPointDirectionLayout = new QGridLayout( GroupPointDirection->layout() ); - GroupPointDirectionLayout->setAlignment( Qt::AlignTop ); - GroupPointDirectionLayout->setSpacing( 6 ); - GroupPointDirectionLayout->setMargin( 11 ); - LineEditDirection = new QLineEdit( GroupPointDirection, "LineEditDirection" ); - LineEditDirection->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditDirection->sizePolicy().hasHeightForWidth() ) ); - GroupPointDirectionLayout->addWidget( LineEditDirection, 1, 2 ); - LineEditPt1 = new QLineEdit( GroupPointDirection, "LineEditPt1" ); - LineEditPt1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditPt1->sizePolicy().hasHeightForWidth() ) ); - GroupPointDirectionLayout->addWidget( LineEditPt1, 0, 2 ); - SelectButtonPt1 = new QPushButton( GroupPointDirection, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - GroupPointDirectionLayout->addWidget( SelectButtonPt1, 0, 1 ); - SelectButtonDirection = new QPushButton( GroupPointDirection, "SelectButtonDirection" ); - SelectButtonDirection->setText( tr( "" ) ); - SelectButtonDirection->setPixmap( image1 ); - GroupPointDirectionLayout->addWidget( SelectButtonDirection, 1, 1 ); - TextLabelDirection = new QLabel( GroupPointDirection, "TextLabelDirection" ); - TextLabelDirection->setText( tr( "GEOM_VECTOR" ) ); - TextLabelDirection->setMinimumSize( QSize( 50, 0 ) ); - TextLabelDirection->setFrameShape( QLabel::NoFrame ); - TextLabelDirection->setFrameShadow( QLabel::Plain ); - GroupPointDirectionLayout->addWidget( TextLabelDirection, 1, 0 ); - TextLabelPt1 = new QLabel( GroupPointDirection, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT" ) ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointDirectionLayout->addWidget( TextLabelPt1, 0, 0 ); - - SpinBox_C1Size = new GeometryGUI_SpinBox( GroupPointDirection, "SpinBox_C1Size" ); - GroupPointDirectionLayout->addWidget( SpinBox_C1Size, 2, 2 ); - TextLabelC1Size = new QLabel( GroupPointDirection, "TextLabelC1Size" ); - TextLabelC1Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC1Size->setMinimumSize( QSize( 60, 0 ) ); - GroupPointDirectionLayout->addWidget( TextLabelC1Size, 2, 0 ); - - GeometryGUI_PlaneDlgLayout->addWidget( GroupPointDirection, 1, 0 ); - - /***************************************************************/ - GroupPointPlusCoordinates = new QGroupBox( this, "GroupPointPlusCoordinates" ); - GroupPointPlusCoordinates->setTitle( tr( "GEOM_PLANE_PVC" ) ); - GroupPointPlusCoordinates->setColumnLayout(0, Qt::Vertical ); - GroupPointPlusCoordinates->layout()->setSpacing( 0 ); - GroupPointPlusCoordinates->layout()->setMargin( 0 ); - GroupPointPlusCoordinatesLayout = new QGridLayout( GroupPointPlusCoordinates->layout() ); - GroupPointPlusCoordinatesLayout->setAlignment( Qt::AlignTop ); - GroupPointPlusCoordinatesLayout->setSpacing( 6 ); - GroupPointPlusCoordinatesLayout->setMargin( 11 ); - - LineEditPt2 = new QLineEdit( GroupPointPlusCoordinates, "LineEditPt2" ); - LineEditPt2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditPt2->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( LineEditPt2, 0, 0, 5, 8 ); - - SelectButtonPt2 = new QPushButton( GroupPointPlusCoordinates, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - SelectButtonPt2->setMaximumSize( QSize( 28, 32767 ) ); - GroupPointPlusCoordinatesLayout->addWidget( SelectButtonPt2, 0, 4 ); - - TextLabelPt2 = new QLabel( GroupPointPlusCoordinates, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT" ) ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt2->setFrameShape( QLabel::NoFrame ); - TextLabelPt2->setFrameShadow( QLabel::Plain ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( TextLabelPt2, 0, 0, 0, 3 ); - - SpinBox_DX = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DX" ); - SpinBox_DX->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DX->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( SpinBox_DX, 1, 1, 3, 4 ); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_PV"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_FACE"))); + QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PLANE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PLANE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + GroupPointDirection = new GeometryGUI_2Sel1Spin(this, "GroupPointDirection"); + GroupPointDirection->GroupBox1->setTitle(tr("GEOM_PLANE_PV")); + GroupPointDirection->TextLabel1->setText(tr("GEOM_POINT")); + GroupPointDirection->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPointDirection->TextLabel3->setText(tr("GEOM_PLANE_SIZE")); + GroupPointDirection->PushButton1->setPixmap(image3); + GroupPointDirection->PushButton2->setPixmap(image3); + + GroupPointPlusCoordinates = new GeometryGUI_1Sel4Spin(this, "GroupPointPlusCoordinates" ); + GroupPointPlusCoordinates->GroupBox1->setTitle(tr("GEOM_PLANE_PVC")); + GroupPointPlusCoordinates->TextLabel1->setText(tr("GEOM_POINT")); + GroupPointPlusCoordinates->TextLabel2->setText(tr("GEOM_COOR")); + GroupPointPlusCoordinates->TextLabel3->setText(tr("GEOM_DX")); + GroupPointPlusCoordinates->TextLabel4->setText(tr("GEOM_DY")); + GroupPointPlusCoordinates->TextLabel5->setText(tr("GEOM_DZ")); + GroupPointPlusCoordinates->TextLabel6->setText(tr("GEOM_PLANE_SIZE")); + GroupPointPlusCoordinates->PushButton1->setPixmap(image3); + + GroupFace = new GeometryGUI_1Sel1Spin(this, "GroupFace"); + GroupFace->GroupBox1->setTitle(tr("GEOM_FACE")); + GroupFace->TextLabel1->setText(tr("GEOM_SELECTION")); + GroupFace->TextLabel2->setText(tr("GEOM_PLANE_SIZE")); + GroupFace->PushButton1->setPixmap(image3); - SpinBox_DY = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DY" ); - SpinBox_DY->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DY->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addWidget( SpinBox_DY, 1, 6 ); - - SpinBox_DZ = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DZ" ); - SpinBox_DZ->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DZ->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addWidget( SpinBox_DZ, 1, 8 ); - - TextLabel_DX = new QLabel( GroupPointPlusCoordinates, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DX, 1, 2 ); - - TextLabel_DY = new QLabel( GroupPointPlusCoordinates, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DY, 1, 5 ); - - TextLabel_DZ = new QLabel( GroupPointPlusCoordinates, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DZ, 1, 7 ); - - TextLabelCoordinates = new QLabel( GroupPointPlusCoordinates, "TextLabelCoordinates" ); - TextLabelCoordinates->setText( tr( "GEOM_COOR" ) ); - TextLabelCoordinates->setMinimumSize( QSize( 50, 0 ) ); - TextLabelCoordinates->setFrameShape( QLabel::NoFrame ); - TextLabelCoordinates->setFrameShadow( QLabel::Plain ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabelCoordinates, 1, 0 ); - - TextLabelC2Size = new QLabel( GroupPointPlusCoordinates, "TextLabelC2Size" ); - TextLabelC2Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC2Size->setMinimumSize( QSize( 60, 0 ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( TextLabelC2Size, 2, 2, 0, 1 ); - - SpinBox_C2Size = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_C2Size" ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( SpinBox_C2Size, 2, 2, 5, 8 ); - - QSpacerItem* spacer_c = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupPointPlusCoordinatesLayout->addMultiCell( spacer_c, 2, 2, 2, 4 ); - QSpacerItem* spacer_d = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupPointPlusCoordinatesLayout->addItem( spacer_d, 1, 1 ); - - GeometryGUI_PlaneDlgLayout->addWidget( GroupPointPlusCoordinates, 1, 0 ); - - /***************************************************************/ - - GroupFace = new QGroupBox( this, "GroupFace" ); - GroupFace->setTitle( tr( "GEOM_FACE" ) ); - GroupFace->setColumnLayout(0, Qt::Vertical ); - GroupFace->layout()->setSpacing( 0 ); - GroupFace->layout()->setMargin( 0 ); - GroupFaceLayout = new QGridLayout( GroupFace->layout() ); - GroupFaceLayout->setAlignment( Qt::AlignTop ); - GroupFaceLayout->setSpacing( 6 ); - GroupFaceLayout->setMargin( 11 ); - - TextLabelFace = new QLabel( GroupFace, "TextLabelFace" ); - TextLabelFace->setFrameShadow( QLabel::Plain ); - TextLabelFace->setFrameShape( QLabel::NoFrame ); - TextLabelFace->setText( tr( "GEOM_SELECTION" ) ); - TextLabelFace->setMinimumSize( QSize( 50, 0 ) ); - GroupFaceLayout->addMultiCellWidget( TextLabelFace, 0, 0, 0, 1 ); - - SelectButtonFace = new QPushButton( GroupFace, "SelectButtonFace" ); - SelectButtonFace->setText( tr( "" ) ); - SelectButtonFace->setPixmap( image1 ); - SelectButtonFace->setMaximumSize( QSize( 28, 32767 ) ); - GroupFaceLayout->addWidget( SelectButtonFace, 0, 2 ); - - LineEditFace = new QLineEdit( GroupFace, "LineEditFace" ); - LineEditFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditFace->sizePolicy().hasHeightForWidth() ) ); - GroupFaceLayout->addWidget( LineEditFace, 0, 3 ); - - TextLabelC3Size = new QLabel( GroupFace, "TextLabelC3Size" ); - TextLabelC3Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC3Size->setMinimumSize( QSize( 60, 0 ) ); - GroupFaceLayout->addWidget( TextLabelC3Size, 1, 0 ); - - SpinBox_C3Size = new GeometryGUI_SpinBox( GroupFace, "SpinBox_C3Size" ); - SpinBox_C3Size->setCaption( tr( "" ) ); - GroupFaceLayout->addWidget( SpinBox_C3Size, 1, 3 ); - - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupFaceLayout->addMultiCell( spacer, 1, 1, 1, 2 ); - QSpacerItem* spacer_e = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupFaceLayout->addItem( spacer_e, 2, 3 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupFace, 1, 0 ); - - /* Initialisation */ - Init( Sel ) ; + Layout1->addWidget(GroupPointDirection, 1, 0); + Layout1->addWidget(GroupPointPlusCoordinates, 1, 0); + Layout1->addWidget(GroupFace, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(Sel); } @@ -328,7 +104,6 @@ GeometryGUI_PlaneDlg::GeometryGUI_PlaneDlg( QWidget* parent, const char* name, S GeometryGUI_PlaneDlg::~GeometryGUI_PlaneDlg() { /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; } @@ -338,219 +113,187 @@ GeometryGUI_PlaneDlg::~GeometryGUI_PlaneDlg() //================================================================================= void GeometryGUI_PlaneDlg::Init( SALOME_Selection* Sel ) { - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 1.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 1.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 1.0 ) ; - - this->myTrimSize = 2000.0 ; - SpinBox_C1Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C1Size->SetValue( myTrimSize ) ; - SpinBox_C2Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C2Size->SetValue( myTrimSize ) ; - SpinBox_C3Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C3Size->SetValue( myTrimSize ) ; + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPointDirection->LineEdit1; - GroupPointDirection->show(); - GroupPointPlusCoordinates->hide() ; - GroupFace->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); + myPoint1.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false; - mySelection = Sel ; - myEditCurrentArgument = LineEditPt1 ; - mySimulationTopoDs.Nullify() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); + myFaceFilter = new GEOM_FaceFilter(StdSelect_Plane, myGeom); /* Filter for the next selection */ - mySelection->AddFilter( myVertexFilter ) ; + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + this->myTrimSize = 2000.0; + + /* min, max, step and decimals for spin boxes */ + GroupPointDirection->SpinBox_DX->RangeStepAndValidator(+0.001, 10000000.0, step, 5); + GroupPointDirection->SpinBox_DX->SetValue(myTrimSize); + + GroupPointPlusCoordinates->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPointPlusCoordinates->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPointPlusCoordinates->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPointPlusCoordinates->SpinBox_DX->SetValue(1.0); + GroupPointPlusCoordinates->SpinBox_DY->SetValue(1.0); + GroupPointPlusCoordinates->SpinBox_DZ->SetValue(1.0); + GroupPointPlusCoordinates->SpinBox_S->RangeStepAndValidator(+0.001, 10000000.0, step, 5); + GroupPointPlusCoordinates->SpinBox_S->SetValue(myTrimSize) ; + + GroupFace->SpinBox_DX->RangeStepAndValidator(+0.001, 10000000.0, step, 5); + GroupFace->SpinBox_DX->SetValue(myTrimSize); /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - - connect( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditDirection, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( LineEditPt2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditFace, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonFace, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonDirection, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( SpinBox_C1Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - connect( SpinBox_C2Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - connect( SpinBox_C3Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + + connect(GroupPointDirection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPointDirection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPointPlusCoordinates->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupFace->PushButton1, SIGNAL(clicked()), this, SLOT( SetEditCurrentArgument())); + + connect(GroupPointDirection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPointDirection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPointPlusCoordinates->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupFace->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPointPlusCoordinates->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointPlusCoordinates->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointPlusCoordinates->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointPlusCoordinates->SpinBox_S, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointDirection->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupFace->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* Displays Dialog */ + GroupPointPlusCoordinates->hide(); + GroupFace->hide(); + GroupPointDirection->show(); + this->show(); return ; } - //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= void GeometryGUI_PlaneDlg::ConstructorsClicked(int constructorId) { - myGeomGUI->EraseSimulationShape() ; - myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false ; - mySelection->ClearFilters() ; - myConstructorId = constructorId ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomGUI->EraseSimulationShape(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false; switch (constructorId) { case 0: /* plane from a point and a direction (vector, edge...) */ - { - GroupPointDirection->show(); - GroupPointPlusCoordinates->hide() ; - GroupFace->hide() ; - myEditCurrentArgument = LineEditPt1 ; - LineEditPt1->setText(tr("")) ; - LineEditDirection->setText(tr("")) ; + { + GroupPointPlusCoordinates->hide(); + GroupFace->hide(); + resize(0, 0); + GroupPointDirection->show(); + + myEditCurrentArgument = GroupPointDirection->LineEdit1; + GroupPointDirection->LineEdit1->setText(tr("")); + GroupPointDirection->LineEdit2->setText(tr("")); /* for the first argument */ - mySelection->AddFilter(myVertexFilter) ; + mySelection->AddFilter(myVertexFilter); break; } - case 1: /* plane from a point and vector coordinates */ { - GroupPointDirection->hide() ; - GroupPointPlusCoordinates->show() ; - GroupFace->hide() ; - myEditCurrentArgument = LineEditPt2 ; - LineEditPt2->setText(tr("")) ; - SpinBox_DX->SetValue( 1.0 ) ; - SpinBox_DY->SetValue( 1.0 ) ; - SpinBox_DZ->SetValue( 1.0 ) ; - myOkCoordinates = true ; + GroupPointDirection->hide(); + GroupFace->hide(); + resize(0, 0); + GroupPointPlusCoordinates->show(); + + myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; + GroupPointPlusCoordinates->LineEdit1->setText(tr("")); + GroupPointPlusCoordinates->SpinBox_DX->SetValue(1.0); + GroupPointPlusCoordinates->SpinBox_DY->SetValue(1.0); + GroupPointPlusCoordinates->SpinBox_DZ->SetValue(1.0); + myOkCoordinates = true; /* for the first argument */ - mySelection->AddFilter(myVertexFilter) ; - break ; - } - + mySelection->AddFilter(myVertexFilter); + break; + } case 2: /* plane from a planar face selection */ { - GroupPointDirection->hide() ; - GroupPointPlusCoordinates->hide() ; - GroupFace->show() ; - myEditCurrentArgument = LineEditFace ; - LineEditFace->setText(tr("")) ; + GroupPointDirection->hide(); + GroupPointPlusCoordinates->hide(); + resize(0, 0); + GroupFace->show(); + + myEditCurrentArgument = GroupFace->LineEdit1; + GroupFace->LineEdit1->setText(tr("")); /* for the first argument */ - mySelection->AddFilter(myFaceFilter) ; - break ; + mySelection->AddFilter(myFaceFilter); + break; } - } - return ; + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void GeometryGUI_PlaneDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - + this->ClickOnApply(); + ClickOnCancel(); return ; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void GeometryGUI_PlaneDlg::ClickOnApply() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomGUI->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + switch(myConstructorId) { case 0 : /* args are myPoint1 and myDx, myDy, myDz from a vector(edge) */ { - if(myOkPoint1 && myOkDirection) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - break ; + if(myOkPoint1 && myOkDirection) + myGeomGUI->MakePlaneAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize); + break; } - case 1 : /* args are myPoint1 and myDx, myDy, myDz from a Spin Box */ { - if(myOkPoint1) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - break ; + if(myOkPoint1) + myGeomGUI->MakePlaneAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize); + break; } - case 2 : /* arg is a planar face selection */ { - if(myOkPlanarFace) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize) ; - } - break ; + if(myOkPlanarFace) + myGeomGUI->MakePlaneAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize); + break; } } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -560,115 +303,107 @@ void GeometryGUI_PlaneDlg::ClickOnCancel() //================================================================================= void GeometryGUI_PlaneDlg::SelectionIntoArgument() { - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of argument */ + myGeomGUI->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); QString aString = ""; - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { + int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { switch (myConstructorId) { case 0: { - if ( myEditCurrentArgument == LineEditPt1 ) { - LineEditPt1->setText("") ; + if(myEditCurrentArgument == GroupPointDirection->LineEdit1) { + GroupPointDirection->LineEdit1->setText(""); myOkPoint1 = false ; } - else if ( myEditCurrentArgument == LineEditDirection ) { - LineEditDirection->setText("") ; + else if(myEditCurrentArgument == GroupPointDirection->LineEdit2) { + GroupPointDirection->LineEdit2->setText(""); myOkDirection = false ; } - break ; + break; } case 1: { - if ( myEditCurrentArgument == LineEditPt2 ) { - LineEditPt2->setText("") ; + if(myEditCurrentArgument == GroupPointPlusCoordinates->LineEdit1) { + GroupPointPlusCoordinates->LineEdit1->setText("") ; myOkPoint1 = false ; } - break ; + break; } - case 2: { - if ( myEditCurrentArgument == LineEditFace ) { - LineEditFace->setText("") ; - if ( aString.compare("") == 0 ) - myOkPlanarFace = false ; + if(myEditCurrentArgument == GroupFace->LineEdit1) { + GroupFace->LineEdit1->setText("") ; + if(aString.compare("") == 0) + myOkPlanarFace = false; else - myOkPlanarFace = true ; + myOkPlanarFace = true; } - break ; + break; } - } return ; } /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) return ; - /* FIRST CONSTRUCTOR */ - if ( myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt1->setText(aString) ; - myOkPoint1 = true ; + if(myEditCurrentArgument == GroupPointDirection->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + GroupPointDirection->LineEdit1->setText(aString); + myOkPoint1 = true; } - else if ( myEditCurrentArgument == LineEditDirection ) { + else if( myEditCurrentArgument == GroupPointDirection->LineEdit2) { /* We verify if the selection is a linear edge */ - gp_Pnt Pfirst, Plast ; - if( myGeomGUI->LinearEdgeExtremities(S, Pfirst, Plast ) ) { - myGeomGUI->GetBipointDxDyDz( Pfirst, Plast, myDx, myDy, myDz) ; - LineEditDirection->setText(aString) ; - myOkDirection = true ; - this->myTrimSize = SpinBox_C1Size->GetValue() ; + gp_Pnt Pfirst, Plast; + if( myGeomGUI->LinearEdgeExtremities(S, Pfirst, Plast)) { + myGeomGUI->GetBipointDxDyDz(Pfirst, Plast, myDx, myDy, myDz); + GroupPointDirection->LineEdit2->setText(aString); + myOkDirection = true; + this->myTrimSize = GroupPointDirection->SpinBox_DX->GetValue(); } } /* SECOND CONSTRUCTOR */ - else if ( myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt2->setText(aString) ; + else if(myEditCurrentArgument == GroupPointPlusCoordinates->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + GroupPointPlusCoordinates->LineEdit1->setText(aString); /* Get arguments */ - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - this->myTrimSize = SpinBox_C2Size->GetValue() ; - myOkPoint1 = true ; - myOkCoordinates = true ; + myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue(); + myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue(); + myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue(); + this->myTrimSize = GroupPointPlusCoordinates->SpinBox_S->GetValue(); + myOkPoint1 = true; + myOkCoordinates = true; } /* THIRD CONSTRUCTOR */ - else if ( myEditCurrentArgument == LineEditFace) { - if( myOkPlanarFace ) { - LineEditFace->setText(aString) ; + else if(myEditCurrentArgument == GroupFace->LineEdit1) { + if(myOkPlanarFace) { + GroupFace->LineEdit1->setText(aString); BRepAdaptor_Surface surf(TopoDS::Face(S)); gp_Pln Plane = surf.Plane(); gp_Pnt myPoint1 = Plane.Location(); gp_Ax1 ax = Plane.Axis(); - myDx = (ax.Direction()).X() ; - myDy = (ax.Direction()).Y() ; - myDz = (ax.Direction()).Z() ; - this->myTrimSize = SpinBox_C3Size->GetValue() ; + myDx = (ax.Direction()).X(); + myDy = (ax.Direction()).Y(); + myDz = (ax.Direction()).Z(); + this->myTrimSize = GroupFace->SpinBox_DX->GetValue(); } } /* Call method simulation */ - if( ( myOkPoint1 && myOkDirection) || ( myOkPoint1 && myOkCoordinates ) || myOkPlanarFace ) { - if ( myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion()*Precision::Confusion() ) { - MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } + if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) { + if(myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion()*Precision::Confusion()) + MakePlaneSimulationAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize) ; } - return ; + return; } - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -682,84 +417,46 @@ void GeometryGUI_PlaneDlg::SetEditCurrentArgument() { case 0: { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - mySelection->AddFilter(myVertexFilter) ; + if(send == GroupPointDirection->PushButton1) { + GroupPointDirection->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPointDirection->LineEdit1; + mySelection->AddFilter(myVertexFilter); } - else if(send == SelectButtonDirection) { - LineEditDirection->setFocus() ; - myEditCurrentArgument = LineEditDirection; + else if(send == GroupPointDirection->PushButton2) { + GroupPointDirection->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPointDirection->LineEdit2; /* Edge filter here */ - mySelection->AddFilter(myEdgeFilter) ; - SelectionIntoArgument() ; + mySelection->AddFilter(myEdgeFilter); + SelectionIntoArgument(); } break; } - case 1: { - if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; + if(send == GroupPointPlusCoordinates->PushButton1) { + GroupPointPlusCoordinates->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; /* Vertex filter here */ - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; + mySelection->AddFilter(myVertexFilter); + SelectionIntoArgument(); } break; } - case 2: { - if(send == SelectButtonFace) { - LineEditFace->setFocus() ; - myEditCurrentArgument = LineEditFace; + if(send == GroupFace->PushButton1) { + GroupFace->LineEdit1->setFocus(); + myEditCurrentArgument = GroupFace->LineEdit1; /* Face filter here */ - mySelection->AddFilter(myFaceFilter) ; - SelectionIntoArgument() ; + mySelection->AddFilter(myFaceFilter); + SelectionIntoArgument(); } break; } - } return ; } -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender() ; - - if( send == SpinBox_DX ) { - myDx = newValue ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DY ) { - myDx = SpinBox_DX->GetValue() ; - myDy = newValue ; - myDz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DZ ) { - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = newValue ; - } else if( send == SpinBox_C1Size || send == SpinBox_C2Size || send == SpinBox_C3Size ) { - myTrimSize = newValue ; - } else - return ; - - if ( myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion() * Precision::Confusion() ) { - MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - //================================================================================= // function : LineEditReturnPressed() @@ -768,43 +465,18 @@ void GeometryGUI_PlaneDlg::ValueChangedInSpinBox( double newValue ) void GeometryGUI_PlaneDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditDirection ) - myEditCurrentArgument = LineEditDirection ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; - else if ( send == LineEditFace ) - myEditCurrentArgument = LineEditFace ; + if(send == GroupPointDirection->LineEdit1) + myEditCurrentArgument = GroupPointDirection->LineEdit1; + else if (send == GroupPointDirection->LineEdit2) + myEditCurrentArgument = GroupPointDirection->LineEdit2; + else if (send == GroupPointPlusCoordinates->LineEdit1) + myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; + else if (send == GroupFace->LineEdit1) + myEditCurrentArgument = GroupFace->LineEdit1; else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} + return; - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupPointDirection->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupFace->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } + GeometryGUI_Skeleton::LineEditReturnPressed(); return ; } @@ -815,17 +487,11 @@ void GeometryGUI_PlaneDlg::DeactivateActiveDialog() //================================================================================= void GeometryGUI_PlaneDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupPointDirection->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupFace->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; + GeometryGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -833,47 +499,72 @@ void GeometryGUI_PlaneDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void GeometryGUI_PlaneDlg::enterEvent( QEvent* e) +void GeometryGUI_PlaneDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } //================================================================================= -// function : closeEvent() +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void GeometryGUI_PlaneDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; -} +void GeometryGUI_PlaneDlg::ValueChangedInSpinBox( double newValue ) +{ + myGeomGUI->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender() ; + + if(send == GroupPointPlusCoordinates->SpinBox_DX) { + myDx = newValue; + myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue(); + myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue(); + } else if(send == GroupPointPlusCoordinates->SpinBox_DY) { + myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue(); + myDy = newValue; + myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue(); + } else if(send == GroupPointPlusCoordinates->SpinBox_DZ) { + myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue(); + myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue(); + myDz = newValue; + } else if(send == GroupPointDirection->SpinBox_DX || send == GroupPointPlusCoordinates->SpinBox_S || send == GroupFace->SpinBox_DX) { + myTrimSize = newValue; + } else + return; + + if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) { + if (myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion() * Precision::Confusion()) + MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize); + } + return ; +} //================================================================================= // function : MakePlaneSimulationAndDisplay(() // purpose : //================================================================================= -void GeometryGUI_PlaneDlg::MakePlaneSimulationAndDisplay( const gp_Pnt& P1, - const Standard_Real dx, - const Standard_Real dy, - const Standard_Real dz, - const Standard_Real trimsize ) +void GeometryGUI_PlaneDlg::MakePlaneSimulationAndDisplay(const gp_Pnt& P1, + const Standard_Real dx, + const Standard_Real dy, + const Standard_Real dz, + const Standard_Real trimsize) { try { - gp_Dir aDirection( dx, dy, dz ) ; + gp_Dir aDirection(dx, dy, dz); /* We make a trimmed plane */ - gp_Pln gplane(P1, aDirection) ; - mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -trimsize, +trimsize, -trimsize, +trimsize) ; + gp_Pln gplane(P1, aDirection); + mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -trimsize, +trimsize, -trimsize, +trimsize); } catch(Standard_Failure) { - MESSAGE( "Exception catched in MakePlaneSimulation" << endl ) ; - return ; + MESSAGE( "Exception catched in MakePlaneSimulation" << endl ); + return; } - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); return ; } diff --git a/src/GEOMGUI/GeometryGUI_PlaneDlg.h b/src/GEOMGUI/GeometryGUI_PlaneDlg.h index fb5c0f6ee..38435a02b 100644 --- a/src/GEOMGUI/GeometryGUI_PlaneDlg.h +++ b/src/GEOMGUI/GeometryGUI_PlaneDlg.h @@ -29,151 +29,67 @@ #ifndef DIALOGBOX_PLANE_H #define DIALOGBOX_PLANE_H -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_FaceFilter.hxx" -#include "GeometryGUI_SpinBox.h" +#include "GeometryGUI_Skeleton.h" +#include "GeometryGUI_2Sel1Spin.h" +#include "GeometryGUI_1Sel4Spin.h" +#include "GeometryGUI_1Sel1Spin.h" -#include +#include "GEOM_FaceFilter.hxx" #include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - //================================================================================= // class : GeometryGUI_PlaneDlg // purpose : //================================================================================= -class GeometryGUI_PlaneDlg : public QDialog +class GeometryGUI_PlaneDlg : public GeometryGUI_Skeleton { Q_OBJECT public: - GeometryGUI_PlaneDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + GeometryGUI_PlaneDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~GeometryGUI_PlaneDlg(); private : - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Point on the plane */ + void Init(SALOME_Selection* Sel); + void enterEvent(QEvent* e); - Standard_Real myDx ; - Standard_Real myDy ; - Standard_Real myDz ; - Standard_Real myTrimSize ; - - bool myOkPoint1 ; /* true when argument is defined */ - bool myOkDirection ; - bool myOkCoordinates ; - bool myOkPlanarFace ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - + double step; + int myConstructorId; Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filters selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ - Handle(GEOM_FaceFilter) myFaceFilter; /* Filters selection */ - - // Constructors - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - // Constructor with a point + direction (vector) - QGroupBox* GroupPointDirection; - - QLabel* TextLabelPt1; - QPushButton* SelectButtonPt1; - QLineEdit* LineEditPt1; - - QLabel* TextLabelDirection; - QPushButton* SelectButtonDirection; - QLineEdit* LineEditDirection; - - QLabel* TextLabelC1Size; - GeometryGUI_SpinBox* SpinBox_C1Size ; + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; + Handle(GEOM_FaceFilter) myFaceFilter; - // Constructor with a point + dx, dy, dz coordinates - QGroupBox* GroupPointPlusCoordinates; + gp_Pnt myPoint1; /* Point on the plane */ - QLabel* TextLabelPt2; - QPushButton* SelectButtonPt2; - QLineEdit* LineEditPt2; + Standard_Real myDx; + Standard_Real myDy; + Standard_Real myDz; + Standard_Real myTrimSize; - QLabel* TextLabelCoordinates; - QLabel* TextLabel_DX; - QLabel* TextLabel_DY; - QLabel* TextLabel_DZ; - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; + bool myOkPoint1; /* true when argument is defined */ + bool myOkDirection; + bool myOkCoordinates; + bool myOkPlanarFace; - QLabel* TextLabelC2Size; - GeometryGUI_SpinBox* SpinBox_C2Size ; - - // Constructor with a face - QGroupBox* GroupFace; - - QLabel* TextLabelFace; - QPushButton* SelectButtonFace; - QLineEdit* LineEditFace; - - QLabel* TextLabelC3Size; - GeometryGUI_SpinBox* SpinBox_C3Size ; - - // BUTTONS - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + GeometryGUI_2Sel1Spin* GroupPointDirection; + GeometryGUI_1Sel4Spin* GroupPointPlusCoordinates; + GeometryGUI_1Sel1Spin* GroupFace; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void MakePlaneSimulationAndDisplay( const gp_Pnt& P, - const Standard_Real dx, - const Standard_Real dy, - const Standard_Real dz, - const Standard_Real trimSize ) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: + void ActivateThisDialog(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + void MakePlaneSimulationAndDisplay(const gp_Pnt& P, + const Standard_Real dx, + const Standard_Real dy, + const Standard_Real dz, + const Standard_Real trimSize); - QGridLayout* GeometryGUI_PlaneDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupPointDirectionLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupPointPlusCoordinatesLayout; - QGridLayout* GroupFaceLayout; - QHBoxLayout* Layout2 ; }; #endif // DIALOGBOX_PLANE_H diff --git a/src/GEOMGUI/GeometryGUI_ShellDlg.cxx b/src/GEOMGUI/GeometryGUI_ShellDlg.cxx index a7492b479..8aceaaeee 100644 --- a/src/GEOMGUI/GeometryGUI_ShellDlg.cxx +++ b/src/GEOMGUI/GeometryGUI_ShellDlg.cxx @@ -22,30 +22,15 @@ // // // File : GeometryGUI_ShellDlg.cxx -// Author : Lucien PIGNOLONI +// Author : Damien COQUERET // Module : GEOM -// $Header$ +// $Header: using namespace std; #include "GeometryGUI_ShellDlg.h" #include "GeometryGUI.h" -#include "QAD_Application.h" #include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include //================================================================================= // class : GeometryGUI_ShellDlg() @@ -54,96 +39,30 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GeometryGUI_ShellDlg::GeometryGUI_ShellDlg( QWidget* parent, const char* name, SALOME_Selection* Sel = 0, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +GeometryGUI_ShellDlg::GeometryGUI_ShellDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SHELL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "GeometryGUI_ShellDlg" ); - resize( 303, 190 ); - setCaption( tr( "GEOM_SHELL_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ShellDlgLayout = new QGridLayout( this ); - GeometryGUI_ShellDlgLayout->setSpacing( 6 ); - GeometryGUI_ShellDlgLayout->setMargin( 11 ); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SHELL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SHELL_TITLE")); - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SHELL" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - GeometryGUI_ShellDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_SHELL_LIST" ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_FACES" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - GeometryGUI_ShellDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_ShellDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SHELL")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupShell = new GeometryGUI_1Sel_QTD(this, "GroupShell"); + GroupShell->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupShell->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupShell->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupShell, 1, 0); + /***************************************************************/ + + /* Initialisations */ + Init(Sel); } @@ -157,56 +76,33 @@ GeometryGUI_ShellDlg::~GeometryGUI_ShellDlg() } - //================================================================================= // function : Init() // purpose : //================================================================================= void GeometryGUI_ShellDlg::Init( SALOME_Selection* Sel ) { + /* init variables */ + myEditCurrentArgument = GroupShell->LineEdit1; + myOkListShapes = false; - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; + myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); + /* Filter for the next selection */ + mySelection->AddFilter( myFaceFilter ) ; - // TODO : previous selection into argument ? + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + connect(GroupShell->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupShell->show(); + this->show(); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ShellDlg::ConstructorsClicked(int constructorId) -{ - return ; + return; } @@ -216,9 +112,8 @@ void GeometryGUI_ShellDlg::ConstructorsClicked(int constructorId) //================================================================================= void GeometryGUI_ShellDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - + this->ClickOnApply(); + ClickOnCancel(); return ; } @@ -229,31 +124,12 @@ void GeometryGUI_ShellDlg::ClickOnOk() //================================================================================= void GeometryGUI_ShellDlg::ClickOnApply() { - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - // myGeomGUI->MakeShellAndDisplay( myListShapes ) ; - } - break ; - } - } - // accept(); - return ; -} + myGeomGUI->GetDesktop()->putInfo(tr("")); + if(myOkListShapes) + myGeomGUI->MakeShellAndDisplay(myListShapes); -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -263,23 +139,21 @@ void GeometryGUI_ShellDlg::ClickOnCancel() //================================================================================= void GeometryGUI_ShellDlg::SelectionIntoArgument() { - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - myEditCurrentArgument->setText("") ; + myEditCurrentArgument->setText(""); + QString aString = ""; + myOkListShapes = false; + int nbSel = mySelection->IObjectCount(); + if (nbSel == 0) + return; - QString aString = ""; /* name of future selection */ + aString = tr("%1_objects").arg(nbSel); - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel < 1 ) { - return ; - } - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; + myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + + return; } @@ -290,45 +164,15 @@ void GeometryGUI_ShellDlg::SelectionIntoArgument() void GeometryGUI_ShellDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - + mySelection->ClearFilters() ; - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; + if(send == GroupShell->PushButton1) { + GroupShell->LineEdit1->setFocus(); + myEditCurrentArgument = GroupShell->LineEdit1; + mySelection->AddFilter(myFaceFilter); } + SelectionIntoArgument(); + return ; } @@ -339,12 +183,8 @@ void GeometryGUI_ShellDlg::DeactivateActiveDialog() //================================================================================= void GeometryGUI_ShellDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + GeometryGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); return ; } @@ -355,21 +195,8 @@ void GeometryGUI_ShellDlg::ActivateThisDialog() //================================================================================= void GeometryGUI_ShellDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - diff --git a/src/GEOMGUI/GeometryGUI_ShellDlg.h b/src/GEOMGUI/GeometryGUI_ShellDlg.h index 0e3fc1940..49dde726e 100644 --- a/src/GEOMGUI/GeometryGUI_ShellDlg.h +++ b/src/GEOMGUI/GeometryGUI_ShellDlg.h @@ -22,86 +22,48 @@ // // // File : GeometryGUI_ShellDlg.h -// Author : Lucien PIGNOLONI +// Author : Damien COQUERET // Module : GEOM -// $Header$ +// $Header: #ifndef DIALOGBOX_SHELL_H #define DIALOGBOX_SHELL_H -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; +#include "GeometryGUI_Skeleton.h" +#include "GeometryGUI_1Sel_QTD.h" +#include "GEOM_FaceFilter.hxx" //================================================================================= // class : GeometryGUI_ShellDlg // purpose : //================================================================================= -class GeometryGUI_ShellDlg : public QDialog +class GeometryGUI_ShellDlg : public GeometryGUI_Skeleton { Q_OBJECT public: - GeometryGUI_ShellDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + GeometryGUI_ShellDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~GeometryGUI_ShellDlg(); private: + void Init(SALOME_Selection* Sel); + void enterEvent(QEvent * e); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - bool myOkListShapes ; /* to check when argument is defined */ + Handle(GEOM_FaceFilter) myFaceFilter; /* Filters selection */ + GEOM::GEOM_Gen::ListOfIOR myListShapes; + bool myOkListShapes; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + GeometryGUI_1Sel_QTD* GroupShell ; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; + void SetEditCurrentArgument(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void ActivateThisDialog(); -protected: - QGridLayout* GeometryGUI_ShellDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* GroupButtonsLayout; }; #endif // DIALOGBOX_SHELL_H diff --git a/src/GEOMGUI/GeometryGUI_Skeleton.cxx b/src/GEOMGUI/GeometryGUI_Skeleton.cxx new file mode 100644 index 000000000..e91e5a259 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_Skeleton.cxx @@ -0,0 +1,175 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_Skeleton.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "GeometryGUI_Skeleton.h" + +#include "GeometryGUI.h" +#include "QAD_Application.h" + +//================================================================================= +// class : GeometryGUI_Skeleton() +// purpose : Constructs a GeometryGUI_Skeleton which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GeometryGUI_Skeleton::GeometryGUI_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :GeometryGUI_Skeleton_QTD(parent, name, modal, fl) +{ + if (!name) + setName("GeometryGUI_Skeleton"); + + buttonCancel->setText(tr("GEOM_BUT_CLOSE")); + buttonOk->setText(tr("GEOM_BUT_OK")); + buttonApply->setText(tr("GEOM_BUT_APPLY")); + + GroupMedium->close(TRUE); + resize(0, 0); + + Init(Sel) ; +} + + +//================================================================================= +// function : ~GeometryGUI_Skeleton() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GeometryGUI_Skeleton::~GeometryGUI_Skeleton() +{ + // no need to delete child widgets, Qt does it all for us + this->destroy(TRUE, TRUE); +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GeometryGUI_Skeleton::Init(SALOME_Selection* Sel) +{ + /* init variables */ + mySelection = Sel; + mySimulationTopoDs.Nullify(); + + myGeomGUI = GeometryGUI::GetGeometryGUI(); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); + myGeom = GEOM::GEOM_Gen::_narrow(comp); + + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + + /* Move widget on the botton right corner of main widget */ +// int x, y ; +// myGeomGUI->DefineDlgPosition( this, x, y ) ; + + /* displays Dialog */ + RadioButton1->setChecked(TRUE); + + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void GeometryGUI_Skeleton::ClickOnCancel() +{ + myGeomGUI->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + mySelection->ClearFilters(); + disconnect(mySelection, 0, this, 0); + + myGeomGUI->ResetState(); + reject(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GeometryGUI_Skeleton::LineEditReturnPressed() +{ + /* User name of object input management */ + /* If successfull the selection is changed and signal emitted... */ + /* so SelectionIntoArgument() is automatically called. */ + const QString objectUserName = myEditCurrentArgument->text(); + QWidget* thisWidget = (QWidget*)this; + if( myGeomGUI->SelectionByNameInDialogs(thisWidget, objectUserName, mySelection)) + myEditCurrentArgument->setText(objectUserName); + + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void GeometryGUI_Skeleton::DeactivateActiveDialog() +{ + Layout1->setEnabled(false); + mySelection->ClearFilters(); + disconnect(mySelection, 0, this, 0); + myGeomGUI->EraseSimulationShape(); + myGeomGUI->SetActiveDialogBox(0); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GeometryGUI_Skeleton::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + myGeomGUI->EmitSignalDeactivateDialog(); + Layout1->setEnabled(true); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void GeometryGUI_Skeleton::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} diff --git a/src/GEOMGUI/GeometryGUI_Skeleton.h b/src/GEOMGUI/GeometryGUI_Skeleton.h new file mode 100644 index 000000000..c7c360101 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_Skeleton.h @@ -0,0 +1,76 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_Skeleton.h +// Author : Damine COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMETRYGUI_SKELETON_H +#define GEOMETRYGUI_SKELETON_H + +#include "GeometryGUI_Skeleton_QTD.h" + +#include "SALOME_Selection.h" +#include "GEOM_ShapeTypeFilter.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include + +class GeometryGUI; + +class GeometryGUI_Skeleton : public GeometryGUI_Skeleton_QTD +{ + Q_OBJECT + +public: + GeometryGUI_Skeleton(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~GeometryGUI_Skeleton(); + +private : + void Init(SALOME_Selection* Sel); + +protected: + void closeEvent(QCloseEvent* e); + + TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + SALOME_Selection* mySelection ; /* User shape selection */ + GEOM::GEOM_Gen_var myGeom; /* Current GeomI object */ + GeometryGUI* myGeomGUI; /* Current GeomGUI object */ + +protected slots: + void ClickOnCancel(); + void LineEditReturnPressed(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + +}; + +#endif // GEOMETRYGUI_SKELETON_H diff --git a/src/GEOMGUI/GeometryGUI_Skeleton_QTD.cxx b/src/GEOMGUI/GeometryGUI_Skeleton_QTD.cxx new file mode 100644 index 000000000..3244050d3 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_Skeleton_QTD.cxx @@ -0,0 +1,111 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'GeometryGUI_Skeleton_QTD.ui' +** +** Created: mar sep 23 15:06:58 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "GeometryGUI_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a GeometryGUI_Skeleton_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +GeometryGUI_Skeleton_QTD::GeometryGUI_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "GeometryGUI_Skeleton_QTD" ); + resize( 307, 147 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "GeometryGUI_Skeleton_QTD" ) ); + setSizeGripEnabled( TRUE ); + GeometryGUI_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "GeometryGUI_Skeleton_QTDLayout"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); + GroupButtons->setTitle( trUtf8( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 6 ); + GroupButtons->layout()->setMargin( 11 ); + GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QHBoxLayout( 0, 0, 6, "Layout3"); + + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( trUtf8( "&Ok" ) ); + Layout3->addWidget( buttonOk ); + + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( trUtf8( "&Apply" ) ); + Layout3->addWidget( buttonApply ); + QSpacerItem* spacer = new QSpacerItem( 91, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer ); + + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( trUtf8( "&Cancel" ) ); + Layout3->addWidget( buttonCancel ); + GroupButtonsLayout->addLayout( Layout3 ); + + Layout1->addWidget( GroupButtons, 2, 0 ); + + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); + GroupConstructors->setTitle( trUtf8( "" ) ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 6 ); + GroupConstructors->layout()->setMargin( 11 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + RadioButton1 = new QRadioButton( GroupConstructors, "RadioButton1" ); + RadioButton1->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton1 ); + + RadioButton2 = new QRadioButton( GroupConstructors, "RadioButton2" ); + RadioButton2->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton2 ); + + RadioButton3 = new QRadioButton( GroupConstructors, "RadioButton3" ); + RadioButton3->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton3 ); + + GroupConstructorsLayout->addLayout( Layout2, 0, 0 ); + + Layout1->addWidget( GroupConstructors, 0, 0 ); + + GroupMedium = new QGroupBox( this, "GroupMedium" ); + GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); + GroupMedium->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupMedium, 1, 0 ); + + GeometryGUI_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +GeometryGUI_Skeleton_QTD::~GeometryGUI_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/GEOMGUI/GeometryGUI_Skeleton_QTD.h b/src/GEOMGUI/GeometryGUI_Skeleton_QTD.h new file mode 100644 index 000000000..c5e398931 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_Skeleton_QTD.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'GeometryGUI_Skeleton_QTD.ui' +** +** Created: mar sep 23 15:06:57 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef GEOMETRYGUI_SKELETON_QTD_H +#define GEOMETRYGUI_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QPushButton; +class QRadioButton; + +class GeometryGUI_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + GeometryGUI_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~GeometryGUI_Skeleton_QTD(); + + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonApply; + QPushButton* buttonCancel; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QRadioButton* RadioButton3; + QGroupBox* GroupMedium; + + +protected: + QGridLayout* GeometryGUI_Skeleton_QTDLayout; + QGridLayout* Layout1; + QHBoxLayout* GroupButtonsLayout; + QHBoxLayout* Layout3; + QGridLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; +}; + +#endif // GEOMETRYGUI_SKELETON_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_SolidDlg.cxx b/src/GEOMGUI/GeometryGUI_SolidDlg.cxx new file mode 100644 index 000000000..0173c0c11 --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_SolidDlg.cxx @@ -0,0 +1,200 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_SolidDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "GeometryGUI_SolidDlg.h" + +#include "GeometryGUI.h" +#include "QAD_Desktop.h" + +//================================================================================= +// class : GeometryGUI_SolidDlg() +// purpose : Constructs a GeometryGUI_SolidDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GeometryGUI_SolidDlg::GeometryGUI_SolidDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :GeometryGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SOLID"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SOLID_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SOLID")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupSolid = new GeometryGUI_1Sel_QTD(this, "GroupSolid"); + GroupSolid->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupSolid->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupSolid->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupSolid, 1, 0); + /***************************************************************/ + + /* Initialisations */ + Init(Sel); +} + + +//================================================================================= +// function : ~GeometryGUI_SolidDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GeometryGUI_SolidDlg::~GeometryGUI_SolidDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GeometryGUI_SolidDlg::Init(SALOME_Selection* Sel) +{ + /* init variables */ + myEditCurrentArgument = GroupSolid->LineEdit1; + myOkListShapes = false; + + myShellFilter = new GEOM_ShapeTypeFilter(TopAbs_SHELL, myGeom); + /* filter for next selection */ + mySelection->AddFilter(myShellFilter); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupSolid->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupSolid->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GeometryGUI_SolidDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void GeometryGUI_SolidDlg::ClickOnApply() +{ + myGeomGUI->GetDesktop()->putInfo(tr("")); + + if(myOkListShapes) + myGeomGUI->MakeSolidAndDisplay(myListShapes); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void GeometryGUI_SolidDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + myOkListShapes = false; + int nbSel = mySelection->IObjectCount(); + if (nbSel == 0) + return; + + aString = tr("%1_objects").arg(nbSel); + + myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + + return ; +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GeometryGUI_SolidDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters() ; + + if(send == GroupSolid->PushButton1) { + GroupSolid->LineEdit1->setFocus(); + myEditCurrentArgument = GroupSolid->LineEdit1; + mySelection->AddFilter(myShellFilter); + } + SelectionIntoArgument(); + + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GeometryGUI_SolidDlg::ActivateThisDialog() +{ + GeometryGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return ; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void GeometryGUI_SolidDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/GEOMGUI/GeometryGUI_SolidDlg.h b/src/GEOMGUI/GeometryGUI_SolidDlg.h new file mode 100644 index 000000000..b2d023c3a --- /dev/null +++ b/src/GEOMGUI/GeometryGUI_SolidDlg.h @@ -0,0 +1,67 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GeometryGUI_SolidDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DIALOGBOX_SOLID_H +#define DIALOGBOX_SOLID_H + +#include "GeometryGUI_Skeleton.h" +#include "GeometryGUI_1Sel_QTD.h" + +//================================================================================= +// class : GeometryGUI_SolidDlg +// purpose : +//================================================================================= +class GeometryGUI_SolidDlg : public GeometryGUI_Skeleton +{ + Q_OBJECT + +public: + GeometryGUI_SolidDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~GeometryGUI_SolidDlg(); + +private: + void Init(SALOME_Selection* Sel); + void enterEvent(QEvent * e); + + Handle(GEOM_ShapeTypeFilter) myShellFilter; /* filter for selection */ + GEOM::GEOM_Gen::ListOfIOR myListShapes; + bool myOkListShapes; /* to check when arguments is defined */ + + GeometryGUI_1Sel_QTD* GroupSolid; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_SOLID_H diff --git a/src/GEOMGUI/GeometryGUI_TorusDlg.cxx b/src/GEOMGUI/GeometryGUI_TorusDlg.cxx index 1936e1e0a..ce3c12e83 100644 --- a/src/GEOMGUI/GeometryGUI_TorusDlg.cxx +++ b/src/GEOMGUI/GeometryGUI_TorusDlg.cxx @@ -400,7 +400,7 @@ void GeometryGUI_TorusDlg::ClickOnApply() } case 1 : { - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { + if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ; } break ; diff --git a/src/GEOMGUI/Makefile.in b/src/GEOMGUI/Makefile.in index be0a495ef..4e737026d 100644 --- a/src/GEOMGUI/Makefile.in +++ b/src/GEOMGUI/Makefile.in @@ -48,6 +48,18 @@ PO_FILES = \ LIB = libGEOMGUI.la LIB_SRC = GeometryGUI.cxx \ GeometryGUI_SpinBox.cxx \ + GeometryGUI_Skeleton_QTD.cxx \ + GeometryGUI_Skeleton.cxx \ + GeometryGUI_1Sel_QTD.cxx \ + GeometryGUI_2Sel_QTD.cxx \ + GeometryGUI_1Sel1Spin_QTD.cxx \ + GeometryGUI_1Sel1Spin.cxx \ + GeometryGUI_1Sel4Spin_QTD.cxx \ + GeometryGUI_1Sel4Spin.cxx \ + GeometryGUI_2Sel1Spin_QTD.cxx \ + GeometryGUI_2Sel1Spin.cxx \ + GeometryGUI_3Spin_QTD.cxx \ + GeometryGUI_3Spin.cxx \ GeometryGUI_TransparencyDlg.cxx \ GeometryGUI_NbIsosDlg.cxx \ GeometryGUI_BoxDlg.cxx \ @@ -87,6 +99,8 @@ LIB_SRC = GeometryGUI.cxx \ GeometryGUI_InertiaDlg.cxx \ GeometryGUI_CenterMassDlg.cxx \ GeometryGUI_FaceDlg.cxx \ + GeometryGUI_ShellDlg.cxx \ + GeometryGUI_SolidDlg.cxx \ GeometryGUI_BndBoxDlg.cxx \ GeometryGUI_MaxToleranceDlg.cxx \ GeometryGUI_WhatisDlg.cxx \ @@ -104,6 +118,18 @@ LIB_SRC = GeometryGUI.cxx \ LIB_MOC = \ GeometryGUI.h \ GeometryGUI_SpinBox.h \ + GeometryGUI_Skeleton_QTD.h \ + GeometryGUI_Skeleton.h \ + GeometryGUI_1Sel_QTD.h \ + GeometryGUI_2Sel_QTD.h \ + GeometryGUI_1Sel1Spin_QTD.h \ + GeometryGUI_1Sel1Spin.h \ + GeometryGUI_1Sel4Spin_QTD.h \ + GeometryGUI_1Sel4Spin.h \ + GeometryGUI_2Sel1Spin_QTD.h \ + GeometryGUI_2Sel1Spin.h \ + GeometryGUI_3Spin_QTD.h \ + GeometryGUI_3Spin.h \ GeometryGUI_TransparencyDlg.h \ GeometryGUI_NbIsosDlg.h \ GeometryGUI_BoxDlg.h \ @@ -143,6 +169,8 @@ LIB_MOC = \ GeometryGUI_InertiaDlg.h \ GeometryGUI_CenterMassDlg.h \ GeometryGUI_FaceDlg.h \ + GeometryGUI_ShellDlg.h \ + GeometryGUI_SolidDlg.h \ GeometryGUI_BndBoxDlg.h \ GeometryGUI_MaxToleranceDlg.h \ GeometryGUI_WhatisDlg.h \ diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index e29c665cb..534445ae1 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -65,6 +65,9 @@ GEOM_Actor::GEOM_Actor() this->ShadingProperty = NULL; this->WireframeProperty = NULL; + //DCQ : Bug Color Face : + this->PreviewProperty = NULL; + //DCQ this->deflection = 0; myDisplayMode = 0; @@ -86,6 +89,10 @@ GEOM_Actor::~GEOM_Actor() ShadingMapper->Delete(); if (ShadingProperty != NULL) ShadingProperty->Delete(); + //DCQ : Bug Color Face : + if (PreviewProperty != NULL) + PreviewProperty->Delete(); + //DCQ if (WireframeProperty != NULL) WireframeProperty->Delete(); if (HighlightProperty != NULL) @@ -126,12 +133,15 @@ void GEOM_Actor::setDisplayMode(int thenewmode) { if ((myShape.ShapeType() == TopAbs_WIRE) || (myShape.ShapeType() == TopAbs_EDGE) || (myShape.ShapeType() == TopAbs_VERTEX)) { - if ( !subshape ) + if ( !subshape ) { CreateWireframeMapper(); - else + } + else { return; - } else + } + } else { CreateShadingMapper(); + } } else CreateWireframeMapper(); } @@ -180,16 +190,36 @@ void GEOM_Actor::CreateMapper(int theMode) { aread->setDisplayMode(theMode); aread->GetOutput()->ReleaseDataFlagOn(); - vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New(); +// vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New(); +// if (theMode == 0) { +// aMapper->SetInput(aread->GetOutput()); +// } else { +// vtkPolyDataNormals *normals = vtkPolyDataNormals::New(); +// normals->SetInput(aread->GetOutput()); +// aMapper->SetInput(normals->GetOutput()); +// } +// aread->Delete(); +// this->SetMapper(theMode == 0? WireframeMapper = aMapper : ShadingMapper = aMapper); + + vtkPolyDataMapper* aMapperWF = vtkPolyDataMapper::New(); + vtkPolyDataMapper* aMapperSH = vtkPolyDataMapper::New(); + vtkPolyDataNormals *normals = vtkPolyDataNormals::New(); + + aMapperWF->SetInput(aread->GetOutput()); + normals->SetInput(aread->GetOutput()); + aMapperSH->SetInput(normals->GetOutput()); + + WireframeMapper = aMapperWF; + ShadingMapper = aMapperSH; + + aread->Delete(); + if (theMode == 0) { - aMapper->SetInput(aread->GetOutput()); + this->SetMapper(WireframeMapper); } else { - vtkPolyDataNormals *normals = vtkPolyDataNormals::New(); - normals->SetInput(aread->GetOutput()); - aMapper->SetInput(normals->GetOutput()); + this->SetMapper(ShadingMapper); } - aread->Delete(); - this->SetMapper(theMode == 0? WireframeMapper = aMapper : ShadingMapper = aMapper); + } void GEOM_Actor::CreateShadingMapper() { @@ -256,6 +286,7 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper) else { if(WireframeMapper==NULL) CreateWireframeMapper(); } + if(myShape.ShapeType() == TopAbs_VERTEX) { if(ren){ //The parameter determine size of vertex actor relate to diagonal of RendererWindow @@ -274,7 +305,11 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper) aMatrix->Delete(); } else this->Device->Render(ren, this->Mapper); - this->EstimatedRenderTime = WireframeMapper->GetTimeToDraw(); + + if(myDisplayMode >= 1) + this->EstimatedRenderTime = ShadingMapper->GetTimeToDraw(); + else + this->EstimatedRenderTime = WireframeMapper->GetTimeToDraw(); } // SubShape @@ -296,6 +331,9 @@ void GEOM_Actor::SetOpacity(float opa) //HighlightProperty->SetOpacity(opa); SALOME_Actor::SetOpacity(opa); ShadingProperty->SetOpacity(opa); + //DCQ : Bug Color Face : + PreviewProperty->SetOpacity(opa); + //DCQ } float GEOM_Actor::GetOpacity() { @@ -306,7 +344,10 @@ float GEOM_Actor::GetOpacity() { // Color methods //------------------------------------------------------------- void GEOM_Actor::SetColor(float r,float g,float b) { - ShadingProperty->SetColor(r,g,b); + ShadingProperty->SetColor(r,g,b); + //DCQ : Bug Color Face : + PreviewProperty->SetColor(r,g,b); + //DCQ } void GEOM_Actor::GetColor(float& r,float& g,float& b) { @@ -336,7 +377,7 @@ void GEOM_Actor::highlight(Standard_Boolean highlight) { HighlightProperty->SetDiffuseColor(1, 1, 1); HighlightProperty->SetSpecularColor(0.5, 0.5, 0.5); } - + this->Property = HighlightProperty; } diff --git a/src/OBJECT/GEOM_AssemblyBuilder.cxx b/src/OBJECT/GEOM_AssemblyBuilder.cxx index 39aca3d9c..b4dce9f9d 100644 --- a/src/OBJECT/GEOM_AssemblyBuilder.cxx +++ b/src/OBJECT/GEOM_AssemblyBuilder.cxx @@ -208,7 +208,10 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap FaceActor->SetShadingProperty(FaceProp); FaceActor->SetWireframeProperty(IsoProp); - FaceActor->SetPreviewProperty(IsoPVProp); + //DCQ : Bug Color Face : + //FaceActor->SetPreviewProperty(IsoPVProp); + FaceActor->SetPreviewProperty(FaceProp); + //DCQ FaceActor->setInputShape(ex.Current(),deflection,mode); @@ -266,7 +269,10 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap EdgeActor->setInputShape(ex.Current(),deflection,mode); EdgeActor->SetShadingProperty(EdgeIProp); EdgeActor->SetWireframeProperty(EdgeIProp); - EdgeActor->SetPreviewProperty(EdgePVProp); + //DCQ : Bug Color Face : + //EdgeActor->SetPreviewProperty(EdgePVProp); + EdgeActor->SetPreviewProperty(EdgeIProp); + //DCQ AISActors->AddItem(EdgeActor); } @@ -275,7 +281,10 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap EdgeActor->setInputShape(myShape,deflection,mode); EdgeActor->SetShadingProperty(EdgeIProp); EdgeActor->SetWireframeProperty(EdgeIProp); - EdgeActor->SetPreviewProperty(EdgePVProp); + //DCQ : Bug Color Face : + //EdgeActor->SetPreviewProperty(EdgePVProp); + EdgeActor->SetPreviewProperty(EdgeIProp); + //DCQ AISActors->AddItem(EdgeActor); } else if ( myShape.ShapeType() == TopAbs_VERTEX ) { // VERTEX Actor @@ -283,7 +292,10 @@ vtkActorCollection* GEOM_AssemblyBuilder::BuildActors(const TopoDS_Shape& myShap VertexActor->setInputShape(myShape,deflection,mode); VertexActor->SetShadingProperty(VertexProp); VertexActor->SetWireframeProperty(VertexProp); - VertexActor->SetPreviewProperty(VertexPVProp); + //DCQ : Bug Color Face : + //VertexActor->SetPreviewProperty(VertexPVProp); + VertexActor->SetPreviewProperty(VertexProp); + //DCQ AISActors->AddItem(VertexActor);