0020976: EDF 1471 SMESH: New ergonomy to display quality controls

This commit is contained in:
mpa 2013-06-27 12:35:43 +00:00
parent d14e48c7b0
commit a58d128175
13 changed files with 367 additions and 127 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -145,10 +145,13 @@ sub-mesh or mesh group:
<center>\image html ctrlinfo.png <center>\image html ctrlinfo.png
<em>"Quality Info" page</em></center> <em>"Quality Info" page</em></center>
\note For the perfomance reason, the Aspect Ratio histogram for the big meshes is \note User can set "Double nodes tolerance" in the dialog for local change
computed only by demand. For this, the user should press the "Compute" or via the "Quality controls" in Mesh preferences.
button (see picture). Also, histogram is automatically computed if the size of the
elements does not exceed the "Automatic controls compute limit" set \note For the perfomance reason, all quality control values for the big meshes are
computed only by demand. For this, the user should press the "compute"
button (see picture). Also, values are automatically computed if the number of the
nodes / elements does not exceed the "Automatic controls compute limit" set
via the "Mesh information" preferences (zero value means no limit). via the "Mesh information" preferences (zero value means no limit).
The button \b "Dump" allows printing the information displayed in the The button \b "Dump" allows printing the information displayed in the

View File

@ -4220,6 +4220,7 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), -1, 0 ); popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 214, View, mesh_part ); // UPDATE createPopupItem( 214, View, mesh_part ); // UPDATE
createPopupItem( 900, View, mesh_part ); // ADV_INFO createPopupItem( 900, View, mesh_part ); // ADV_INFO
createPopupItem( 6032,View, mesh_part ); // CTRL_INFO
createPopupItem( 904, View, mesh ); // FIND_ELEM createPopupItem( 904, View, mesh ); // FIND_ELEM
popupMgr()->insert( separator(), -1, 0 ); popupMgr()->insert( separator(), -1, 0 );
@ -4843,6 +4844,7 @@ void SMESHGUI::createPreferences()
setPreferenceProperty( nodesLim, "step", 10000 ); setPreferenceProperty( nodesLim, "step", 10000 );
setPreferenceProperty( nodesLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) ); setPreferenceProperty( nodesLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
int ctrlLim = addPreference( tr( "PREF_CTRL_LIMIT" ), infoGroup, LightApp_Preferences::IntSpin, "SMESH", "info_controls_limit" ); int ctrlLim = addPreference( tr( "PREF_CTRL_LIMIT" ), infoGroup, LightApp_Preferences::IntSpin, "SMESH", "info_controls_limit" );
setPreferenceProperty( ctrlLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
setPreferenceProperty( ctrlLim, "min", 0 ); setPreferenceProperty( ctrlLim, "min", 0 );
setPreferenceProperty( ctrlLim, "max", 10000000 ); setPreferenceProperty( ctrlLim, "max", 10000000 );
setPreferenceProperty( ctrlLim, "step", 1000 ); setPreferenceProperty( ctrlLim, "step", 1000 );

View File

@ -29,6 +29,7 @@
#include "SMESHGUI_IdValidator.h" #include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_SpinBox.h"
#include "SMDSAbs_ElementType.hxx" #include "SMDSAbs_ElementType.hxx"
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#include "SMDS_BallElement.hxx" #include "SMDS_BallElement.hxx"
@ -59,6 +60,7 @@
#include <QLineEdit> #include <QLineEdit>
#include <QMenu> #include <QMenu>
#include <QPushButton> #include <QPushButton>
#include <QToolButton>
#include <QRadioButton> #include <QRadioButton>
#include <QTextStream> #include <QTextStream>
#include <QTabWidget> #include <QTabWidget>
@ -2999,9 +3001,9 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
{ {
setFrameStyle( StyledPanel | Sunken ); setFrameStyle( StyledPanel | Sunken );
QGridLayout* l = new QGridLayout( this ); myMainLayout = new QGridLayout( this );
l->setMargin( MARGIN ); myMainLayout->setMargin( MARGIN );
l->setSpacing( SPACING ); myMainLayout->setSpacing( SPACING );
// name // name
QLabel* aNameLab = new QLabel( tr( "NAME_LAB" ), this ); QLabel* aNameLab = new QLabel( tr( "NAME_LAB" ), this );
@ -3009,6 +3011,9 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
aName->setMinimumWidth( 150 ); aName->setMinimumWidth( 150 );
myWidgets << aName; myWidgets << aName;
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QIcon aComputeIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_COMPUTE" ) ) );
// nodes info // nodes info
QLabel* aNodesLab = new QLabel( tr( "NODES_INFO" ), this ); QLabel* aNodesLab = new QLabel( tr( "NODES_INFO" ), this );
QLabel* aNodesFreeLab = new QLabel( tr( "NUMBER_OF_THE_FREE_NODES" ), this ); QLabel* aNodesFreeLab = new QLabel( tr( "NUMBER_OF_THE_FREE_NODES" ), this );
@ -3017,6 +3022,11 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
QLabel* aNodesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_NODES" ), this ); QLabel* aNodesDoubleLab = new QLabel( tr( "NUMBER_OF_THE_DOUBLE_NODES" ), this );
QLabel* aNodesDouble = createField(); QLabel* aNodesDouble = createField();
myWidgets << aNodesDouble; myWidgets << aNodesDouble;
QLabel* aToleranceLab = new QLabel( tr( "DOUBLE_NODES_TOLERANCE" ), this );
myToleranceWidget = new SMESHGUI_SpinBox( this );
myToleranceWidget->RangeStepAndValidator(0.0000000001, 1000000.0, 0.0000001, "length_precision" );
myToleranceWidget->setAcceptNames( false );
myToleranceWidget->SetValue( SMESHGUI::resourceMgr()->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 ) );
// edges info // edges info
QLabel* anEdgesLab = new QLabel( tr( "EDGES_INFO" ), this ); QLabel* anEdgesLab = new QLabel( tr( "EDGES_INFO" ), this );
@ -3046,17 +3056,52 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
QLabel* anAspectRatio3DLab = new QLabel( tr( "ASPECT_RATIO_3D_HISTOGRAM" ), this ); QLabel* anAspectRatio3DLab = new QLabel( tr( "ASPECT_RATIO_3D_HISTOGRAM" ), this );
myPlot3D = createPlot( this ); myPlot3D = createPlot( this );
myComputeFaceBtn = new QPushButton( tr( "BUT_COMPUTE" ), this ); QToolButton* aFreeNodesBtn = new QToolButton( this );
myComputeFaceBtn->setAutoDefault( true ); aFreeNodesBtn->setIcon(aComputeIcon);
myComputeFaceBtn->setFixedWidth( 80 ); myButtons << aFreeNodesBtn; //0
myComputeFaceBtn->setVisible( false );
myComputeVolumeBtn = new QPushButton( tr( "BUT_COMPUTE" ), this );
myComputeVolumeBtn->setAutoDefault( true );
myComputeVolumeBtn->setFixedWidth( 80 );
myComputeVolumeBtn->setVisible( false );
connect( myComputeFaceBtn, SIGNAL( clicked() ), this, SLOT( computeFaceInfo() ) ); QToolButton* aDoubleNodesBtn = new QToolButton( this );
connect( myComputeVolumeBtn, SIGNAL( clicked() ), this, SLOT( computeVolumeInfo() ) ); aDoubleNodesBtn->setIcon(aComputeIcon);
myButtons << aDoubleNodesBtn; //1
QToolButton* aDoubleEdgesBtn = new QToolButton( this );
aDoubleEdgesBtn->setIcon(aComputeIcon);
myButtons << aDoubleEdgesBtn; //2
QToolButton* aDoubleFacesBtn = new QToolButton( this );
aDoubleFacesBtn->setIcon(aComputeIcon);
myButtons << aDoubleFacesBtn; //3
QToolButton* aOverContFacesBtn = new QToolButton( this );
aOverContFacesBtn->setIcon(aComputeIcon);
myButtons << aOverContFacesBtn; //4
QToolButton* aComputeFaceBtn = new QToolButton( this );
aComputeFaceBtn->setIcon(aComputeIcon);
myButtons << aComputeFaceBtn; //5
QToolButton* aDoubleVolumesBtn = new QToolButton( this );
aDoubleVolumesBtn->setIcon(aComputeIcon);
myButtons << aDoubleVolumesBtn; //6
QToolButton* aOverContVolumesBtn = new QToolButton( this );
aOverContVolumesBtn->setIcon(aComputeIcon);
myButtons << aOverContVolumesBtn; //7
QToolButton* aComputeVolumeBtn = new QToolButton( this );
aComputeVolumeBtn->setIcon(aComputeIcon);
myButtons << aComputeVolumeBtn; //8
connect( aComputeFaceBtn, SIGNAL( clicked() ), this, SLOT( computeFaceInfo() ) );
connect( aComputeVolumeBtn, SIGNAL( clicked() ), this, SLOT( computeVolumeInfo() ) );
connect( aFreeNodesBtn, SIGNAL( clicked() ), this, SLOT( computeFreeNodesInfo() ) );
connect( aDoubleNodesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleNodesInfo() ) );
connect( aDoubleEdgesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleEdgesInfo() ) );
connect( aDoubleFacesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleFacesInfo() ) );
connect( aOverContFacesBtn, SIGNAL( clicked() ), this, SLOT( computeOverConstrainedFacesInfo() ) );
connect( aDoubleVolumesBtn, SIGNAL( clicked() ), this, SLOT( computeDoubleVolumesInfo() ) );
connect( aOverContVolumesBtn, SIGNAL( clicked() ), this, SLOT( computeOverConstrainedVolumesInfo() ) );
connect( myToleranceWidget, SIGNAL(valueChanged(double)), this, SLOT( setTolerance( double )));
setFontAttributes( aNameLab ); setFontAttributes( aNameLab );
setFontAttributes( aNodesLab ); setFontAttributes( aNodesLab );
@ -3064,37 +3109,47 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
setFontAttributes( aFacesLab ); setFontAttributes( aFacesLab );
setFontAttributes( aVolumesLab ); setFontAttributes( aVolumesLab );
l->addWidget( aNameLab, 0, 0 ); myMainLayout->addWidget( aNameLab, 0, 0 ); //0
l->addWidget( aName, 0, 1 ); myMainLayout->addWidget( aName, 0, 1, 1, 2 ); //1
l->addWidget( aNodesLab, 1, 0, 1, 2 ); myMainLayout->addWidget( aNodesLab, 1, 0, 1, 3 ); //2
l->addWidget( aNodesFreeLab, 2, 0 ); myMainLayout->addWidget( aNodesFreeLab, 2, 0 ); //3
l->addWidget( aNodesFree, 2, 1 ); myMainLayout->addWidget( aNodesFree, 2, 1 ); //4
l->addWidget( aNodesDoubleLab, 3, 0 ); myMainLayout->addWidget( aFreeNodesBtn, 2, 2 ); //5
l->addWidget( aNodesDouble, 3, 1 ); myMainLayout->addWidget( aNodesDoubleLab, 3, 0 ); //6
l->addWidget( anEdgesLab, 4, 0, 1, 2 ); myMainLayout->addWidget( aNodesDouble, 3, 1 ); //7
l->addWidget( anEdgesDoubleLab, 5, 0 ); myMainLayout->addWidget( aDoubleNodesBtn, 3, 2 ); //8
l->addWidget( anEdgesDouble, 5, 1 ); myMainLayout->addWidget( aToleranceLab, 4, 0 ); //9
l->addWidget( aFacesLab, 6, 0, 1, 2 ); myMainLayout->addWidget( myToleranceWidget, 4, 1 ); //10
l->addWidget( aFacesDoubleLab, 7, 0 ); myMainLayout->addWidget( anEdgesLab, 5, 0, 1, 3 ); //11
l->addWidget( aFacesDouble, 7, 1 ); myMainLayout->addWidget( anEdgesDoubleLab, 6, 0 ); //12
l->addWidget( aFacesOverLab, 8, 0 ); myMainLayout->addWidget( anEdgesDouble, 6, 1 ); //13
l->addWidget( aFacesOver, 8, 1 ); myMainLayout->addWidget( aDoubleEdgesBtn, 6, 2 ); //14
l->addWidget( anAspectRatioLab, 9, 0 ); myMainLayout->addWidget( aFacesLab, 7, 0, 1, 3 ); //15
l->addWidget( myComputeFaceBtn, 9, 1 ); myMainLayout->addWidget( aFacesDoubleLab, 8, 0 ); //16
l->addWidget( myPlot, 10, 0, 1, 2 ); myMainLayout->addWidget( aFacesDouble, 8, 1 ); //17
l->addWidget( aVolumesLab, 11, 0, 1, 2 ); myMainLayout->addWidget( aDoubleFacesBtn, 8, 2 ); //18
l->addWidget( aVolumesDoubleLab, 12, 0 ); myMainLayout->addWidget( aFacesOverLab, 9, 0 ); //19
l->addWidget( aVolumesDouble, 12, 1 ); myMainLayout->addWidget( aFacesOver, 9, 1 ); //20
l->addWidget( aVolumesOverLab, 13, 0 ); myMainLayout->addWidget( aOverContFacesBtn, 9, 2 ); //21
l->addWidget( aVolumesOver, 13, 1 ); myMainLayout->addWidget( anAspectRatioLab, 10, 0 ); //22
l->addWidget( anAspectRatio3DLab, 14, 0 ); myMainLayout->addWidget( aComputeFaceBtn, 10, 2 ); //23
l->addWidget( myComputeVolumeBtn, 14, 1 ); myMainLayout->addWidget( myPlot, 11, 0, 1, 3 );//24
l->addWidget( myPlot3D, 15, 0, 1, 2 ); myMainLayout->addWidget( aVolumesLab, 12, 0, 1, 3 );//25
myMainLayout->addWidget( aVolumesDoubleLab, 13, 0 ); //26
myMainLayout->addWidget( aVolumesDouble, 13, 1 ); //27
myMainLayout->addWidget( aDoubleVolumesBtn, 13, 2 ); //28
myMainLayout->addWidget( aVolumesOverLab, 14, 0 ); //28
myMainLayout->addWidget( aVolumesOver, 14, 1 ); //30
myMainLayout->addWidget( aOverContVolumesBtn,14, 2 ); //31
myMainLayout->addWidget( anAspectRatio3DLab, 15, 0 ); //32
myMainLayout->addWidget( aComputeVolumeBtn, 15, 2 ); //33
myMainLayout->addWidget( myPlot3D, 16, 0, 1, 3 );//34
l->setColumnStretch( 0, 0 ); myMainLayout->setColumnStretch( 0, 0 );
l->setColumnStretch( 1, 5 ); myMainLayout->setColumnStretch( 1, 5 );
l->setRowStretch ( 10, 5 ); myMainLayout->setRowStretch ( 11, 5 );
l->setRowStretch ( 15, 5 ); myMainLayout->setRowStretch ( 16, 5 );
myMainLayout->setRowStretch ( 17, 1 );
clearInternal(); clearInternal();
} }
@ -3103,8 +3158,7 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent )
\brief Destructor \brief Destructor
*/ */
SMESHGUI_CtrlInfo::~SMESHGUI_CtrlInfo() SMESHGUI_CtrlInfo::~SMESHGUI_CtrlInfo()
{ {}
}
/*! /*!
\brief Change widget font attributes (bold, ...). \brief Change widget font attributes (bold, ...).
@ -3155,7 +3209,6 @@ QwtPlot* SMESHGUI_CtrlInfo::createPlot( QWidget* parent )
return aPlot; return aPlot;
} }
/*! /*!
\brief Show controls information on the selected object \brief Show controls information on the selected object
*/ */
@ -3177,76 +3230,204 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() ); SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
if ( !anActor ) anActor = SMESH::CreateActor( aSO->GetStudy(), aSO->GetID().c_str(), true ); if ( !anActor ) anActor = SMESH::CreateActor( aSO->GetStudy(), aSO->GetID().c_str(), true );
if ( !anActor ) return; if ( !anActor ) return;
myActor = anActor;
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( obj ); SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( obj );
if ( aMesh->_is_nil() ) return; SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( obj );
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( obj );
SMESH::Controls::FunctorPtr aFunctor; if ( !aMesh->_is_nil() )
myObjectType = Mesh;
else if( !aSubMesh->_is_nil() )
myObjectType = SubMesh;
else if( !aGroup->_is_nil() )
myObjectType = Group;
else
return;
// nodes info // nodes info
if ( aMesh->NbNodes() ) { anElems = getElementsByType( SMESH::NODE );
// free nodes if( myObjectType == Group ){
aFunctor.reset( new SMESH::Controls::FreeNodes() ); anElems = aGroup->GetNodeIDs();
aFunctor->SetMesh( anActor->GetObject()->GetMesh() ); }
anElems = aMesh->GetElementsByType( SMESH::NODE ); if ( anElems->length() ) {
myWidgets[1]->setText( QString::number( nbElemsControl( anElems, aFunctor ) ) ); if( anElems->length() <= ctrlLimit ) {
// double nodes // free nodes
SMESH::Controls::CoincidentNodes* aNodes = new SMESH::Controls::CoincidentNodes(); computeFreeNodesInfo();
double tol = SMESHGUI::resourceMgr()->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 ); // double nodes
aNodes->SetTolerance( tol ); computeDoubleNodesInfo();
aFunctor.reset( aNodes ); }
aFunctor->SetMesh( anActor->GetObject()->GetMesh() ); else {
myWidgets[2]->setText( QString::number( nbElemsControl( anElems, aFunctor ) ) ); myButtons[0]->setEnabled( true );
myButtons[1]->setEnabled( true );
}
}
else {
for( int i=2; i<=10; i++)
myMainLayout->itemAt(i)->widget()->setVisible( false );
} }
// edges info // edges info
if ( aMesh->NbEdges() ) { anElems = getElementsByType( SMESH::EDGE );
if ( anElems->length() ) {
// double edges // double edges
aFunctor.reset( new SMESH::Controls::CoincidentElements1D() ); if( anElems->length() <= ctrlLimit )
aFunctor->SetMesh( anActor->GetObject()->GetMesh() ); computeDoubleEdgesInfo();
anElems = aMesh->GetElementsByType( SMESH::EDGE ); else
myWidgets[3]->setText( QString::number( nbElemsControl( anElems, aFunctor ) ) ); myButtons[2]->setEnabled( true );
}
else {
for( int i=11; i<=14; i++)
myMainLayout->itemAt(i)->widget()->setVisible( false );
} }
// faces info // faces info
if ( aMesh->NbFaces() ) { anElems = getElementsByType( SMESH::FACE );
// double faces if ( anElems->length() ) {
aFunctor.reset( new SMESH::Controls::CoincidentElements2D() ); if ( anElems->length() <= ctrlLimit ) {
aFunctor->SetMesh( anActor->GetObject()->GetMesh() ); // double faces
anElems = aMesh->GetElementsByType( SMESH::FACE ); computeDoubleFacesInfo();
myWidgets[4]->setText( QString::number( nbElemsControl( anElems, aFunctor ) ) ); // over constrained faces
// over constrained faces computeOverConstrainedFacesInfo();
aFunctor.reset( new SMESH::Controls::OverConstrainedFace() ); // aspect Ratio histogram
aFunctor->SetMesh( anActor->GetObject()->GetMesh() );
myWidgets[5]->setText( QString::number( nbElemsControl( anElems, aFunctor ) ) );
// aspect Ratio histogram
if ( aMesh->NbFaces() <= ctrlLimit )
computeFaceInfo(); computeFaceInfo();
else }
myComputeFaceBtn->setVisible( true ); else {
myButtons[3]->setEnabled( true );
myButtons[4]->setEnabled( true );
myButtons[5]->setEnabled( true );
}
}
else {
myMainLayout->setRowStretch(11,0);
for( int i=15; i<=24; i++)
myMainLayout->itemAt(i)->widget()->setVisible( false );
} }
// volumes info // volumes info
if ( aMesh->NbVolumes() ) { anElems = getElementsByType( SMESH::VOLUME );
// double volumes if ( anElems->length() ) {
aFunctor.reset( new SMESH::Controls::CoincidentElements3D() ); if ( anElems->length() <= ctrlLimit ) {
aFunctor->SetMesh( anActor->GetObject()->GetMesh() ); // double volumes
anElems = aMesh->GetElementsByType( SMESH::VOLUME ); computeDoubleVolumesInfo();
myWidgets[6]->setText( QString::number( nbElemsControl( anElems, aFunctor ) ) ); // over constrained volumes
// over constrained volumes computeOverConstrainedVolumesInfo();
aFunctor.reset( new SMESH::Controls::OverConstrainedVolume() ); // aspect Ratio 3D histogram
aFunctor->SetMesh( anActor->GetObject()->GetMesh() );
myWidgets[7]->setText( QString::number( nbElemsControl( anElems, aFunctor ) ) );
// aspect Ratio 3D histogram
if ( aMesh->NbVolumes() <= ctrlLimit )
computeVolumeInfo(); computeVolumeInfo();
else }
myComputeVolumeBtn->setVisible( true ); else {
myButtons[6]->setEnabled( true );
myButtons[7]->setEnabled( true );
myButtons[8]->setEnabled( true );
}
}
else {
myMainLayout->setRowStretch(16,0);
for( int i=25; i<=34; i++)
myMainLayout->itemAt(i)->widget()->setVisible( false );
} }
} }
void SMESHGUI_CtrlInfo::computeFreeNodesInfo()
{
myButtons[0]->setEnabled( false );
SALOME_ListIO selected;
SMESHGUI::selectionMgr()->selectedObjects( selected );
if ( selected.Extent() < 1 ) return;
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( selected.First() );
if ( CORBA::is_nil( obj ) ) return;
SMESH::Controls::FunctorPtr aFunctor;
aFunctor.reset( new SMESH::Controls::FreeNodes() );
aFunctor->SetMesh( myActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::NODE );
if( myObjectType == Group ){
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( obj );
anElems = aGroup->GetNodeIDs();
}
int aNBFreeNodes = nbElemsControl( anElems, aFunctor );
myWidgets[1]->setText( QString::number( aNBFreeNodes ) );
}
void SMESHGUI_CtrlInfo::computeDoubleNodesInfo()
{
myButtons[1]->setEnabled( false );
SALOME_ListIO selected;
SMESHGUI::selectionMgr()->selectedObjects( selected );
if ( selected.Extent() < 1 ) return;
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( selected.First() );
if ( CORBA::is_nil( obj ) ) return;
SMESH::Controls::FunctorPtr aFunctor;
SMESH::Controls::CoincidentNodes* aNodes = new SMESH::Controls::CoincidentNodes();
aNodes->SetTolerance( myToleranceWidget->value() );
aFunctor.reset( aNodes );
aFunctor->SetMesh( myActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::NODE );
if( myObjectType == Group ){
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( obj );
anElems = aGroup->GetNodeIDs();
}
int aNBDoubleNodes = nbElemsControl( anElems, aFunctor );
myWidgets[2]->setText( QString::number( aNBDoubleNodes ) );
}
void SMESHGUI_CtrlInfo::computeDoubleEdgesInfo()
{
myButtons[2]->setEnabled( false );
SMESH::Controls::FunctorPtr aFunctor;
aFunctor.reset( new SMESH::Controls::CoincidentElements1D() );
aFunctor->SetMesh( myActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::EDGE );
int aNBDoubleEdges = nbElemsControl( anElems, aFunctor );
myWidgets[3]->setText( QString::number( aNBDoubleEdges ) );
}
void SMESHGUI_CtrlInfo::computeDoubleFacesInfo()
{
myButtons[3]->setEnabled( false );
SMESH::Controls::FunctorPtr aFunctor;
aFunctor.reset( new SMESH::Controls::CoincidentElements2D() );
aFunctor->SetMesh( myActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::FACE );
int aNBDoubleFaces = nbElemsControl( anElems, aFunctor );
myWidgets[4]->setText( QString::number( aNBDoubleFaces ) );
}
void SMESHGUI_CtrlInfo::computeOverConstrainedFacesInfo()
{
myButtons[4]->setEnabled( false );
SMESH::Controls::FunctorPtr aFunctor;
aFunctor.reset( new SMESH::Controls::OverConstrainedFace() );
aFunctor->SetMesh( myActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::FACE );
int aNBOverConstrainedFaces = nbElemsControl( anElems, aFunctor );
myWidgets[5]->setText( QString::number( aNBOverConstrainedFaces ) );
}
void SMESHGUI_CtrlInfo::computeDoubleVolumesInfo()
{
myButtons[6]->setEnabled( false );
SMESH::Controls::FunctorPtr aFunctor;
aFunctor.reset( new SMESH::Controls::CoincidentElements3D() );
aFunctor->SetMesh( myActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::VOLUME );
int aNBDoubleVolumes = nbElemsControl( anElems, aFunctor );
myWidgets[6]->setText( QString::number( aNBDoubleVolumes ) );
}
void SMESHGUI_CtrlInfo::computeOverConstrainedVolumesInfo()
{
myButtons[7]->setEnabled( false );
SMESH::Controls::FunctorPtr aFunctor;
aFunctor.reset( new SMESH::Controls::OverConstrainedVolume() );
aFunctor->SetMesh( myActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::VOLUME );
int aNBOverConstrainedVolumes = nbElemsControl( anElems, aFunctor );
myWidgets[7]->setText( QString::number( aNBOverConstrainedVolumes ) );
}
void SMESHGUI_CtrlInfo::computeFaceInfo() { void SMESHGUI_CtrlInfo::computeFaceInfo() {
myComputeFaceBtn->setVisible( false ); myButtons[5]->setEnabled( false );
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
SALOME_ListIO selected; SALOME_ListIO selected;
@ -3259,17 +3440,14 @@ void SMESHGUI_CtrlInfo::computeFaceInfo() {
SMESH_Actor* anActor = SMESH::FindActorByEntry( selected.First()->getEntry() ); SMESH_Actor* anActor = SMESH::FindActorByEntry( selected.First()->getEntry() );
if ( !anActor ) anActor = SMESH::CreateActor( aSO->GetStudy(), aSO->GetID().c_str(), true ); if ( !anActor ) anActor = SMESH::CreateActor( aSO->GetStudy(), aSO->GetID().c_str(), true );
if ( !anActor ) return; if ( !anActor ) return;
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( obj );
if ( aMesh->_is_nil() ) return;
SMESH::long_array_var anElems;
anElems = aMesh->GetElementsByType( SMESH::FACE );
SMESH::Controls::NumericalFunctorPtr anAspectRatio( new SMESH::Controls::AspectRatio() ); SMESH::Controls::NumericalFunctorPtr anAspectRatio( new SMESH::Controls::AspectRatio() );
int cprecision = 6; int cprecision = 6;
if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) ) if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) )
cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 ); cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
anAspectRatio->SetPrecision( cprecision ); anAspectRatio->SetPrecision( cprecision );
anAspectRatio->SetMesh( anActor->GetObject()->GetMesh() ); anAspectRatio->SetMesh( anActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::FACE );
Plot2d_Histogram* aHistogram = getHistogram( anElems, anAspectRatio ); Plot2d_Histogram* aHistogram = getHistogram( anElems, anAspectRatio );
if ( !aHistogram->isEmpty() ) { if ( !aHistogram->isEmpty() ) {
@ -3280,7 +3458,7 @@ void SMESHGUI_CtrlInfo::computeFaceInfo() {
} }
void SMESHGUI_CtrlInfo::computeVolumeInfo() { void SMESHGUI_CtrlInfo::computeVolumeInfo() {
myComputeVolumeBtn->setVisible( false ); myButtons[8]->setEnabled( false );
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
SALOME_ListIO selected; SALOME_ListIO selected;
@ -3293,17 +3471,14 @@ void SMESHGUI_CtrlInfo::computeVolumeInfo() {
SMESH_Actor* anActor = SMESH::FindActorByEntry( selected.First()->getEntry() ); SMESH_Actor* anActor = SMESH::FindActorByEntry( selected.First()->getEntry() );
if ( !anActor ) anActor = SMESH::CreateActor( aSO->GetStudy(), aSO->GetID().c_str(), true ); if ( !anActor ) anActor = SMESH::CreateActor( aSO->GetStudy(), aSO->GetID().c_str(), true );
if ( !anActor ) return; if ( !anActor ) return;
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( obj );
if ( aMesh->_is_nil() ) return;
SMESH::long_array_var anElems;
anElems = aMesh->GetElementsByType( SMESH::VOLUME );
SMESH::Controls::NumericalFunctorPtr anAspectRatio3D( new SMESH::Controls::AspectRatio3D() ); SMESH::Controls::NumericalFunctorPtr anAspectRatio3D( new SMESH::Controls::AspectRatio3D() );
int cprecision = 6; int cprecision = 6;
if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) ) if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) )
cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 ); cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
anAspectRatio3D->SetPrecision( cprecision ); anAspectRatio3D->SetPrecision( cprecision );
anAspectRatio3D->SetMesh( anActor->GetObject()->GetMesh() ); anAspectRatio3D->SetMesh( anActor->GetObject()->GetMesh() );
SMESH::long_array_var anElems = getElementsByType( SMESH::VOLUME );
Plot2d_Histogram* aHistogram = getHistogram( anElems, anAspectRatio3D ); Plot2d_Histogram* aHistogram = getHistogram( anElems, anAspectRatio3D );
if ( !aHistogram->isEmpty() ) { if ( !aHistogram->isEmpty() ) {
@ -3313,20 +3488,56 @@ void SMESHGUI_CtrlInfo::computeVolumeInfo() {
} }
} }
SMESH::long_array_var
SMESHGUI_CtrlInfo::getElementsByType( SMESH::ElementType theElementType )
{
SALOME_ListIO selected;
SMESHGUI::selectionMgr()->selectedObjects( selected );
if ( selected.Extent() < 1 ) return new SMESH::long_array();;
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( selected.First() );
if ( CORBA::is_nil( obj ) ) return new SMESH::long_array();;
SMESH::long_array_var anElems;
if( myObjectType == Mesh ) {
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( obj );
anElems = aMesh->GetElementsByType( theElementType );
}
else if( myObjectType == SubMesh ) {
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( obj );
anElems = aSubMesh->GetElementsByType( theElementType );
}
else if( myObjectType == Group ){
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( obj );
anElems = aGroup->GetType() == theElementType ? obj->GetIDs() : new SMESH::long_array();
}
return anElems;
}
/*! /*!
\brief Internal clean-up (reset widget) \brief Internal clean-up (reset widget)
*/ */
void SMESHGUI_CtrlInfo::clearInternal() void SMESHGUI_CtrlInfo::clearInternal()
{ {
myComputeFaceBtn->setVisible( false ); for( int i=0; i<=34; i++)
myComputeVolumeBtn->setVisible( false ); myMainLayout->itemAt(i)->widget()->setVisible( true );
for( int i=0; i<=8; i++)
myButtons[i]->setEnabled( false );
myPlot->detachItems(); myPlot->detachItems();
myPlot3D->detachItems(); myPlot3D->detachItems();
myPlot->replot(); myPlot->replot();
myPlot3D->replot(); myPlot3D->replot();
myWidgets[0]->setText( QString() ); myWidgets[0]->setText( QString() );
for ( int i = 1; i < myWidgets.count(); i++ ) for ( int i = 1; i < myWidgets.count(); i++ )
myWidgets[i]->setText( QString::number( 0 ) ); myWidgets[i]->setText( "" );
myMainLayout->setRowStretch(11,5);
myMainLayout->setRowStretch(16,5);
}
void SMESHGUI_CtrlInfo::setTolerance( double theTolerance )
{
SMESH::long_array_var anElems = getElementsByType( SMESH::NODE );
myButtons[1]->setEnabled( true );
myWidgets[2]->setText("");
} }
int SMESHGUI_CtrlInfo::nbElemsControl( SMESH::long_array_var& elems, SMESH::Controls::FunctorPtr theFunctor ) { int SMESHGUI_CtrlInfo::nbElemsControl( SMESH::long_array_var& elems, SMESH::Controls::FunctorPtr theFunctor ) {

View File

@ -43,6 +43,7 @@
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_Group)
class QAbstractButton;
class QButtonGroup; class QButtonGroup;
class QContextMenuEvent; class QContextMenuEvent;
class QLabel; class QLabel;
@ -50,9 +51,11 @@ class QLineEdit;
class QPushButton; class QPushButton;
class QTabWidget; class QTabWidget;
class QTextBrowser; class QTextBrowser;
class QGridLayout;
class SMESH_Actor; class SMESH_Actor;
class SMDS_MeshNode; class SMDS_MeshNode;
class SMDS_MeshElement; class SMDS_MeshElement;
class SMESHGUI_SpinBox;
class ExtraWidget; class ExtraWidget;
@ -291,27 +294,40 @@ public:
SMESHGUI_CtrlInfo( QWidget* = 0 ); SMESHGUI_CtrlInfo( QWidget* = 0 );
~SMESHGUI_CtrlInfo(); ~SMESHGUI_CtrlInfo();
void showInfo( SMESH::SMESH_IDSource_ptr ); void showInfo( SMESH::SMESH_IDSource_ptr );
void saveInfo( QTextStream &out ); void saveInfo( QTextStream &out );
private: private:
QLabel* createField(); enum ObjectType { Mesh, SubMesh, Group };
QwtPlot* createPlot( QWidget* ); QLabel* createField();
void setFontAttributes( QWidget* ); QwtPlot* createPlot( QWidget* );
void clearInternal(); void setFontAttributes( QWidget* );
int nbElemsControl( SMESH::long_array_var&, SMESH::Controls::FunctorPtr ); void clearInternal();
Plot2d_Histogram* getHistogram( SMESH::long_array_var&, SMESH::Controls::NumericalFunctorPtr ); SMESH::long_array_var getElementsByType( SMESH::ElementType theElementType );
int nbElemsControl( SMESH::long_array_var&, SMESH::Controls::FunctorPtr );
Plot2d_Histogram* getHistogram( SMESH::long_array_var&, SMESH::Controls::NumericalFunctorPtr );
private slots: private slots:
void computeFaceInfo(); void computeFaceInfo();
void computeVolumeInfo(); void computeVolumeInfo();
void computeFreeNodesInfo();
void computeDoubleNodesInfo();
void computeDoubleEdgesInfo();
void computeDoubleFacesInfo();
void computeOverConstrainedFacesInfo();
void computeDoubleVolumesInfo();
void computeOverConstrainedVolumesInfo();
void setTolerance( const double theTolerance );
private: private:
QList<QLabel*> myWidgets; SMESH_Actor* myActor;
QwtPlot* myPlot; ObjectType myObjectType;
QwtPlot* myPlot3D; SMESHGUI_SpinBox* myToleranceWidget;
QPushButton* myComputeFaceBtn; QList<QLabel*> myWidgets;
QPushButton* myComputeVolumeBtn; QGridLayout* myMainLayout;
QwtPlot* myPlot;
QwtPlot* myPlot3D;
QList<QAbstractButton*> myButtons;
}; };
class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog

