mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 23:30:34 +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_TransparencyDlg.cxx \
|
||||||
SMESHGUI_ClippingDlg.cxx \
|
SMESHGUI_ClippingDlg.cxx \
|
||||||
SMESHGUI_GroupDlg.cxx \
|
SMESHGUI_GroupDlg.cxx \
|
||||||
SMESHGUI_RemoveNodesDlg.cxx \
|
SMESHGUI_RemoveDlg.cxx \
|
||||||
SMESHGUI_RemoveNodesOp.cxx \
|
SMESHGUI_RemoveOp.cxx \
|
||||||
SMESHGUI_RemoveElementsDlg.cxx \
|
|
||||||
SMESHGUI_MeshInfosDlg.cxx \
|
SMESHGUI_MeshInfosDlg.cxx \
|
||||||
SMESHGUI_StandardMeshInfosDlg.cxx \
|
SMESHGUI_StandardMeshInfosDlg.cxx \
|
||||||
SMESHGUI_Preferences_ColorDlg.cxx \
|
SMESHGUI_Preferences_ColorDlg.cxx \
|
||||||
@ -98,6 +97,7 @@ LIB_SRC = SMESHGUI.cxx \
|
|||||||
SMESHGUI_RenumberingDlg.cxx \
|
SMESHGUI_RenumberingDlg.cxx \
|
||||||
SMESHGUI_RenumberingOp.cxx \
|
SMESHGUI_RenumberingOp.cxx \
|
||||||
SMESHGUI_ExtrusionDlg.cxx \
|
SMESHGUI_ExtrusionDlg.cxx \
|
||||||
|
SMESHGUI_ExtrusionOp.cxx \
|
||||||
SMESHGUI_ExtrusionAlongPathDlg.cxx \
|
SMESHGUI_ExtrusionAlongPathDlg.cxx \
|
||||||
SMESHGUI_RevolutionDlg.cxx \
|
SMESHGUI_RevolutionDlg.cxx \
|
||||||
SMESHGUI_RotationDlg.cxx \
|
SMESHGUI_RotationDlg.cxx \
|
||||||
@ -138,9 +138,8 @@ LIB_MOC = \
|
|||||||
SMESHGUI_TransparencyDlg.h \
|
SMESHGUI_TransparencyDlg.h \
|
||||||
SMESHGUI_ClippingDlg.h \
|
SMESHGUI_ClippingDlg.h \
|
||||||
SMESHGUI_GroupDlg.h \
|
SMESHGUI_GroupDlg.h \
|
||||||
SMESHGUI_RemoveNodesDlg.h \
|
SMESHGUI_RemoveDlg.h \
|
||||||
SMESHGUI_RemoveNodesOp.h \
|
SMESHGUI_RemoveOp.h \
|
||||||
SMESHGUI_RemoveElementsDlg.h \
|
|
||||||
SMESHGUI_MeshInfosDlg.h \
|
SMESHGUI_MeshInfosDlg.h \
|
||||||
SMESHGUI_StandardMeshInfosDlg.h \
|
SMESHGUI_StandardMeshInfosDlg.h \
|
||||||
SMESHGUI_Preferences_ColorDlg.h \
|
SMESHGUI_Preferences_ColorDlg.h \
|
||||||
@ -163,6 +162,7 @@ LIB_MOC = \
|
|||||||
SMESHGUI_RenumberingDlg.h \
|
SMESHGUI_RenumberingDlg.h \
|
||||||
SMESHGUI_RenumberingOp.h \
|
SMESHGUI_RenumberingOp.h \
|
||||||
SMESHGUI_ExtrusionDlg.h \
|
SMESHGUI_ExtrusionDlg.h \
|
||||||
|
SMESHGUI_ExtrusionOp.h \
|
||||||
SMESHGUI_ExtrusionAlongPathDlg.h \
|
SMESHGUI_ExtrusionAlongPathDlg.h \
|
||||||
SMESHGUI_RevolutionDlg.h \
|
SMESHGUI_RevolutionDlg.h \
|
||||||
SMESHGUI_RotationDlg.h \
|
SMESHGUI_RotationDlg.h \
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
#include "SMESHGUI_TransparencyDlg.h"
|
#include "SMESHGUI_TransparencyDlg.h"
|
||||||
#include "SMESHGUI_ClippingDlg.h"
|
#include "SMESHGUI_ClippingDlg.h"
|
||||||
#include "SMESHGUI_GroupDlg.h"
|
#include "SMESHGUI_GroupDlg.h"
|
||||||
#include "SMESHGUI_RemoveNodesOp.h"
|
#include "SMESHGUI_RemoveOp.h"
|
||||||
#include "SMESHGUI_RemoveElementsDlg.h"
|
|
||||||
#include "SMESHGUI_MeshInfosDlg.h"
|
#include "SMESHGUI_MeshInfosDlg.h"
|
||||||
#include "SMESHGUI_StandardMeshInfosDlg.h"
|
#include "SMESHGUI_StandardMeshInfosDlg.h"
|
||||||
#include "SMESHGUI_Preferences_ColorDlg.h"
|
#include "SMESHGUI_Preferences_ColorDlg.h"
|
||||||
@ -53,7 +52,7 @@
|
|||||||
#include "SMESHGUI_DeleteGroupDlg.h"
|
#include "SMESHGUI_DeleteGroupDlg.h"
|
||||||
#include "SMESHGUI_SmoothingDlg.h"
|
#include "SMESHGUI_SmoothingDlg.h"
|
||||||
#include "SMESHGUI_RenumberingOp.h"
|
#include "SMESHGUI_RenumberingOp.h"
|
||||||
#include "SMESHGUI_ExtrusionDlg.h"
|
#include "SMESHGUI_ExtrusionOp.h"
|
||||||
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
|
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
|
||||||
#include "SMESHGUI_RevolutionDlg.h"
|
#include "SMESHGUI_RevolutionDlg.h"
|
||||||
#include "SMESHGUI_TranslationDlg.h"
|
#include "SMESHGUI_TranslationDlg.h"
|
||||||
@ -1337,17 +1336,19 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
case 410: // Union of triangles
|
case 410: // Union of triangles
|
||||||
case 411: // Cutting of quadrangles
|
case 411: // Cutting of quadrangles
|
||||||
{
|
{
|
||||||
if ( !vtkwnd )
|
/* if ( !vtkwnd )
|
||||||
{
|
{
|
||||||
SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
|
SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
|
||||||
tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
|
tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if ( checkLock( aStudy ) )
|
if ( checkLock( aStudy ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
EmitSignalDeactivateDialog();
|
startOperation( theCommandID );
|
||||||
|
|
||||||
|
/* EmitSignalDeactivateDialog();
|
||||||
SMESHGUI_MultiEditDlg* aDlg = NULL;
|
SMESHGUI_MultiEditDlg* aDlg = NULL;
|
||||||
if ( theCommandID == 409 )
|
if ( theCommandID == 409 )
|
||||||
aDlg = new SMESHGUI_ChangeOrientationDlg(this);
|
aDlg = new SMESHGUI_ChangeOrientationDlg(this);
|
||||||
@ -1359,7 +1360,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
int x, y ;
|
int x, y ;
|
||||||
DefineDlgPosition( aDlg, x, y );
|
DefineDlgPosition( aDlg, x, y );
|
||||||
aDlg->move( x, y );
|
aDlg->move( x, y );
|
||||||
aDlg->show();
|
aDlg->show();*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 412: // Smoothing
|
case 412: // Smoothing
|
||||||
@ -1378,15 +1379,17 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
}
|
}
|
||||||
case 413: // Extrusion
|
case 413: // Extrusion
|
||||||
{
|
{
|
||||||
if (checkLock(aStudy)) break;
|
if( checkLock( aStudy) )
|
||||||
if (vtkwnd) {
|
break;
|
||||||
|
startOperation( 413 );
|
||||||
|
/* if (vtkwnd) {
|
||||||
EmitSignalDeactivateDialog();
|
EmitSignalDeactivateDialog();
|
||||||
new SMESHGUI_ExtrusionDlg ( this );
|
new SMESHGUI_ExtrusionDlg ( this );
|
||||||
} else {
|
} else {
|
||||||
SUIT_MessageBox::warn1(desktop(),
|
SUIT_MessageBox::warn1(desktop(),
|
||||||
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
||||||
tr("SMESH_BUT_OK"));
|
tr("SMESH_BUT_OK"));
|
||||||
}
|
}*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 414: // Revolution
|
case 414: // Revolution
|
||||||
@ -1938,7 +1941,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
case 4042: // REMOVES ELEMENTS
|
case 4042: // REMOVES ELEMENTS
|
||||||
{
|
{
|
||||||
if(checkLock(aStudy)) break;
|
if(checkLock(aStudy)) break;
|
||||||
if( vtkwnd ) {
|
startOperation( 4042 );
|
||||||
|
/* if( vtkwnd ) {
|
||||||
EmitSignalDeactivateDialog();
|
EmitSignalDeactivateDialog();
|
||||||
new SMESHGUI_RemoveElementsDlg(this);
|
new SMESHGUI_RemoveElementsDlg(this);
|
||||||
}
|
}
|
||||||
@ -1947,7 +1951,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
SUIT_MessageBox::warn1(desktop(),
|
SUIT_MessageBox::warn1(desktop(),
|
||||||
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
|
||||||
tr("SMESH_BUT_OK"));
|
tr("SMESH_BUT_OK"));
|
||||||
}
|
}*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4051: // RENUMBERING NODES
|
case 4051: // RENUMBERING NODES
|
||||||
@ -3223,10 +3227,14 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
|||||||
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Volume, 8 );
|
op = new SMESHGUI_AddMeshElementOp( SMDSAbs_Volume, 8 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4041:
|
case 4041: //REMOVE NODES
|
||||||
op = new SMESHGUI_RemoveNodesOp();
|
op = new SMESHGUI_RemoveOp( false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 4042: //REMOVE ELEMENTS
|
||||||
|
op = new SMESHGUI_RemoveOp( true );
|
||||||
|
break;
|
||||||
|
|
||||||
case 4051: // RENUMBERING NODES
|
case 4051: // RENUMBERING NODES
|
||||||
op = new SMESHGUI_RenumberingOp( 0 );
|
op = new SMESHGUI_RenumberingOp( 0 );
|
||||||
break;
|
break;
|
||||||
@ -3258,6 +3266,22 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
|||||||
case 812:
|
case 812:
|
||||||
op = new SMESHGUI_GroupOp( SMESHGUI_GroupOp::CUT );
|
op = new SMESHGUI_GroupOp( SMESHGUI_GroupOp::CUT );
|
||||||
break;
|
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:
|
default:
|
||||||
op = SalomeApp_Module::createOperation( id );
|
op = SalomeApp_Module::createOperation( id );
|
||||||
@ -3265,12 +3289,3 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
|
|||||||
}
|
}
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -334,15 +334,3 @@ void SMESHGUI_AddSubMeshOp::onNameChanged( const QString& )
|
|||||||
{
|
{
|
||||||
updateDialog();
|
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 SalomeApp_Dialog* dlg() const;
|
||||||
virtual void initDialog();
|
virtual void initDialog();
|
||||||
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void startOperation();
|
virtual void startOperation();
|
||||||
|
@ -27,250 +27,143 @@
|
|||||||
// $Header:
|
// $Header:
|
||||||
|
|
||||||
#include "SMESHGUI_ExtrusionDlg.h"
|
#include "SMESHGUI_ExtrusionDlg.h"
|
||||||
|
#include <SMESHGUI_SpinBox.h>
|
||||||
|
|
||||||
#include "SMESHGUI.h"
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include "SMESHGUI_Utils.h"
|
|
||||||
#include "SMESHGUI_VTKUtils.h"
|
|
||||||
#include "SMESHGUI_MeshUtils.h"
|
|
||||||
#include "SMESHGUI_SpinBox.h"
|
|
||||||
#include "SMESHGUI_IdValidator.h"
|
|
||||||
|
|
||||||
#include "SMESH_Actor.h"
|
#include <SMDSAbs_ElementType.hxx>
|
||||||
#include "SMESH_TypeFilter.hxx"
|
#include <SMESH_Type.h>
|
||||||
#include "SMESH_NumberFilter.hxx"
|
|
||||||
#include "SMESH_LogicalFilter.hxx"
|
|
||||||
|
|
||||||
#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 <qcheckbox.h>
|
||||||
#include <qspinbox.h>
|
|
||||||
#include <qlayout.h>
|
|
||||||
#include <qvalidator.h>
|
#include <qvalidator.h>
|
||||||
#include <qpixmap.h>
|
#include <qlabel.h>
|
||||||
|
#include <qlayout.h>
|
||||||
// IDL Headers
|
#include <qgroupbox.h>
|
||||||
#include "SALOMEconfig.h"
|
#include <qbuttongroup.h>
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
#include <qradiobutton.h>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SMESHGUI_ExtrusionDlg()
|
// function : SMESHGUI_ExtrusionDlg()
|
||||||
// purpose : constructor
|
// purpose : constructor
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
|
SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg()
|
||||||
bool modal)
|
: SMESHGUI_Dialog( false, true, OK | Apply | Close )
|
||||||
: 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() )
|
|
||||||
{
|
{
|
||||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
|
QPixmap image0( resMgr()->loadPixmap( "SMESH", tr( "ICON_DLG_EDGE") ) ),
|
||||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
|
image1( resMgr()->loadPixmap( "SMESH", tr( "ICON_DLG_TRIANGLE") ) );
|
||||||
QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
|
||||||
|
|
||||||
resize(303, 185);
|
resize(303, 185);
|
||||||
setCaption(tr("EXTRUSION_ALONG_LINE"));
|
setCaption(tr("EXTRUSION_ALONG_LINE"));
|
||||||
setSizeGripEnabled(TRUE);
|
|
||||||
|
QVBoxLayout* main = new QVBoxLayout( mainFrame() );
|
||||||
QGridLayout* SMESHGUI_ExtrusionDlgLayout = new QGridLayout(this);
|
|
||||||
SMESHGUI_ExtrusionDlgLayout->setSpacing(6);
|
|
||||||
SMESHGUI_ExtrusionDlgLayout->setMargin(11);
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupConstructors = new QButtonGroup("GroupConstructors", this);
|
myGroupConstructors = new QButtonGroup("GroupConstructors", mainFrame() );
|
||||||
GroupConstructors->setTitle(tr("SMESH_EXTRUSION"));
|
myGroupConstructors->setTitle(tr("SMESH_EXTRUSION"));
|
||||||
GroupConstructors->setExclusive(TRUE);
|
myGroupConstructors->setExclusive(TRUE);
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical);
|
myGroupConstructors->setColumnLayout(0, Qt::Vertical);
|
||||||
GroupConstructors->layout()->setSpacing(0);
|
myGroupConstructors->layout()->setSpacing(0);
|
||||||
GroupConstructors->layout()->setMargin(0);
|
myGroupConstructors->layout()->setMargin(0);
|
||||||
QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
|
QGridLayout* GroupConstructorsLayout = new QGridLayout(myGroupConstructors->layout());
|
||||||
GroupConstructorsLayout->setAlignment(Qt::AlignTop);
|
GroupConstructorsLayout->setAlignment(Qt::AlignTop);
|
||||||
GroupConstructorsLayout->setSpacing(6);
|
GroupConstructorsLayout->setSpacing(6);
|
||||||
GroupConstructorsLayout->setMargin(11);
|
GroupConstructorsLayout->setMargin(11);
|
||||||
RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1");
|
QRadioButton* RadioButton1 = new QRadioButton(myGroupConstructors, "RadioButton1");
|
||||||
RadioButton1->setText(tr(""));
|
RadioButton1->setText(tr(""));
|
||||||
RadioButton1->setPixmap(image0);
|
RadioButton1->setPixmap(image0);
|
||||||
GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
|
GroupConstructorsLayout->addWidget(RadioButton1, 0, 0);
|
||||||
RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2");
|
QRadioButton* RadioButton2 = new QRadioButton(myGroupConstructors, "RadioButton2");
|
||||||
RadioButton2->setText(tr(""));
|
RadioButton2->setText(tr(""));
|
||||||
RadioButton2->setPixmap(image1);
|
RadioButton2->setPixmap(image1);
|
||||||
GroupConstructorsLayout->addWidget(RadioButton2, 0, 2);
|
GroupConstructorsLayout->addWidget(RadioButton2, 0, 2);
|
||||||
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupConstructors, 0, 0);
|
main->addWidget(myGroupConstructors);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupButtons = new QGroupBox(this, "GroupButtons");
|
myGroupArguments = new QGroupBox( mainFrame(), "GroupArguments");
|
||||||
GroupButtons->setGeometry(QRect(10, 10, 281, 48));
|
myGroupArguments->setTitle(tr("EXTRUSION_1D"));
|
||||||
GroupButtons->setTitle(tr(""));
|
myGroupArguments->setColumnLayout( 1, Qt::Horizontal );
|
||||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
myGroupArguments->layout()->setSpacing(0);
|
||||||
GroupButtons->layout()->setSpacing(0);
|
myGroupArguments->layout()->setMargin(11);
|
||||||
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);
|
|
||||||
|
|
||||||
|
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
|
// Controls for elements selection
|
||||||
TextLabelElements = new QLabel(GroupArguments, "TextLabelElements");
|
createObject( tr( "SMESH_ID_ELEMENTS" ), sel, 0 );
|
||||||
TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
|
createObject( tr( "SMESH_NAME" ), sel, 1 );
|
||||||
TextLabelElements->setFixedWidth(74);
|
|
||||||
GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
|
|
||||||
|
|
||||||
SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton");
|
int epr = prefix( "SMESH element" );
|
||||||
SelectElementsButton->setText(tr("" ));
|
setObjectType( 0, epr + SMDSAbs_Edge, epr + SMDSAbs_Face, -1 );
|
||||||
SelectElementsButton->setPixmap(image2);
|
setNameIndication( 0, ListOfNames );
|
||||||
SelectElementsButton->setToggleButton(FALSE);
|
setReadOnly( 0, false );
|
||||||
GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
|
int mpr = prefix( "SMESH" );
|
||||||
|
setObjectType( 1, mpr + MESH, mpr + SUBMESH, mpr + SUBMESH_EDGE, mpr + GROUP, -1 );
|
||||||
LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
|
setNameIndication( 1, OneName );
|
||||||
LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
|
|
||||||
GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7);
|
|
||||||
|
|
||||||
|
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
|
// Control for the whole mesh selection
|
||||||
CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
|
myCheckBoxMesh = new QCheckBox( box1, "CheckBoxMesh" );
|
||||||
CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
|
myCheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
|
||||||
GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 7);
|
|
||||||
|
|
||||||
|
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
|
// Controls for vector selection
|
||||||
TextLabelVector = new QLabel(GroupArguments, "TextLabelVector");
|
QLabel* TextLabelVector = new QLabel( box2, "TextLabelVector" );
|
||||||
TextLabelVector->setText(tr("SMESH_VECTOR"));
|
TextLabelVector->setText( tr( "SMESH_VECTOR" ) );
|
||||||
GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0);
|
|
||||||
|
|
||||||
TextLabelDx = new QLabel(GroupArguments, "TextLabelDx");
|
QLabel* TextLabelDx = new QLabel( box2, "TextLabelDx" );
|
||||||
TextLabelDx->setText(tr("SMESH_DX"));
|
TextLabelDx->setText(tr("SMESH_DX"));
|
||||||
GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2);
|
|
||||||
|
|
||||||
SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx");
|
myDx = new SMESHGUI_SpinBox( box2, "SpinBox_Dx" );
|
||||||
GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3);
|
|
||||||
|
|
||||||
TextLabelDy = new QLabel(GroupArguments, "TextLabelDy");
|
QLabel* TextLabelDy = new QLabel( box2, "TextLabelDy" );
|
||||||
TextLabelDy->setText(tr("SMESH_DY"));
|
TextLabelDy->setText(tr("SMESH_DY"));
|
||||||
GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4);
|
|
||||||
|
|
||||||
SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy");
|
myDy = new SMESHGUI_SpinBox( box2, "SpinBox_Dy" );
|
||||||
GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5);
|
|
||||||
|
|
||||||
TextLabelDz = new QLabel(GroupArguments, "TextLabelDz");
|
QLabel* TextLabelDz = new QLabel( box2, "TextLabelDz" );
|
||||||
TextLabelDz->setText(tr("SMESH_DZ"));
|
TextLabelDz->setText(tr("SMESH_DZ"));
|
||||||
GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6);
|
|
||||||
|
|
||||||
SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz");
|
myDz = new SMESHGUI_SpinBox( box2, "SpinBox_Dz" );
|
||||||
GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7);
|
|
||||||
|
|
||||||
|
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
|
// Controls for nb. steps defining
|
||||||
TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps");
|
QLabel* TextLabelNbSteps = new QLabel( box3, "TextLabelNbSteps" );
|
||||||
TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
|
TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
|
||||||
GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 3, 3, 0, 1);
|
|
||||||
|
|
||||||
SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
|
myNbSteps = new QSpinBox( box3, "SpinBox_NbSteps" );
|
||||||
GroupArgumentsLayout->addMultiCellWidget(SpinBox_NbSteps, 3, 3, 2, 7);
|
|
||||||
|
|
||||||
SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments, 1, 0);
|
main->addWidget( myGroupArguments );
|
||||||
|
|
||||||
/* Initialisations */
|
/* Initialisations */
|
||||||
SpinBox_Dx->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
myDx->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||||
SpinBox_Dy->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
myDy->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||||
SpinBox_Dz->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
myDz->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3);
|
||||||
|
|
||||||
QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
|
QIntValidator* anIntValidator = new QIntValidator( myNbSteps );
|
||||||
SpinBox_NbSteps->setValidator(anIntValidator);
|
myNbSteps->setValidator( anIntValidator );
|
||||||
SpinBox_NbSteps->setRange(1, 999999);
|
myNbSteps->setRange( 1, 999999 );
|
||||||
|
|
||||||
GroupArguments->show();
|
connect( myGroupConstructors, SIGNAL( clicked( int ) ), this, SLOT ( onConstructorsClicked( int ) ) );
|
||||||
RadioButton1->setChecked(TRUE);
|
connect( myGroupConstructors, SIGNAL( clicked( int ) ), this, SIGNAL( constructorClicked( int ) ) );
|
||||||
|
connect( myCheckBoxMesh, SIGNAL( toggled( bool ) ), this, SLOT ( onSelectMesh( bool ) ) );
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -279,457 +172,82 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule,
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
|
SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg()
|
||||||
{
|
{
|
||||||
// no need to delete child widgets, Qt does it all for us
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : onConstructorsClicked()
|
||||||
// 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()
|
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_ExtrusionDlg::ConstructorsClicked (int constructorId)
|
void SMESHGUI_ExtrusionDlg::onConstructorsClicked( int id )
|
||||||
{
|
{
|
||||||
disconnect(mySelectionMgr, 0, this, 0);
|
myGroupArguments->setTitle( tr( QString( "EXTRUSION_%1D" ).arg( id+1 ) ) );
|
||||||
|
int mpr = prefix( "SMESH" );
|
||||||
switch (constructorId) {
|
setObjectType( 1, mpr + MESH, mpr + SUBMESH, mpr + ( id==0 ? SUBMESH_EDGE : SUBMESH_FACE ), mpr + GROUP, -1 );
|
||||||
case 0:
|
clearSelection();
|
||||||
{
|
|
||||||
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()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// 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()
|
// function : onSelectMesh()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
|
void SMESHGUI_ExtrusionDlg::onSelectMesh( bool toSelectMesh )
|
||||||
{
|
{
|
||||||
if (toSelectMesh)
|
setObjectShown( 0, !toSelectMesh );
|
||||||
TextLabelElements->setText(tr("SMESH_NAME"));
|
setObjectShown( 1, toSelectMesh );
|
||||||
else
|
clearSelection();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : GetConstructorId()
|
// function : constructorId()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
int SMESHGUI_ExtrusionDlg::GetConstructorId()
|
int SMESHGUI_ExtrusionDlg::constructorId() const
|
||||||
{
|
{
|
||||||
if (GroupConstructors != NULL && GroupConstructors->selected() != NULL)
|
if( myGroupConstructors && myGroupConstructors->selected() )
|
||||||
return GroupConstructors->id(GroupConstructors->selected());
|
return myGroupConstructors->id( myGroupConstructors->selected() );
|
||||||
return -1;
|
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
|
#ifndef DIALOGBOX_EXTRUSION_H
|
||||||
#define DIALOGBOX_EXTRUSION_H
|
#define DIALOGBOX_EXTRUSION_H
|
||||||
|
|
||||||
#include "SalomeApp_SelectionMgr.h"
|
#include <SMESHGUI_Dialog.h>
|
||||||
#include "SUIT_SelectionFilter.h"
|
|
||||||
|
|
||||||
// QT Includes
|
|
||||||
#include <qdialog.h>
|
|
||||||
|
|
||||||
class QGridLayout;
|
|
||||||
class QButtonGroup;
|
class QButtonGroup;
|
||||||
class QRadioButton;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
class QPushButton;
|
class QGroupBox;
|
||||||
|
|
||||||
class SMESHGUI;
|
|
||||||
class SMESH_Actor;
|
|
||||||
class SMESHGUI_SpinBox;
|
class SMESHGUI_SpinBox;
|
||||||
class SVTK_ViewWindow;
|
|
||||||
class SVTK_Selector;
|
|
||||||
|
|
||||||
// IDL Headers
|
|
||||||
#include <SALOMEconfig.h>
|
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : SMESHGUI_ExtrusionDlg
|
// class : SMESHGUI_ExtrusionDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_ExtrusionDlg : public QDialog
|
class SMESHGUI_ExtrusionDlg : public SMESHGUI_Dialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_ExtrusionDlg (SMESHGUI*,
|
SMESHGUI_ExtrusionDlg();
|
||||||
bool modal = FALSE);
|
|
||||||
~SMESHGUI_ExtrusionDlg();
|
~SMESHGUI_ExtrusionDlg();
|
||||||
|
|
||||||
private:
|
void init();
|
||||||
void Init (bool ResetControls = true);
|
int constructorId() const;
|
||||||
void enterEvent (QEvent*); /* mouse enter the QWidget */
|
void coords( double&, double&, double& ) const;
|
||||||
int GetConstructorId();
|
int nbStep() const;
|
||||||
//void closeEvent (QCloseEvent*);
|
bool isSelectMesh() const;
|
||||||
//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;
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void constructorClicked( int );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ConstructorsClicked (int);
|
void onConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void onSelectMesh( bool );
|
||||||
bool ClickOnApply();
|
|
||||||
void ClickOnCancel();
|
private:
|
||||||
void SetEditCurrentArgument();
|
QButtonGroup* myGroupConstructors;
|
||||||
void SelectionIntoArgument();
|
QGroupBox* myGroupArguments;
|
||||||
void DeactivateActiveDialog();
|
|
||||||
void ActivateThisDialog();
|
QCheckBox* myCheckBoxMesh;
|
||||||
void onTextChange (const QString&);
|
SMESHGUI_SpinBox *myDx, *myDy, *myDz;
|
||||||
void onSelectMesh (bool toSelectMesh);
|
QSpinBox *myNbSteps;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_EXTRUSION_H
|
#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->hasSelection( SMESHGUI_InitMeshDlg::Algo );
|
||||||
myDlg->setButtonEnabled( isEnabled, QtxDialog::OK | QtxDialog::Apply );
|
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();
|
virtual void initDialog();
|
||||||
|
|
||||||
QString defaultMeshName() const;
|
QString defaultMeshName() const;
|
||||||
|
|
||||||
virtual bool isValid( SUIT_Operation* theOtherOp ) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void startOperation();
|
virtual void startOperation();
|
||||||
|
@ -183,3 +183,11 @@ bool SMESHGUI_Operation::isStudyLocked( const bool theMess ) const
|
|||||||
return false;
|
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;
|
bool isStudyLocked( const bool = true ) const;
|
||||||
|
|
||||||
_PTR(Study) studyDS() const;
|
_PTR(Study) studyDS() const;
|
||||||
|
|
||||||
|
virtual bool isValid( SUIT_Operation* ) const;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void onOk();
|
virtual void onOk();
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// File : SMESHGUI_RemoveNodesDlg.cxx
|
// File : SMESHGUI_RemoveDlg.cxx
|
||||||
// Author : Nicolas REJNERI
|
// Author : Nicolas REJNERI
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header$
|
// $Header$
|
||||||
|
|
||||||
#include "SMESHGUI_RemoveNodesDlg.h"
|
#include "SMESHGUI_RemoveDlg.h"
|
||||||
|
|
||||||
#include <SUIT_ResourceMgr.h>
|
#include <SUIT_ResourceMgr.h>
|
||||||
|
|
||||||
@ -38,25 +38,26 @@
|
|||||||
#include <qradiobutton.h>
|
#include <qradiobutton.h>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : SMESHGUI_RemoveNodesDlg()
|
// class : SMESHGUI_RemoveDlg()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg()
|
SMESHGUI_RemoveDlg::SMESHGUI_RemoveDlg( const bool elem )
|
||||||
: SMESHGUI_Dialog( false, true, OK | Apply | Close )
|
: SMESHGUI_Dialog( false, true, OK | Apply | Close )
|
||||||
{
|
{
|
||||||
QPixmap image0( resMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE")));
|
QString entity = elem ? "ELEMENT" : "NODE";
|
||||||
QPixmap image1( resMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
|
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);
|
resize(303, 185);
|
||||||
setCaption(tr("SMESH_REMOVE_NODES_TITLE" ));
|
setCaption( tr( QString( "SMESH_REMOVE_%1S_TITLE" ).arg( entity ) ) );
|
||||||
setSizeGripEnabled(TRUE);
|
setSizeGripEnabled(TRUE);
|
||||||
|
|
||||||
QVBoxLayout* main = new QVBoxLayout( mainFrame() );
|
QVBoxLayout* main = new QVBoxLayout( mainFrame() );
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
QButtonGroup* GroupConstructors = new QButtonGroup( mainFrame(), "GroupConstructors");
|
QButtonGroup* GroupConstructors = new QButtonGroup( mainFrame(), "GroupConstructors");
|
||||||
GroupConstructors->setTitle(tr("SMESH_NODES" ));
|
GroupConstructors->setTitle(tr( QString( "SMESH_%1S" ).arg( entity ) ) );
|
||||||
GroupConstructors->setExclusive(TRUE);
|
GroupConstructors->setExclusive(TRUE);
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical);
|
GroupConstructors->setColumnLayout(0, Qt::Vertical);
|
||||||
GroupConstructors->layout()->setSpacing(0);
|
GroupConstructors->layout()->setSpacing(0);
|
||||||
@ -86,18 +87,22 @@ SMESHGUI_RemoveNodesDlg::SMESHGUI_RemoveNodesDlg()
|
|||||||
// GroupC1->layout()->setSpacing(0);
|
// GroupC1->layout()->setSpacing(0);
|
||||||
// GroupC1->layout()->setMargin(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 );
|
setNameIndication( 0, ListOfNames );
|
||||||
setReadOnly( 0, false );
|
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);
|
main->addWidget(GroupC1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~SMESHGUI_RemoveNodesDlg()
|
// function : ~SMESHGUI_RemoveDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// 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
|
// Author : Nicolas REJNERI
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header$
|
// $Header$
|
||||||
|
|
||||||
#ifndef DIALOGBOX_REMOVE_NODES_H
|
#ifndef DIALOGBOX_REMOVE_H
|
||||||
#define DIALOGBOX_REMOVE_NODES_H
|
#define DIALOGBOX_REMOVE_H
|
||||||
|
|
||||||
#include <SMESHGUI_Dialog.h>
|
#include <SMESHGUI_Dialog.h>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : SMESHGUI_RemoveNodesDlg
|
// class : SMESHGUI_RemoveDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_RemoveNodesDlg : public SMESHGUI_Dialog
|
class SMESHGUI_RemoveDlg : public SMESHGUI_Dialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_RemoveNodesDlg();
|
SMESHGUI_RemoveDlg( const bool elem );
|
||||||
~SMESHGUI_RemoveNodesDlg();
|
~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
|
// Author : Alexander SOLOVYOV
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header$
|
// $Header$
|
||||||
|
|
||||||
#include "SMESHGUI_RemoveNodesOp.h"
|
#include "SMESHGUI_RemoveOp.h"
|
||||||
#include <SMESHGUI_RemoveNodesDlg.h>
|
#include <SMESHGUI_RemoveDlg.h>
|
||||||
#include <SMESHGUI.h>
|
#include <SMESHGUI.h>
|
||||||
#include <SMESHGUI_VTKUtils.h>
|
#include <SMESHGUI_VTKUtils.h>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function :
|
// function : SMESHGUI_RemoveOp
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_RemoveNodesOp::SMESHGUI_RemoveNodesOp()
|
SMESHGUI_RemoveOp::SMESHGUI_RemoveOp( const bool elems )
|
||||||
: SMESHGUI_SelectionOp( NodeSelection ),
|
: SMESHGUI_SelectionOp( elems ? CellSelection : NodeSelection ),
|
||||||
myDlg( 0 )
|
myDlg( 0 ),
|
||||||
|
myIsElem( elems )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function :
|
// function : ~SMESHGUI_RemoveOp
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_RemoveNodesOp::~SMESHGUI_RemoveNodesOp()
|
SMESHGUI_RemoveOp::~SMESHGUI_RemoveOp()
|
||||||
{
|
{
|
||||||
if( myDlg )
|
if( myDlg )
|
||||||
delete myDlg;
|
delete myDlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function :
|
// function : dlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SalomeApp_Dialog* SMESHGUI_RemoveNodesOp::dlg() const
|
SalomeApp_Dialog* SMESHGUI_RemoveOp::dlg() const
|
||||||
{
|
{
|
||||||
return myDlg;
|
return myDlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function :
|
// function : startOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RemoveNodesOp::startOperation()
|
void SMESHGUI_RemoveOp::startOperation()
|
||||||
{
|
{
|
||||||
if( !myDlg )
|
if( !myDlg )
|
||||||
{
|
{
|
||||||
myDlg = new SMESHGUI_RemoveNodesDlg();
|
myDlg = new SMESHGUI_RemoveDlg( myIsElem );
|
||||||
connect( myDlg, SIGNAL( objectChanged( int, const QStringList& ) ), this, SLOT( onTextChanged( int, const QStringList& ) ) );
|
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 :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RemoveNodesOp::selectionDone()
|
void SMESHGUI_RemoveOp::selectionDone()
|
||||||
{
|
{
|
||||||
SMESHGUI_SelectionOp::selectionDone();
|
SMESHGUI_SelectionOp::selectionDone();
|
||||||
updateDialog();
|
updateDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function :
|
// function : initDialog
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RemoveNodesOp::updateDialog()
|
void SMESHGUI_RemoveOp::initDialog()
|
||||||
|
{
|
||||||
|
SMESHGUI_SelectionOp::initDialog();
|
||||||
|
updateDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : updateDialog
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_RemoveOp::updateDialog()
|
||||||
{
|
{
|
||||||
if( !myDlg )
|
if( !myDlg )
|
||||||
return;
|
return;
|
||||||
@ -101,10 +112,10 @@ void SMESHGUI_RemoveNodesOp::updateDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function :
|
// function : onApply
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool SMESHGUI_RemoveNodesOp::onApply()
|
bool SMESHGUI_RemoveOp::onApply()
|
||||||
{
|
{
|
||||||
if( isStudyLocked() )
|
if( isStudyLocked() )
|
||||||
return false;
|
return false;
|
||||||
@ -120,7 +131,10 @@ bool SMESHGUI_RemoveNodesOp::onApply()
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = mesh()->GetMeshEditor();
|
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(...)
|
catch(...)
|
||||||
{
|
{
|
@ -21,31 +21,32 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// File : SMESHGUI_RemoveNodesOp.h
|
// File : SMESHGUI_RemoveOp.h
|
||||||
// Author : Nicolas REJNERI
|
// Author : Nicolas REJNERI
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
// $Header$
|
// $Header$
|
||||||
|
|
||||||
#ifndef OPERATION_REMOVE_NODES_H
|
#ifndef OPERATION_REMOVE_H
|
||||||
#define OPERATION_REMOVE_NODES_H
|
#define OPERATION_REMOVE_H
|
||||||
|
|
||||||
#include <SMESHGUI_SelectionOp.h>
|
#include <SMESHGUI_SelectionOp.h>
|
||||||
|
|
||||||
class SMESHGUI_RemoveNodesDlg;
|
class SMESHGUI_RemoveDlg;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : SMESHGUI_RemoveNodesOp
|
// class : SMESHGUI_RemoveOp
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_RemoveNodesOp : public SMESHGUI_SelectionOp
|
class SMESHGUI_RemoveOp : public SMESHGUI_SelectionOp
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_RemoveNodesOp();
|
SMESHGUI_RemoveOp( const bool elems );
|
||||||
~SMESHGUI_RemoveNodesOp();
|
~SMESHGUI_RemoveOp();
|
||||||
|
|
||||||
virtual SalomeApp_Dialog* dlg() const;
|
virtual SalomeApp_Dialog* dlg() const;
|
||||||
|
virtual void initDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void startOperation();
|
virtual void startOperation();
|
||||||
@ -57,7 +58,8 @@ protected slots:
|
|||||||
virtual bool onApply();
|
virtual bool onApply();
|
||||||
|
|
||||||
private:
|
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