mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-31 21:00:33 +05:00
Revert back previous bad integration
This commit is contained in:
parent
6e55d5dca6
commit
8693dba253
@ -28,12 +28,9 @@
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_MeshInfosBox.h"
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_LogicalFilter.hxx"
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <SalomeApp_Tools.h>
|
||||
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
@ -56,17 +53,14 @@
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QGroupBox>
|
||||
#include <QRadioButton>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
|
||||
// MESH includes
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
|
||||
|
||||
#define SPACING 6
|
||||
#define MARGIN 11
|
||||
|
||||
@ -154,97 +148,6 @@ void SMESHGUI_Make2DFrom3DDlg::SetMeshInfo(const SMESH::long_array& theInfo)
|
||||
myFullInfo->SetMeshInfo( theInfo );
|
||||
}
|
||||
|
||||
// =========================================================================================
|
||||
/*!
|
||||
* \brief Copy Mesh dialog box
|
||||
*/
|
||||
//=======================================================================
|
||||
|
||||
SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMeshDlg( QWidget* parent )
|
||||
: SMESHGUI_Dialog( parent, false, true, OK | Apply | Close | Help )
|
||||
{
|
||||
setWindowTitle( tr("CAPTION") );
|
||||
|
||||
// mesh
|
||||
setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
|
||||
createObject( tr( "MESH" ), mainFrame(), Mesh );
|
||||
|
||||
// mode
|
||||
QGroupBox* aModeGrp = new QGroupBox( tr( "MODE" ), mainFrame() );
|
||||
QHBoxLayout* aModeGrpLayout = new QHBoxLayout( aModeGrp );
|
||||
aModeGrpLayout->setMargin( MARGIN );
|
||||
aModeGrpLayout->setSpacing( SPACING );
|
||||
QRadioButton* a2dFrom3dRB = new QRadioButton( tr( "2D_FROM_3D" ), aModeGrp );
|
||||
QRadioButton* a1dFrom3dRB = new QRadioButton( tr( "1D_FROM_3D" ), aModeGrp );
|
||||
QRadioButton* a1dFrom2dRB = new QRadioButton( tr( "1D_FROM_2D" ), aModeGrp );
|
||||
aModeGrpLayout->addWidget( a2dFrom3dRB );
|
||||
aModeGrpLayout->addWidget( a1dFrom3dRB );
|
||||
aModeGrpLayout->addWidget( a1dFrom2dRB );
|
||||
|
||||
// target
|
||||
QGroupBox* aTargetGrp = new QGroupBox( tr( "TARGET" ), mainFrame() );
|
||||
QGridLayout* aTargetGrpLayout = new QGridLayout( aTargetGrp );
|
||||
aTargetGrpLayout->setMargin( MARGIN );
|
||||
aTargetGrpLayout->setSpacing( SPACING );
|
||||
myThisMeshRB = new QRadioButton( tr( "THIS_MESH" ), aTargetGrp );
|
||||
myNewMeshRB = new QRadioButton( tr( "NEW_MESH" ), aTargetGrp );
|
||||
myMeshName = new QLineEdit( aTargetGrp );
|
||||
myCopyCheck = new QCheckBox( tr( "COPY_SRC" ), aTargetGrp );
|
||||
myMissingCheck = new QCheckBox( tr( "MISSING_ONLY" ), aTargetGrp );
|
||||
aTargetGrpLayout->addWidget( myThisMeshRB, 0, 0 );
|
||||
aTargetGrpLayout->addWidget( myNewMeshRB, 1, 0 );
|
||||
aTargetGrpLayout->addWidget( myMeshName, 1, 1 );
|
||||
aTargetGrpLayout->addWidget( myCopyCheck, 2, 0 );
|
||||
aTargetGrpLayout->addWidget( myMissingCheck, 2, 1 );
|
||||
myGroupCheck = new QCheckBox( tr( "CREATE_GROUP" ), mainFrame() );
|
||||
myGroupName = new QLineEdit( mainFrame() );
|
||||
|
||||
// layout
|
||||
QGridLayout* aDlgLay = new QGridLayout( mainFrame() );
|
||||
aDlgLay->setMargin( 0 );
|
||||
aDlgLay->setSpacing( SPACING );
|
||||
aDlgLay->addWidget( objectWg( Mesh, Label ), 0, 0 );
|
||||
aDlgLay->addWidget( objectWg( Mesh, Btn ), 0, 1 );
|
||||
aDlgLay->addWidget( objectWg( Mesh, Control ), 0, 2 );
|
||||
aDlgLay->addWidget( aModeGrp, 1, 0, 1, 3 );
|
||||
aDlgLay->addWidget( aTargetGrp, 2, 0, 1, 3 );
|
||||
aDlgLay->addWidget( myGroupCheck, 3, 0 );
|
||||
aDlgLay->addWidget( myGroupName, 3, 1, 1, 2 );
|
||||
//aDlgLay->setStretchFactor(aMainFrame, 1);
|
||||
|
||||
connect( myThisMeshRB, SIGNAL( clicked() ), this, SLOT( onTargetChanged() ) );
|
||||
connect( myNewMeshRB, SIGNAL( clicked() ), this, SLOT( onTargetChanged() ) );
|
||||
connect( myGroupCheck, SIGNAL( clicked() ), this, SLOT( onGroupChecked() ) );
|
||||
|
||||
a2dFrom3dRB->setChecked( true );
|
||||
myThisMeshRB->setChecked( true );
|
||||
onTargetChanged();
|
||||
onGroupChecked();
|
||||
enableControls( false );
|
||||
}
|
||||
|
||||
SMESHGUI_CopyMeshDlg::~SMESHGUI_CopyMeshDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void SMESHGUI_CopyMeshDlg::enableControls( bool on )
|
||||
{
|
||||
printf("SMESHGUI_CopyMeshDlg::enableControls:%d\n",on);
|
||||
setButtonEnabled( on, QtxDialog::OK | QtxDialog::Apply );
|
||||
}
|
||||
|
||||
void SMESHGUI_CopyMeshDlg::onTargetChanged()
|
||||
{
|
||||
myMeshName->setEnabled( myNewMeshRB->isChecked() );
|
||||
myCopyCheck->setEnabled( myNewMeshRB->isChecked() );
|
||||
myMissingCheck->setEnabled( myNewMeshRB->isChecked() );
|
||||
}
|
||||
|
||||
void SMESHGUI_CopyMeshDlg::onGroupChecked()
|
||||
{
|
||||
myGroupName->setEnabled( myGroupCheck->isChecked() );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Constructor
|
||||
@ -252,8 +155,9 @@ void SMESHGUI_CopyMeshDlg::onGroupChecked()
|
||||
//================================================================================
|
||||
|
||||
SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
|
||||
: SMESHGUI_SelectionOp()
|
||||
: SMESHGUI_Operation()
|
||||
{
|
||||
myDlg = new SMESHGUI_Make2DFrom3DDlg(desktop());
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -264,19 +168,6 @@ SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
|
||||
|
||||
SMESHGUI_Make2DFrom3DOp::~SMESHGUI_Make2DFrom3DOp()
|
||||
{
|
||||
if ( myDlg )
|
||||
delete myDlg;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Gets dialog of this operation
|
||||
* \retval LightApp_Dialog* - pointer to dialog of this operation
|
||||
*/
|
||||
//================================================================================
|
||||
LightApp_Dialog* SMESHGUI_Make2DFrom3DOp::dlg() const
|
||||
{
|
||||
return myDlg;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -287,25 +178,39 @@ LightApp_Dialog* SMESHGUI_Make2DFrom3DOp::dlg() const
|
||||
|
||||
void SMESHGUI_Make2DFrom3DOp::startOperation()
|
||||
{
|
||||
if( !myDlg )
|
||||
myDlg = new SMESHGUI_CopyMeshDlg( desktop() );
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
|
||||
mySrc = SMESH::SMESH_IDSource::_nil();
|
||||
// check selection
|
||||
LightApp_SelectionMgr *Sel = selectionMgr();
|
||||
SALOME_ListIO selected; Sel->selectedObjects( selected );
|
||||
|
||||
myHelpFileName = "copy_mesh_page.html";
|
||||
int nbSel = selected.Extent();
|
||||
if (nbSel != 1) {
|
||||
SUIT_MessageBox::warning(desktop(),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_NO_AVAILABLE_DATA"));
|
||||
onCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
SMESHGUI_SelectionOp::startOperation();
|
||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||
myMesh = SMESH::GetMeshByIO(anIO);
|
||||
if (myMesh->_is_nil()) {
|
||||
SUIT_MessageBox::warning(desktop(),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_NO_AVAILABLE_DATA"));
|
||||
onCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
SMESHGUI_Operation::startOperation();
|
||||
|
||||
myDlg->activateObject( SMESHGUI_CopyMeshDlg::Mesh );
|
||||
myDlg->show();
|
||||
|
||||
selectionDone();
|
||||
/*
|
||||
// backup mesh info before 2D mesh computation
|
||||
SMESH::long_array_var anOldInfo = myMesh->GetMeshInfo();
|
||||
|
||||
|
||||
if (0){//!compute2DMesh()) {
|
||||
if (!compute2DMesh()) {
|
||||
SUIT_MessageBox::warning(desktop(),
|
||||
tr("SMESH_WRN_WARNING"),
|
||||
tr("SMESH_WRN_COMPUTE_FAILED"));
|
||||
@ -324,62 +229,11 @@ void SMESHGUI_Make2DFrom3DOp::startOperation()
|
||||
// show computated result
|
||||
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
|
||||
if ( aMeshSObj )
|
||||
;//myDlg->SetMeshName( aMeshSObj->GetName().c_str() );
|
||||
//myDlg->SetMeshInfo( aNewInfo );
|
||||
myDlg->show();
|
||||
//commit();
|
||||
//SMESHGUI::Modified();
|
||||
*/
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Updates dialog's look and feel
|
||||
*
|
||||
* Virtual method redefined from the base class updates dialog's look and feel
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_Make2DFrom3DOp::selectionDone()
|
||||
{
|
||||
bool on = false;
|
||||
if ( dlg()->isVisible() ) {
|
||||
SMESHGUI_SelectionOp::selectionDone();
|
||||
try {
|
||||
QString entry = myDlg->selectedObject( SMESHGUI_CopyMeshDlg::Mesh );
|
||||
_PTR(SObject) sobj = studyDS()->FindObjectID( entry.toLatin1().constData() );
|
||||
if ( sobj ) {
|
||||
SMESH::SMESH_IDSource_var obj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
|
||||
on = !obj->_is_nil();
|
||||
}
|
||||
}
|
||||
catch ( const SALOME::SALOME_Exception& S_ex ) {
|
||||
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
||||
}
|
||||
catch ( ... ) {
|
||||
}
|
||||
}
|
||||
myDlg->enableControls( on );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Creates selection filter
|
||||
* \param theId - identifier of current selection widget
|
||||
* \retval SUIT_SelectionFilter* - pointer to the created filter or null
|
||||
*
|
||||
* Creates selection filter in accordance with identifier of current selection widget
|
||||
*/
|
||||
//================================================================================
|
||||
SUIT_SelectionFilter* SMESHGUI_Make2DFrom3DOp::createFilter( const int theId ) const
|
||||
{
|
||||
SUIT_SelectionFilter* f = 0;
|
||||
if ( theId == SMESHGUI_CopyMeshDlg::Mesh ) {
|
||||
QList<SUIT_SelectionFilter*> filters;
|
||||
filters.append( new SMESH_TypeFilter( MESHorSUBMESH ) );
|
||||
filters.append( new SMESH_TypeFilter( GROUP ) );
|
||||
f = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );
|
||||
}
|
||||
return f;
|
||||
myDlg->SetMeshName( aMeshSObj->GetName().c_str() );
|
||||
myDlg->SetMeshInfo( aNewInfo );
|
||||
myDlg->show(); /*exec();*/
|
||||
commit();
|
||||
SMESHGUI::Modified();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -390,12 +244,7 @@ SUIT_SelectionFilter* SMESHGUI_Make2DFrom3DOp::createFilter( const int theId ) c
|
||||
|
||||
bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
|
||||
{
|
||||
// SUIT_OverrideCursor wc;
|
||||
// SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
// return aMeshEditor->Make2DMeshFrom3D();
|
||||
}
|
||||
|
||||
bool SMESHGUI_Make2DFrom3DOp::onApply()
|
||||
{
|
||||
return false;
|
||||
SUIT_OverrideCursor wc;
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
return aMeshEditor->Make2DMeshFrom3D();
|
||||
}
|
||||
|
@ -28,16 +28,13 @@
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
#include "SMESHGUI_Dialog.h"
|
||||
#include "SMESHGUI_SelectionOp.h"
|
||||
#include "SMESHGUI_Operation.h"
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QFrame;
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QRadioButton;
|
||||
class SMESHGUI_MeshInfosBox;
|
||||
|
||||
/*!
|
||||
@ -48,79 +45,41 @@ class SMESHGUI_Make2DFrom3DDlg : public SMESHGUI_Dialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
SMESHGUI_Make2DFrom3DDlg( QWidget* );
|
||||
virtual ~SMESHGUI_Make2DFrom3DDlg();
|
||||
|
||||
void SetMeshName(const QString& theName);
|
||||
void SetMeshInfo(const SMESH::long_array& theInfo);
|
||||
|
||||
private:
|
||||
private:
|
||||
QFrame* createMainFrame( QWidget* );
|
||||
|
||||
private:
|
||||
private:
|
||||
QLabel* myMeshName;
|
||||
SMESHGUI_MeshInfosBox* myFullInfo;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Dialog to show result mesh statistic
|
||||
*/
|
||||
|
||||
class SMESHGUI_CopyMeshDlg : public SMESHGUI_Dialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum { Mesh };
|
||||
|
||||
SMESHGUI_CopyMeshDlg( QWidget* );
|
||||
virtual ~SMESHGUI_CopyMeshDlg();
|
||||
|
||||
void enableControls( bool );
|
||||
|
||||
private slots:
|
||||
void onTargetChanged();
|
||||
void onGroupChecked();
|
||||
|
||||
private:
|
||||
QRadioButton* myThisMeshRB;
|
||||
QRadioButton* myNewMeshRB;
|
||||
QLineEdit* myMeshName;
|
||||
QCheckBox* myCopyCheck;
|
||||
QCheckBox* myMissingCheck;
|
||||
QCheckBox* myGroupCheck;
|
||||
QLineEdit* myGroupName;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Operation to compute 2D mesh on 3D
|
||||
*/
|
||||
|
||||
class SMESHGUI_Make2DFrom3DOp : public SMESHGUI_SelectionOp
|
||||
class SMESHGUI_Make2DFrom3DOp : public SMESHGUI_Operation
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
SMESHGUI_Make2DFrom3DOp();
|
||||
virtual ~SMESHGUI_Make2DFrom3DOp();
|
||||
|
||||
virtual LightApp_Dialog* dlg() const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual void startOperation();
|
||||
virtual void selectionDone();
|
||||
virtual SUIT_SelectionFilter* createFilter( const int ) const;
|
||||
|
||||
protected slots:
|
||||
virtual bool onApply();
|
||||
|
||||
private:
|
||||
private:
|
||||
bool compute2DMesh();
|
||||
|
||||
private:
|
||||
SMESH::SMESH_IDSource_var mySrc;
|
||||
QPointer<SMESHGUI_CopyMeshDlg> myDlg;
|
||||
private:
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_Make2DFrom3DOp_H
|
||||
|
Loading…
Reference in New Issue
Block a user