mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-14 09:38:33 +05:00
*** empty log message ***
This commit is contained in:
parent
717a547e50
commit
56b5060f4b
@ -69,9 +69,8 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_TransparencyDlg.cxx \
|
||||
SMESHGUI_ClippingDlg.cxx \
|
||||
SMESHGUI_GroupDlg.cxx \
|
||||
SMESHGUI_RemoveNodesDlg.cxx \
|
||||
SMESHGUI_RemoveNodesOp.cxx \
|
||||
SMESHGUI_RemoveElementsDlg.cxx \
|
||||
SMESHGUI_RemoveDlg.cxx \
|
||||
SMESHGUI_RemoveOp.cxx \
|
||||
SMESHGUI_MeshInfosDlg.cxx \
|
||||
SMESHGUI_StandardMeshInfosDlg.cxx \
|
||||
SMESHGUI_Preferences_ColorDlg.cxx \
|
||||
@ -98,6 +97,7 @@ LIB_SRC = SMESHGUI.cxx \
|
||||
SMESHGUI_RenumberingDlg.cxx \
|
||||
SMESHGUI_RenumberingOp.cxx \
|
||||
SMESHGUI_ExtrusionDlg.cxx \
|
||||
SMESHGUI_ExtrusionOp.cxx \
|
||||
SMESHGUI_ExtrusionAlongPathDlg.cxx \
|
||||
SMESHGUI_RevolutionDlg.cxx \
|
||||
SMESHGUI_RotationDlg.cxx \
|
||||
@ -138,9 +138,8 @@ LIB_MOC = \
|
||||
SMESHGUI_TransparencyDlg.h \
|
||||
SMESHGUI_ClippingDlg.h \
|
||||
SMESHGUI_GroupDlg.h \
|
||||
SMESHGUI_RemoveNodesDlg.h \
|
||||
SMESHGUI_RemoveNodesOp.h \
|
||||
SMESHGUI_RemoveElementsDlg.h \
|
||||
SMESHGUI_RemoveDlg.h \
|
||||
SMESHGUI_RemoveOp.h \
|
||||
SMESHGUI_MeshInfosDlg.h \
|
||||
SMESHGUI_StandardMeshInfosDlg.h \
|
||||
SMESHGUI_Preferences_ColorDlg.h \
|
||||
@ -163,6 +162,7 @@ LIB_MOC = \
|
||||
SMESHGUI_RenumberingDlg.h \
|
||||
SMESHGUI_RenumberingOp.h \
|
||||
SMESHGUI_ExtrusionDlg.h \
|
||||
SMESHGUI_ExtrusionOp.h \
|
||||
SMESHGUI_ExtrusionAlongPathDlg.h \
|
||||
SMESHGUI_RevolutionDlg.h \
|
||||
SMESHGUI_RotationDlg.h \
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include "SMESHGUI_TransparencyDlg.h"
|
||||
#include "SMESHGUI_ClippingDlg.h"
|
||||
#include "SMESHGUI_GroupDlg.h"
|
||||
#include "SMESHGUI_RemoveNodesOp.h"
|
||||
#include "SMESHGUI_RemoveElementsDlg.h"
|
||||
#include "SMESHGUI_RemoveOp.h"
|
||||
#include "SMESHGUI_MeshInfosDlg.h"
|
||||
#include "SMESHGUI_StandardMeshInfosDlg.h"
|
||||
#include "SMESHGUI_Preferences_ColorDlg.h"
|
||||
@ -53,7 +52,7 @@
|
||||
#include "SMESHGUI_DeleteGroupDlg.h"
|
||||
#include "SMESHGUI_SmoothingDlg.h"
|
||||
#include "SMESHGUI_RenumberingOp.h"
|
||||
#include "SMESHGUI_ExtrusionDlg.h"
|
||||
#include "SMESHGUI_ExtrusionOp.h"
|
||||
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
|
||||
#include "SMESHGUI_RevolutionDlg.h"
|
||||
#include "SMESHGUI_TranslationDlg.h"
|
||||
@ -1337,17 +1336,19 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case 410: // Union of triangles
|
||||
case 411: // Cutting of quadrangles
|
||||
{
|
||||
if ( !vtkwnd )
|
||||
/* if ( !vtkwnd )
|
||||
{
|
||||
SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
|
||||
tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
if ( checkLock( aStudy ) )
|
||||
break;
|
||||
|
||||
EmitSignalDeactivateDialog();
|
||||
startOperation( theCommandID );
|
||||
|
||||
/* EmitSignalDeactivateDialog();
|
||||
SMESHGUI_MultiEditDlg* aDlg = NULL;
|
||||
if ( theCommandID == 409 )
|
||||
aDlg = new SMESHGUI_ChangeOrientationDlg(this);
|
||||
@ -1359,7 +1360,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
int x, y ;
|
||||
DefineDlgPosition( aDlg, x, y );
|
||||
aDlg->move( x, y );
|
||||
aDlg->show();
|
||||
aDlg->show();*/
|
||||
break;
|
||||
}
|
||||
case 412: // Smoothing
|
||||
@ -1378,15 +1379,17 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
case 413: // Extrusion
|
||||
{
|
||||
if (checkLock(aStudy)) break;
|
||||
if (vtkwnd) {
|
||||
if( checkLock( aStudy) )
|
||||
break;
|
||||
startOperation( 413 );
|
||||
/* if (vtkwnd) {
|
||||
EmitSignalDeactivateDialog();
|
||||
new SMESHGUI_ExtrusionDlg ( this );
|
||||
} else {
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
||||
tr("SMESH_BUT_OK"));
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
case 414: // Revolution
|
||||
@ -1938,7 +1941,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case 4042: // REMOVES ELEMENTS
|
||||
{
|
||||
if(checkLock(aStudy)) break;
|
||||
if( vtkwnd ) {
|
||||
startOperation( 4042 );
|
||||
/* if( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
new SMESHGUI_RemoveElementsDlg(this);
|
||||
}
|
||||
@ -1947,7 +1951,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
SUIT_MessageBox::warn1(desktop(),
|
||||
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
||||
tr("SMESH_BUT_OK"));
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
case 4051: // RENUMBERING NODES
|
||||
@ -3223,10 +3227,14 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
||||
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Volume, 8 );
|
||||
break;
|
||||
|
||||
case 4041:
|
||||
op = new SMESHGUI_RemoveNodesOp();
|
||||
case 4041: //REMOVE NODES
|
||||
op = new SMESHGUI_RemoveOp( false );
|
||||
break;
|
||||
|
||||
case 4042: //REMOVE ELEMENTS
|
||||
op = new SMESHGUI_RemoveOp( true );
|
||||
break;
|
||||
|
||||
case 4051: // RENUMBERING NODES
|
||||
op = new SMESHGUI_RenumberingOp( 0 );
|
||||
break;
|
||||
@ -3258,6 +3266,22 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
||||
case 812:
|
||||
op = new SMESHGUI_GroupOp( SMESHGUI_GroupOp::CUT );
|
||||
break;
|
||||
|
||||
/* case 409: // Change orientation
|
||||
op = new SMESHGUI_ChangeOrientationOp();
|
||||
break;
|
||||
|
||||
case 410: // Union of triangles
|
||||
op = new SMESHGUI_UnionOfTrianglesDlg();
|
||||
break;*/
|
||||
|
||||
/* case 411: // Cutting of quadrangles
|
||||
op = new SMESHGUI_CuttingOfQuadsDlg();
|
||||
break;*/
|
||||
|
||||
case 413:
|
||||
op = new SMESHGUI_ExtrusionOp();
|
||||
break;
|
||||
|
||||
default:
|
||||
op = SalomeApp_Module::createOperation( id );
|
||||
@ -3265,12 +3289,3 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
||||
}
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -334,15 +334,3 @@ void SMESHGUI_AddSubMeshOp::onNameChanged( const QString& )
|
||||
{
|
||||
updateDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_AddSubMeshOp::isValid( SUIT_Operation* theOtherOp ) const
|
||||
{
|
||||
//if ( theOtherOp && theOtherOp->inherits( "SMESHGUI_InitMeshOp" ) )
|
||||
return true;
|
||||
/*else
|
||||
return false;*/
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ public:
|
||||
|
||||
virtual SalomeApp_Dialog* dlg() const;
|
||||
virtual void initDialog();
|
||||
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
||||
|
||||
protected:
|
||||
virtual void startOperation();
|
||||
|
@ -27,250 +27,143 @@
|
||||
// $Header:
|
||||
|
||||
#include "SMESHGUI_ExtrusionDlg.h"
|
||||
#include <SMESHGUI_SpinBox.h>
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_SpinBox.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_NumberFilter.hxx"
|
||||
#include "SMESH_LogicalFilter.hxx"
|
||||
#include <SMDSAbs_ElementType.hxx>
|
||||
#include <SMESH_Type.h>
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
#include "SUIT_MessageBox.h"
|
||||
|
||||
#include "SVTK_ViewModel.h"
|
||||
#include "SVTK_ViewWindow.h"
|
||||
#include "SVTK_Selector.h"
|
||||
#include "SVTK_Selection.h"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
// OCCT Includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
// QT Includes
|
||||
#include <qapplication.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qspinbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qvalidator.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
using namespace std;
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qradiobutton.h>
|
||||
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_ExtrusionDlg()
|
||||
// purpose : constructor
|
||||
//=================================================================================
|
||||
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
|
||||
bool modal)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionDlg", modal, WStyle_Customize |
|
||||
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myViewWindow( SMESH::GetViewWindow( theModule ) ),
|
||||
mySelector( myViewWindow->GetSelector() )
|
||||
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg()
|
||||
: SMESHGUI_Dialog( false, true, OK | Apply | Close )
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
|
||||
QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
QPixmap image0( resMgr()->loadPixmap( "SMESH", tr( "ICON_DLG_EDGE") ) ),
|
||||
image1( resMgr()->loadPixmap( "SMESH", tr( "ICON_DLG_TRIANGLE") ) );
|
||||
|
||||
resize(303, 185);
|
||||
setCaption(tr("EXTRUSION_ALONG_LINE"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
|
||||
QGridLayout* SMESHGUI_ExtrusionDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_ExtrusionDlgLayout->setSpacing(6);
|
||||
SMESHGUI_ExtrusionDlgLayout->setMargin(11);
|
||||
|
||||
QVBoxLayout* main = new QVBoxLayout( mainFrame() );
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup("GroupConstructors", this);
|
||||
GroupConstructors->setTitle(tr("SMESH_EXTRUSION"));
|
||||
GroupConstructors->setExclusive(TRUE);
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical);
|
||||
GroupConstructors->layout()->setSpacing(0);
|
||||
GroupConstructors->layout()->setMargin(0);
|
||||
QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
|
||||
myGroupConstructors = new QButtonGroup("GroupConstructors", mainFrame() );
|
||||
myGroupConstructors->setTitle(tr("SMESH_EXTRUSION"));
|
||||
myGroupConstructors->setExclusive(TRUE);
|
||||
myGroupConstructors->setColumnLayout(0, Qt::Vertical);
|
||||
myGroupConstructors->layout()->setSpacing(0);
|
||||
myGroupConstructors->layout()->setMargin(0);
|
||||
QGridLayout* GroupConstructorsLayout = new QGridLayout(myGroupConstructors->layout());
|
||||
GroupConstructorsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupConstructorsLayout->setSpacing(6);
|
||||
GroupConstructorsLayout->setMargin(11);
|
||||
RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
|
||||
QRadioButton* RadioButton1 = new QRadioButton(myGroupConstructors, "RadioButton1");
|
||||
RadioButton1->setText(tr(""));
|
||||
RadioButton1->setPixmap(image0);
|
||||
GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
|
||||
RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
|
||||
QRadioButton* RadioButton2 = new QRadioButton(myGroupConstructors, "RadioButton2");
|
||||
RadioButton2->setText(tr(""));
|
||||
RadioButton2->setPixmap(image1);
|
||||
GroupConstructorsLayout->addWidget(RadioButton2, 0, 2);
|
||||
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupConstructors, 0, 0);
|
||||
main->addWidget(myGroupConstructors);
|
||||
|
||||
/***************************************************************/
|
||||
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);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
buttonCancel = new QPushButton(GroupButtons, "buttonCancel");
|
||||
buttonCancel->setText(tr("SMESH_BUT_CLOSE" ));
|
||||
buttonCancel->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
||||
buttonApply = new QPushButton(GroupButtons, "buttonApply");
|
||||
buttonApply->setText(tr("SMESH_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("SMESH_BUT_OK" ));
|
||||
buttonOk->setAutoDefault(TRUE);
|
||||
buttonOk->setDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
|
||||
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons, 2, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupArguments = new QGroupBox(this, "GroupArguments");
|
||||
GroupArguments->setTitle(tr("EXTRUSION_1D"));
|
||||
GroupArguments->setColumnLayout(0, Qt::Vertical);
|
||||
GroupArguments->layout()->setSpacing(0);
|
||||
GroupArguments->layout()->setMargin(0);
|
||||
QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout());
|
||||
GroupArgumentsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupArgumentsLayout->setSpacing(6);
|
||||
GroupArgumentsLayout->setMargin(11);
|
||||
myGroupArguments = new QGroupBox( mainFrame(), "GroupArguments");
|
||||
myGroupArguments->setTitle(tr("EXTRUSION_1D"));
|
||||
myGroupArguments->setColumnLayout( 1, Qt::Horizontal );
|
||||
myGroupArguments->layout()->setSpacing(0);
|
||||
myGroupArguments->layout()->setMargin(11);
|
||||
|
||||
QGroupBox* sel = new QGroupBox( myGroupArguments );
|
||||
sel->setColumnLayout( 3, Qt::Horizontal );
|
||||
sel->setFrameShape( QFrame::NoFrame );
|
||||
sel->layout()->setSpacing(0);
|
||||
sel->layout()->setMargin(0);
|
||||
|
||||
// Controls for elements selection
|
||||
TextLabelElements = new QLabel(GroupArguments, "TextLabelElements");
|
||||
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
|
||||
TextLabelElements->setFixedWidth(74);
|
||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
||||
createObject( tr( "SMESH_ID_ELEMENTS" ), sel, 0 );
|
||||
createObject( tr( "SMESH_NAME" ), sel, 1 );
|
||||
|
||||
SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton");
|
||||
SelectElementsButton->setText(tr("" ));
|
||||
SelectElementsButton->setPixmap(image2);
|
||||
SelectElementsButton->setToggleButton(FALSE);
|
||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
||||
|
||||
LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
|
||||
LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
|
||||
GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7);
|
||||
int epr = prefix( "SMESH element" );
|
||||
setObjectType( 0, epr + SMDSAbs_Edge, epr + SMDSAbs_Face, -1 );
|
||||
setNameIndication( 0, ListOfNames );
|
||||
setReadOnly( 0, false );
|
||||
int mpr = prefix( "SMESH" );
|
||||
setObjectType( 1, mpr + MESH, mpr + SUBMESH, mpr + SUBMESH_EDGE, mpr + GROUP, -1 );
|
||||
setNameIndication( 1, OneName );
|
||||
|
||||
QGroupBox* box1 = new QGroupBox( myGroupArguments );
|
||||
box1->setColumnLayout( 1, Qt::Vertical );
|
||||
box1->setFrameShape( QFrame::NoFrame );
|
||||
box1->layout()->setSpacing(0);
|
||||
box1->layout()->setMargin(0);
|
||||
|
||||
// Control for the whole mesh selection
|
||||
CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
|
||||
CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
|
||||
GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 7);
|
||||
myCheckBoxMesh = new QCheckBox( box1, "CheckBoxMesh" );
|
||||
myCheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
|
||||
|
||||
QGroupBox* box2 = new QGroupBox( myGroupArguments );
|
||||
box2->setColumnLayout( 1, Qt::Vertical );
|
||||
box2->setFrameShape( QFrame::NoFrame );
|
||||
box2->layout()->setSpacing(0);
|
||||
box2->layout()->setMargin(0);
|
||||
|
||||
// Controls for vector selection
|
||||
TextLabelVector = new QLabel(GroupArguments, "TextLabelVector");
|
||||
TextLabelVector->setText(tr("SMESH_VECTOR"));
|
||||
GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
|
||||
QLabel* TextLabelVector = new QLabel( box2, "TextLabelVector" );
|
||||
TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
|
||||
|
||||
TextLabelDx = new QLabel(GroupArguments, "TextLabelDx");
|
||||
QLabel* TextLabelDx = new QLabel( box2, "TextLabelDx" );
|
||||
TextLabelDx->setText(tr("SMESH_DX"));
|
||||
GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
|
||||
|
||||
SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx");
|
||||
GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
|
||||
myDx = new SMESHGUI_SpinBox( box2, "SpinBox_Dx" );
|
||||
|
||||
TextLabelDy = new QLabel(GroupArguments, "TextLabelDy");
|
||||
QLabel* TextLabelDy = new QLabel( box2, "TextLabelDy" );
|
||||
TextLabelDy->setText(tr("SMESH_DY"));
|
||||
GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
|
||||
|
||||
SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy");
|
||||
GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
|
||||
myDy = new SMESHGUI_SpinBox( box2, "SpinBox_Dy" );
|
||||
|
||||
TextLabelDz = new QLabel(GroupArguments, "TextLabelDz");
|
||||
QLabel* TextLabelDz = new QLabel( box2, "TextLabelDz" );
|
||||
TextLabelDz->setText(tr("SMESH_DZ"));
|
||||
GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
|
||||
|
||||
SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz");
|
||||
GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
|
||||
myDz = new SMESHGUI_SpinBox( box2, "SpinBox_Dz" );
|
||||
|
||||
QGroupBox* box3 = new QGroupBox( myGroupArguments );
|
||||
box3->setColumnLayout( 1, Qt::Vertical );
|
||||
box3->setFrameShape( QFrame::NoFrame );
|
||||
box3->layout()->setSpacing(0);
|
||||
box3->layout()->setMargin(0);
|
||||
|
||||
// Controls for nb. steps defining
|
||||
TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps");
|
||||
QLabel* TextLabelNbSteps = new QLabel( box3, "TextLabelNbSteps" );
|
||||
TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
|
||||
GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 3, 3, 0, 1);
|
||||
|
||||
SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
|
||||
GroupArgumentsLayout->addMultiCellWidget(SpinBox_NbSteps, 3, 3, 2, 7);
|
||||
myNbSteps = new QSpinBox( box3, "SpinBox_NbSteps" );
|
||||
|
||||
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments, 1, 0);
|
||||
main->addWidget( myGroupArguments );
|
||||
|
||||
/* Initialisations */
|
||||
SpinBox_Dx->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||
SpinBox_Dy->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||
SpinBox_Dz->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||
myDx->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||
myDy->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||
myDz->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||
|
||||
QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
|
||||
SpinBox_NbSteps->setValidator(anIntValidator);
|
||||
SpinBox_NbSteps->setRange(1, 999999);
|
||||
QIntValidator* anIntValidator = new QIntValidator( myNbSteps );
|
||||
myNbSteps->setValidator( anIntValidator );
|
||||
myNbSteps->setRange( 1, 999999 );
|
||||
|
||||
GroupArguments->show();
|
||||
RadioButton1->setChecked(TRUE);
|
||||
|
||||
mySMESHGUI->SetActiveDialogBox(this);
|
||||
|
||||
// Costruction of the logical filter for the elements: mesh/sub-mesh/group
|
||||
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
|
||||
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP);
|
||||
|
||||
QPtrList<SUIT_SelectionFilter> aListOfFilters;
|
||||
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
|
||||
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
|
||||
|
||||
myMeshOrSubMeshOrGroupFilter =
|
||||
new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR);
|
||||
|
||||
Init();
|
||||
|
||||
/***************************************************************/
|
||||
// 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(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
/* to close dialog if study change */
|
||||
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
|
||||
connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool)));
|
||||
|
||||
/***************************************************************/
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show(); // displays Dialog
|
||||
|
||||
ConstructorsClicked(0);
|
||||
connect( myGroupConstructors, SIGNAL( clicked( int ) ), this, SLOT ( onConstructorsClicked( int ) ) );
|
||||
connect( myGroupConstructors, SIGNAL( clicked( int ) ), this, SIGNAL( constructorClicked( int ) ) );
|
||||
connect( myCheckBoxMesh, SIGNAL( toggled( bool ) ), this, SLOT ( onSelectMesh( bool ) ) );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -279,457 +172,82 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
|
||||
//=================================================================================
|
||||
SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose : initialization
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
|
||||
{
|
||||
myBusy = false;
|
||||
|
||||
LineEditElements->clear();
|
||||
myElementsId = "";
|
||||
myNbOkElements = 0;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
myActor = 0;
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
|
||||
if (ResetControls) {
|
||||
SpinBox_NbSteps->setValue(1);
|
||||
SpinBox_Dx->SetValue(0);
|
||||
SpinBox_Dy->SetValue(0);
|
||||
SpinBox_Dz->SetValue(0);
|
||||
|
||||
CheckBoxMesh->setChecked(false);
|
||||
onSelectMesh(false);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// function : onConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
|
||||
void SMESHGUI_ExtrusionDlg::onConstructorsClicked( int id )
|
||||
{
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
|
||||
switch (constructorId) {
|
||||
case 0:
|
||||
{
|
||||
GroupArguments->setTitle(tr("EXTRUSION_1D"));
|
||||
if (!CheckBoxMesh->isChecked())
|
||||
myViewWindow->SetSelectionMode(EdgeSelection);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
GroupArguments->setTitle(tr("EXTRUSION_2D"));
|
||||
if (!CheckBoxMesh->isChecked())
|
||||
myViewWindow->SetSelectionMode(FaceSelection);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
myEditCurrentArgument = LineEditElements;
|
||||
LineEditElements->setFocus();
|
||||
|
||||
if (CheckBoxMesh->isChecked())
|
||||
onSelectMesh(true);
|
||||
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
myGroupArguments->setTitle( tr( QString( "EXTRUSION_%1D" ).arg( id+1 ) ) );
|
||||
int mpr = prefix( "SMESH" );
|
||||
setObjectType( 1, mpr + MESH, mpr + SUBMESH, mpr + ( id==0 ? SUBMESH_EDGE : SUBMESH_FACE ), mpr + GROUP, -1 );
|
||||
clearSelection();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose : Called when user presses <Apply> button
|
||||
//=================================================================================
|
||||
bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
if (myNbOkElements) {
|
||||
QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
|
||||
|
||||
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||
|
||||
anElementsId->length(aListElementsId.count());
|
||||
for (int i = 0; i < aListElementsId.count(); i++)
|
||||
anElementsId[i] = aListElementsId[i].toInt();
|
||||
|
||||
SMESH::DirStruct aVector;
|
||||
aVector.PS.x = SpinBox_Dx->GetValue();
|
||||
aVector.PS.y = SpinBox_Dy->GetValue();
|
||||
aVector.PS.z = SpinBox_Dz->GetValue();
|
||||
|
||||
long aNbSteps = (long)SpinBox_NbSteps->value();
|
||||
|
||||
try {
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps);
|
||||
QApplication::restoreOverrideCursor();
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
mySelectionMgr->clearSelected();
|
||||
SMESH::UpdateView();
|
||||
Init(false);
|
||||
ConstructorsClicked(GetConstructorId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose : Called when user presses <OK> button
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::ClickOnOk()
|
||||
{
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose : Called when dialog box is closed
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::ClickOnCancel()
|
||||
{
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->clearSelected();
|
||||
SMESH::SetPickable(); // ???
|
||||
SMESH::SetPointRepresentation(false);
|
||||
myViewWindow->SetSelectionMode(ActorSelection);
|
||||
mySMESHGUI->ResetState();
|
||||
reject();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onTextChange()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
|
||||
// return if busy
|
||||
if (myBusy) return;
|
||||
|
||||
// set busy flag
|
||||
myBusy = true;
|
||||
|
||||
if (send == LineEditElements)
|
||||
myNbOkElements = 0;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
// hilight entered elements/nodes
|
||||
SMDS_Mesh* aMesh = 0;
|
||||
if (myActor)
|
||||
aMesh = myActor->GetObject()->GetMesh();
|
||||
|
||||
if (aMesh) {
|
||||
QStringList aListId = QStringList::split(" ", theNewText, false);
|
||||
|
||||
if (send == LineEditElements) {
|
||||
const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO();
|
||||
TColStd_MapOfInteger newIndices;
|
||||
for (int i = 0; i < aListId.count(); i++) {
|
||||
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
|
||||
if (e)
|
||||
newIndices.Add(e->GetID());
|
||||
myNbOkElements++;
|
||||
}
|
||||
mySelector->AddOrRemoveIndex(anIO, newIndices, false);
|
||||
myViewWindow->highlight( anIO, true, true );
|
||||
myElementsId = theNewText;
|
||||
}
|
||||
}
|
||||
|
||||
if (myNbOkElements) {
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
|
||||
myBusy = false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
||||
{
|
||||
if (myBusy) return;
|
||||
|
||||
// return if dialog box is inactive
|
||||
if (!GroupButtons->isEnabled())
|
||||
return;
|
||||
|
||||
// clear
|
||||
myActor = 0;
|
||||
QString aString = "";
|
||||
|
||||
// set busy flag
|
||||
myBusy = true;
|
||||
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myNbOkElements = 0;
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
myBusy = false;
|
||||
|
||||
// get selected mesh
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
|
||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
if (nbSel != 1)
|
||||
return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myMesh = SMESH::GetMeshByIO(IO);
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
|
||||
myActor = SMESH::FindActorByObject(myMesh);
|
||||
if (!myActor)
|
||||
return;
|
||||
|
||||
if (myEditCurrentArgument == LineEditElements) {
|
||||
int aNbElements = 0;
|
||||
myElementsId = "";
|
||||
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
int aConstructorId = GetConstructorId();
|
||||
|
||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
||||
// get IDs from mesh
|
||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||
if (!aSMDSMesh)
|
||||
return;
|
||||
|
||||
if (aConstructorId == 0) {
|
||||
SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
|
||||
|
||||
while (anIter->more()) {
|
||||
const SMDS_MeshEdge * edge = anIter->next();
|
||||
if (edge) {
|
||||
myElementsId += QString(" %1").arg(edge->GetID());
|
||||
aNbElements++;
|
||||
}
|
||||
}
|
||||
} else if (aConstructorId == 1) {
|
||||
SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
|
||||
while (anIter->more()) {
|
||||
const SMDS_MeshFace * face = anIter->next();
|
||||
if (face) {
|
||||
myElementsId += QString(" %1").arg(face->GetID());
|
||||
aNbElements++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
|
||||
// get submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||
|
||||
// get IDs from submesh
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
if (aConstructorId == 0)
|
||||
anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
|
||||
else if (aConstructorId == 1)
|
||||
anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
|
||||
|
||||
for (int i = 0; i < anElementsIds->length(); i++)
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
aNbElements = anElementsIds->length();
|
||||
} else { // GROUP
|
||||
// get smesh group
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||
if (aGroup->_is_nil())
|
||||
return;
|
||||
|
||||
if ((aConstructorId == 0 && aGroup->GetType() != SMESH::EDGE) ||
|
||||
(aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
|
||||
return;
|
||||
|
||||
// get IDs from smesh group
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
anElementsIds = aGroup->GetListOfID();
|
||||
for (int i = 0; i < anElementsIds->length(); i++)
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
aNbElements = anElementsIds->length();
|
||||
}
|
||||
} else {
|
||||
aNbElements = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
|
||||
myElementsId = aString;
|
||||
}
|
||||
|
||||
if (aNbElements < 1)
|
||||
return;
|
||||
|
||||
myNbOkElements = true;
|
||||
}
|
||||
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myBusy = false;
|
||||
|
||||
// OK
|
||||
if (myNbOkElements) {
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySelectionMgr->clearSelected();
|
||||
mySelectionMgr->clearFilters();
|
||||
|
||||
if (send == SelectElementsButton) {
|
||||
myEditCurrentArgument = LineEditElements;
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
myViewWindow->SetSelectionMode(ActorSelection);
|
||||
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
|
||||
} else {
|
||||
int aConstructorId = GetConstructorId();
|
||||
if (aConstructorId == 0)
|
||||
myViewWindow->SetSelectionMode(EdgeSelection);
|
||||
else if (aConstructorId == 1)
|
||||
myViewWindow->SetSelectionMode(FaceSelection);
|
||||
}
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose : Deactivates this dialog
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if (GroupConstructors->isEnabled()) {
|
||||
GroupConstructors->setEnabled(false);
|
||||
GroupArguments->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
mySMESHGUI->ResetState();
|
||||
mySMESHGUI->SetActiveDialogBox(0);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose : Activates this dialog
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::ActivateThisDialog()
|
||||
{
|
||||
// Emit a signal to deactivate the active dialog
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
GroupConstructors->setEnabled(true);
|
||||
GroupArguments->setEnabled(true);
|
||||
GroupButtons->setEnabled(true);
|
||||
|
||||
mySMESHGUI->SetActiveDialogBox(this);
|
||||
|
||||
ConstructorsClicked(GetConstructorId());
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose : Mouse enter event
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if (!GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
//void SMESHGUI_ExtrusionDlg::closeEvent (QCloseEvent*)
|
||||
//{
|
||||
// /* same than click on cancel button */
|
||||
// this->ClickOnCancel();
|
||||
//}
|
||||
//
|
||||
//=================================================================================
|
||||
// function : hideEvent()
|
||||
// purpose : caused by ESC key
|
||||
//=================================================================================
|
||||
//void SMESHGUI_ExtrusionDlg::hideEvent (QHideEvent*)
|
||||
//{
|
||||
// if (!isMinimized())
|
||||
// ClickOnCancel();
|
||||
//}
|
||||
|
||||
//=================================================================================
|
||||
// function : onSelectMesh()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
|
||||
void SMESHGUI_ExtrusionDlg::onSelectMesh( bool toSelectMesh )
|
||||
{
|
||||
if (toSelectMesh)
|
||||
TextLabelElements->setText(tr("SMESH_NAME"));
|
||||
else
|
||||
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
|
||||
|
||||
if (myEditCurrentArgument != LineEditElements) {
|
||||
LineEditElements->clear();
|
||||
return;
|
||||
}
|
||||
|
||||
mySelectionMgr->clearFilters();
|
||||
|
||||
if (toSelectMesh) {
|
||||
myViewWindow->SetSelectionMode(ActorSelection);
|
||||
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
|
||||
LineEditElements->setReadOnly(true);
|
||||
} else {
|
||||
int aConstructorId = GetConstructorId();
|
||||
if (aConstructorId == 0)
|
||||
myViewWindow->SetSelectionMode(EdgeSelection);
|
||||
else if (aConstructorId == 0)
|
||||
myViewWindow->SetSelectionMode(FaceSelection);
|
||||
|
||||
LineEditElements->setReadOnly(false);
|
||||
onTextChange(LineEditElements->text());
|
||||
}
|
||||
|
||||
SelectionIntoArgument();
|
||||
setObjectShown( 0, !toSelectMesh );
|
||||
setObjectShown( 1, toSelectMesh );
|
||||
clearSelection();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetConstructorId()
|
||||
// function : constructorId()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
int SMESHGUI_ExtrusionDlg::GetConstructorId()
|
||||
int SMESHGUI_ExtrusionDlg::constructorId() const
|
||||
{
|
||||
if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
|
||||
return GroupConstructors->id(GroupConstructors->selected());
|
||||
return -1;
|
||||
if( myGroupConstructors && myGroupConstructors->selected() )
|
||||
return myGroupConstructors->id( myGroupConstructors->selected() );
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::init()
|
||||
{
|
||||
myGroupConstructors->setButton( 0 );
|
||||
myCheckBoxMesh->setChecked( false );
|
||||
onSelectMesh( false );
|
||||
myDx->setValue( 0.0 );
|
||||
myDy->setValue( 0.0 );
|
||||
myDz->setValue( 0.0 );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : coords()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionDlg::coords( double& x, double& y, double& z ) const
|
||||
{
|
||||
x = myDx->value();
|
||||
y = myDy->value();
|
||||
z = myDz->value();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : nbStep()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
int SMESHGUI_ExtrusionDlg::nbStep() const
|
||||
{
|
||||
return myNbSteps->value();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isSelectMesh()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_ExtrusionDlg::isSelectMesh() const
|
||||
{
|
||||
return myCheckBoxMesh->isChecked();
|
||||
}
|
||||
|
@ -29,101 +29,46 @@
|
||||
#ifndef DIALOGBOX_EXTRUSION_H
|
||||
#define DIALOGBOX_EXTRUSION_H
|
||||
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
#include "SUIT_SelectionFilter.h"
|
||||
#include <SMESHGUI_Dialog.h>
|
||||
|
||||
// QT Includes
|
||||
#include <qdialog.h>
|
||||
|
||||
class QGridLayout;
|
||||
class QButtonGroup;
|
||||
class QRadioButton;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QPushButton;
|
||||
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class QGroupBox;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SVTK_ViewWindow;
|
||||
class SVTK_Selector;
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_ExtrusionDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_ExtrusionDlg : public QDialog
|
||||
class SMESHGUI_ExtrusionDlg : public SMESHGUI_Dialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_ExtrusionDlg (SMESHGUI*,
|
||||
bool modal = FALSE);
|
||||
SMESHGUI_ExtrusionDlg();
|
||||
~SMESHGUI_ExtrusionDlg();
|
||||
|
||||
private:
|
||||
void Init (bool ResetControls = true);
|
||||
void enterEvent (QEvent*); /* mouse enter the QWidget */
|
||||
int GetConstructorId();
|
||||
//void closeEvent (QCloseEvent*);
|
||||
//void hideEvent (QHideEvent*); /* ESC key */
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SalomeApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
QString myElementsId;
|
||||
int myNbOkElements; /* to check when elements are defined */
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter;
|
||||
|
||||
// widgets
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* RadioButton1;
|
||||
QRadioButton* RadioButton2;
|
||||
|
||||
QGroupBox* GroupArguments;
|
||||
QLabel* TextLabelElements;
|
||||
QPushButton* SelectElementsButton;
|
||||
QLineEdit* LineEditElements;
|
||||
QCheckBox* CheckBoxMesh;
|
||||
QLabel* TextLabelVector;
|
||||
QLabel* TextLabelDx;
|
||||
SMESHGUI_SpinBox* SpinBox_Dx;
|
||||
QLabel* TextLabelDy;
|
||||
SMESHGUI_SpinBox* SpinBox_Dy;
|
||||
QLabel* TextLabelDz;
|
||||
SMESHGUI_SpinBox* SpinBox_Dz;
|
||||
QLabel* TextLabelNbSteps;
|
||||
QSpinBox* SpinBox_NbSteps;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
void init();
|
||||
int constructorId() const;
|
||||
void coords( double&, double&, double& ) const;
|
||||
int nbStep() const;
|
||||
bool isSelectMesh() const;
|
||||
|
||||
signals:
|
||||
void constructorClicked( int );
|
||||
|
||||
private slots:
|
||||
void ConstructorsClicked (int);
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void ClickOnCancel();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
void onTextChange (const QString&);
|
||||
void onSelectMesh (bool toSelectMesh);
|
||||
void onConstructorsClicked( int );
|
||||
void onSelectMesh( bool );
|
||||
|
||||
private:
|
||||
QButtonGroup* myGroupConstructors;
|
||||
QGroupBox* myGroupArguments;
|
||||
|
||||
QCheckBox* myCheckBoxMesh;
|
||||
SMESHGUI_SpinBox *myDx, *myDy, *myDz;
|
||||
QSpinBox *myNbSteps;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_EXTRUSION_H
|
||||
|
272
src/SMESHGUI/SMESHGUI_ExtrusionOp.cxx
Normal file
272
src/SMESHGUI/SMESHGUI_ExtrusionOp.cxx
Normal file
@ -0,0 +1,272 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_ExtrusionOp.cxx
|
||||
// Author : Alexander SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header:
|
||||
|
||||
#include "SMESHGUI_ExtrusionOp.h"
|
||||
#include <SMESHGUI_ExtrusionDlg.h>
|
||||
#include <SMESHGUI_VTKUtils.h>
|
||||
|
||||
#include <SMESH_TypeFilter.hxx>
|
||||
#include <SMESH_LogicalFilter.hxx>
|
||||
|
||||
#include <SUIT_OverrideCursor.h>
|
||||
|
||||
#include <SALOMEDS_SObject.hxx>
|
||||
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
//=================================================================================
|
||||
// name : SMESHGUI_ExtrusionOp
|
||||
// purpose : constructor
|
||||
//=================================================================================
|
||||
SMESHGUI_ExtrusionOp::SMESHGUI_ExtrusionOp()
|
||||
: SMESHGUI_SelectionOp( EdgeSelection ),
|
||||
myDlg( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : ~SMESHGUI_ExtrusionOp
|
||||
// purpose : destructor
|
||||
//=================================================================================
|
||||
SMESHGUI_ExtrusionOp::~SMESHGUI_ExtrusionOp()
|
||||
{
|
||||
if( myDlg )
|
||||
delete myDlg;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : dlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SalomeApp_Dialog* SMESHGUI_ExtrusionOp::dlg() const
|
||||
{
|
||||
return myDlg;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : initDialog
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionOp::initDialog()
|
||||
{
|
||||
if( myDlg )
|
||||
{
|
||||
myDlg->init();
|
||||
updateDialog();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : startOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionOp::startOperation()
|
||||
{
|
||||
if( !myDlg )
|
||||
{
|
||||
myDlg = new SMESHGUI_ExtrusionDlg();
|
||||
connect( myDlg, SIGNAL( constructorClicked( int ) ), this, SLOT( onChangeType( int ) ) );
|
||||
connect( myDlg, SIGNAL( objectChanged( int, const QStringList& ) ),
|
||||
this, SLOT( onTextChanged( int, const QStringList& ) ) );
|
||||
}
|
||||
|
||||
SMESHGUI_SelectionOp::startOperation();
|
||||
|
||||
myDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : onSelectionChanged
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionOp::onSelectionChanged( int )
|
||||
{
|
||||
updateDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : createFilter
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SUIT_SelectionFilter* SMESHGUI_ExtrusionOp::createFilter( const int id ) const
|
||||
{
|
||||
if( id==1 )
|
||||
{
|
||||
// Costruction of the logical filter for the elements: mesh/sub-mesh/group
|
||||
SMESH_TypeFilter* aMeshOrSubMesh = new SMESH_TypeFilter (MESHorSUBMESH);
|
||||
SMESH_TypeFilter* aGroup = new SMESH_TypeFilter (GROUP);
|
||||
|
||||
QPtrList<SUIT_SelectionFilter> list;
|
||||
list.append( aMeshOrSubMesh );
|
||||
list.append( aGroup );
|
||||
|
||||
return new SMESH_LogicalFilter( list, SMESH_LogicalFilter::LO_OR );
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : updateDialog
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionOp::updateDialog()
|
||||
{
|
||||
if( !myDlg )
|
||||
return;
|
||||
|
||||
bool en = myDlg->hasSelection( myDlg->isSelectMesh() ? 1 : 0 );
|
||||
myDlg->setButtonEnabled( en, QtxDialog::OK | QtxDialog::Apply );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : onApply
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_ExtrusionOp::onApply()
|
||||
{
|
||||
if( isStudyLocked() )
|
||||
return false;
|
||||
|
||||
IdList ids;
|
||||
SMESH::SMESH_Mesh_var m = extractIds( ids );
|
||||
if( ids.count() && !m->_is_nil() )
|
||||
{
|
||||
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||
anElementsId->length( ids.count() );
|
||||
|
||||
for( int i=0, n=ids.count(); i<n; i++)
|
||||
anElementsId[i] = ids[i];
|
||||
|
||||
SMESH::DirStruct aVector;
|
||||
double x, y, z;
|
||||
myDlg->coords( x, y, z );
|
||||
aVector.PS.x = x;
|
||||
aVector.PS.y = y;
|
||||
aVector.PS.z = z;
|
||||
long aNbSteps = (long)myDlg->nbStep();
|
||||
|
||||
try
|
||||
{
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = m->GetMeshEditor();
|
||||
SUIT_OverrideCursor c;
|
||||
aMeshEditor->ExtrusionSweep( anElementsId.inout(), aVector, aNbSteps );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
}
|
||||
|
||||
initDialog();
|
||||
SMESH::UpdateView();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : onChangeType
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionOp::onChangeType( int t )
|
||||
{
|
||||
if( !myDlg->isSelectMesh() )
|
||||
setSelectionMode( t==0 ? EdgeSelection : FaceSelection );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : onActivateObject
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionOp::onActivateObject( int id )
|
||||
{
|
||||
if( id==0 && myDlg )
|
||||
onChangeType( myDlg->constructorId() );
|
||||
else if( id==1 )
|
||||
setSelectionMode( ActorSelection );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// name : extractIds
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESH::SMESH_Mesh_var SMESHGUI_ExtrusionOp::extractIds( IdList& list ) const
|
||||
{
|
||||
if( selectionMode()==ActorSelection )
|
||||
{
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
|
||||
QStringList sel; myDlg->selectedObject( 1, sel );
|
||||
if( sel.isEmpty() )
|
||||
return aMesh;
|
||||
|
||||
_PTR( SObject ) SO = studyDS()->FindObjectID( sel.first() );
|
||||
if( !SO )
|
||||
return aMesh;
|
||||
|
||||
CORBA::Object* obj = _CAST(SObject, SO)->GetObject();
|
||||
SMESH::SMESH_Mesh_var selMesh = SMESH::SMESH_Mesh::_narrow( obj );
|
||||
SMESH::SMESH_subMesh_var selSubMesh = SMESH::SMESH_subMesh::_narrow( obj );
|
||||
SMESH::SMESH_Group_var selGroup = SMESH::SMESH_Group::_narrow( obj );
|
||||
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
if( !selMesh->_is_nil() )
|
||||
{
|
||||
//MESH
|
||||
aMesh = selMesh;
|
||||
|
||||
// get IDs from submesh
|
||||
anElementsIds = selMesh->GetElementsByType( myDlg->constructorId()==0 ? SMESH::EDGE : SMESH::FACE );
|
||||
}
|
||||
else if( !selSubMesh->_is_nil() )
|
||||
{
|
||||
//SUBMESH
|
||||
aMesh = selSubMesh->GetFather();
|
||||
|
||||
// get IDs from submesh
|
||||
anElementsIds = selSubMesh->GetElementsByType( myDlg->constructorId()==0 ? SMESH::EDGE : SMESH::FACE );
|
||||
}
|
||||
else if( !selGroup->_is_nil() )
|
||||
{
|
||||
//GROUP
|
||||
aMesh = selGroup->GetMesh();
|
||||
|
||||
if( selGroup->GetType()==( myDlg->constructorId()==0 ? SMESH::EDGE : SMESH::FACE ) )
|
||||
// get IDs from group
|
||||
anElementsIds = selGroup->GetListOfID();
|
||||
}
|
||||
|
||||
for (int i=0, n=anElementsIds->length(); i<n; i++)
|
||||
list.append( anElementsIds[ i ] );
|
||||
|
||||
return aMesh;
|
||||
}
|
||||
else
|
||||
{
|
||||
SMESHGUI_SelectionOp::selectedIds( 0, list );
|
||||
return mesh();
|
||||
}
|
||||
}
|
68
src/SMESHGUI/SMESHGUI_ExtrusionOp.h
Normal file
68
src/SMESHGUI/SMESHGUI_ExtrusionOp.h
Normal file
@ -0,0 +1,68 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_ExtrusionOp.h
|
||||
// Author : Alexander SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header:
|
||||
|
||||
#ifndef OPERATION_EXTRUSION_H
|
||||
#define OPERATION_EXTRUSION_H
|
||||
|
||||
#include <SMESHGUI_SelectionOp.h>
|
||||
|
||||
class SMESHGUI_ExtrusionDlg;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_ExtrusionOp
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_ExtrusionOp : public SMESHGUI_SelectionOp
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_ExtrusionOp();
|
||||
~SMESHGUI_ExtrusionOp();
|
||||
|
||||
virtual SalomeApp_Dialog* dlg() const;
|
||||
virtual void initDialog();
|
||||
|
||||
protected:
|
||||
virtual void startOperation();
|
||||
virtual SUIT_SelectionFilter* createFilter( const int ) const;
|
||||
|
||||
void updateDialog();
|
||||
SMESH::SMESH_Mesh_var extractIds( IdList& ) const;
|
||||
|
||||
protected slots:
|
||||
virtual bool onApply();
|
||||
virtual void onChangeType( int );
|
||||
virtual void onSelectionChanged( int );
|
||||
virtual void onActivateObject( int );
|
||||
|
||||
private:
|
||||
SMESHGUI_ExtrusionDlg* myDlg;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_EXTRUSION_H
|
@ -317,16 +317,3 @@ void SMESHGUI_InitMeshOp::updateDialog()
|
||||
myDlg->hasSelection( SMESHGUI_InitMeshDlg::Algo );
|
||||
myDlg->setButtonEnabled( isEnabled, QtxDialog::OK | QtxDialog::Apply );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_InitMeshOp::isValid( SUIT_Operation* theOtherOp ) const
|
||||
{
|
||||
//if ( theOtherOp && theOtherOp->inherits( "SMESHGUI_AddSubMeshOp" ) )
|
||||
return true;
|
||||
/*else
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
|
@ -53,8 +53,6 @@ public:
|
||||
virtual void initDialog();
|
||||
|
||||
QString defaultMeshName() const;
|
||||
|
||||
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
||||
|
||||
protected:
|
||||
virtual void startOperation();
|
||||
|
@ -183,3 +183,11 @@ bool SMESHGUI_Operation::isStudyLocked( const bool theMess ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// name : isValid
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
bool SMESHGUI_Operation::isValid( SUIT_Operation* op ) const
|
||||
{
|
||||
return( op && op->inherits( "SMESHGUI_Operation" ) );
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ protected:
|
||||
bool isStudyLocked( const bool = true ) const;
|
||||
|
||||
_PTR(Study) studyDS() const;
|
||||
|
||||
virtual bool isValid( SUIT_Operation* ) const;
|
||||
|
||||
protected slots:
|
||||
virtual void onOk();
|
||||
|
@ -21,12 +21,12 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_RemoveNodesDlg.cxx
|
||||
// File : SMESHGUI_RemoveDlg.cxx
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_RemoveNodesDlg.h"
|
||||
#include "SMESHGUI_RemoveDlg.h"
|
||||
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
|
||||
@ -38,25 +38,26 @@
|
||||
#include <qradiobutton.h>
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_RemoveNodesDlg()
|
||||
// class : SMESHGUI_RemoveDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg()
|
||||
SMESHGUI_RemoveDlg::SMESHGUI_RemoveDlg( const bool elem )
|
||||
: SMESHGUI_Dialog( false, true, OK | Apply | Close )
|
||||
{
|
||||
QPixmap image0( resMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE")));
|
||||
QPixmap image1( resMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
QString entity = elem ? "ELEMENT" : "NODE";
|
||||
QString name = QString( "ICON_DLG_REM_%1" ).arg( entity );
|
||||
QPixmap image0( resMgr()->loadPixmap("SMESH", tr( name ) ) );
|
||||
|
||||
setName("SMESHGUI_RemoveNodesDlg");
|
||||
setName("SMESHGUI_RemoveDlg");
|
||||
resize(303, 185);
|
||||
setCaption(tr("SMESH_REMOVE_NODES_TITLE" ));
|
||||
setCaption( tr( QString( "SMESH_REMOVE_%1S_TITLE" ).arg( entity ) ) );
|
||||
setSizeGripEnabled(TRUE);
|
||||
|
||||
QVBoxLayout* main = new QVBoxLayout( mainFrame() );
|
||||
|
||||
/***************************************************************/
|
||||
QButtonGroup* GroupConstructors = new QButtonGroup( mainFrame(), "GroupConstructors");
|
||||
GroupConstructors->setTitle(tr("SMESH_NODES" ));
|
||||
GroupConstructors->setTitle(tr( QString( "SMESH_%1S" ).arg( entity ) ) );
|
||||
GroupConstructors->setExclusive(TRUE);
|
||||
GroupConstructors->setColumnLayout(0, Qt::Vertical);
|
||||
GroupConstructors->layout()->setSpacing(0);
|
||||
@ -86,18 +87,22 @@ SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg()
|
||||
// GroupC1->layout()->setSpacing(0);
|
||||
// GroupC1->layout()->setMargin(0);
|
||||
|
||||
createObject( tr("SMESH_ID_NODES" ), GroupC1, 0 );
|
||||
createObject( tr( QString( "SMESH_ID_%1S" ).arg( entity ) ), GroupC1, 0 );
|
||||
setNameIndication( 0, ListOfNames );
|
||||
setReadOnly( 0, false );
|
||||
setObjectType( 0, prefix( "SMESH element" ) + SMDSAbs_Node, -1 );
|
||||
int pr = prefix( "SMESH element" );
|
||||
if( elem )
|
||||
setObjectType( 0, pr + SMDSAbs_Edge, pr + SMDSAbs_Face, pr + SMDSAbs_Volume, -1 );
|
||||
else
|
||||
setObjectType( 0, pr + SMDSAbs_Node, -1 );
|
||||
|
||||
main->addWidget(GroupC1);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ~SMESHGUI_RemoveNodesDlg()
|
||||
// function : ~SMESHGUI_RemoveDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
SMESHGUI_RemoveNodesDlg::~SMESHGUI_RemoveNodesDlg()
|
||||
SMESHGUI_RemoveDlg::~SMESHGUI_RemoveDlg()
|
||||
{
|
||||
}
|
@ -21,27 +21,27 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_RemoveNodesDlg.h
|
||||
// File : SMESHGUI_RemoveDlg.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_REMOVE_NODES_H
|
||||
#define DIALOGBOX_REMOVE_NODES_H
|
||||
#ifndef DIALOGBOX_REMOVE_H
|
||||
#define DIALOGBOX_REMOVE_H
|
||||
|
||||
#include <SMESHGUI_Dialog.h>
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_RemoveNodesDlg
|
||||
// class : SMESHGUI_RemoveDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_RemoveNodesDlg : public SMESHGUI_Dialog
|
||||
class SMESHGUI_RemoveDlg : public SMESHGUI_Dialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_RemoveNodesDlg();
|
||||
~SMESHGUI_RemoveNodesDlg();
|
||||
SMESHGUI_RemoveDlg( const bool elem );
|
||||
~SMESHGUI_RemoveDlg();
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_REMOVE_NODES_H
|
||||
#endif // DIALOGBOX_REMOVE_H
|
@ -1,483 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_RemoveElementsDlg.cxx
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_RemoveElementsDlg.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_IdValidator.h"
|
||||
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMDS_Mesh.hxx"
|
||||
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
#include "SVTK_Selector.h"
|
||||
#include "SVTK_ViewModel.h"
|
||||
#include "SVTK_ViewWindow.h"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
// OCCT Includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
// QT Includes
|
||||
#include <qbuttongroup.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qvariant.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qwhatsthis.h>
|
||||
#include <qimage.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_RemoveElementsDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_RemoveElementsDlg
|
||||
::SMESHGUI_RemoveElementsDlg (SMESHGUI* theModule,
|
||||
const char* name,
|
||||
bool modal,
|
||||
WFlags fl)
|
||||
: QDialog(SMESH::GetDesktop(theModule),
|
||||
name,
|
||||
modal,
|
||||
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
|
||||
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
|
||||
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
|
||||
myViewWindow(SMESH::GetViewWindow(theModule)),
|
||||
mySMESHGUI(theModule),
|
||||
myBusy(false)
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
|
||||
if (!name)
|
||||
setName("SMESHGUI_RemoveElementsDlg");
|
||||
resize(303, 185);
|
||||
setCaption(tr("SMESH_REMOVE_ELEMENTS_TITLE"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
SMESHGUI_RemoveElementsDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_RemoveElementsDlgLayout->setSpacing(6);
|
||||
SMESHGUI_RemoveElementsDlgLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup(this, "GroupConstructors");
|
||||
GroupConstructors->setTitle(tr("SMESH_ELEMENTS" ));
|
||||
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);
|
||||
QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
GroupConstructorsLayout->addItem(spacer, 0, 1);
|
||||
SMESHGUI_RemoveElementsDlgLayout->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("SMESH_BUT_CLOSE" ));
|
||||
buttonCancel->setAutoDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
||||
buttonApply = new QPushButton(GroupButtons, "buttonApply");
|
||||
buttonApply->setText(tr("SMESH_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("SMESH_BUT_OK" ));
|
||||
buttonOk->setAutoDefault(TRUE);
|
||||
buttonOk->setDefault(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
|
||||
SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupButtons, 2, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox(this, "GroupC1");
|
||||
GroupC1->setTitle(tr("SMESH_REMOVE" ));
|
||||
GroupC1->setMinimumSize(QSize(0, 0));
|
||||
GroupC1->setFrameShape(QGroupBox::Box);
|
||||
GroupC1->setFrameShadow(QGroupBox::Sunken);
|
||||
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);
|
||||
TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1");
|
||||
TextLabelC1A1->setText(tr("SMESH_ID_ELEMENTS" ));
|
||||
TextLabelC1A1->setMinimumSize(QSize(50, 0));
|
||||
TextLabelC1A1->setFrameShape(QLabel::NoFrame);
|
||||
TextLabelC1A1->setFrameShadow(QLabel::Plain);
|
||||
GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
|
||||
SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
|
||||
SelectButtonC1A1->setText(tr("" ));
|
||||
SelectButtonC1A1->setPixmap(image1);
|
||||
SelectButtonC1A1->setToggleButton(FALSE);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
|
||||
LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
|
||||
LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator"));
|
||||
GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
|
||||
SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupC1, 1, 0);
|
||||
|
||||
Init(); /* Initialisations */
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ~SMESHGUI_RemoveElementsDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::Init()
|
||||
{
|
||||
GroupC1->show();
|
||||
myConstructorId = 0;
|
||||
Constructor1->setChecked(TRUE);
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
|
||||
myNbOkElements = false;
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
myActor = 0;
|
||||
myBusy = false;
|
||||
|
||||
/* 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(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
/* to close dialog if study change */
|
||||
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)),
|
||||
SLOT(onTextChange(const QString&)));
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show(); /* displays Dialog */
|
||||
|
||||
myViewWindow->SetSelectionMode(CellSelection);
|
||||
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::ConstructorsClicked (int)
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return;
|
||||
if (myNbOkElements) {
|
||||
QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false);
|
||||
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
|
||||
anArrayOfIdeces->length(aListId.count());
|
||||
for (int i = 0; i < aListId.count(); i++)
|
||||
anArrayOfIdeces[i] = aListId[ i ].toInt();
|
||||
|
||||
bool aResult = false;
|
||||
try {
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.inout());
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
if (aResult) {
|
||||
myEditCurrentArgument->clear();
|
||||
SMESH::UpdateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply();
|
||||
this->ClickOnCancel();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::ClickOnCancel()
|
||||
{
|
||||
mySelectionMgr->clearSelected();
|
||||
myViewWindow->SetSelectionMode(ActorSelection);
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySMESHGUI->ResetState();
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : onTextChange
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::onTextChange (const QString& theNewText)
|
||||
{
|
||||
if (myBusy)
|
||||
return;
|
||||
myBusy = true;
|
||||
|
||||
myNbOkElements = 0;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
// hilight entered elements
|
||||
if(myActor){
|
||||
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
|
||||
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
|
||||
|
||||
TColStd_MapOfInteger newIndices;
|
||||
|
||||
QStringList aListId = QStringList::split(" ", theNewText, false);
|
||||
for (int i = 0; i < aListId.count(); i++) {
|
||||
if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) {
|
||||
newIndices.Add(anElem->GetID());
|
||||
myNbOkElements++;
|
||||
}
|
||||
}
|
||||
|
||||
mySelector->AddOrRemoveIndex(anIO,newIndices,false);
|
||||
myViewWindow->highlight(anIO,true,true);
|
||||
}
|
||||
}
|
||||
|
||||
if (myNbOkElements) {
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
|
||||
myBusy = false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
|
||||
{
|
||||
if (myBusy) return;
|
||||
|
||||
// clear
|
||||
|
||||
myNbOkElements = false;
|
||||
myActor = 0;
|
||||
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText("");
|
||||
myBusy = false;
|
||||
|
||||
if (!GroupButtons->isEnabled()) // inactive
|
||||
return;
|
||||
|
||||
buttonOk->setEnabled(false);
|
||||
buttonApply->setEnabled(false);
|
||||
|
||||
// get selected mesh
|
||||
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||
|
||||
int nbSel = aList.Extent();
|
||||
if (nbSel != 1)
|
||||
return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO = aList.First();
|
||||
myMesh = SMESH::GetMeshByIO(anIO);
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
|
||||
myActor = SMESH::FindActorByEntry(anIO->getEntry());
|
||||
if (!myActor)
|
||||
return;
|
||||
|
||||
// get selected nodes
|
||||
QString aString = "";
|
||||
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aString);
|
||||
if(nbElems < 1)
|
||||
return;
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myBusy = false;
|
||||
|
||||
// OK
|
||||
|
||||
myNbOkElements = nbElems;
|
||||
|
||||
buttonOk->setEnabled(true);
|
||||
buttonApply->setEnabled(true);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0: /* default constructor */
|
||||
{
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if (GroupConstructors->isEnabled()) {
|
||||
GroupConstructors->setEnabled(false);
|
||||
GroupC1->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
mySMESHGUI->ResetState(); // ??
|
||||
mySMESHGUI->SetActiveDialogBox(0); // ??
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
|
||||
GroupConstructors->setEnabled(true);
|
||||
GroupC1->setEnabled(true);
|
||||
GroupButtons->setEnabled(true);
|
||||
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this); // ??
|
||||
|
||||
myViewWindow->SetSelectionMode(NodeSelection);
|
||||
|
||||
SelectionIntoArgument(); // ??
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if (!GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::closeEvent (QCloseEvent*)
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : hideEvent
|
||||
//purpose : caused by ESC key
|
||||
//=======================================================================
|
||||
void SMESHGUI_RemoveElementsDlg::hideEvent (QHideEvent * e)
|
||||
{
|
||||
if (!isMinimized())
|
||||
ClickOnCancel();
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH 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 : SMESHGUI_RemoveElementsDlg.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_REMOVE_ELEMENTS_H
|
||||
#define DIALOGBOX_REMOVE_ELEMENTS_H
|
||||
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qvariant.h>
|
||||
#include <qdialog.h>
|
||||
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QGridLayout;
|
||||
class QButtonGroup;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class SVTK_Selector;
|
||||
class SVTK_ViewWindow;
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_RemoveElementsDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_RemoveElementsDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_RemoveElementsDlg(SMESHGUI* theModule,
|
||||
const char* name = 0,
|
||||
bool modal = FALSE,
|
||||
WFlags fl = 0);
|
||||
~SMESHGUI_RemoveElementsDlg();
|
||||
|
||||
private:
|
||||
|
||||
void Init() ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void hideEvent ( QHideEvent * ); /* ESC key */
|
||||
|
||||
SalomeApp_SelectionMgr* mySelectionMgr;
|
||||
SVTK_ViewWindow* myViewWindow;
|
||||
SVTK_Selector* mySelector;
|
||||
SMESHGUI* mySMESHGUI;
|
||||
|
||||
int myNbOkElements; /* to check when arguments is defined */
|
||||
int myConstructorId; /* Current constructor id = radio button id */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabelC1A1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void onTextChange(const QString&);
|
||||
|
||||
protected:
|
||||
QGridLayout* SMESHGUI_RemoveElementsDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_REMOVE_ELEMENTS_H
|
@ -21,54 +21,55 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_RemoveNodesOp.cxx
|
||||
// File : SMESHGUI_RemoveOp.cxx
|
||||
// Author : Alexander SOLOVYOV
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_RemoveNodesOp.h"
|
||||
#include <SMESHGUI_RemoveNodesDlg.h>
|
||||
#include "SMESHGUI_RemoveOp.h"
|
||||
#include <SMESHGUI_RemoveDlg.h>
|
||||
#include <SMESHGUI.h>
|
||||
#include <SMESHGUI_VTKUtils.h>
|
||||
|
||||
//=================================================================================
|
||||
// function :
|
||||
// function : SMESHGUI_RemoveOp
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_RemoveNodesOp::SMESHGUI_RemoveNodesOp()
|
||||
: SMESHGUI_SelectionOp( NodeSelection ),
|
||||
myDlg( 0 )
|
||||
SMESHGUI_RemoveOp::SMESHGUI_RemoveOp( const bool elems )
|
||||
: SMESHGUI_SelectionOp( elems ? CellSelection : NodeSelection ),
|
||||
myDlg( 0 ),
|
||||
myIsElem( elems )
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function :
|
||||
// function : ~SMESHGUI_RemoveOp
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SMESHGUI_RemoveNodesOp::~SMESHGUI_RemoveNodesOp()
|
||||
SMESHGUI_RemoveOp::~SMESHGUI_RemoveOp()
|
||||
{
|
||||
if( myDlg )
|
||||
delete myDlg;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function :
|
||||
// function : dlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
SalomeApp_Dialog* SMESHGUI_RemoveNodesOp::dlg() const
|
||||
SalomeApp_Dialog* SMESHGUI_RemoveOp::dlg() const
|
||||
{
|
||||
return myDlg;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function :
|
||||
// function : startOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveNodesOp::startOperation()
|
||||
void SMESHGUI_RemoveOp::startOperation()
|
||||
{
|
||||
if( !myDlg )
|
||||
{
|
||||
myDlg = new SMESHGUI_RemoveNodesDlg();
|
||||
myDlg = new SMESHGUI_RemoveDlg( myIsElem );
|
||||
connect( myDlg, SIGNAL( objectChanged( int, const QStringList& ) ), this, SLOT( onTextChanged( int, const QStringList& ) ) );
|
||||
}
|
||||
|
||||
@ -78,20 +79,30 @@ void SMESHGUI_RemoveNodesOp::startOperation()
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function :
|
||||
// function : selectionDone
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveNodesOp::selectionDone()
|
||||
void SMESHGUI_RemoveOp::selectionDone()
|
||||
{
|
||||
SMESHGUI_SelectionOp::selectionDone();
|
||||
updateDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function :
|
||||
// function : initDialog
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveNodesOp::updateDialog()
|
||||
void SMESHGUI_RemoveOp::initDialog()
|
||||
{
|
||||
SMESHGUI_SelectionOp::initDialog();
|
||||
updateDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateDialog
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RemoveOp::updateDialog()
|
||||
{
|
||||
if( !myDlg )
|
||||
return;
|
||||
@ -101,10 +112,10 @@ void SMESHGUI_RemoveNodesOp::updateDialog()
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function :
|
||||
// function : onApply
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_RemoveNodesOp::onApply()
|
||||
bool SMESHGUI_RemoveOp::onApply()
|
||||
{
|
||||
if( isStudyLocked() )
|
||||
return false;
|
||||
@ -120,7 +131,10 @@ bool SMESHGUI_RemoveNodesOp::onApply()
|
||||
try
|
||||
{
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = mesh()->GetMeshEditor();
|
||||
aResult = aMeshEditor->RemoveNodes( anArrayOfIdeces.inout() );
|
||||
if( myIsElem )
|
||||
aResult = aMeshEditor->RemoveElements( anArrayOfIdeces.inout() );
|
||||
else
|
||||
aResult = aMeshEditor->RemoveNodes( anArrayOfIdeces.inout() );
|
||||
}
|
||||
catch(...)
|
||||
{
|
@ -21,31 +21,32 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_RemoveNodesOp.h
|
||||
// File : SMESHGUI_RemoveOp.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef OPERATION_REMOVE_NODES_H
|
||||
#define OPERATION_REMOVE_NODES_H
|
||||
#ifndef OPERATION_REMOVE_H
|
||||
#define OPERATION_REMOVE_H
|
||||
|
||||
#include <SMESHGUI_SelectionOp.h>
|
||||
|
||||
class SMESHGUI_RemoveNodesDlg;
|
||||
class SMESHGUI_RemoveDlg;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_RemoveNodesOp
|
||||
// class : SMESHGUI_RemoveOp
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class SMESHGUI_RemoveNodesOp : public SMESHGUI_SelectionOp
|
||||
class SMESHGUI_RemoveOp : public SMESHGUI_SelectionOp
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_RemoveNodesOp();
|
||||
~SMESHGUI_RemoveNodesOp();
|
||||
SMESHGUI_RemoveOp( const bool elems );
|
||||
~SMESHGUI_RemoveOp();
|
||||
|
||||
virtual SalomeApp_Dialog* dlg() const;
|
||||
virtual void initDialog();
|
||||
|
||||
protected:
|
||||
virtual void startOperation();
|
||||
@ -57,7 +58,8 @@ protected slots:
|
||||
virtual bool onApply();
|
||||
|
||||
private:
|
||||
SMESHGUI_RemoveNodesDlg* myDlg;
|
||||
SMESHGUI_RemoveDlg* myDlg;
|
||||
bool myIsElem;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_REMOVE_NODES_H
|
||||
#endif // DIALOGBOX_REMOVE_H
|
Loading…
Reference in New Issue
Block a user