View File

@ -7173,6 +7173,10 @@ as they are of improper type:
<source>NUMBER_OF_THE_FREE_NODES</source> <source>NUMBER_OF_THE_FREE_NODES</source>
<translation>Number of the free nodes</translation> <translation>Number of the free nodes</translation>
</message> </message>
<message>
<source>DOUBLE_NODES_TOLERANCE</source>
<translation>Double nodes tolerance</translation>
</message>
<message> <message>
<source>NUMBER_OF_THE_DOUBLE_NODES</source> <source>NUMBER_OF_THE_DOUBLE_NODES</source>
<translation>Number of the double nodes</translation> <translation>Number of the double nodes</translation>

View File

@ -7177,6 +7177,10 @@ en raison de leurs types incompatibles:
<source>NUMBER_OF_THE_DOUBLE_NODES</source> <source>NUMBER_OF_THE_DOUBLE_NODES</source>
<translation type="unfinished">Number of the double nodes</translation> <translation type="unfinished">Number of the double nodes</translation>
</message> </message>
<message>
<source>DOUBLE_NODES_TOLERANCE</source>
<translation>Tolérance des nœuds doubles</translation>
</message>
<message> <message>
<source>EDGES_INFO</source> <source>EDGES_INFO</source>
<translation type="unfinished">Edges Information:</translation> <translation type="unfinished">Edges Information:</translation>