mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-01 00:00:33 +05:00
PAL20885 EDF 607 SMESH: Measure tools
Complete Boundary Box dialog box
This commit is contained in:
parent
1ec7a722f4
commit
6e55d5dca6
@ -28,9 +28,12 @@
|
|||||||
#include "SMESHGUI_VTKUtils.h"
|
#include "SMESHGUI_VTKUtils.h"
|
||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
#include "SMESHGUI_MeshInfosBox.h"
|
#include "SMESHGUI_MeshInfosBox.h"
|
||||||
|
#include "SMESH_TypeFilter.hxx"
|
||||||
|
#include "SMESH_LogicalFilter.hxx"
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
#include <SalomeApp_Tools.h>
|
||||||
|
|
||||||
#include <SUIT_Desktop.h>
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
@ -53,14 +56,17 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
#include <QRadioButton>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QGridLayout>
|
||||||
|
|
||||||
// MESH includes
|
// MESH includes
|
||||||
#include "SMDSAbs_ElementType.hxx"
|
#include "SMDSAbs_ElementType.hxx"
|
||||||
#include "SMDSAbs_ElementType.hxx"
|
#include "SMDSAbs_ElementType.hxx"
|
||||||
|
|
||||||
|
|
||||||
#define SPACING 6
|
#define SPACING 6
|
||||||
#define MARGIN 11
|
#define MARGIN 11
|
||||||
|
|
||||||
@ -148,6 +154,97 @@ void SMESHGUI_Make2DFrom3DDlg::SetMeshInfo(const SMESH::long_array& theInfo)
|
|||||||
myFullInfo->SetMeshInfo( 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
|
* \brief Constructor
|
||||||
@ -155,9 +252,8 @@ void SMESHGUI_Make2DFrom3DDlg::SetMeshInfo(const SMESH::long_array& theInfo)
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
|
SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
|
||||||
: SMESHGUI_Operation()
|
: SMESHGUI_SelectionOp()
|
||||||
{
|
{
|
||||||
myDlg = new SMESHGUI_Make2DFrom3DDlg(desktop());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -168,6 +264,19 @@ SMESHGUI_Make2DFrom3DOp::SMESHGUI_Make2DFrom3DOp()
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -178,39 +287,25 @@ SMESHGUI_Make2DFrom3DOp::~SMESHGUI_Make2DFrom3DOp()
|
|||||||
|
|
||||||
void SMESHGUI_Make2DFrom3DOp::startOperation()
|
void SMESHGUI_Make2DFrom3DOp::startOperation()
|
||||||
{
|
{
|
||||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
if( !myDlg )
|
||||||
|
myDlg = new SMESHGUI_CopyMeshDlg( desktop() );
|
||||||
|
|
||||||
// check selection
|
mySrc = SMESH::SMESH_IDSource::_nil();
|
||||||
LightApp_SelectionMgr *Sel = selectionMgr();
|
|
||||||
SALOME_ListIO selected; Sel->selectedObjects( selected );
|
|
||||||
|
|
||||||
int nbSel = selected.Extent();
|
myHelpFileName = "copy_mesh_page.html";
|
||||||
if (nbSel != 1) {
|
|
||||||
SUIT_MessageBox::warning(desktop(),
|
|
||||||
tr("SMESH_WRN_WARNING"),
|
|
||||||
tr("SMESH_WRN_NO_AVAILABLE_DATA"));
|
|
||||||
onCancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
SMESHGUI_SelectionOp::startOperation();
|
||||||
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
|
// backup mesh info before 2D mesh computation
|
||||||
SMESH::long_array_var anOldInfo = myMesh->GetMeshInfo();
|
SMESH::long_array_var anOldInfo = myMesh->GetMeshInfo();
|
||||||
|
|
||||||
|
|
||||||
if (!compute2DMesh()) {
|
if (0){//!compute2DMesh()) {
|
||||||
SUIT_MessageBox::warning(desktop(),
|
SUIT_MessageBox::warning(desktop(),
|
||||||
tr("SMESH_WRN_WARNING"),
|
tr("SMESH_WRN_WARNING"),
|
||||||
tr("SMESH_WRN_COMPUTE_FAILED"));
|
tr("SMESH_WRN_COMPUTE_FAILED"));
|
||||||
@ -229,11 +324,62 @@ void SMESHGUI_Make2DFrom3DOp::startOperation()
|
|||||||
// show computated result
|
// show computated result
|
||||||
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
|
_PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
|
||||||
if ( aMeshSObj )
|
if ( aMeshSObj )
|
||||||
myDlg->SetMeshName( aMeshSObj->GetName().c_str() );
|
;//myDlg->SetMeshName( aMeshSObj->GetName().c_str() );
|
||||||
myDlg->SetMeshInfo( aNewInfo );
|
//myDlg->SetMeshInfo( aNewInfo );
|
||||||
myDlg->show(); /*exec();*/
|
myDlg->show();
|
||||||
commit();
|
//commit();
|
||||||
SMESHGUI::Modified();
|
//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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -244,7 +390,12 @@ void SMESHGUI_Make2DFrom3DOp::startOperation()
|
|||||||
|
|
||||||
bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
|
bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
|
||||||
{
|
{
|
||||||
SUIT_OverrideCursor wc;
|
// SUIT_OverrideCursor wc;
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
// SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
return aMeshEditor->Make2DMeshFrom3D();
|
// return aMeshEditor->Make2DMeshFrom3D();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMESHGUI_Make2DFrom3DOp::onApply()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,16 @@
|
|||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
|
||||||
#include "SMESHGUI_Dialog.h"
|
#include "SMESHGUI_Dialog.h"
|
||||||
#include "SMESHGUI_Operation.h"
|
#include "SMESHGUI_SelectionOp.h"
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||||
|
|
||||||
class QFrame;
|
class QFrame;
|
||||||
|
class QCheckBox;
|
||||||
|
class QLineEdit;
|
||||||
|
class QRadioButton;
|
||||||
class SMESHGUI_MeshInfosBox;
|
class SMESHGUI_MeshInfosBox;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -45,41 +48,79 @@ class SMESHGUI_Make2DFrom3DDlg : public SMESHGUI_Dialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_Make2DFrom3DDlg( QWidget* );
|
SMESHGUI_Make2DFrom3DDlg( QWidget* );
|
||||||
virtual ~SMESHGUI_Make2DFrom3DDlg();
|
virtual ~SMESHGUI_Make2DFrom3DDlg();
|
||||||
|
|
||||||
void SetMeshName(const QString& theName);
|
void SetMeshName(const QString& theName);
|
||||||
void SetMeshInfo(const SMESH::long_array& theInfo);
|
void SetMeshInfo(const SMESH::long_array& theInfo);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFrame* createMainFrame( QWidget* );
|
QFrame* createMainFrame( QWidget* );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel* myMeshName;
|
QLabel* myMeshName;
|
||||||
SMESHGUI_MeshInfosBox* myFullInfo;
|
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
|
* \brief Operation to compute 2D mesh on 3D
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SMESHGUI_Make2DFrom3DOp : public SMESHGUI_Operation
|
class SMESHGUI_Make2DFrom3DOp : public SMESHGUI_SelectionOp
|
||||||
{
|
{
|
||||||
public:
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
SMESHGUI_Make2DFrom3DOp();
|
SMESHGUI_Make2DFrom3DOp();
|
||||||
virtual ~SMESHGUI_Make2DFrom3DOp();
|
virtual ~SMESHGUI_Make2DFrom3DOp();
|
||||||
|
|
||||||
protected:
|
virtual LightApp_Dialog* dlg() const;
|
||||||
virtual void startOperation();
|
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
virtual void startOperation();
|
||||||
|
virtual void selectionDone();
|
||||||
|
virtual SUIT_SelectionFilter* createFilter( const int ) const;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
virtual bool onApply();
|
||||||
|
|
||||||
|
private:
|
||||||
bool compute2DMesh();
|
bool compute2DMesh();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_IDSource_var mySrc;
|
||||||
QPointer<SMESHGUI_Make2DFrom3DDlg> myDlg;
|
QPointer<SMESHGUI_CopyMeshDlg> myDlg;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SMESHGUI_Make2DFrom3DOp_H
|
#endif // SMESHGUI_Make2DFrom3DOp_H
|
||||||
|
@ -341,6 +341,7 @@ void SMESHGUI_MinDistance::selectionChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -376,7 +377,8 @@ void SMESHGUI_MinDistance::secondChanged()
|
|||||||
void SMESHGUI_MinDistance::firstEdited()
|
void SMESHGUI_MinDistance::firstEdited()
|
||||||
{
|
{
|
||||||
setTarget( FirstTgt );
|
setTarget( FirstTgt );
|
||||||
clear();
|
if ( sender() == myFirstTgt )
|
||||||
|
clear();
|
||||||
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
|
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
|
||||||
if ( myFirstActor && selector ) {
|
if ( myFirstActor && selector ) {
|
||||||
Handle(SALOME_InteractiveObject) IO = myFirstActor->getIO();
|
Handle(SALOME_InteractiveObject) IO = myFirstActor->getIO();
|
||||||
@ -396,7 +398,8 @@ void SMESHGUI_MinDistance::firstEdited()
|
|||||||
void SMESHGUI_MinDistance::secondEdited()
|
void SMESHGUI_MinDistance::secondEdited()
|
||||||
{
|
{
|
||||||
setTarget( SecondTgt );
|
setTarget( SecondTgt );
|
||||||
clear();
|
if ( sender() == mySecondTgt )
|
||||||
|
clear();
|
||||||
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
|
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
|
||||||
if ( mySecondActor && selector ) {
|
if ( mySecondActor && selector ) {
|
||||||
Handle(SALOME_InteractiveObject) IO = mySecondActor->getIO();
|
Handle(SALOME_InteractiveObject) IO = mySecondActor->getIO();
|
||||||
@ -723,6 +726,7 @@ void SMESHGUI_BoundingBox::selectionChanged()
|
|||||||
mySource->clear();
|
mySource->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -743,7 +747,8 @@ void SMESHGUI_BoundingBox::sourceChanged()
|
|||||||
*/
|
*/
|
||||||
void SMESHGUI_BoundingBox::sourceEdited()
|
void SMESHGUI_BoundingBox::sourceEdited()
|
||||||
{
|
{
|
||||||
clear();
|
if ( sender() == mySource )
|
||||||
|
clear();
|
||||||
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
|
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
|
||||||
if ( myActor && selector ) {
|
if ( myActor && selector ) {
|
||||||
Handle(SALOME_InteractiveObject) IO = myActor->getIO();
|
Handle(SALOME_InteractiveObject) IO = myActor->getIO();
|
||||||
@ -751,7 +756,7 @@ void SMESHGUI_BoundingBox::sourceEdited()
|
|||||||
TColStd_MapOfInteger ID;
|
TColStd_MapOfInteger ID;
|
||||||
if ( !mySource->isReadOnly() )
|
if ( !mySource->isReadOnly() )
|
||||||
myIDs = mySource->text();
|
myIDs = mySource->text();
|
||||||
QStringList ids = mySource->text().split( " ", QString::SkipEmptyParts );
|
QStringList ids = myIDs.split( " ", QString::SkipEmptyParts );
|
||||||
foreach ( QString id, ids )
|
foreach ( QString id, ids )
|
||||||
ID.Add( id.trimmed().toLong() );
|
ID.Add( id.trimmed().toLong() );
|
||||||
selector->AddOrRemoveIndex( IO, ID, false );
|
selector->AddOrRemoveIndex( IO, ID, false );
|
||||||
@ -767,9 +772,45 @@ void SMESHGUI_BoundingBox::sourceEdited()
|
|||||||
void SMESHGUI_BoundingBox::compute()
|
void SMESHGUI_BoundingBox::compute()
|
||||||
{
|
{
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
if ( mySourceMode->checkedId() == NodesSrc ) {
|
SMESH::ListOfIDSources_var srcList = new SMESH::ListOfIDSources();
|
||||||
|
if ( mySourceMode->checkedId() == NodesSrc || mySourceMode->checkedId() == ElementsSrc ) {
|
||||||
|
if ( mySrc.count() > 0 && !CORBA::is_nil( mySrc[0] ) ) {
|
||||||
|
SMESH::SMESH_Mesh_var m = mySrc[0]->GetMesh();
|
||||||
|
QStringList ids = myIDs.split( " ", QString::SkipEmptyParts );
|
||||||
|
if ( !CORBA::is_nil( m ) && ids.count() > 0 ) {
|
||||||
|
SMESH::long_array_var ids_in = new SMESH::long_array();
|
||||||
|
ids_in->length( ids.count() );
|
||||||
|
for( int i = 0; i < ids.count(); i++ )
|
||||||
|
ids_in[i] = ids[i].trimmed().toLong();
|
||||||
|
SMESH::SMESH_MeshEditor_var me = m->GetMeshEditor();
|
||||||
|
SMESH::SMESH_IDSource_var s = me->MakeIDSource( ids_in.in(), mySourceMode->checkedId() == NodesSrc ? SMESH::NODE : SMESH::FACE );
|
||||||
|
srcList->length( 1 );
|
||||||
|
srcList[0] = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
srcList->length( mySrc.count() );
|
||||||
|
for( int i = 0; i < mySrc.count(); i++ )
|
||||||
|
srcList[i] = mySrc[i];
|
||||||
|
}
|
||||||
|
if ( srcList->length() > 0 ) {
|
||||||
|
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
|
||||||
|
SMESH::Measurements_var measure = SMESHGUI::GetSMESHGen()->CreateMeasurements();
|
||||||
|
SMESH::Measure result = measure->BoundingBox( srcList.in() );
|
||||||
|
measure->Destroy();
|
||||||
|
myXmin->setText( QString::number( result.minX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myXmax->setText( QString::number( result.maxX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myDX->setText( QString::number( result.maxX-result.minX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myYmin->setText( QString::number( result.minY, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myYmax->setText( QString::number( result.maxY, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myDY->setText( QString::number( result.maxY-result.minY, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myZmin->setText( QString::number( result.minZ, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myZmax->setText( QString::number( result.maxZ, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
myDZ->setText( QString::number( result.maxZ-result.minZ, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,9 @@
|
|||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
// File : SMESH_Measurements_i.cxx
|
||||||
|
// Author : Pavel TELKOV, Open CASCADE S.A.S. (pavel.telkov@opencascade.com)
|
||||||
|
|
||||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
|
||||||
// File : SMESH_Filter_i.cxx
|
|
||||||
// Author : Alexey Petrov, OCC
|
|
||||||
// Module : SMESH
|
|
||||||
//
|
|
||||||
#include "SMESH_Measurements_i.hxx"
|
#include "SMESH_Measurements_i.hxx"
|
||||||
|
|
||||||
#include "SMESH_Gen_i.hxx"
|
#include "SMESH_Gen_i.hxx"
|
||||||
@ -196,12 +193,21 @@ static void enlargeBoundingBox(const SMDS_MeshNode* theNode,
|
|||||||
{
|
{
|
||||||
if (!theNode)
|
if (!theNode)
|
||||||
return;
|
return;
|
||||||
theMeasure.minX = min( theMeasure.minX, theNode->X() );
|
if ( theMeasure.node1 == -1 ) {
|
||||||
theMeasure.maxX = max( theMeasure.maxX, theNode->X() );
|
// we use this attribute as a flag that it is the first node added to the bnd box
|
||||||
theMeasure.minY = min( theMeasure.minY, theNode->Y() );
|
theMeasure.minX = theMeasure.maxX = theNode->X();
|
||||||
theMeasure.maxY = max( theMeasure.maxY, theNode->Y() );
|
theMeasure.minY = theMeasure.maxY = theNode->Y();
|
||||||
theMeasure.minZ = min( theMeasure.minZ, theNode->Z() );
|
theMeasure.minZ = theMeasure.maxZ = theNode->Z();
|
||||||
theMeasure.maxZ = max( theMeasure.maxZ, theNode->Z() );
|
theMeasure.node1 = theNode->GetID();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
theMeasure.minX = min( theMeasure.minX, theNode->X() );
|
||||||
|
theMeasure.maxX = max( theMeasure.maxX, theNode->X() );
|
||||||
|
theMeasure.minY = min( theMeasure.minY, theNode->Y() );
|
||||||
|
theMeasure.maxY = max( theMeasure.maxY, theNode->Y() );
|
||||||
|
theMeasure.minZ = min( theMeasure.minZ, theNode->Z() );
|
||||||
|
theMeasure.maxZ = max( theMeasure.maxZ, theNode->Z() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -19,12 +19,9 @@
|
|||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
|
|
||||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
|
||||||
// File : SMESH_Measurements_i.hxx
|
// File : SMESH_Measurements_i.hxx
|
||||||
// Author : Pavel Telkov, OCC
|
// Author : Pavel TELKOV, Open CASCADE S.A.S. (pavel.telkov@opencascade.com)
|
||||||
// Module : SMESH
|
|
||||||
//
|
|
||||||
#ifndef _SMESH_MEASUREMENTS_I_HXX_
|
#ifndef _SMESH_MEASUREMENTS_I_HXX_
|
||||||
#define _SMESH_MEASUREMENTS_I_HXX_
|
#define _SMESH_MEASUREMENTS_I_HXX_
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user