Base class for the mesh element information widget. More...
#include <SMESHGUI_MeshInfo.h>

Data Structures | |
| struct | XYZ |
Public Member Functions | |
| SMESHGUI_ElemInfo (QWidget *=0) | |
| Constructor. | |
| ~SMESHGUI_ElemInfo () | |
| Destructor. | |
| void | setSource (SMESH_Actor *) |
| Set mesh data source (actor) | |
| void | showInfo (long, bool) |
| Show mesh element information. | |
| void | showInfo (QSet< long >, bool) |
| Show mesh element information. | |
| void | clear () |
| Clear mesh element information widget. | |
Protected Types | |
| typedef QMap< int, QList< int > > | Connectivity |
Protected Member Functions | |
| QWidget * | frame () const |
| Get central area widget. | |
| SMESH_Actor * | actor () const |
| Get actor. | |
| bool | isElements () const |
| Get current info mode. | |
| virtual void | information (const QList< long > &)=0 |
| Show information on the specified nodes / elements. | |
| virtual void | clearInternal () |
| Internal clean-up (reset widget) | |
| Connectivity | nodeConnectivity (const SMDS_MeshNode *) |
| Get node connectivity. | |
| QString | formatConnectivity (Connectivity, int) |
| Format connectivity data to string representation. | |
| XYZ | gravityCenter (const SMDS_MeshElement *) |
| Calculate gravity center of the mesh element. | |
Private Slots | |
| void | showPrevious () |
| This slot is called from "Show Previous" button click. | |
| void | showNext () |
| This slot is called from "Show Next" button click. | |
| void | updateControls () |
| Update widgets state. | |
Private Attributes | |
| SMESH_Actor * | myActor |
| QList< long > | myIDs |
| int | myIsElement |
| QWidget * | myFrame |
| QWidget * | myExtra |
| QLabel * | myCurrent |
| QPushButton * | myPrev |
| QPushButton * | myNext |
| int | myIndex |
Base class for the mesh element information widget.
Definition at line 117 of file SMESHGUI_MeshInfo.h.
typedef QMap< int, QList<int> > SMESHGUI_ElemInfo.Connectivity [protected] |
Definition at line 141 of file SMESHGUI_MeshInfo.h.
| SMESHGUI_ElemInfo::SMESHGUI_ElemInfo | ( | QWidget * | parent = 0 | ) |
Constructor.
| parent | parent widget |
Definition at line 468 of file SMESHGUI_MeshInfo.cxx.
References clear(), myCurrent, myExtra, myFrame, myNext, myPrev, showNext(), and showPrevious().
: QWidget( parent ), myActor( 0 ), myIsElement( -1 ) { myFrame = new QWidget( this ); myExtra = new QWidget( this ); myCurrent = new QLabel( "10/43 items shown", myExtra ); myCurrent->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); myPrev = new QPushButton( tr( "<<" ), myExtra ); myNext = new QPushButton( tr( ">>" ), myExtra ); QHBoxLayout* hbl = new QHBoxLayout( myExtra ); hbl->setContentsMargins( 0, SPACING, 0, 0 ); hbl->setSpacing( SPACING ); hbl->addStretch(); hbl->addWidget( myCurrent ); hbl->addWidget( myPrev ); hbl->addWidget( myNext ); QVBoxLayout* vbl = new QVBoxLayout( this ); vbl->setMargin( 0 ); vbl->setSpacing( 0 ); vbl->addWidget( myFrame ); vbl->addWidget( myExtra ); connect( myPrev, SIGNAL( clicked() ), this, SLOT( showPrevious() ) ); connect( myNext, SIGNAL( clicked() ), this, SLOT( showNext() ) ); clear(); }
| SMESHGUI_ElemInfo::~SMESHGUI_ElemInfo | ( | ) |
| SMESH_Actor * SMESHGUI_ElemInfo::actor | ( | ) | const [protected] |
Get actor.
Definition at line 568 of file SMESHGUI_MeshInfo.cxx.
References myActor.
Referenced by SMESHGUI_TreeElemInfo.information(), SMESHGUI_SimpleElemInfo.information(), and setSource().
{
return myActor;
}
| void SMESHGUI_ElemInfo::clear | ( | ) |
Clear mesh element information widget.
Definition at line 547 of file SMESHGUI_MeshInfo.cxx.
References clearInternal(), myIDs, myIndex, and updateControls().
Referenced by setSource(), SMESHGUI_MeshInfoDlg.showInfo(), and SMESHGUI_ElemInfo().
{
myIDs.clear();
myIndex = 0;
clearInternal();
updateControls();
}
| void SMESHGUI_ElemInfo::clearInternal | ( | ) | [protected, virtual] |
Internal clean-up (reset widget)
Reimplemented in SMESHGUI_SimpleElemInfo, and SMESHGUI_TreeElemInfo.
Definition at line 594 of file SMESHGUI_MeshInfo.cxx.
Referenced by clear().
{
}
| QString SMESHGUI_ElemInfo::formatConnectivity | ( | Connectivity | connectivity, |
| int | type | ||
| ) | [protected] |
Format connectivity data to string representation.
| connectivity | connetivity map |
| type | element type |
Definition at line 622 of file SMESHGUI_MeshInfo.cxx.
Referenced by SMESHGUI_TreeElemInfo.information(), and SMESHGUI_SimpleElemInfo.information().
{
QStringList str;
if ( connectivity.contains( type ) ) {
QList<int> elements = connectivity[ type ];
qSort( elements );
foreach( int id, elements )
str << QString::number( id );
}
return str.join( " " );
}
| QWidget * SMESHGUI_ElemInfo::frame | ( | ) | const [protected] |
Get central area widget.
Definition at line 559 of file SMESHGUI_MeshInfo.cxx.
References myFrame.
Referenced by SMESHGUI_SimpleElemInfo.SMESHGUI_SimpleElemInfo(), and SMESHGUI_TreeElemInfo.SMESHGUI_TreeElemInfo().
{
return myFrame;
}
| SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::gravityCenter | ( | const SMDS_MeshElement * | element | ) | [protected] |
Calculate gravity center of the mesh element.
| element | mesh element |
Definition at line 638 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.XYZ.add(), SMESHGUI_ElemInfo.XYZ.divide(), SMDS_MeshElement.NbNodes(), ex29_refine.node(), SMDS_MeshElement.nodesIterator(), SMDS_MeshNode.X(), SMESH_AdvancedEditor.xyz, SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
Referenced by SMESHGUI_TreeElemInfo.information(), and SMESHGUI_SimpleElemInfo.information().
{
XYZ xyz;
if ( element ) {
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
while ( nodeIt->more() ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
xyz.add( node->X(), node->Y(), node->Z() );
}
xyz.divide( element->NbNodes() );
}
return xyz;
}
| void SMESHGUI_ElemInfo::information | ( | const QList< long > & | ids | ) | [protected, pure virtual] |
Show information on the specified nodes / elements.
This function is to be redefined in sub-classes.
| ids | nodes / elements identifiers information is to be shown on |
Implemented in SMESHGUI_SimpleElemInfo, and SMESHGUI_TreeElemInfo.
Referenced by showInfo(), showNext(), and showPrevious().
| bool SMESHGUI_ElemInfo::isElements | ( | ) | const [protected] |
Get current info mode.
true if mesh element information is shown or false if node information is shown Definition at line 577 of file SMESHGUI_MeshInfo.cxx.
References myIsElement.
Referenced by SMESHGUI_TreeElemInfo.information(), and SMESHGUI_SimpleElemInfo.information().
{
return myIsElement;
}
| SMESHGUI_ElemInfo::Connectivity SMESHGUI_ElemInfo::nodeConnectivity | ( | const SMDS_MeshNode * | node | ) | [protected] |
Get node connectivity.
| node | mesh node |
Definition at line 603 of file SMESHGUI_MeshInfo.cxx.
References SMDS_MeshElement.GetID(), SMDS_MeshNode.GetInverseElementIterator(), and SMDS_MeshElement.GetType().
Referenced by SMESHGUI_TreeElemInfo.information(), and SMESHGUI_SimpleElemInfo.information().
{
Connectivity elmap;
if ( node ) {
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
while ( it && it->more() ) {
const SMDS_MeshElement* ne = it->next();
elmap[ ne->GetType() ] << ne->GetID();
}
}
return elmap;
}
| void SMESHGUI_ElemInfo::setSource | ( | SMESH_Actor * | actor | ) |
Set mesh data source (actor)
| actor | mesh object actor |
Definition at line 505 of file SMESHGUI_MeshInfo.cxx.
References actor(), clear(), myActor, and myIsElement.
Referenced by SMESHGUI_MeshInfoDlg.showInfo().
{
if ( myActor != actor ) {
myActor = actor;
myIsElement = -1;
clear();
}
}
| void SMESHGUI_ElemInfo::showInfo | ( | long | id, |
| bool | isElem | ||
| ) |
Show mesh element information.
| id | mesh node / element ID |
| isElem | show mesh element information if true or mesh node information if false |
Definition at line 519 of file SMESHGUI_MeshInfo.cxx.
References SMESH_test.ids.
Referenced by SMESHGUI_MeshInfoDlg.idChanged(), and SMESHGUI_MeshInfoDlg.showInfo().
| void SMESHGUI_ElemInfo::showInfo | ( | QSet< long > | ids, |
| bool | isElem | ||
| ) |
Show mesh element information.
| ids | mesh nodes / elements identifiers |
| isElem | show mesh element information if true or mesh node information if false |
Definition at line 531 of file SMESHGUI_MeshInfo.cxx.
References information(), myIDs, myIndex, myIsElement, and updateControls().
{
QList<long> newIds = ids.toList();
qSort( newIds );
if ( myIDs == newIds && myIsElement == isElem ) return;
myIDs = newIds;
myIsElement = isElem;
myIndex = 0;
updateControls();
information( myIDs.mid( myIndex*MAXITEMS, MAXITEMS ) );
}
| void SMESHGUI_ElemInfo::showNext | ( | ) | [private, slot] |
This slot is called from "Show Next" button click.
Shows information on the next group of the items.
Definition at line 667 of file SMESHGUI_MeshInfo.cxx.
References information(), MAXITEMS, myIDs, myIndex, and updateControls().
Referenced by SMESHGUI_ElemInfo().
{
myIndex = qMin( myIndex+1, myIDs.count() / MAXITEMS );
updateControls();
information( myIDs.mid( myIndex*MAXITEMS, MAXITEMS ) );
}
| void SMESHGUI_ElemInfo::showPrevious | ( | ) | [private, slot] |
This slot is called from "Show Previous" button click.
Shows information on the previous group of the items.
Definition at line 656 of file SMESHGUI_MeshInfo.cxx.
References information(), myIDs, myIndex, and updateControls().
Referenced by SMESHGUI_ElemInfo().
{
myIndex = qMax( 0, myIndex-1 );
updateControls();
information( myIDs.mid( myIndex*MAXITEMS, MAXITEMS ) );
}
| void SMESHGUI_ElemInfo::updateControls | ( | ) | [private, slot] |
Update widgets state.
Definition at line 677 of file SMESHGUI_MeshInfo.cxx.
References MAXITEMS, myCurrent, myExtra, myIDs, myIndex, myNext, and myPrev.
Referenced by clear(), showInfo(), showNext(), and showPrevious().
SMESH_Actor* SMESHGUI_ElemInfo.myActor [private] |
Definition at line 160 of file SMESHGUI_MeshInfo.h.
Referenced by actor(), and setSource().
QLabel* SMESHGUI_ElemInfo.myCurrent [private] |
Definition at line 165 of file SMESHGUI_MeshInfo.h.
Referenced by SMESHGUI_ElemInfo(), and updateControls().
QWidget* SMESHGUI_ElemInfo.myExtra [private] |
Definition at line 164 of file SMESHGUI_MeshInfo.h.
Referenced by SMESHGUI_ElemInfo(), and updateControls().
QWidget* SMESHGUI_ElemInfo.myFrame [private] |
Definition at line 163 of file SMESHGUI_MeshInfo.h.
Referenced by frame(), and SMESHGUI_ElemInfo().
QList<long> SMESHGUI_ElemInfo.myIDs [private] |
Definition at line 161 of file SMESHGUI_MeshInfo.h.
Referenced by clear(), showInfo(), showNext(), showPrevious(), and updateControls().
int SMESHGUI_ElemInfo.myIndex [private] |
Definition at line 168 of file SMESHGUI_MeshInfo.h.
Referenced by clear(), showInfo(), showNext(), showPrevious(), and updateControls().
int SMESHGUI_ElemInfo.myIsElement [private] |
Definition at line 162 of file SMESHGUI_MeshInfo.h.
Referenced by isElements(), setSource(), and showInfo().
QPushButton* SMESHGUI_ElemInfo.myNext [private] |
Definition at line 167 of file SMESHGUI_MeshInfo.h.
Referenced by SMESHGUI_ElemInfo(), and updateControls().
QPushButton* SMESHGUI_ElemInfo.myPrev [private] |
Definition at line 166 of file SMESHGUI_MeshInfo.h.
Referenced by SMESHGUI_ElemInfo(), and updateControls().