Represents mesh element information in the simple text area. More...
#include <SMESHGUI_MeshInfo.h>

Public Member Functions | |
| SMESHGUI_SimpleElemInfo (QWidget *=0) | |
| Constructor. | |
| 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 | |
| void | information (const QList< long > &) |
| Show mesh element information. | |
| void | clearInternal () |
| Internal clean-up (reset widget) | |
| QWidget * | frame () const |
| Get central area widget. | |
| SMESH_Actor * | actor () const |
| Get actor. | |
| bool | isElements () const |
| Get current info mode. | |
| 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 Attributes | |
| QTextBrowser * | myInfo |
Represents mesh element information in the simple text area.
Definition at line 171 of file SMESHGUI_MeshInfo.h.
typedef QMap< int, QList<int> > SMESHGUI_ElemInfo.Connectivity [protected, inherited] |
Definition at line 141 of file SMESHGUI_MeshInfo.h.
| SMESHGUI_SimpleElemInfo::SMESHGUI_SimpleElemInfo | ( | QWidget * | parent = 0 | ) |
Constructor.
| parent | parent widget |
Definition at line 694 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.frame(), and myInfo.
: SMESHGUI_ElemInfo( parent ) { myInfo = new QTextBrowser( frame() ); QVBoxLayout* l = new QVBoxLayout( frame() ); l->setMargin( 0 ); l->addWidget( myInfo ); }
| SMESH_Actor * SMESHGUI_ElemInfo::actor | ( | ) | const [protected, inherited] |
Get actor.
Definition at line 568 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.myActor.
Referenced by SMESHGUI_TreeElemInfo.information(), information(), and SMESHGUI_ElemInfo.setSource().
{
return myActor;
}
| void SMESHGUI_ElemInfo::clear | ( | ) | [inherited] |
Clear mesh element information widget.
Definition at line 547 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.clearInternal(), SMESHGUI_ElemInfo.myIDs, SMESHGUI_ElemInfo.myIndex, and SMESHGUI_ElemInfo.updateControls().
Referenced by SMESHGUI_ElemInfo.setSource(), SMESHGUI_MeshInfoDlg.showInfo(), and SMESHGUI_ElemInfo.SMESHGUI_ElemInfo().
{
myIDs.clear();
myIndex = 0;
clearInternal();
updateControls();
}
| void SMESHGUI_SimpleElemInfo::clearInternal | ( | ) | [protected, virtual] |
Internal clean-up (reset widget)
Reimplemented from SMESHGUI_ElemInfo.
Definition at line 869 of file SMESHGUI_MeshInfo.cxx.
References myInfo.
Referenced by information().
{
myInfo->clear();
}
| QString SMESHGUI_ElemInfo::formatConnectivity | ( | Connectivity | connectivity, |
| int | type | ||
| ) | [protected, inherited] |
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 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, inherited] |
Get central area widget.
Definition at line 559 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.myFrame.
Referenced by SMESHGUI_SimpleElemInfo(), and SMESHGUI_TreeElemInfo.SMESHGUI_TreeElemInfo().
{
return myFrame;
}
| SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::gravityCenter | ( | const SMDS_MeshElement * | element | ) | [protected, inherited] |
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 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_SimpleElemInfo::information | ( | const QList< long > & | ids | ) | [protected, virtual] |
Show mesh element information.
| ids | mesh nodes / elements identifiers |
Implements SMESHGUI_ElemInfo.
Definition at line 707 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.actor(), clearInternal(), SMESHGUI_ElemInfo.formatConnectivity(), SMDS_MeshElement.GetEntityType(), SMDS_MeshElement.GetID(), SMESH_Actor.GetObject(), SMDS_MeshElement.GetType(), SMESHGUI_ElemInfo.gravityCenter(), SMESHGUI_ElemInfo.isElements(), SMDS_MeshElement.IsQuadratic(), myInfo, SMDS_MeshElement.NbNodes(), ex29_refine.node(), SMESHGUI_ElemInfo.nodeConnectivity(), SMDS_MeshElement.nodesIterator(), SMESHGUI.resourceMgr(), SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume, SMDSEntity_0D, SMDSEntity_Hexa, SMDSEntity_Last, SMDSEntity_Penta, SMDSEntity_Polygon, SMDSEntity_Polyhedra, SMDSEntity_Pyramid, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Polygon, SMDSEntity_Quad_Polyhedra, SMDSEntity_Quad_Pyramid, SMDSEntity_Quad_Quadrangle, SMDSEntity_Quad_Tetra, SMDSEntity_Quad_Triangle, SMDSEntity_Quadrangle, SMDSEntity_Tetra, SMDSEntity_Triangle, SMESHGUI_ElemInfo.XYZ.x(), SMDS_MeshNode.X(), SMESHGUI_ElemInfo.XYZ.y(), SMDS_MeshNode.Y(), SMESHGUI_ElemInfo.XYZ.z(), and SMDS_MeshNode.Z().
{
clearInternal();
if ( actor() ) {
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
foreach ( long id, ids ) {
if ( !isElements() ) {
//
// show node info
//
const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindNode( id );
if ( !e ) return;
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( e );
// node ID
myInfo->append( QString( "<b>%1 #%2</b>" ).arg( tr( "NODE" ) ).arg( id ) );
// separator
myInfo->append( "" );
// coordinates
myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "COORDINATES" ) ).
arg( node->X(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
arg( node->Y(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
arg( node->Z(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
// separator
myInfo->append( "" );
// connectivity
Connectivity connectivity = nodeConnectivity( node );
if ( !connectivity.isEmpty() ) {
myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "CONNECTIVITY" ) ) );
QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "0D_ELEMENTS" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Edge );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "EDGES" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Face );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "FACES" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Volume );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "VOLUMES" ) ).arg( con ) );
}
else {
myInfo->append( QString( "<b>%1</b>" ).arg( tr( "FREE_NODE" ) ).arg( id ) );
}
}
else {
//
// show element info
//
const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindElement( id );
if ( !e ) return;
// element ID && type
QString stype;
switch( e->GetType() ) {
case SMDSAbs_0DElement:
stype = tr( "0D ELEMENT" ); break;
case SMDSAbs_Edge:
stype = tr( "EDGE" ); break;
case SMDSAbs_Face:
stype = tr( "FACE" ); break;
case SMDSAbs_Volume:
stype = tr( "VOLUME" ); break;
default:
break;
}
if ( stype.isEmpty() ) return;
myInfo->append( QString( "<b>%1 #%2</b>" ).arg( stype ).arg( id ) );
// separator
myInfo->append( "" );
// geometry type
QString gtype;
switch( e->GetEntityType() ) {
case SMDSEntity_Triangle:
case SMDSEntity_Quad_Triangle:
gtype = tr( "TRIANGLE" ); break;
case SMDSEntity_Quadrangle:
case SMDSEntity_Quad_Quadrangle:
gtype = tr( "QUADRANGLE" ); break;
case SMDSEntity_Polygon:
case SMDSEntity_Quad_Polygon:
gtype = tr( "POLYGON" ); break;
case SMDSEntity_Tetra:
case SMDSEntity_Quad_Tetra:
gtype = tr( "TETRAHEDRON" ); break;
case SMDSEntity_Pyramid:
case SMDSEntity_Quad_Pyramid:
gtype = tr( "PYRAMID" ); break;
case SMDSEntity_Hexa:
case SMDSEntity_Quad_Hexa:
gtype = tr( "HEXAHEDRON" ); break;
case SMDSEntity_Penta:
case SMDSEntity_Quad_Penta:
gtype = tr( "PRISM" ); break;
case SMDSEntity_Polyhedra:
case SMDSEntity_Quad_Polyhedra:
gtype = tr( "POLYHEDRON" ); break;
default:
break;
}
if ( !gtype.isEmpty() )
myInfo->append( QString( "<b>%1:</b> %2" ).arg( tr( "TYPE" ) ).arg( gtype ) );
// quadratic flag and gravity center (any element except 0D)
if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Last ) {
// quadratic flag
myInfo->append( QString( "<b>%1?</b> %2" ).arg( tr( "QUADRATIC" ) ).arg( e->IsQuadratic() ? tr( "YES" ) : tr( "NO" ) ) );
// separator
myInfo->append( "" );
// gravity center
XYZ gc = gravityCenter( e );
myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "GRAVITY_CENTER" ) ).arg( gc.x() ).arg( gc.y() ).arg( gc.z() ) );
}
// separator
myInfo->append( "" );
// connectivity
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
for ( int idx = 1; nodeIt->more(); idx++ ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
// node number and ID
myInfo->append( QString( "<b>%1 %2/%3</b> - #%4" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ).arg( node->GetID() ) );
// node coordinates
myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "COORDINATES" ) ).
arg( node->X(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
arg( node->Y(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
arg( node->Z(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
// node connectivity
Connectivity connectivity = nodeConnectivity( node );
if ( !connectivity.isEmpty() ) {
myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "CONNECTIVITY" ) ) );
QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "0D_ELEMENTS" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Edge );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "EDGES" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Face );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "FACES" ) ).arg( con ) );
con = formatConnectivity( connectivity, SMDSAbs_Volume );
if ( !con.isEmpty() )
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "VOLUMES" ) ).arg( con ) );
}
else {
myInfo->append( QString( "<b>%1</b>" ).arg( tr( "FREE_NODE" ) ).arg( id ) );
}
}
}
// separator
if ( ids.count() > 1 ) {
myInfo->append( "" );
myInfo->append( "------" );
myInfo->append( "" );
}
}
}
}
| bool SMESHGUI_ElemInfo::isElements | ( | ) | const [protected, inherited] |
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 SMESHGUI_ElemInfo.myIsElement.
Referenced by SMESHGUI_TreeElemInfo.information(), and information().
{
return myIsElement;
}
| SMESHGUI_ElemInfo::Connectivity SMESHGUI_ElemInfo::nodeConnectivity | ( | const SMDS_MeshNode * | node | ) | [protected, inherited] |
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 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 | ) | [inherited] |
Set mesh data source (actor)
| actor | mesh object actor |
Definition at line 505 of file SMESHGUI_MeshInfo.cxx.
References SMESHGUI_ElemInfo.actor(), SMESHGUI_ElemInfo.clear(), SMESHGUI_ElemInfo.myActor, and SMESHGUI_ElemInfo.myIsElement.
Referenced by SMESHGUI_MeshInfoDlg.showInfo().
{
if ( myActor != actor ) {
myActor = actor;
myIsElement = -1;
clear();
}
}
| void SMESHGUI_ElemInfo::showInfo | ( | long | id, |
| bool | isElem | ||
| ) | [inherited] |
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 | ||
| ) | [inherited] |
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 SMESHGUI_ElemInfo.information(), SMESHGUI_ElemInfo.myIDs, SMESHGUI_ElemInfo.myIndex, SMESHGUI_ElemInfo.myIsElement, and SMESHGUI_ElemInfo.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 ) );
}
QTextBrowser* SMESHGUI_SimpleElemInfo.myInfo [private] |
Definition at line 181 of file SMESHGUI_MeshInfo.h.
Referenced by clearInternal(), information(), and SMESHGUI_SimpleElemInfo().