mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
Imp for Mesh Info dialog box: double click on "connectivity" item switch dialog box to show information of connected nodes/elements
This commit is contained in:
parent
cda4289765
commit
22878614be
@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
#include <QContextMenuEvent>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
@ -52,6 +53,7 @@
|
|||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
@ -69,6 +71,16 @@ const int MAXITEMS = 10;
|
|||||||
const int GROUPS_ID = 100;
|
const int GROUPS_ID = 100;
|
||||||
const int SUBMESHES_ID = 200;
|
const int SUBMESHES_ID = 200;
|
||||||
|
|
||||||
|
enum InfoRole {
|
||||||
|
TypeRole = Qt::UserRole + 10,
|
||||||
|
IdRole,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum InfoType {
|
||||||
|
NodeConnectivity = 100,
|
||||||
|
ElemConnectivity,
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ExtraWidget
|
\class ExtraWidget
|
||||||
\internal
|
\internal
|
||||||
@ -1194,6 +1206,7 @@ SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
|
|||||||
QVBoxLayout* l = new QVBoxLayout( frame() );
|
QVBoxLayout* l = new QVBoxLayout( frame() );
|
||||||
l->setMargin( 0 );
|
l->setMargin( 0 );
|
||||||
l->addWidget( myInfo );
|
l->addWidget( myInfo );
|
||||||
|
connect( myInfo, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( itemDoubleClicked( QTreeWidgetItem*, int ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1250,24 +1263,28 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
|||||||
QTreeWidgetItem* i = createItem( conItem );
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
i->setText( 0, tr( "BALL_ELEMENTS" ) );
|
i->setText( 0, tr( "BALL_ELEMENTS" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
con = formatConnectivity( connectivity, SMDSAbs_Edge );
|
con = formatConnectivity( connectivity, SMDSAbs_Edge );
|
||||||
if ( !con.isEmpty() ) {
|
if ( !con.isEmpty() ) {
|
||||||
QTreeWidgetItem* i = createItem( conItem );
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
i->setText( 0, tr( "EDGES" ) );
|
i->setText( 0, tr( "EDGES" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
con = formatConnectivity( connectivity, SMDSAbs_Face );
|
con = formatConnectivity( connectivity, SMDSAbs_Face );
|
||||||
if ( !con.isEmpty() ) {
|
if ( !con.isEmpty() ) {
|
||||||
QTreeWidgetItem* i = createItem( conItem );
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
i->setText( 0, tr( "FACES" ) );
|
i->setText( 0, tr( "FACES" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
con = formatConnectivity( connectivity, SMDSAbs_Volume );
|
con = formatConnectivity( connectivity, SMDSAbs_Volume );
|
||||||
if ( !con.isEmpty() ) {
|
if ( !con.isEmpty() ) {
|
||||||
QTreeWidgetItem* i = createItem( conItem );
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
i->setText( 0, tr( "VOLUMES" ) );
|
i->setText( 0, tr( "VOLUMES" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1410,6 +1427,8 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
|||||||
QTreeWidgetItem* nodeItem = createItem( conItem, Bold );
|
QTreeWidgetItem* nodeItem = createItem( conItem, Bold );
|
||||||
nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) );
|
nodeItem->setText( 0, QString( "%1 %2 / %3" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) );
|
||||||
nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) );
|
nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) );
|
||||||
|
nodeItem->setData( 1, TypeRole, ElemConnectivity );
|
||||||
|
nodeItem->setData( 1, IdRole, node->GetID() );
|
||||||
nodeItem->setExpanded( false );
|
nodeItem->setExpanded( false );
|
||||||
// node coordinates
|
// node coordinates
|
||||||
QTreeWidgetItem* coordItem = createItem( nodeItem );
|
QTreeWidgetItem* coordItem = createItem( nodeItem );
|
||||||
@ -1439,24 +1458,28 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
|||||||
QTreeWidgetItem* i = createItem( nconItem );
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
i->setText( 0, tr( "EDGES" ) );
|
i->setText( 0, tr( "EDGES" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
con = formatConnectivity( connectivity, SMDSAbs_Ball );
|
con = formatConnectivity( connectivity, SMDSAbs_Ball );
|
||||||
if ( !con.isEmpty() ) {
|
if ( !con.isEmpty() ) {
|
||||||
QTreeWidgetItem* i = createItem( nconItem );
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
i->setText( 0, tr( "BALL_ELEMENTS" ) );
|
i->setText( 0, tr( "BALL_ELEMENTS" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
con = formatConnectivity( connectivity, SMDSAbs_Face );
|
con = formatConnectivity( connectivity, SMDSAbs_Face );
|
||||||
if ( !con.isEmpty() ) {
|
if ( !con.isEmpty() ) {
|
||||||
QTreeWidgetItem* i = createItem( nconItem );
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
i->setText( 0, tr( "FACES" ) );
|
i->setText( 0, tr( "FACES" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
con = formatConnectivity( connectivity, SMDSAbs_Volume );
|
con = formatConnectivity( connectivity, SMDSAbs_Volume );
|
||||||
if ( !con.isEmpty() ) {
|
if ( !con.isEmpty() ) {
|
||||||
QTreeWidgetItem* i = createItem( nconItem );
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
i->setText( 0, tr( "VOLUMES" ) );
|
i->setText( 0, tr( "VOLUMES" ) );
|
||||||
i->setText( 1, con );
|
i->setText( 1, con );
|
||||||
|
i->setData( 1, TypeRole, NodeConnectivity );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1600,6 +1623,33 @@ QTreeWidgetItem* SMESHGUI_TreeElemInfo::createItem( QTreeWidgetItem* parent, int
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMESHGUI_TreeElemInfo::contextMenuEvent( QContextMenuEvent* e )
|
||||||
|
{
|
||||||
|
QList< QTreeWidgetItem* > widgets = myInfo->selectedItems();
|
||||||
|
if ( widgets.isEmpty() ) return;
|
||||||
|
QTreeWidgetItem* aTreeItem = widgets.first();
|
||||||
|
int type = aTreeItem->data( 1, TypeRole ).toInt();
|
||||||
|
int id = aTreeItem->data( 1, IdRole ).toInt();
|
||||||
|
QMenu menu;
|
||||||
|
QAction* a = menu.addAction( tr( "SHOW_ITEM_INFO" ) );
|
||||||
|
if ( type == ElemConnectivity && id > 0 && menu.exec( e->globalPos() ) == a )
|
||||||
|
emit( itemInfo( id ) );
|
||||||
|
else if ( type == NodeConnectivity && menu.exec( e->globalPos() ) == a )
|
||||||
|
emit( itemInfo( aTreeItem->text( 1 ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMESHGUI_TreeElemInfo::itemDoubleClicked( QTreeWidgetItem* theItem, int theColumn )
|
||||||
|
{
|
||||||
|
if ( theItem ) {
|
||||||
|
int type = theItem->data( 1, TypeRole ).toInt();
|
||||||
|
int id = theItem->data( 1, IdRole ).toInt();
|
||||||
|
if ( type == ElemConnectivity && id > 0 )
|
||||||
|
emit( itemInfo( id ) );
|
||||||
|
else if ( type == NodeConnectivity )
|
||||||
|
emit( itemInfo( theItem->text( 1 ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class GrpComputor
|
\class GrpComputor
|
||||||
\brief Mesh information computer
|
\brief Mesh information computer
|
||||||
@ -2147,9 +2197,11 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
|
|||||||
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) );
|
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) );
|
||||||
connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( updateSelection() ) );
|
connect( myTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( updateSelection() ) );
|
||||||
connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged() ) );
|
connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged() ) );
|
||||||
connect( myID, SIGNAL( textEdited( QString ) ), this, SLOT( idChanged() ) );
|
connect( myID, SIGNAL( textChanged( QString ) ), this, SLOT( idChanged() ) );
|
||||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
|
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
|
||||||
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) );
|
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) );
|
||||||
|
connect( myElemInfo, SIGNAL( itemInfo( int ) ), this, SLOT( showItemInfo( int ) ) );
|
||||||
|
connect( myElemInfo, SIGNAL( itemInfo( QString ) ), this, SLOT( showItemInfo( QString ) ) );
|
||||||
|
|
||||||
updateSelection();
|
updateSelection();
|
||||||
}
|
}
|
||||||
@ -2354,8 +2406,26 @@ void SMESHGUI_MeshInfoDlg::idChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
selector->AddOrRemoveIndex( IO, ID, false );
|
selector->AddOrRemoveIndex( IO, ID, false );
|
||||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) {
|
||||||
aViewWindow->highlight( IO, true, true );
|
aViewWindow->highlight( IO, true, true );
|
||||||
|
aViewWindow->Repaint();
|
||||||
|
}
|
||||||
myElemInfo->showInfo( ids, myMode->checkedId() == ElemMode );
|
myElemInfo->showInfo( ids, myMode->checkedId() == ElemMode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMESHGUI_MeshInfoDlg::showItemInfo( int id )
|
||||||
|
{
|
||||||
|
if ( id > 0 && myActor->GetObject()->GetMesh()->FindNode( id ) ) {
|
||||||
|
myMode->button( NodeMode )->click();
|
||||||
|
myID->setText( QString::number( id ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SMESHGUI_MeshInfoDlg::showItemInfo( const QString& theStr )
|
||||||
|
{
|
||||||
|
if ( !theStr.isEmpty() ) {
|
||||||
|
myMode->button( ElemMode )->click();
|
||||||
|
myID->setText( theStr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||||
|
|
||||||
class QButtonGroup;
|
class QButtonGroup;
|
||||||
|
class QContextMenuEvent;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
@ -161,6 +162,10 @@ protected:
|
|||||||
QString formatConnectivity( Connectivity, int );
|
QString formatConnectivity( Connectivity, int );
|
||||||
XYZ gravityCenter( const SMDS_MeshElement* );
|
XYZ gravityCenter( const SMDS_MeshElement* );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void itemInfo( int );
|
||||||
|
void itemInfo( const QString& );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showPrevious();
|
void showPrevious();
|
||||||
void showNext();
|
void showNext();
|
||||||
@ -177,6 +182,8 @@ private:
|
|||||||
|
|
||||||
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
|
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_SimpleElemInfo( QWidget* = 0 );
|
SMESHGUI_SimpleElemInfo( QWidget* = 0 );
|
||||||
|
|
||||||
@ -190,6 +197,8 @@ private:
|
|||||||
|
|
||||||
class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
|
class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
|
||||||
{
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
|
||||||
class ItemDelegate;
|
class ItemDelegate;
|
||||||
|
|
||||||
enum { Bold = 0x01, All = 0x80 };
|
enum { Bold = 0x01, All = 0x80 };
|
||||||
@ -198,9 +207,13 @@ public:
|
|||||||
SMESHGUI_TreeElemInfo( QWidget* = 0 );
|
SMESHGUI_TreeElemInfo( QWidget* = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void contextMenuEvent( QContextMenuEvent* e );
|
||||||
void information( const QList<long>& );
|
void information( const QList<long>& );
|
||||||
void clearInternal();
|
void clearInternal();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void itemDoubleClicked( QTreeWidgetItem*, int );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
|
QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
|
||||||
|
|
||||||
@ -291,6 +304,8 @@ private slots:
|
|||||||
void deactivate();
|
void deactivate();
|
||||||
void modeChanged();
|
void modeChanged();
|
||||||
void idChanged();
|
void idChanged();
|
||||||
|
void showItemInfo( int );
|
||||||
|
void showItemInfo( const QString& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTabWidget* myTabWidget;
|
QTabWidget* myTabWidget;
|
||||||
|
Loading…
Reference in New Issue
Block a user