-// GEOM GEOMGUI : GUI for Geometry component\r
-//\r
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-// This library is free software; you can redistribute it and/or \r
-// modify it under the terms of the GNU Lesser General Public \r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License. \r
-// \r
-// This library is distributed in the hope that it will be useful, \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
-// Lesser General Public License for more details. \r
-// \r
-// You should have received a copy of the GNU Lesser General Public \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
-// \r
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
-//\r
-//\r
-//\r
-// File : OperationGUI_ChamferDlg.cxx\r
-// Author : Damien COQUERET\r
-// Module : GEOM\r
-// $Header$\r
-\r
-#include "OperationGUI_ChamferDlg.h"\r
-#include "DlgRef_SpinBox.h"\r
-\r
-#include "SUIT_Desktop.h"\r
-#include "SUIT_Session.h"\r
-#include "SalomeApp_Application.h"\r
-#include "LightApp_SelectionMgr.h"\r
-#include "OCCViewer_ViewModel.h"\r
-\r
-#include <TColStd_MapOfInteger.hxx>\r
-\r
-#include <qlabel.h>\r
-#include "qpixmap.h"\r
-#include <list>\r
-\r
-#include "GEOMImpl_Types.hxx"\r
-\r
-//=================================================================================\r
-// class : OperationGUI_ChamferDlg()\r
-// purpose : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the\r
-// name 'name' and widget flags set to 'f'.\r
-// The dialog will by default be modeless, unless you set 'modal' to\r
-// TRUE to construct a modal dialog.\r
-//=================================================================================\r
-OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent)\r
- : GEOMBase_Skeleton(theGeometryGUI, parent, "ChamferDlg", false,\r
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)\r
-{\r
- myConstructorId = -1;\r
-\r
- QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL")));\r
- QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE_FROM_FACE")));\r
- QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE")));\r
- QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE")));\r
- QPixmap iconSelect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));\r
-\r
- setCaption( tr( "GEOM_CHAMFER_TITLE" ) );\r
-\r
- GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) );\r
-\r
- RadioButton1->setPixmap( image1 );\r
- RadioButton2->setPixmap( image2 );\r
- RadioButton3->setPixmap( image3 );\r
- RadioButton4->show();\r
- RadioButton4->setPixmap( image4 );\r
-\r
- // Create first group\r
-\r
- myGrp1 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_ALL" ), this );\r
-\r
- QGroupBox* aSelGrp1 = new QGroupBox( 3, Qt::Horizontal, myGrp1 );\r
- aSelGrp1->setFrameStyle( QFrame::NoFrame );\r
- aSelGrp1->setInsideMargin( 0 );\r
-\r
- createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp1, MainObj1 );\r
-\r
- QGroupBox* aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp1 );\r
- aSpinGrp->setFrameStyle( QFrame::NoFrame );\r
- aSpinGrp->setInsideMargin( 0 );\r
-\r
- new QLabel( tr( "D" ), aSpinGrp );\r
- mySpinBox[ SpinBox1 ] = new DlgRef_SpinBox( aSpinGrp );\r
-\r
- ( new QFrame( myGrp1 ) )->setSizePolicy(\r
- QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
-\r
- // Create second group\r
-\r
- myGrp2 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGES" ), this );\r
-\r
- QGroupBox* aSelGrp2 = new QGroupBox( 3, Qt::Horizontal, myGrp2 );\r
- aSelGrp2->setFrameStyle( QFrame::NoFrame );\r
- aSelGrp2->setInsideMargin( 0 );\r
-\r
- createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp2, MainObj2 );\r
- createSelWg( tr( "FACE_1" ), iconSelect, aSelGrp2, Face1 );\r
- createSelWg( tr( "FACE_2" ), iconSelect, aSelGrp2, Face2 );\r
-\r
- QGroupBox* aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp2 );\r
- aSpinGrp1->setFrameStyle( QFrame::NoFrame );\r
- aSpinGrp1->setInsideMargin( 0 );\r
- \r
- myRadioButton[ RadioButton21] = new QRadioButton( aSpinGrp1 );\r
-\r
- new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );\r
- mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
-\r
- new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );\r
- mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
-\r
- QGroupBox* aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp2 );\r
- aSpinGrp2->setFrameStyle( QFrame::NoFrame );\r
- aSpinGrp2->setInsideMargin( 0 );\r
-\r
- myRadioButton[ RadioButton22] = new QRadioButton( aSpinGrp2 );\r
-\r
- new QLabel( tr( "GEOM_D" ), aSpinGrp2 );\r
- mySpinBox[ SpinBox23 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
-\r
- new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );\r
- mySpinBox[ SpinBox24 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
-\r
- ( new QLabel( myGrp2 ) )->setSizePolicy(\r
- QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
-\r
- // Create third group\r
-\r
- myGrp3 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_FACES" ), this );\r
-\r
- QGroupBox* aSelGrp3 = new QGroupBox( 3, Qt::Horizontal, myGrp3 );\r
- aSelGrp3->setFrameStyle( QFrame::NoFrame );\r
- aSelGrp3->setInsideMargin( 0 );\r
-\r
- createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp3, MainObj3 );\r
- createSelWg( tr( "SELECTED_FACES" ), iconSelect, aSelGrp3, Faces );\r
-\r
- aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp3 );\r
- aSpinGrp1->setFrameStyle( QFrame::NoFrame );\r
- aSpinGrp1->setInsideMargin( 0 );\r
-\r
- myRadioButton[ RadioButton31] = new QRadioButton( aSpinGrp1 );\r
-\r
- new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );\r
- mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
-\r
- new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );\r
- mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
-\r
- aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp3 );\r
- aSpinGrp2->setFrameStyle( QFrame::NoFrame );\r
- aSpinGrp2->setInsideMargin( 0 );\r
-\r
- myRadioButton[ RadioButton32] = new QRadioButton( aSpinGrp2 );\r
-\r
- new QLabel( tr( "GEOM_D" ), aSpinGrp2 );\r
- mySpinBox[ SpinBox33 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
-\r
- new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );\r
- mySpinBox[ SpinBox34 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
-\r
- ( new QLabel( myGrp3 ) )->setSizePolicy(\r
- QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
-\r
- // Create fourth group\r
-\r
- myGrp4 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGE" ), this );\r
-\r
- QGroupBox* aSelGrp4 = new QGroupBox( 3, Qt::Horizontal, myGrp4 );\r
- aSelGrp4->setFrameStyle( QFrame::NoFrame );\r
- aSelGrp4->setInsideMargin( 0 );\r
-\r
- createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp4, MainObj4 );\r
- createSelWg( tr( "SELECTED_EDGE" ), iconSelect, aSelGrp4, Edges );\r
-\r
- aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp4 );\r
- aSpinGrp1->setFrameStyle( QFrame::NoFrame );\r
- aSpinGrp1->setInsideMargin( 0 );\r
-\r
- myRadioButton[ RadioButton41] = new QRadioButton( aSpinGrp1 );\r
-\r
- new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );\r
- mySpinBox[ SpinBox41 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
-\r
- new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );\r
- mySpinBox[ SpinBox42 ] = new DlgRef_SpinBox( aSpinGrp1 );\r
-\r
- aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp4 );\r
- aSpinGrp2->setFrameStyle( QFrame::NoFrame );\r
- aSpinGrp2->setInsideMargin( 0 );\r
-\r
- myRadioButton[ RadioButton42] = new QRadioButton( aSpinGrp2 );\r
-\r
- new QLabel( tr( "GEOM_D" ), aSpinGrp2 );\r
- mySpinBox[ SpinBox43 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
-\r
- new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );\r
- mySpinBox[ SpinBox44 ] = new DlgRef_SpinBox( aSpinGrp2 );\r
-\r
- ( new QLabel( myGrp4 ) )->setSizePolicy(\r
- QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );\r
-\r
- // Add groups to layout\r
-\r
- Layout1->addWidget( myGrp1, 2, 0 );\r
- Layout1->addWidget( myGrp2, 2, 0 );\r
- Layout1->addWidget( myGrp3, 2, 0 );\r
- Layout1->addWidget( myGrp4, 2, 0 );\r
-\r
- // Set range of spinboxes\r
-\r
- double SpecificStep = 10.0;\r
- QMap< int, DlgRef_SpinBox* >::iterator anIter;\r
- for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )\r
- {\r
- anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, 3 );\r
- if ( anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24 )\r
- anIter.data()->RangeStepAndValidator( 0, 90, 5, 0 );\r
- }\r
-\r
- setHelpFileName("chamfer.htm");\r
-\r
- /* Initialisations */\r
- RadioButtonPressed();\r
- Init();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : ~OperationGUI_ChamferDlg()\r
-// purpose : Destroys the object and frees any allocated resources\r
-//=================================================================================\r
-OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()\r
-{\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : Init()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::Init()\r
-{\r
- myConstructorId = -1;\r
- reset();\r
- RadioButton1->setChecked( true );\r
- myEditCurrentArgument = mySelName[ MainObj1 ];\r
-\r
- /* signals and slots connections */\r
-\r
- // main buttons\r
- connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );\r
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );\r
-\r
- // group box\r
- connect( GroupConstructors, SIGNAL( clicked( int ) ),\r
- this, SLOT( ConstructorsClicked( int ) ) );\r
-\r
- // push buttons\r
- QMap< int, QPushButton* >::iterator anIterBtn;\r
- for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )\r
- connect( anIterBtn.data(), SIGNAL( clicked() ),\r
- this, SLOT( SetEditCurrentArgument() ) );\r
-\r
- // line edits\r
- QMap< int, QLineEdit* >::iterator anIterLE2;\r
- for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 )\r
- connect( anIterLE2.data(), SIGNAL( returnPressed() ),\r
- this, SLOT( LineEditReturnPressed() ) );\r
-\r
- // spin boxes\r
- QMap< int, DlgRef_SpinBox* >::iterator anIterSpin;\r
- for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )\r
- connect( anIterSpin.data(), SIGNAL( valueChanged( double ) ),\r
- this, SLOT( ValueChangedInSpinBox( double ) ) );\r
-\r
- // radio buttons\r
- QMap< int, QRadioButton* >::iterator anIterRadio;\r
- for ( anIterRadio = myRadioButton.begin(); anIterRadio != myRadioButton.end(); ++anIterRadio )\r
- connect( anIterRadio.data(), SIGNAL( clicked() ),\r
- this, SLOT( RadioButtonPressed() ) );\r
-\r
- // selection\r
- connect(myGeomGUI->getApp()->selectionMgr(), \r
- SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));\r
-\r
- initName( tr( "GEOM_CHAMFER" ) );\r
-\r
- myGrp4->hide();\r
- myGrp3->hide();\r
- myGrp2->hide();\r
- myGrp1->show();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : ConstructorsClicked()\r
-// purpose : Radio button management\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )\r
-{\r
- // Activate next widget\r
- if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType() \r
- != OCCViewer_Viewer::Type())\r
- {\r
- RadioButton1->setChecked( true );\r
- return;\r
- }\r
-\r
- if (myConstructorId == constructorId)\r
- return;\r
-\r
- // Get values from previous widget\r
- double D1 = 5, D2 = 5, D = 5, Angle = 5;\r
- if ( myConstructorId == 0 )\r
- D1 = D2 = mySpinBox[ SpinBox1 ]->GetValue();\r
- else if ( myConstructorId == 1 )\r
- {\r
- D1 = mySpinBox[ SpinBox21 ]->GetValue();\r
- D2 = mySpinBox[ SpinBox22 ]->GetValue();\r
- D = mySpinBox[ SpinBox23 ]->GetValue();\r
- Angle = mySpinBox[ SpinBox24 ]->GetValue();\r
- }\r
- else if ( myConstructorId == 2 )\r
- {\r
- D1 = mySpinBox[ SpinBox31 ]->GetValue();\r
- D2 = mySpinBox[ SpinBox32 ]->GetValue();\r
- D = mySpinBox[ SpinBox33 ]->GetValue();\r
- Angle = mySpinBox[ SpinBox34 ]->GetValue();\r
- }\r
- else if ( myConstructorId == 3 )\r
- {\r
- D1 = mySpinBox[ SpinBox41 ]->GetValue();\r
- D2 = mySpinBox[ SpinBox42 ]->GetValue();\r
- D = mySpinBox[ SpinBox43 ]->GetValue();\r
- Angle = mySpinBox[ SpinBox44 ]->GetValue();\r
- }\r
-\r
- myConstructorId = constructorId;\r
-\r
- switch ( constructorId )\r
- {\r
- case 0:\r
- myGrp1->show();\r
- myGrp2->hide();\r
- myGrp3->hide();\r
- myGrp4->hide();\r
- mySpinBox[ SpinBox1 ]->SetValue( D1 );\r
- break;\r
- case 1:\r
- myGrp1->hide();\r
- myGrp2->show();\r
- myGrp3->hide();\r
- myGrp4->hide();\r
- mySpinBox[ SpinBox21 ]->SetValue( D1 );\r
- mySpinBox[ SpinBox22 ]->SetValue( D2 );\r
- mySpinBox[ SpinBox23 ]->SetValue( D );\r
- mySpinBox[ SpinBox24 ]->SetValue( Angle );\r
- break;\r
- case 2:\r
- myGrp1->hide();\r
- myGrp2->hide();\r
- myGrp3->show();\r
- myGrp4->hide();\r
- mySpinBox[ SpinBox31 ]->SetValue( D1 );\r
- mySpinBox[ SpinBox32 ]->SetValue( D2 ); \r
- mySpinBox[ SpinBox33 ]->SetValue( D );\r
- mySpinBox[ SpinBox34 ]->SetValue( Angle );\r
- break;\r
- case 3:\r
- myGrp1->hide();\r
- myGrp2->hide();\r
- myGrp3->hide();\r
- myGrp4->show();\r
- mySpinBox[ SpinBox41 ]->SetValue( D1 );\r
- mySpinBox[ SpinBox42 ]->SetValue( D2 ); \r
- mySpinBox[ SpinBox43 ]->SetValue( D );\r
- mySpinBox[ SpinBox44 ]->SetValue( Angle );\r
- break;\r
- default:\r
- break;\r
- }\r
-\r
- if ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];\r
- else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];\r
- else if ( constructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];\r
- else myEditCurrentArgument = mySelName[ MainObj4 ];\r
-\r
- activateSelection(); \r
- enableWidgets();\r
- \r
- if ( !myShape->_is_nil() )\r
- {\r
- myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) );\r
- GEOMBase_Skeleton::LineEditReturnPressed();\r
- }\r
- else\r
- myEditCurrentArgument->setText( "" );\r
-\r
- displayPreview();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : ClickOnOk()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::ClickOnOk()\r
-{\r
- if ( ClickOnApply() )\r
- ClickOnCancel();\r
-}\r
-\r
-//=================================================================================\r
-// function : ClickOnApply()\r
-// purpose :\r
-//=================================================================================\r
-bool OperationGUI_ChamferDlg::ClickOnApply()\r
-{\r
- if ( !onAccept() )\r
- return false;\r
-\r
- initName();\r
- return true;\r
-}\r
-\r
-//=================================================================================\r
-// function : SelectionIntoArgument()\r
-// purpose : Called when selection has changed\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::SelectionIntoArgument()\r
-{\r
- erasePreview();\r
- myEditCurrentArgument->setText( "" );\r
-\r
- // Get index of current selection focus\r
- int aCurrFocus = -1;\r
- QMap< int, QLineEdit* >::iterator anIter;\r
- for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter )\r
- if ( myEditCurrentArgument == anIter.data() )\r
- {\r
- aCurrFocus = anIter.key();\r
- break;\r
- }\r
-\r
- // If selection of main object is activated\r
- if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 || aCurrFocus == MainObj4)\r
- {\r
- if ( IObjectCount() == 1 )\r
- {\r
- Standard_Boolean aResult = Standard_False;\r
- GEOM::GEOM_Object_var anObj =\r
- GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );\r
-\r
- if ( aResult && !anObj->_is_nil() )\r
- {\r
- myShape = anObj;\r
- mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) );\r
- displayPreview();\r
- enableWidgets();\r
- return;\r
- }\r
- }\r
-\r
- myShape = GEOM::GEOM_Object::_nil();\r
- enableWidgets();\r
- }\r
- // If face selection of second tab is activated\r
- else if ( aCurrFocus == Face1 || aCurrFocus == Face2 )\r
- {\r
- if ( IObjectCount() == 1 )\r
- {\r
- Standard_Boolean aResult = Standard_False;\r
- GEOM::GEOM_Object_var anObj =\r
- GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );\r
-\r
- if ( aResult && !anObj->_is_nil() )\r
- {\r
- TColStd_IndexedMapOfInteger anIndexes;\r
- ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );\r
-\r
- if ( anIndexes.Extent() == 1 )\r
- {\r
- int anIndex = anIndexes( 1 );\r
- QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1";\r
- myEditCurrentArgument->setText( aFaceName.arg( anIndex ) );\r
- myFace[ aCurrFocus ] = anIndex;\r
- displayPreview();\r
- return;\r
- }\r
- }\r
- }\r
-\r
- myFace[ aCurrFocus ] = -1;\r
- }\r
- // If face selection of third or fourth tab is activated\r
- else if ( aCurrFocus == Faces || aCurrFocus == Edges )\r
- {\r
- if ( IObjectCount() == 1 )\r
- {\r
- Standard_Boolean aResult = Standard_False;\r
- GEOM::GEOM_Object_var anObj =\r
- GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );\r
-\r
- if ( aResult && !anObj->_is_nil() )\r
- {\r
- TColStd_IndexedMapOfInteger anIndexes;\r
- ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );\r
-\r
- if ( anIndexes.Extent() > 0 )\r
- {\r
- QString aName;\r
- if ( anIndexes.Extent() == 1 )\r
- {\r
- int anIndex = anIndexes( 1 );\r
-\r
- aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );\r
- }\r
- else\r
- aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );\r
-\r
- myEditCurrentArgument->setText( aName );\r
- int aConstructorId = getConstructorId();\r
- if ( aConstructorId == 2)\r
- myFaces = anIndexes;\r
- else if (aConstructorId == 3)\r
- myEdges = anIndexes;\r
- \r
- displayPreview();\r
- return;\r
- }\r
- }\r
- }\r
- myFaces.Clear();\r
- myEdges.Clear();\r
- }\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : LineEditReturnPressed()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::LineEditReturnPressed()\r
-{\r
- QLineEdit* aSender = ( QLineEdit* )sender();\r
-\r
- QMap< int, QLineEdit* >::iterator anIterLE;\r
- for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )\r
- if ( anIterLE.data() == aSender )\r
- myEditCurrentArgument = anIterLE.data();\r
-\r
- GEOMBase_Skeleton::LineEditReturnPressed();\r
-}\r
-\r
-//=================================================================================\r
-// function : RadioButtonPressed()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::RadioButtonPressed()\r
-{\r
- bool flag;\r
- flag = ( myRadioButton[ RadioButton21 ]->isChecked() &&\r
- myRadioButton[ RadioButton31 ]->isChecked() &&\r
- myRadioButton[ RadioButton41 ]->isChecked() );\r
- \r
- myRadioButton[ RadioButton21 ]->setChecked(!flag);\r
- myRadioButton[ RadioButton31 ]->setChecked(!flag);\r
- myRadioButton[ RadioButton41 ]->setChecked(!flag);\r
- myRadioButton[ RadioButton22 ]->setChecked(flag);\r
- myRadioButton[ RadioButton32 ]->setChecked(flag);\r
- myRadioButton[ RadioButton42 ]->setChecked(flag);\r
- mySpinBox[ SpinBox21 ]->setDisabled(flag);\r
- mySpinBox[ SpinBox22 ]->setDisabled(flag); \r
- mySpinBox[ SpinBox31 ]->setDisabled(flag); \r
- mySpinBox[ SpinBox32 ]->setDisabled(flag); \r
- mySpinBox[ SpinBox41 ]->setDisabled(flag); \r
- mySpinBox[ SpinBox42 ]->setDisabled(flag);\r
- mySpinBox[ SpinBox23 ]->setDisabled(!flag);\r
- mySpinBox[ SpinBox24 ]->setDisabled(!flag); \r
- mySpinBox[ SpinBox33 ]->setDisabled(!flag); \r
- mySpinBox[ SpinBox34 ]->setDisabled(!flag); \r
- mySpinBox[ SpinBox43 ]->setDisabled(!flag); \r
- mySpinBox[ SpinBox44 ]->setDisabled(!flag);\r
- displayPreview();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : SetEditCurrentArgument()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::SetEditCurrentArgument()\r
-{\r
- QPushButton* aSender = ( QPushButton* )sender();\r
-\r
- QMap< int, QPushButton* >::iterator anIter;\r
- for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )\r
- if ( anIter.data() == aSender )\r
- {\r
- mySelName[ anIter.key() ]->setFocus();\r
- myEditCurrentArgument = mySelName[ anIter.key() ];\r
- }\r
-\r
- activateSelection();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : ActivateThisDialog()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::ActivateThisDialog()\r
-{\r
- GEOMBase_Skeleton::ActivateThisDialog();\r
-\r
- connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), \r
- SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) );\r
-\r
- activateSelection();\r
- displayPreview();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : enterEvent()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::enterEvent(QEvent* e)\r
-{\r
- if ( !GroupConstructors->isEnabled() )\r
- this->ActivateThisDialog();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : ValueChangedInSpinBox()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue )\r
-{\r
- displayPreview();\r
-}\r
-\r
-\r
-//=================================================================================\r
-// function : createSelWg()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl,\r
- QPixmap& thePix,\r
- QWidget* theParent,\r
- const int theId )\r
-{\r
- new QLabel( theLbl, theParent );\r
- mySelBtn[ theId ] = new QPushButton( theParent );\r
- mySelBtn[ theId ]->setPixmap( thePix );\r
- mySelName[ theId ] = new QLineEdit( theParent );\r
- mySelName[ theId ]->setReadOnly( true );\r
-}\r
-\r
-//=================================================================================\r
-// function : reset()\r
-// purpose :\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::reset()\r
-{\r
- // Set Initial values of spinboxes\r
- QMap< int, DlgRef_SpinBox* >::iterator anIter;\r
- for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )\r
- anIter.data()->SetValue( 5 );\r
-\r
- // clear line edits\r
- QMap< int, QLineEdit* >::iterator anIterLE;\r
- for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )\r
- anIterLE.data()->setText( "" );\r
-\r
- // constructor id\r
- int aConstructorId = getConstructorId();\r
-\r
- if ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];\r
- else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];\r
- else if ( aConstructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];\r
- else myEditCurrentArgument = mySelName[ MainObj4 ];\r
-\r
- myShape = GEOM::GEOM_Object::_nil();\r
-\r
- myFaces.Clear();\r
- myEdges.Clear();\r
- myFace[ Face1 ] = -1;\r
- myFace[ Face2 ] = -1;\r
-\r
- erasePreview( true );\r
-\r
- activateSelection();\r
-\r
- enableWidgets();\r
-}\r
-\r
-//=================================================================================\r
-// function : getConstructorId()\r
-// purpose :\r
-//=================================================================================\r
-int OperationGUI_ChamferDlg::getConstructorId() const\r
-{\r
- return GroupConstructors->id( GroupConstructors->selected() );\r
-}\r
-\r
-//=================================================================================\r
-// function : activateSelection\r
-// purpose : Activate selection in accordance with myEditCurrentArgument\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::activateSelection()\r
-{\r
- if ( !myShape->_is_nil() &&\r
- ( myEditCurrentArgument == mySelName[ Face1 ] ||\r
- myEditCurrentArgument == mySelName[ Face2 ] ||\r
- myEditCurrentArgument == mySelName[ Faces ] ) )\r
- localSelection( myShape, TopAbs_FACE );\r
- else if (!myShape->_is_nil() && myEditCurrentArgument == mySelName[ Edges ] )\r
- localSelection( myShape, TopAbs_EDGE );\r
- else\r
- {\r
- TColStd_MapOfInteger aMap;\r
- aMap.Add( GEOM_SHELL );\r
- aMap.Add( GEOM_SOLID );\r
- aMap.Add( GEOM_COMPOUND );\r
- globalSelection( aMap );\r
- }\r
-\r
- SelectionIntoArgument();\r
-}\r
-\r
-//=================================================================================\r
-// function : enableWidgets\r
-// purpose : Enable widgets of faces in accordance with value of main object\r
-//=================================================================================\r
-void OperationGUI_ChamferDlg::enableWidgets()\r
-{\r
- int anId = getConstructorId();\r
-\r
- bool toEnable = !myShape->_is_nil();\r
- \r
- if ( anId == 1 )\r
- {\r
- mySelName[ Face1 ]->setEnabled( toEnable );\r
- mySelName[ Face2 ]->setEnabled( toEnable );\r
- mySelBtn[ Face1 ]->setEnabled( toEnable );\r
- mySelBtn[ Face2 ]->setEnabled( toEnable );\r
-\r
- if ( !toEnable )\r
- {\r
- mySelName[ Face1 ]->setText( "" );\r
- mySelName[ Face2 ]->setText( "" );\r
- myFace[ Face1 ] = -1;\r
- myFace[ Face2 ] = -1;\r
- }\r
- }\r
- else if ( anId == 2 )\r
- {\r
- mySelName[ Faces ]->setEnabled( toEnable );\r
-\r
- if ( !toEnable )\r
- {\r
- mySelName[ Faces ]->setText( "" );\r
- myFaces = -1;\r
- }\r
- }\r
- else if ( anId == 3 )\r
- {\r
- mySelName[ Edges ]->setEnabled( toEnable );\r
-\r
- if ( !toEnable )\r
- {\r
- mySelName[ Edges ]->setText( "" );\r
- myEdges = -1;\r
- }\r
- }\r
-}\r
-\r
-//=================================================================================\r
-// function : createOperation\r
-// purpose :\r
-//=================================================================================\r
-GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation()\r
-{\r
- return getGeomEngine()->GetILocalOperations( getStudyId() );\r
-}\r
-\r
-//=================================================================================\r
-// function : ClickOnApply()\r
-// purpose : Verify validity of input data\r
-//=================================================================================\r
-bool OperationGUI_ChamferDlg::isValid( QString& )\r
-{\r
- switch ( getConstructorId() )\r
- {\r
- case 0: return !myShape->_is_nil();\r
- case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0;\r
- case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;\r
- case 3: return !myShape->_is_nil() && myEdges.Extent() > 0;\r
- default: return false;\r
- }\r
-}\r
-\r
-//=================================================================================\r
-// function : execute\r
-// purpose :\r
-//=================================================================================\r
-bool OperationGUI_ChamferDlg::execute( ObjectList& objects )\r
-{\r
- GEOM::GEOM_Object_var anObj;\r
- bool flag = ( myRadioButton[ RadioButton21 ]->isChecked() &&\r
- myRadioButton[ RadioButton31 ]->isChecked() &&\r
- myRadioButton[ RadioButton41 ]->isChecked() );\r
-\r
- int anId = getConstructorId();\r
- if ( anId == 0 )\r
- anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
- getOperation() )->MakeChamferAll( myShape,\r
- mySpinBox[ SpinBox1 ]->GetValue() );\r
- else if ( anId == 1 )\r
- {\r
- if ( flag )\r
- anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
- getOperation() )->MakeChamferEdge( myShape,\r
- mySpinBox[ SpinBox21 ]->GetValue(),\r
- mySpinBox[ SpinBox22 ]->GetValue(),\r
- myFace[ Face1 ],\r
- myFace[ Face2 ] );\r
- else\r
- anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
- getOperation() )->MakeChamferEdgeAD( myShape,\r
- mySpinBox[ SpinBox23 ]->GetValue(),\r
- mySpinBox[ SpinBox24 ]->GetValue() * PI180,\r
- myFace[ Face1 ],\r
- myFace[ Face2 ] );\r
- }\r
- else if ( anId == 2 )\r
- {\r
- GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;\r
- anArray->length( myFaces.Extent() );\r
-\r
- for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )\r
- anArray[ i - 1 ] = myFaces( i ); \r
- if ( flag )\r
- anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
- getOperation() )->MakeChamferFaces( myShape,\r
- mySpinBox[ SpinBox31 ]->GetValue(),\r
- mySpinBox[ SpinBox32 ]->GetValue(),\r
- anArray );\r
- else\r
- anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
- getOperation() )->MakeChamferFacesAD( myShape,\r
- mySpinBox[ SpinBox33 ]->GetValue(),\r
- mySpinBox[ SpinBox34 ]->GetValue() * PI180,\r
- anArray );\r
- }\r
- else if ( anId == 3 )\r
- {\r
- GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;\r
- anArray->length( myEdges.Extent() );\r
- for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )\r
- anArray[ i - 1 ] = myEdges( i ); \r
- if ( flag )\r
- anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
- getOperation() )->MakeChamferEdges( myShape, mySpinBox[ SpinBox41 ]->GetValue(),\r
- mySpinBox[ SpinBox42 ]->GetValue(), anArray );\r
- else\r
- anObj = GEOM::GEOM_ILocalOperations::_narrow(\r
- getOperation() )->MakeChamferEdgesAD( myShape, mySpinBox[ SpinBox43 ]->GetValue(),\r
- mySpinBox[ SpinBox44 ]->GetValue() * PI180, anArray );\r
- }\r
-\r
- if ( !anObj->_is_nil() )\r
- objects.push_back( anObj._retn() );\r
-\r
- return true;\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : OperationGUI_ChamferDlg.cxx
+// Author : Damien COQUERET
+// Module : GEOM
+// $Header$
+
+#include "OperationGUI_ChamferDlg.h"
+#include "DlgRef_SpinBox.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+#include "OCCViewer_ViewModel.h"
+
+#include <TColStd_MapOfInteger.hxx>
+
+#include <qlabel.h>
+#include "qpixmap.h"
+#include <list>
+
+#include "GEOMImpl_Types.hxx"
+
+//=================================================================================
+// class : OperationGUI_ChamferDlg()
+// purpose : Constructs a OperationGUI_ChamferDlg 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.
+//=================================================================================
+OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(GeometryGUI* theGeometryGUI, QWidget* parent)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, "ChamferDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+ myConstructorId = -1;
+
+ QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL")));
+ QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE_FROM_FACE")));
+ QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE")));
+ QPixmap image4(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE")));
+ QPixmap iconSelect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
+
+ setCaption( tr( "GEOM_CHAMFER_TITLE" ) );
+
+ GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) );
+
+ RadioButton1->setPixmap( image1 );
+ RadioButton2->setPixmap( image2 );
+ RadioButton3->setPixmap( image3 );
+ RadioButton4->show();
+ RadioButton4->setPixmap( image4 );
+
+ // Create first group
+
+ myGrp1 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_ALL" ), this );
+
+ QGroupBox* aSelGrp1 = new QGroupBox( 3, Qt::Horizontal, myGrp1 );
+ aSelGrp1->setFrameStyle( QFrame::NoFrame );
+ aSelGrp1->setInsideMargin( 0 );
+
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp1, MainObj1 );
+
+ QGroupBox* aSpinGrp = new QGroupBox( 1, Qt::Vertical, myGrp1 );
+ aSpinGrp->setFrameStyle( QFrame::NoFrame );
+ aSpinGrp->setInsideMargin( 0 );
+
+ new QLabel( tr( "D" ), aSpinGrp );
+ mySpinBox[ SpinBox1 ] = new DlgRef_SpinBox( aSpinGrp );
+
+ ( new QFrame( myGrp1 ) )->setSizePolicy(
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+
+ // Create second group
+
+ myGrp2 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGES" ), this );
+
+ QGroupBox* aSelGrp2 = new QGroupBox( 3, Qt::Horizontal, myGrp2 );
+ aSelGrp2->setFrameStyle( QFrame::NoFrame );
+ aSelGrp2->setInsideMargin( 0 );
+
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp2, MainObj2 );
+ createSelWg( tr( "FACE_1" ), iconSelect, aSelGrp2, Face1 );
+ createSelWg( tr( "FACE_2" ), iconSelect, aSelGrp2, Face2 );
+
+ QGroupBox* aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp2 );
+ aSpinGrp1->setFrameStyle( QFrame::NoFrame );
+ aSpinGrp1->setInsideMargin( 0 );
+
+ myRadioButton[ RadioButton21] = new QRadioButton( aSpinGrp1 );
+
+ new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );
+ mySpinBox[ SpinBox21 ] = new DlgRef_SpinBox( aSpinGrp1 );
+
+ new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );
+ mySpinBox[ SpinBox22 ] = new DlgRef_SpinBox( aSpinGrp1 );
+
+ QGroupBox* aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp2 );
+ aSpinGrp2->setFrameStyle( QFrame::NoFrame );
+ aSpinGrp2->setInsideMargin( 0 );
+
+ myRadioButton[ RadioButton22] = new QRadioButton( aSpinGrp2 );
+
+ new QLabel( tr( "GEOM_D" ), aSpinGrp2 );
+ mySpinBox[ SpinBox23 ] = new DlgRef_SpinBox( aSpinGrp2 );
+
+ new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );
+ mySpinBox[ SpinBox24 ] = new DlgRef_SpinBox( aSpinGrp2 );
+
+ ( new QLabel( myGrp2 ) )->setSizePolicy(
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+
+ // Create third group
+
+ myGrp3 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_FACES" ), this );
+
+ QGroupBox* aSelGrp3 = new QGroupBox( 3, Qt::Horizontal, myGrp3 );
+ aSelGrp3->setFrameStyle( QFrame::NoFrame );
+ aSelGrp3->setInsideMargin( 0 );
+
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp3, MainObj3 );
+ createSelWg( tr( "SELECTED_FACES" ), iconSelect, aSelGrp3, Faces );
+
+ aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp3 );
+ aSpinGrp1->setFrameStyle( QFrame::NoFrame );
+ aSpinGrp1->setInsideMargin( 0 );
+
+ myRadioButton[ RadioButton31] = new QRadioButton( aSpinGrp1 );
+
+ new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );
+ mySpinBox[ SpinBox31 ] = new DlgRef_SpinBox( aSpinGrp1 );
+
+ new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );
+ mySpinBox[ SpinBox32 ] = new DlgRef_SpinBox( aSpinGrp1 );
+
+ aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp3 );
+ aSpinGrp2->setFrameStyle( QFrame::NoFrame );
+ aSpinGrp2->setInsideMargin( 0 );
+
+ myRadioButton[ RadioButton32] = new QRadioButton( aSpinGrp2 );
+
+ new QLabel( tr( "GEOM_D" ), aSpinGrp2 );
+ mySpinBox[ SpinBox33 ] = new DlgRef_SpinBox( aSpinGrp2 );
+
+ new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );
+ mySpinBox[ SpinBox34 ] = new DlgRef_SpinBox( aSpinGrp2 );
+
+ ( new QLabel( myGrp3 ) )->setSizePolicy(
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+
+ // Create fourth group
+
+ myGrp4 = new QGroupBox( 1, Qt::Horizontal, tr( "GEOM_CHAMFER_EDGE" ), this );
+
+ QGroupBox* aSelGrp4 = new QGroupBox( 3, Qt::Horizontal, myGrp4 );
+ aSelGrp4->setFrameStyle( QFrame::NoFrame );
+ aSelGrp4->setInsideMargin( 0 );
+
+ createSelWg( tr( "GEOM_MAIN_OBJECT" ), iconSelect, aSelGrp4, MainObj4 );
+ createSelWg( tr( "SELECTED_EDGE" ), iconSelect, aSelGrp4, Edges );
+
+ aSpinGrp1 = new QGroupBox( 1, Qt::Vertical, myGrp4 );
+ aSpinGrp1->setFrameStyle( QFrame::NoFrame );
+ aSpinGrp1->setInsideMargin( 0 );
+
+ myRadioButton[ RadioButton41] = new QRadioButton( aSpinGrp1 );
+
+ new QLabel( tr( "GEOM_D1" ), aSpinGrp1 );
+ mySpinBox[ SpinBox41 ] = new DlgRef_SpinBox( aSpinGrp1 );
+
+ new QLabel( tr( "GEOM_D2" ), aSpinGrp1 );
+ mySpinBox[ SpinBox42 ] = new DlgRef_SpinBox( aSpinGrp1 );
+
+ aSpinGrp2 = new QGroupBox( 1, Qt::Vertical, myGrp4 );
+ aSpinGrp2->setFrameStyle( QFrame::NoFrame );
+ aSpinGrp2->setInsideMargin( 0 );
+
+ myRadioButton[ RadioButton42] = new QRadioButton( aSpinGrp2 );
+
+ new QLabel( tr( "GEOM_D" ), aSpinGrp2 );
+ mySpinBox[ SpinBox43 ] = new DlgRef_SpinBox( aSpinGrp2 );
+
+ new QLabel( tr( "GEOM_ANGLE" ), aSpinGrp2 );
+ mySpinBox[ SpinBox44 ] = new DlgRef_SpinBox( aSpinGrp2 );
+
+ ( new QLabel( myGrp4 ) )->setSizePolicy(
+ QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
+
+ // Add groups to layout
+
+ Layout1->addWidget( myGrp1, 2, 0 );
+ Layout1->addWidget( myGrp2, 2, 0 );
+ Layout1->addWidget( myGrp3, 2, 0 );
+ Layout1->addWidget( myGrp4, 2, 0 );
+
+ // Set range of spinboxes
+
+ double SpecificStep = 10.0;
+ QMap< int, DlgRef_SpinBox* >::iterator anIter;
+ for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
+ {
+ anIter.data()->RangeStepAndValidator( 0.001, COORD_MAX, SpecificStep, 3 );
+ if ( anIter.key() == SpinBox44 || anIter.key() == SpinBox34 || anIter.key() == SpinBox24 )
+ anIter.data()->RangeStepAndValidator( 0, 90, 5, 0 );
+ }
+
+ setHelpFileName("chamfer.htm");
+
+ /* Initialisations */
+ RadioButtonPressed();
+ Init();
+}
+
+
+//=================================================================================
+// function : ~OperationGUI_ChamferDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()
+{
+}
+
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::Init()
+{
+ myConstructorId = -1;
+ reset();
+ RadioButton1->setChecked( true );
+ myEditCurrentArgument = mySelName[ MainObj1 ];
+
+ /* signals and slots connections */
+
+ // main buttons
+ connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+
+ // group box
+ connect( GroupConstructors, SIGNAL( clicked( int ) ),
+ this, SLOT( ConstructorsClicked( int ) ) );
+
+ // push buttons
+ QMap< int, QPushButton* >::iterator anIterBtn;
+ for ( anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn )
+ connect( anIterBtn.data(), SIGNAL( clicked() ),
+ this, SLOT( SetEditCurrentArgument() ) );
+
+ // line edits
+ QMap< int, QLineEdit* >::iterator anIterLE2;
+ for ( anIterLE2 = mySelName.begin(); anIterLE2 != mySelName.end(); ++anIterLE2 )
+ connect( anIterLE2.data(), SIGNAL( returnPressed() ),
+ this, SLOT( LineEditReturnPressed() ) );
+
+ // spin boxes
+ QMap< int, DlgRef_SpinBox* >::iterator anIterSpin;
+ for ( anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin )
+ connect( anIterSpin.data(), SIGNAL( valueChanged( double ) ),
+ this, SLOT( ValueChangedInSpinBox( double ) ) );
+
+ // radio buttons
+ QMap< int, QRadioButton* >::iterator anIterRadio;
+ for ( anIterRadio = myRadioButton.begin(); anIterRadio != myRadioButton.end(); ++anIterRadio )
+ connect( anIterRadio.data(), SIGNAL( clicked() ),
+ this, SLOT( RadioButtonPressed() ) );
+
+ // selection
+ connect(myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+
+ initName( tr( "GEOM_CHAMFER" ) );
+
+ myGrp4->hide();
+ myGrp3->hide();
+ myGrp2->hide();
+ myGrp1->show();
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose : Radio button management
+//=================================================================================
+void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId )
+{
+ // Activate next widget
+ if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
+ != OCCViewer_Viewer::Type())
+ {
+ RadioButton1->setChecked( true );
+ return;
+ }
+
+ if (myConstructorId == constructorId)
+ return;
+
+ // Get values from previous widget
+ double D1 = 5, D2 = 5, D = 5, Angle = 5;
+ if ( myConstructorId == 0 )
+ D1 = D2 = mySpinBox[ SpinBox1 ]->GetValue();
+ else if ( myConstructorId == 1 )
+ {
+ D1 = mySpinBox[ SpinBox21 ]->GetValue();
+ D2 = mySpinBox[ SpinBox22 ]->GetValue();
+ D = mySpinBox[ SpinBox23 ]->GetValue();
+ Angle = mySpinBox[ SpinBox24 ]->GetValue();
+ }
+ else if ( myConstructorId == 2 )
+ {
+ D1 = mySpinBox[ SpinBox31 ]->GetValue();
+ D2 = mySpinBox[ SpinBox32 ]->GetValue();
+ D = mySpinBox[ SpinBox33 ]->GetValue();
+ Angle = mySpinBox[ SpinBox34 ]->GetValue();
+ }
+ else if ( myConstructorId == 3 )
+ {
+ D1 = mySpinBox[ SpinBox41 ]->GetValue();
+ D2 = mySpinBox[ SpinBox42 ]->GetValue();
+ D = mySpinBox[ SpinBox43 ]->GetValue();
+ Angle = mySpinBox[ SpinBox44 ]->GetValue();
+ }
+
+ myConstructorId = constructorId;
+
+ switch ( constructorId )
+ {
+ case 0:
+ myGrp1->show();
+ myGrp2->hide();
+ myGrp3->hide();
+ myGrp4->hide();
+ mySpinBox[ SpinBox1 ]->SetValue( D1 );
+ break;
+ case 1:
+ myGrp1->hide();
+ myGrp2->show();
+ myGrp3->hide();
+ myGrp4->hide();
+ mySpinBox[ SpinBox21 ]->SetValue( D1 );
+ mySpinBox[ SpinBox22 ]->SetValue( D2 );
+ mySpinBox[ SpinBox23 ]->SetValue( D );
+ mySpinBox[ SpinBox24 ]->SetValue( Angle );
+ break;
+ case 2:
+ myGrp1->hide();
+ myGrp2->hide();
+ myGrp3->show();
+ myGrp4->hide();
+ mySpinBox[ SpinBox31 ]->SetValue( D1 );
+ mySpinBox[ SpinBox32 ]->SetValue( D2 );
+ mySpinBox[ SpinBox33 ]->SetValue( D );
+ mySpinBox[ SpinBox34 ]->SetValue( Angle );
+ break;
+ case 3:
+ myGrp1->hide();
+ myGrp2->hide();
+ myGrp3->hide();
+ myGrp4->show();
+ mySpinBox[ SpinBox41 ]->SetValue( D1 );
+ mySpinBox[ SpinBox42 ]->SetValue( D2 );
+ mySpinBox[ SpinBox43 ]->SetValue( D );
+ mySpinBox[ SpinBox44 ]->SetValue( Angle );
+ break;
+ default:
+ break;
+ }
+
+ if ( constructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
+ else if ( constructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
+ else if ( constructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];
+ else myEditCurrentArgument = mySelName[ MainObj4 ];
+
+ activateSelection();
+ enableWidgets();
+
+ if ( !myShape->_is_nil() )
+ {
+ myEditCurrentArgument->setText( GEOMBase::GetName( myShape ) );
+ GEOMBase_Skeleton::LineEditReturnPressed();
+ }
+ else
+ myEditCurrentArgument->setText( "" );
+
+ displayPreview();
+}
+
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::ClickOnOk()
+{
+ if ( ClickOnApply() )
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool OperationGUI_ChamferDlg::ClickOnApply()
+{
+ if ( !onAccept() )
+ return false;
+
+ initName();
+ return true;
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection has changed
+//=================================================================================
+void OperationGUI_ChamferDlg::SelectionIntoArgument()
+{
+ erasePreview();
+ myEditCurrentArgument->setText( "" );
+
+ // Get index of current selection focus
+ int aCurrFocus = -1;
+ QMap< int, QLineEdit* >::iterator anIter;
+ for ( anIter = mySelName.begin(); anIter != mySelName.end(); ++anIter )
+ if ( myEditCurrentArgument == anIter.data() )
+ {
+ aCurrFocus = anIter.key();
+ break;
+ }
+
+ // If selection of main object is activated
+ if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 || aCurrFocus == MainObj4)
+ {
+ if ( IObjectCount() == 1 )
+ {
+ Standard_Boolean aResult = Standard_False;
+ GEOM::GEOM_Object_var anObj =
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
+
+ if ( aResult && !anObj->_is_nil() )
+ {
+ myShape = anObj;
+ mySelName[ aCurrFocus ]->setText( GEOMBase::GetName( anObj ) );
+ displayPreview();
+ enableWidgets();
+ return;
+ }
+ }
+
+ myShape = GEOM::GEOM_Object::_nil();
+ enableWidgets();
+ }
+ // If face selection of second tab is activated
+ else if ( aCurrFocus == Face1 || aCurrFocus == Face2 )
+ {
+ if ( IObjectCount() == 1 )
+ {
+ Standard_Boolean aResult = Standard_False;
+ GEOM::GEOM_Object_var anObj =
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
+
+ if ( aResult && !anObj->_is_nil() )
+ {
+ TColStd_IndexedMapOfInteger anIndexes;
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
+
+ if ( anIndexes.Extent() == 1 )
+ {
+ int anIndex = anIndexes( 1 );
+ QString aFaceName = QString( GEOMBase::GetName( anObj ) ) + ":%1";
+ myEditCurrentArgument->setText( aFaceName.arg( anIndex ) );
+ myFace[ aCurrFocus ] = anIndex;
+ displayPreview();
+ return;
+ }
+ }
+ }
+
+ myFace[ aCurrFocus ] = -1;
+ }
+ // If face selection of third or fourth tab is activated
+ else if ( aCurrFocus == Faces || aCurrFocus == Edges )
+ {
+ if ( IObjectCount() == 1 )
+ {
+ Standard_Boolean aResult = Standard_False;
+ GEOM::GEOM_Object_var anObj =
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
+
+ if ( aResult && !anObj->_is_nil() )
+ {
+ TColStd_IndexedMapOfInteger anIndexes;
+ ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes );
+
+ if ( anIndexes.Extent() > 0 )
+ {
+ QString aName;
+ if ( anIndexes.Extent() == 1 )
+ {
+ int anIndex = anIndexes( 1 );
+
+ aName = QString( GEOMBase::GetName( anObj ) ) + QString( ":%1" ).arg( anIndex );
+ }
+ else
+ aName = tr( "GEOM_MEN_POPUP_NAME" ).arg( anIndexes.Extent() );
+
+ myEditCurrentArgument->setText( aName );
+ int aConstructorId = getConstructorId();
+ if ( aConstructorId == 2)
+ myFaces = anIndexes;
+ else if (aConstructorId == 3)
+ myEdges = anIndexes;
+
+ displayPreview();
+ return;
+ }
+ }
+ }
+ myFaces.Clear();
+ myEdges.Clear();
+ }
+}
+
+
+//=================================================================================
+// function : LineEditReturnPressed()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::LineEditReturnPressed()
+{
+ QLineEdit* aSender = ( QLineEdit* )sender();
+
+ QMap< int, QLineEdit* >::iterator anIterLE;
+ for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
+ if ( anIterLE.data() == aSender )
+ myEditCurrentArgument = anIterLE.data();
+
+ GEOMBase_Skeleton::LineEditReturnPressed();
+}
+
+//=================================================================================
+// function : RadioButtonPressed()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::RadioButtonPressed()
+{
+ bool flag;
+ flag = ( myRadioButton[ RadioButton21 ]->isChecked() &&
+ myRadioButton[ RadioButton31 ]->isChecked() &&
+ myRadioButton[ RadioButton41 ]->isChecked() );
+
+ myRadioButton[ RadioButton21 ]->setChecked(!flag);
+ myRadioButton[ RadioButton31 ]->setChecked(!flag);
+ myRadioButton[ RadioButton41 ]->setChecked(!flag);
+ myRadioButton[ RadioButton22 ]->setChecked(flag);
+ myRadioButton[ RadioButton32 ]->setChecked(flag);
+ myRadioButton[ RadioButton42 ]->setChecked(flag);
+ mySpinBox[ SpinBox21 ]->setDisabled(flag);
+ mySpinBox[ SpinBox22 ]->setDisabled(flag);
+ mySpinBox[ SpinBox31 ]->setDisabled(flag);
+ mySpinBox[ SpinBox32 ]->setDisabled(flag);
+ mySpinBox[ SpinBox41 ]->setDisabled(flag);
+ mySpinBox[ SpinBox42 ]->setDisabled(flag);
+ mySpinBox[ SpinBox23 ]->setDisabled(!flag);
+ mySpinBox[ SpinBox24 ]->setDisabled(!flag);
+ mySpinBox[ SpinBox33 ]->setDisabled(!flag);
+ mySpinBox[ SpinBox34 ]->setDisabled(!flag);
+ mySpinBox[ SpinBox43 ]->setDisabled(!flag);
+ mySpinBox[ SpinBox44 ]->setDisabled(!flag);
+ displayPreview();
+}
+
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::SetEditCurrentArgument()
+{
+ QPushButton* aSender = ( QPushButton* )sender();
+
+ QMap< int, QPushButton* >::iterator anIter;
+ for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )
+ if ( anIter.data() == aSender )
+ {
+ mySelName[ anIter.key() ]->setFocus();
+ myEditCurrentArgument = mySelName[ anIter.key() ];
+ }
+
+ activateSelection();
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) );
+
+ activateSelection();
+ displayPreview();
+}
+
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::enterEvent(QEvent* e)
+{
+ if ( !GroupConstructors->isEnabled() )
+ this->ActivateThisDialog();
+}
+
+
+//=================================================================================
+// function : ValueChangedInSpinBox()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue )
+{
+ displayPreview();
+}
+
+
+//=================================================================================
+// function : createSelWg()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::createSelWg( const QString& theLbl,
+ QPixmap& thePix,
+ QWidget* theParent,
+ const int theId )
+{
+ new QLabel( theLbl, theParent );
+ mySelBtn[ theId ] = new QPushButton( theParent );
+ mySelBtn[ theId ]->setPixmap( thePix );
+ mySelName[ theId ] = new QLineEdit( theParent );
+ mySelName[ theId ]->setReadOnly( true );
+}
+
+//=================================================================================
+// function : reset()
+// purpose :
+//=================================================================================
+void OperationGUI_ChamferDlg::reset()
+{
+ // Set Initial values of spinboxes
+ QMap< int, DlgRef_SpinBox* >::itertor anIter;
+ for ( anIter = mySpinBox.begin(); anIter != mySpinBox.end(); ++anIter )
+ anIter.data()->SetValue( 5 );
+
+ // clear line edits
+ QMap< int, QLineEdit* >::iterator anIterLE;
+ for ( anIterLE = mySelName.begin(); anIterLE != mySelName.end(); ++anIterLE )
+ anIterLE.data()->setText( "" );
+
+ // constructor id
+ int aConstructorId = getConstructorId();
+
+ if ( aConstructorId == 0 ) myEditCurrentArgument = mySelName[ MainObj1 ];
+ else if ( aConstructorId == 1 ) myEditCurrentArgument = mySelName[ MainObj2 ];
+ else if ( aConstructorId == 2 ) myEditCurrentArgument = mySelName[ MainObj3 ];
+ else myEditCurrentArgument = mySelName[ MainObj4 ];
+
+ myShape = GEOM::GEOM_Object::_nil();
+
+ myFaces.Clear();
+ myEdges.Clear();
+ myFace[ Face1 ] = -1;
+ myFace[ Face2 ] = -1;
+
+ erasePreview( true );
+
+ activateSelection();
+
+ enableWidgets();
+}
+
+//=================================================================================
+// function : getConstructorId()
+// purpose :
+//=================================================================================
+int OperationGUI_ChamferDlg::getConstructorId() const
+{
+ return GroupConstructors->id( GroupConstructors->selected() );
+}
+
+//=================================================================================
+// function : activateSelection
+// purpose : Activate selection in accordance with myEditCurrentArgument
+//=================================================================================
+void OperationGUI_ChamferDlg::activateSelection()
+{
+ if ( !myShape->_is_nil() &&
+ ( myEditCurrentArgument == mySelName[ Face1 ] ||
+ myEditCurrentArgument == mySelName[ Face2 ] ||
+ myEditCurrentArgument == mySelName[ Faces ] ) )
+ localSelection( myShape, TopAbs_FACE );
+ else if (!myShape->_is_nil() && myEditCurrentArgument == mySelName[ Edges ] )
+ localSelection( myShape, TopAbs_EDGE );
+ else
+ {
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_SHELL );
+ aMap.Add( GEOM_SOLID );
+ aMap.Add( GEOM_COMPOUND );
+ globalSelection( aMap );
+ }
+
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : enableWidgets
+// purpose : Enable widgets of faces in accordance with value of main object
+//=================================================================================
+void OperationGUI_ChamferDlg::enableWidgets()
+{
+ int anId = getConstructorId();
+
+ bool toEnable = !myShape->_is_nil();
+
+ if ( anId == 1 )
+ {
+ mySelName[ Face1 ]->setEnabled( toEnable );
+ mySelName[ Face2 ]->setEnabled( toEnable );
+ mySelBtn[ Face1 ]->setEnabled( toEnable );
+ mySelBtn[ Face2 ]->setEnabled( toEnable );
+
+ if ( !toEnable )
+ {
+ mySelName[ Face1 ]->setText( "" );
+ mySelName[ Face2 ]->setText( "" );
+ myFace[ Face1 ] = -1;
+ myFace[ Face2 ] = -1;
+ }
+ }
+ else if ( anId == 2 )
+ {
+ mySelName[ Faces ]->setEnabled( toEnable );
+ if ( !toEnable )
+ {
+ mySelName[ Faces ]->setText( "" );
+ myFaces = -1;
+ }
+ }
+ else if ( anId == 3 )
+ {
+ mySelName[ Edges ]->setEnabled( toEnable );
+
+ if ( !toEnable )
+ {
+ mySelName[ Edges ]->setText( "" );
+ myEdges = -1;
+ }
+ }
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr OperationGUI_ChamferDlg::createOperation()
+{
+ return getGeomEngine()->GetILocalOperations( getStudyId() );
+}
+//=================================================================================
+// function : ClickOnApply()
+// purpose : Verify validity of input data
+//=================================================================================
+bool OperationGUI_ChamferDlg::isValid( QString& )
+{
+ switch ( getConstructorId() )
+ {
+ case 0: return !myShape->_is_nil();
+ case 1: return !myShape->_is_nil() && myFace[ Face1 ] > 0 && myFace[ Face2 ] > 0;
+ case 2: return !myShape->_is_nil() && myFaces.Extent() > 0;
+ case 3: return !myShape->_is_nil() && myEdges.Extent() > 0;
+ default: return false;
+ }
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool OperationGUI_ChamferDlg::execute( ObjectList& objects )
+{
+ GEOM::GEOM_Object_var anObj;
+ bool flag = ( myRadioButton[ RadioButton21 ]->isChecked() &&
+ myRadioButton[ RadioButton31 ]->isChecked() &&
+ myRadioButton[ RadioButton41 ]->isChecked() );
+
+ int anId = getConstructorId();
+ if ( anId == 0 )
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeChamferAll( myShape,
+ mySpinBox[ SpinBox1 ]->GetValue() );
+ else if ( anId == 1 )
+ {
+ if ( flag )
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeChamferEdge( myShape,
+ mySpinBox[ SpinBox21 ]->GetValue(),
+ mySpinBox[ SpinBox22 ]->GetValue(),
+ myFace[ Face1 ],
+ myFace[ Face2 ] );
+ else
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeChamferEdgeAD( myShape,
+ mySpinBox[ SpinBox23 ]->GetValue(),
+ mySpinBox[ SpinBox24 ]->GetValue() * PI180,
+ myFace[ Face1 ],
+ myFace[ Face2 ]);
+ }
+ else if ( anId == 2 )
+ {
+ GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+ anArray->length( myFaces.Extent() );
+ for ( int i = 1, n = myFaces.Extent(); i <= n; i++ )
+ anArray[ i - 1 ] = myFaces( i );
+ if ( flag )
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeChamferFaces( myShape,
+ mySpinBox[ SpinBox31 ]->GetValue(),
+ mySpinBox[ SpinBox32 ]->GetValue(),
+ anArray );
+ else
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeChamferFacesAD( myShape,
+ mySpinBox[ SpinBox33 ]->GetValue(),
+ mySpinBox[ SpinBox34 ]->GetValue() * PI180,
+ anArray );
+ }
+ else if ( anId == 3 )
+ { GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
+ anArray->length( myEdges.Extent() )
+ for ( int i = 1, n = myEdges.Extent(); i <= n; i++ )
+ anArray[ i - 1 ] = myEdges( i );
+ if ( flag )
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeChamferEdges( myShape, mySpinBox[ SpinBox41 ]->GetValue(),
+ mySpinBox[ SpinBox42 ]->GetValue(), anArray );
+ else
+ anObj = GEOM::GEOM_ILocalOperations::_narrow(
+ getOperation() )->MakeChamferEdgesAD( myShape, mySpinBox[ SpinBox43 ]->GetValue(),
+ mySpinBox[ SpinBox44 ]->GetValue() * PI180, anArray );
+ }
+
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+
+ return true;
+}
+
+