mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-08 00:14:17 +05:00
PAL20885 EDF 607 SMESH: Measure tools
Improve mesh element information dialog box
This commit is contained in:
parent
1cd7b4a0c0
commit
7ca35196f4
@ -4092,9 +4092,9 @@ void SMESHGUI::createPreferences()
|
|||||||
setPreferenceProperty( computeGroup, "columns", 2 );
|
setPreferenceProperty( computeGroup, "columns", 2 );
|
||||||
int notifyMode = addPreference( tr( "PREF_NOTIFY_MODE" ), computeGroup, LightApp_Preferences::Selector, "SMESH", "show_result_notification" );
|
int notifyMode = addPreference( tr( "PREF_NOTIFY_MODE" ), computeGroup, LightApp_Preferences::Selector, "SMESH", "show_result_notification" );
|
||||||
modes.clear();
|
modes.clear();
|
||||||
modes.append( "Never" );
|
modes.append( tr( "PREF_NOTIFY_NEVER" ) );
|
||||||
modes.append( "Errors only" );
|
modes.append( tr( "PREF_NOTIFY_ERROR" ) );
|
||||||
modes.append( "Always" );
|
modes.append( tr( "PREF_NOTIFY_ALWAYS" ) );
|
||||||
indices.clear();
|
indices.clear();
|
||||||
indices.append( 0 );
|
indices.append( 0 );
|
||||||
indices.append( 1 );
|
indices.append( 1 );
|
||||||
@ -4102,6 +4102,18 @@ void SMESHGUI::createPreferences()
|
|||||||
setPreferenceProperty( notifyMode, "strings", modes );
|
setPreferenceProperty( notifyMode, "strings", modes );
|
||||||
setPreferenceProperty( notifyMode, "indexes", indices );
|
setPreferenceProperty( notifyMode, "indexes", indices );
|
||||||
|
|
||||||
|
int infoGroup = addPreference( tr( "PREF_GROUP_INFO" ), genTab );
|
||||||
|
setPreferenceProperty( computeGroup, "columns", 2 );
|
||||||
|
int elemInfo = addPreference( tr( "PREF_ELEM_INFO" ), infoGroup, LightApp_Preferences::Selector, "SMESH", "mesh_elem_info" );
|
||||||
|
modes.clear();
|
||||||
|
modes.append( tr( "PREF_ELEM_INFO_SIMPLE" ) );
|
||||||
|
modes.append( tr( "PREF_ELEM_INFO_TREE" ) );
|
||||||
|
indices.clear();
|
||||||
|
indices.append( 0 );
|
||||||
|
indices.append( 1 );
|
||||||
|
setPreferenceProperty( elemInfo, "strings", modes );
|
||||||
|
setPreferenceProperty( elemInfo, "indexes", indices );
|
||||||
|
|
||||||
int segGroup = addPreference( tr( "PREF_GROUP_SEGMENT_LENGTH" ), genTab );
|
int segGroup = addPreference( tr( "PREF_GROUP_SEGMENT_LENGTH" ), genTab );
|
||||||
setPreferenceProperty( segGroup, "columns", 2 );
|
setPreferenceProperty( segGroup, "columns", 2 );
|
||||||
int segLen = addPreference( tr( "PREF_SEGMENT_LENGTH" ), segGroup, LightApp_Preferences::IntSpin,
|
int segLen = addPreference( tr( "PREF_SEGMENT_LENGTH" ), segGroup, LightApp_Preferences::IntSpin,
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QItemDelegate>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@ -51,6 +53,7 @@
|
|||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
|
#include <QTreeWidget>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -461,7 +464,7 @@ void SMESHGUI_MeshInfo::setFieldsVisible( int start, int end, bool on )
|
|||||||
\param parent parent widget
|
\param parent parent widget
|
||||||
*/
|
*/
|
||||||
SMESHGUI_ElemInfo::SMESHGUI_ElemInfo( QWidget* parent )
|
SMESHGUI_ElemInfo::SMESHGUI_ElemInfo( QWidget* parent )
|
||||||
: QWidget( parent ), myActor( 0 )
|
: QWidget( parent ), myActor( 0 ), myID( 0 ), myIsElement( -1 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,9 +481,29 @@ SMESHGUI_ElemInfo::~SMESHGUI_ElemInfo()
|
|||||||
*/
|
*/
|
||||||
void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor )
|
void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor )
|
||||||
{
|
{
|
||||||
|
if ( myActor != actor ) {
|
||||||
myActor = actor;
|
myActor = actor;
|
||||||
|
myID = 0;
|
||||||
|
myIsElement = -1;
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Show mesh element information
|
||||||
|
\param long id mesh node / element ID
|
||||||
|
\param isElem show mesh element information if \c true or mesh node information if \c false
|
||||||
|
*/
|
||||||
|
void SMESHGUI_ElemInfo::showInfo( long id, bool isElem )
|
||||||
|
{
|
||||||
|
myID = id;
|
||||||
|
myIsElement = isElem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void SMESHGUI_ElemInfo::clear()
|
||||||
|
\brief Clear mesh element information widget
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Get node connectivity
|
\brief Get node connectivity
|
||||||
@ -500,6 +523,24 @@ SMESHGUI_ElemInfo::Connectivity SMESHGUI_ElemInfo::nodeConnectivity( const SMDS_
|
|||||||
return elmap;
|
return elmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Format connectivity data to string representation
|
||||||
|
\param connectivity connetivity map
|
||||||
|
\param type element type
|
||||||
|
\return string representation of the connectivity
|
||||||
|
*/
|
||||||
|
QString SMESHGUI_ElemInfo::formatConnectivity( Connectivity connectivity, int type )
|
||||||
|
{
|
||||||
|
QStringList str;
|
||||||
|
if ( connectivity.contains( type ) ) {
|
||||||
|
QList<int> elements = connectivity[ type ];
|
||||||
|
qSort( elements );
|
||||||
|
foreach( int id, elements )
|
||||||
|
str << QString::number( id );
|
||||||
|
}
|
||||||
|
return str.join( " " );
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Calculate gravity center of the mesh element
|
\brief Calculate gravity center of the mesh element
|
||||||
\param element mesh element
|
\param element mesh element
|
||||||
@ -518,18 +559,6 @@ SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::gravityCenter( const SMDS_MeshElement*
|
|||||||
return xyz;
|
return xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void SMESHGUI_ElemInfo::showInfo( long id, bool isElem )
|
|
||||||
\brief Show mesh element information
|
|
||||||
\param long id mesh node / element ID
|
|
||||||
\param isElem show mesh element information if \c true or mesh node information if \c false
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void SMESHGUI_ElemInfo::clear()
|
|
||||||
\brief Clear mesh element information widget
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class SMESHGUI_SimpleElemInfo
|
\class SMESHGUI_SimpleElemInfo
|
||||||
\brief Represents mesh element information in the simple text area.
|
\brief Represents mesh element information in the simple text area.
|
||||||
@ -555,6 +584,10 @@ SMESHGUI_SimpleElemInfo::SMESHGUI_SimpleElemInfo( QWidget* parent )
|
|||||||
*/
|
*/
|
||||||
void SMESHGUI_SimpleElemInfo::showInfo( long id, bool isElem )
|
void SMESHGUI_SimpleElemInfo::showInfo( long id, bool isElem )
|
||||||
{
|
{
|
||||||
|
if ( myID == id && myIsElement == isElem ) return;
|
||||||
|
|
||||||
|
SMESHGUI_ElemInfo::showInfo( id, isElem );
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
if ( myActor ) {
|
if ( myActor ) {
|
||||||
@ -567,7 +600,7 @@ void SMESHGUI_SimpleElemInfo::showInfo( long id, bool isElem )
|
|||||||
if ( !e ) return;
|
if ( !e ) return;
|
||||||
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( e );
|
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( e );
|
||||||
|
|
||||||
// node number
|
// node ID
|
||||||
myInfo->append( QString( "<b>%1 #%2</b>" ).arg( tr( "NODE" ) ).arg( id ) );
|
myInfo->append( QString( "<b>%1 #%2</b>" ).arg( tr( "NODE" ) ).arg( id ) );
|
||||||
// separator
|
// separator
|
||||||
myInfo->append( "" );
|
myInfo->append( "" );
|
||||||
@ -606,7 +639,7 @@ void SMESHGUI_SimpleElemInfo::showInfo( long id, bool isElem )
|
|||||||
const SMDS_MeshElement* e = myActor->GetObject()->GetMesh()->FindElement( id );
|
const SMDS_MeshElement* e = myActor->GetObject()->GetMesh()->FindElement( id );
|
||||||
if ( !e ) return;
|
if ( !e ) return;
|
||||||
|
|
||||||
// element type
|
// element ID && type
|
||||||
QString stype;
|
QString stype;
|
||||||
switch( e->GetType() ) {
|
switch( e->GetType() ) {
|
||||||
case SMDSAbs_0DElement:
|
case SMDSAbs_0DElement:
|
||||||
@ -672,14 +705,14 @@ void SMESHGUI_SimpleElemInfo::showInfo( long id, bool isElem )
|
|||||||
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
|
SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
|
||||||
for ( int idx = 1; nodeIt->more(); idx++ ) {
|
for ( int idx = 1; nodeIt->more(); idx++ ) {
|
||||||
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
|
||||||
// node number and id
|
// node number and ID
|
||||||
myInfo->append( QString( "<b>%1 %2/%3</b> - #%4" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ).arg( node->GetID() ) );
|
myInfo->append( QString( "<b>%1 %2/%3</b> - #%4" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ).arg( node->GetID() ) );
|
||||||
// coordinates
|
// node coordinates
|
||||||
myInfo->append( QString( "<b>%1:</b> (%2, %3, %4)" ).arg( tr( "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->X(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ).
|
||||||
arg( node->Y(), 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 ) ) );
|
arg( node->Z(), 0, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
// connectivity
|
// node connectivity
|
||||||
Connectivity connectivity = nodeConnectivity( node );
|
Connectivity connectivity = nodeConnectivity( node );
|
||||||
if ( !connectivity.isEmpty() ) {
|
if ( !connectivity.isEmpty() ) {
|
||||||
myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "CONNECTIVITY" ) ) );
|
myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "CONNECTIVITY" ) ) );
|
||||||
@ -715,26 +748,39 @@ void SMESHGUI_SimpleElemInfo::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Format connectivity data to string representation
|
\class SMESHGUI_TreeElemInfo::ItemDelegate
|
||||||
\param connectivity connetivity map
|
\brief Item delegate for tree mesh info widget
|
||||||
\param type element type
|
\internal
|
||||||
\return string representation of the connectivity
|
|
||||||
*/
|
*/
|
||||||
QString SMESHGUI_SimpleElemInfo::formatConnectivity( Connectivity connectivity, int type )
|
class SMESHGUI_TreeElemInfo::ItemDelegate : public QItemDelegate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ItemDelegate( QObject* );
|
||||||
|
QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, const QModelIndex& ) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Constructor
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
SMESHGUI_TreeElemInfo::ItemDelegate::ItemDelegate( QObject* parent ) : QItemDelegate( parent )
|
||||||
{
|
{
|
||||||
QStringList str;
|
|
||||||
if ( connectivity.contains( type ) ) {
|
|
||||||
QList<int> elements = connectivity[ type ];
|
|
||||||
qSort( elements );
|
|
||||||
foreach( int id, elements )
|
|
||||||
str << QString::number( id );
|
|
||||||
}
|
}
|
||||||
return str.join( " " );
|
|
||||||
|
/*!
|
||||||
|
\brief Create item editor widget
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
QWidget* SMESHGUI_TreeElemInfo::ItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||||
|
{
|
||||||
|
QWidget* w = index.column() == 0 ? 0: QItemDelegate::createEditor( parent, option, index );
|
||||||
|
if ( qobject_cast<QLineEdit*>( w ) ) qobject_cast<QLineEdit*>( w )->setReadOnly( true );
|
||||||
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class SMESHGUI_TreeElemInfo
|
\class SMESHGUI_TreeElemInfo
|
||||||
\brief Simple mesh element information representation widget
|
\brief Represents mesh element information in the tree-like form.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -744,6 +790,15 @@ QString SMESHGUI_SimpleElemInfo::formatConnectivity( Connectivity connectivity,
|
|||||||
SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
|
SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
|
||||||
: SMESHGUI_ElemInfo( parent )
|
: SMESHGUI_ElemInfo( parent )
|
||||||
{
|
{
|
||||||
|
myInfo = new QTreeWidget( this );
|
||||||
|
myInfo->setColumnCount( 2 );
|
||||||
|
myInfo->setHeaderLabels( QStringList() << tr( "PROPERTY" ) << tr( "VALUE" ) );
|
||||||
|
myInfo->header()->setStretchLastSection( true );
|
||||||
|
myInfo->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
|
||||||
|
myInfo->setItemDelegate( new ItemDelegate( myInfo ) );
|
||||||
|
QVBoxLayout* l = new QVBoxLayout( this );
|
||||||
|
l->setMargin( 0 );
|
||||||
|
l->addWidget( myInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -753,6 +808,216 @@ SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
|
|||||||
*/
|
*/
|
||||||
void SMESHGUI_TreeElemInfo::showInfo( long id, bool isElem )
|
void SMESHGUI_TreeElemInfo::showInfo( long id, bool isElem )
|
||||||
{
|
{
|
||||||
|
if ( myID == id && myIsElement == isElem ) return;
|
||||||
|
|
||||||
|
SMESHGUI_ElemInfo::showInfo( id, isElem );
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
if ( myActor ) {
|
||||||
|
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
|
||||||
|
if ( !isElem ) {
|
||||||
|
//
|
||||||
|
// show node info
|
||||||
|
//
|
||||||
|
const SMDS_MeshElement* e = myActor->GetObject()->GetMesh()->FindNode( id );
|
||||||
|
if ( !e ) return;
|
||||||
|
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( e );
|
||||||
|
|
||||||
|
// node ID
|
||||||
|
QTreeWidgetItem* nodeItem = createItem( 0, -1 );
|
||||||
|
nodeItem->setText( 0, tr( "NODE" ) );
|
||||||
|
nodeItem->setText( 1, QString( "#%1" ).arg( id ) );
|
||||||
|
nodeItem->setExpanded( true );
|
||||||
|
// coordinates
|
||||||
|
QTreeWidgetItem* coordItem = createItem( nodeItem, 0 );
|
||||||
|
coordItem->setText( 0, tr( "COORDINATES" ) );
|
||||||
|
coordItem->setExpanded( true );
|
||||||
|
QTreeWidgetItem* xItem = createItem( coordItem );
|
||||||
|
xItem->setText( 0, "X" );
|
||||||
|
xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
QTreeWidgetItem* yItem = createItem( coordItem );
|
||||||
|
yItem->setText( 0, "Y" );
|
||||||
|
yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
QTreeWidgetItem* zItem = createItem( coordItem );
|
||||||
|
zItem->setText( 0, "Z" );
|
||||||
|
zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
// connectivity
|
||||||
|
QTreeWidgetItem* conItem = createItem( nodeItem, 0 );
|
||||||
|
conItem->setText( 0, tr( "CONNECTIVITY" ) );
|
||||||
|
conItem->setExpanded( true );
|
||||||
|
Connectivity connectivity = nodeConnectivity( node );
|
||||||
|
if ( !connectivity.isEmpty() ) {
|
||||||
|
QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
|
i->setText( 0, tr( "0D_ELEMENTS" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
con = formatConnectivity( connectivity, SMDSAbs_Edge );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
|
i->setText( 0, tr( "EDGES" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
con = formatConnectivity( connectivity, SMDSAbs_Face );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
|
i->setText( 0, tr( "FACES" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
con = formatConnectivity( connectivity, SMDSAbs_Volume );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( conItem );
|
||||||
|
i->setText( 0, tr( "VOLUMES" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
conItem->setText( 1, tr( "FREE_NODE" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//
|
||||||
|
// show element info
|
||||||
|
//
|
||||||
|
const SMDS_MeshElement* e = myActor->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;
|
||||||
|
QTreeWidgetItem* elemItem = createItem( 0, -1 );
|
||||||
|
elemItem->setText( 0, stype );
|
||||||
|
elemItem->setText( 1, QString( "#%1" ).arg( id ) );
|
||||||
|
elemItem->setExpanded( true );
|
||||||
|
// 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( "QUADRANGLE" ); 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() ) {
|
||||||
|
QTreeWidgetItem* typeItem = createItem( elemItem, 0 );
|
||||||
|
typeItem->setText( 0, tr( "TYPE" ) );
|
||||||
|
typeItem->setText( 1, gtype );
|
||||||
|
}
|
||||||
|
// quadratic flag and gravity center (any element except 0D)
|
||||||
|
if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Last ) {
|
||||||
|
// quadratic flag
|
||||||
|
QTreeWidgetItem* quadItem = createItem( elemItem, 0 );
|
||||||
|
quadItem->setText( 0, tr( "QUADRATIC" ) );
|
||||||
|
quadItem->setText( 1, e->IsQuadratic() ? tr( "YES" ) : tr( "NO" ) );
|
||||||
|
// gravity center
|
||||||
|
XYZ gc = gravityCenter( e );
|
||||||
|
QTreeWidgetItem* gcItem = createItem( elemItem, 0 );
|
||||||
|
gcItem->setText( 0, tr( "GRAVITY_CENTER" ) );
|
||||||
|
gcItem->setExpanded( true );
|
||||||
|
QTreeWidgetItem* xItem = createItem( gcItem );
|
||||||
|
xItem->setText( 0, "X" );
|
||||||
|
xItem->setText( 1, QString::number( gc.x(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
QTreeWidgetItem* yItem = createItem( gcItem );
|
||||||
|
yItem->setText( 0, "Y" );
|
||||||
|
yItem->setText( 1, QString::number( gc.y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
QTreeWidgetItem* zItem = createItem( gcItem );
|
||||||
|
zItem->setText( 0, "Z" );
|
||||||
|
zItem->setText( 1, QString::number( gc.z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
}
|
||||||
|
// connectivity
|
||||||
|
QTreeWidgetItem* conItem = createItem( elemItem, 0 );
|
||||||
|
conItem->setText( 0, tr( "CONNECTIVITY" ) );
|
||||||
|
conItem->setExpanded( true );
|
||||||
|
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
|
||||||
|
QTreeWidgetItem* nodeItem = createItem( conItem, 0 );
|
||||||
|
nodeItem->setText( 0, QString( "%1 %2/%3" ).arg( tr( "NODE" ) ).arg( idx ).arg( e->NbNodes() ) );
|
||||||
|
nodeItem->setText( 1, QString( "#%1" ).arg( node->GetID() ) );
|
||||||
|
//nodeItem->setExpanded( true );
|
||||||
|
// node coordinates
|
||||||
|
QTreeWidgetItem* coordItem = createItem( nodeItem );
|
||||||
|
coordItem->setText( 0, tr( "COORDINATES" ) );
|
||||||
|
coordItem->setExpanded( true );
|
||||||
|
QTreeWidgetItem* xItem = createItem( coordItem );
|
||||||
|
xItem->setText( 0, "X" );
|
||||||
|
xItem->setText( 1, QString::number( node->X(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
QTreeWidgetItem* yItem = createItem( coordItem );
|
||||||
|
yItem->setText( 0, "Y" );
|
||||||
|
yItem->setText( 1, QString::number( node->Y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
QTreeWidgetItem* zItem = createItem( coordItem );
|
||||||
|
zItem->setText( 0, "Z" );
|
||||||
|
zItem->setText( 1, QString::number( node->Z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
|
||||||
|
// node connectivity
|
||||||
|
QTreeWidgetItem* nconItem = createItem( nodeItem );
|
||||||
|
nconItem->setText( 0, tr( "CONNECTIVITY" ) );
|
||||||
|
nconItem->setExpanded( true );
|
||||||
|
Connectivity connectivity = nodeConnectivity( node );
|
||||||
|
if ( !connectivity.isEmpty() ) {
|
||||||
|
QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
|
i->setText( 0, tr( "0D_ELEMENTS" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
con = formatConnectivity( connectivity, SMDSAbs_Edge );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
|
i->setText( 0, tr( "EDGES" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
con = formatConnectivity( connectivity, SMDSAbs_Face );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
|
i->setText( 0, tr( "FACES" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
con = formatConnectivity( connectivity, SMDSAbs_Volume );
|
||||||
|
if ( !con.isEmpty() ) {
|
||||||
|
QTreeWidgetItem* i = createItem( nconItem );
|
||||||
|
i->setText( 0, tr( "VOLUMES" ) );
|
||||||
|
i->setText( 1, con );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -760,6 +1025,36 @@ void SMESHGUI_TreeElemInfo::showInfo( long id, bool isElem )
|
|||||||
*/
|
*/
|
||||||
void SMESHGUI_TreeElemInfo::clear()
|
void SMESHGUI_TreeElemInfo::clear()
|
||||||
{
|
{
|
||||||
|
myInfo->clear();
|
||||||
|
myInfo->repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Create new tree item.
|
||||||
|
\param parnt parent tree widget item
|
||||||
|
\param column item column to be set bold, if it is -1, bold font will be set for all columns
|
||||||
|
\return new tree widget item
|
||||||
|
*/
|
||||||
|
QTreeWidgetItem* SMESHGUI_TreeElemInfo::createItem( QTreeWidgetItem* parent, int column )
|
||||||
|
{
|
||||||
|
QTreeWidgetItem* item;
|
||||||
|
if ( parent )
|
||||||
|
item = new QTreeWidgetItem( parent );
|
||||||
|
else
|
||||||
|
item = new QTreeWidgetItem( myInfo );
|
||||||
|
|
||||||
|
item->setFlags( item->flags() | Qt::ItemIsEditable );
|
||||||
|
|
||||||
|
QFont f = item->font( 0 );
|
||||||
|
f.setBold( true );
|
||||||
|
if ( column >= 0 && column < myInfo->columnCount() ) {
|
||||||
|
item->setFont( column, f );
|
||||||
|
}
|
||||||
|
else if ( column == -1 ) {
|
||||||
|
for ( int i = 0; i < myInfo->columnCount(); i++ )
|
||||||
|
item->setFont( i, f );
|
||||||
|
}
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -798,7 +1093,7 @@ SMESHGUI_MeshInfoDlg::SMESHGUI_MeshInfoDlg( QWidget* parent, int page )
|
|||||||
myID = new QLineEdit( w );
|
myID = new QLineEdit( w );
|
||||||
myID->setValidator( new SMESHGUI_IdValidator( this, 1 ) );
|
myID->setValidator( new SMESHGUI_IdValidator( this, 1 ) );
|
||||||
|
|
||||||
int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 0 );
|
int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 1 );
|
||||||
mode = qMin( 1, qMax( 0, mode ) );
|
mode = qMin( 1, qMax( 0, mode ) );
|
||||||
|
|
||||||
if ( mode == 0 )
|
if ( mode == 0 )
|
||||||
|
@ -42,6 +42,8 @@ class QLabel;
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
class QTextBrowser;
|
class QTextBrowser;
|
||||||
|
class QTreeWidget;
|
||||||
|
class QTreeWidgetItem;
|
||||||
class SMESH_Actor;
|
class SMESH_Actor;
|
||||||
class SMDS_MeshNode;
|
class SMDS_MeshNode;
|
||||||
class SMDS_MeshElement;
|
class SMDS_MeshElement;
|
||||||
@ -119,8 +121,7 @@ public:
|
|||||||
~SMESHGUI_ElemInfo();
|
~SMESHGUI_ElemInfo();
|
||||||
|
|
||||||
void setSource( SMESH_Actor* );
|
void setSource( SMESH_Actor* );
|
||||||
|
virtual void showInfo( long, bool );
|
||||||
virtual void showInfo( long, bool ) = 0;
|
|
||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -137,10 +138,13 @@ protected:
|
|||||||
typedef QMap< int, QList<int> > Connectivity;
|
typedef QMap< int, QList<int> > Connectivity;
|
||||||
|
|
||||||
Connectivity nodeConnectivity( const SMDS_MeshNode* );
|
Connectivity nodeConnectivity( const SMDS_MeshNode* );
|
||||||
|
QString formatConnectivity( Connectivity, int );
|
||||||
XYZ gravityCenter( const SMDS_MeshElement* );
|
XYZ gravityCenter( const SMDS_MeshElement* );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SMESH_Actor* myActor;
|
SMESH_Actor* myActor;
|
||||||
|
long myID;
|
||||||
|
int myIsElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
|
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
|
||||||
@ -151,20 +155,25 @@ public:
|
|||||||
void showInfo( long, bool );
|
void showInfo( long, bool );
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
protected:
|
|
||||||
QString formatConnectivity( Connectivity, int );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTextBrowser* myInfo;
|
QTextBrowser* myInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
|
class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
|
||||||
{
|
{
|
||||||
|
class ItemDelegate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SMESHGUI_TreeElemInfo( QWidget* = 0 );
|
SMESHGUI_TreeElemInfo( QWidget* = 0 );
|
||||||
|
|
||||||
void showInfo( long, bool );
|
void showInfo( long, bool );
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 100 );
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTreeWidget* myInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog
|
class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog
|
||||||
|
@ -3402,6 +3402,30 @@ Please, create VTK viewer and try again</translation>
|
|||||||
<source>PREF_NOTIFY_MODE</source>
|
<source>PREF_NOTIFY_MODE</source>
|
||||||
<translation>Show a computation result notification</translation>
|
<translation>Show a computation result notification</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_NOTIFY_NEVER</source>
|
||||||
|
<translation>Never</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_NOTIFY_ERROR</source>
|
||||||
|
<translation>Errors only</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_NOTIFY_ALWAYS</source>
|
||||||
|
<translation>Always</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_ELEM_INFO</source>
|
||||||
|
<translation>Mesh element information</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_ELEM_INFO_SIMPLE</source>
|
||||||
|
<translation>Simple</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_ELEM_INFO_TREE</source>
|
||||||
|
<translation>Tree</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_PREF_GROUP_PRECISION</source>
|
<source>SMESH_PREF_GROUP_PRECISION</source>
|
||||||
<translation>Input fields precision</translation>
|
<translation>Input fields precision</translation>
|
||||||
@ -3454,6 +3478,10 @@ Please, create VTK viewer and try again</translation>
|
|||||||
<source>PREF_GROUP_UPDATE</source>
|
<source>PREF_GROUP_UPDATE</source>
|
||||||
<translation>Update</translation>
|
<translation>Update</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PREF_GROUP_INFO</source>
|
||||||
|
<translation>Mesh information</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>PREF_HIGHLIGHT_COLOR</source>
|
<source>PREF_HIGHLIGHT_COLOR</source>
|
||||||
<translation>Highlight color</translation>
|
<translation>Highlight color</translation>
|
||||||
@ -5608,5 +5636,13 @@ It is impossible to read point coordinates from file</translation>
|
|||||||
<source>GRAVITY_CENTER</source>
|
<source>GRAVITY_CENTER</source>
|
||||||
<translation>GRAVITY CENTER</translation>
|
<translation>GRAVITY CENTER</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>PROPERTY</source>
|
||||||
|
<translation>Property</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>VALUE</source>
|
||||||
|
<translation>Value</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
Loading…
Reference in New Issue
Block a user