-
- if ( actor() ) {
- int grp_details = SMESHGUI::resourceMgr()->booleanValue( "SMESH", "elem_info_grp_details", false );
- int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
- int cprecision = -1;
- if ( SMESHGUI::resourceMgr()->booleanValue( "SMESH", "use_precision", false ) )
- cprecision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "controls_precision", -1 );
- 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
- QTreeWidgetItem* nodeItem = createItem( 0, Bold | All );
- nodeItem->setText( 0, SMESHGUI_ElemInfo::tr( "NODE" ) );
- nodeItem->setText( 1, QString( "#%1" ).arg( id ) );
- // coordinates
- QTreeWidgetItem* coordItem = createItem( nodeItem, Bold );
- coordItem->setText( 0, SMESHGUI_ElemInfo::tr( "COORDINATES" ) );
- 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, Bold );
- conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
- Connectivity connectivity = nodeConnectivity( node );
- if ( !connectivity.isEmpty() ) {
- QString con = formatConnectivity( connectivity, SMDSAbs_0DElement );
- if ( !con.isEmpty() ) {
- QTreeWidgetItem* i = createItem( conItem );
- i->setText( 0, SMESHGUI_ElemInfo::tr( "0D_ELEMENTS" ) );
- i->setText( 1, con );
- }
- con = formatConnectivity( connectivity, SMDSAbs_Ball );
- if ( !con.isEmpty() ) {
- QTreeWidgetItem* i = createItem( conItem );
- i->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_ELEMENTS" ) );
- i->setText( 1, con );
- i->setData( 1, TypeRole, NodeConnectivity );
- }
- con = formatConnectivity( connectivity, SMDSAbs_Edge );
- if ( !con.isEmpty() ) {
- QTreeWidgetItem* i = createItem( conItem );
- i->setText( 0, SMESHGUI_ElemInfo::tr( "EDGES" ) );
- i->setText( 1, con );
- i->setData( 1, TypeRole, NodeConnectivity );
- }
- con = formatConnectivity( connectivity, SMDSAbs_Face );
- if ( !con.isEmpty() ) {
- QTreeWidgetItem* i = createItem( conItem );
- i->setText( 0, SMESHGUI_ElemInfo::tr( "FACES" ) );
- i->setText( 1, con );
- i->setData( 1, TypeRole, NodeConnectivity );
- }
- con = formatConnectivity( connectivity, SMDSAbs_Volume );
- if ( !con.isEmpty() ) {
- QTreeWidgetItem* i = createItem( conItem );
- i->setText( 0, SMESHGUI_ElemInfo::tr( "VOLUMES" ) );
- i->setText( 1, con );
- i->setData( 1, TypeRole, NodeConnectivity );
- }
- }
- else {
- conItem->setText( 1, SMESHGUI_ElemInfo::tr( "FREE_NODE" ) );
- }
- // node position
- SMESH::SMESH_Mesh_ptr aMeshPtr = actor()->GetObject()->GetMeshServer();
- if ( !CORBA::is_nil( aMeshPtr ) ) {
- SMESH::NodePosition_var pos = aMeshPtr->GetNodePosition( id );
- int shapeID = pos->shapeID;
- if ( shapeID > 0 ) {
- QString shapeType;
- double u, v;
- switch ( pos->shapeType ) {
- case GEOM::EDGE:
- shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" );
- if ( pos->params.length() == 1 )
- u = pos->params[0];
- break;
- case GEOM::FACE:
- shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" );
- if ( pos->params.length() == 2 ) {
- u = pos->params[0];
- v = pos->params[1];
- }
- break;
- case GEOM::VERTEX:
- shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" );
- break;
- default:
- shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" );
- break;
- }
- QTreeWidgetItem* posItem = createItem( nodeItem, Bold );
- posItem->setText( 0, SMESHGUI_ElemInfo::tr("POSITION") );
- posItem->setText( 1, (shapeType + " #%1").arg( shapeID ));
- if ( pos->shapeType == GEOM::EDGE || pos->shapeType == GEOM::FACE ) {
- QTreeWidgetItem* uItem = createItem( posItem );
- uItem->setText( 0, SMESHGUI_ElemInfo::tr("U_POSITION") );
- uItem->setText( 1, QString::number( u, precision > 0 ? 'f' : 'g', qAbs( precision )));
- if ( pos->shapeType == GEOM::FACE ) {
- QTreeWidgetItem* vItem = createItem( posItem );
- vItem->setText( 0, SMESHGUI_ElemInfo::tr("V_POSITION") );
- vItem->setText( 1, QString::number( v, precision > 0 ? 'f' : 'g', qAbs( precision )));
- }
- }
- }
- }
- // groups node belongs to
- SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
- if ( !CORBA::is_nil( aMesh ) ) {
- SMESH::ListOfGroups_var groups = aMesh->GetGroups();
- QTreeWidgetItem* groupsItem = 0;
- for ( int i = 0; i < groups->length(); i++ ) {
- SMESH::SMESH_GroupBase_var aGrp = groups[i];
- if ( CORBA::is_nil( aGrp ) ) continue;
- QString aName = aGrp->GetName();
- if ( aGrp->GetType() == SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) {
- if ( !groupsItem ) {
- groupsItem = createItem( nodeItem, Bold );
- groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) );
- }
- QTreeWidgetItem* it = createItem( groupsItem, Bold );
- it->setText( 0, aName.trimmed() );
- if ( grp_details ) {
- SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
- SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
- SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
-
- // type : group on geometry, standalone group, group on filter
- QTreeWidgetItem* typeItem = createItem( it );
- typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) );
- if ( !CORBA::is_nil( aStdGroup ) ) {
- typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) );
- }
- else if ( !CORBA::is_nil( aGeomGroup ) ) {
- typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) );
- GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
- _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
- if ( sobj ) {
- QTreeWidgetItem* gobjItem = createItem( typeItem );
- gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) );
- gobjItem->setText( 1, sobj->GetName().c_str() );
- }
- }
- else if ( !CORBA::is_nil( aFltGroup ) ) {
- typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
- }
-
- // size
- QTreeWidgetItem* sizeItem = createItem( it );
- sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) );
- sizeItem->setText( 1, QString::number( aGrp->Size() ) );
-
- // color
- SALOMEDS::Color color = aGrp->GetColor();
- QTreeWidgetItem* colorItem = createItem( it );
- colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) );
- colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) );
- }
- }
- }
- }
- }
- else {
- //
- // show element info
- //
- const SMDS_MeshElement* e = actor()->GetObject()->GetMesh()->FindElement( id );
- SMESH::Controls::NumericalFunctorPtr afunctor;
- if ( !e ) return;
-
- // element ID && type
- QString stype;
- switch( e->GetType() ) {
- case SMDSAbs_0DElement: stype = SMESHGUI_ElemInfo::tr( "0D_ELEMENT" ); break;
- case SMDSAbs_Ball: stype = SMESHGUI_ElemInfo::tr( "BALL" ); break;
- case SMDSAbs_Edge: stype = SMESHGUI_ElemInfo::tr( "EDGE" ); break;
- case SMDSAbs_Face: stype = SMESHGUI_ElemInfo::tr( "FACE" ); break;
- case SMDSAbs_Volume: stype = SMESHGUI_ElemInfo::tr( "VOLUME" ); break;
- default:;
- }
- if ( stype.isEmpty() ) return;
- QTreeWidgetItem* elemItem = createItem( 0, Bold | All );
- elemItem->setText( 0, stype );
- elemItem->setText( 1, QString( "#%1" ).arg( id ) );
- // geometry type
- QString gtype;
- switch( e->GetEntityType() ) {
- case SMDSEntity_Triangle:
- case SMDSEntity_Quad_Triangle:
- case SMDSEntity_BiQuad_Triangle:
- gtype = SMESHGUI_ElemInfo::tr( "TRIANGLE" ); break;
- case SMDSEntity_Quadrangle:
- case SMDSEntity_Quad_Quadrangle:
- case SMDSEntity_BiQuad_Quadrangle:
- gtype = SMESHGUI_ElemInfo::tr( "QUADRANGLE" ); break;
- case SMDSEntity_Polygon:
- case SMDSEntity_Quad_Polygon:
- gtype = SMESHGUI_ElemInfo::tr( "POLYGON" ); break;
- case SMDSEntity_Tetra:
- case SMDSEntity_Quad_Tetra:
- gtype = SMESHGUI_ElemInfo::tr( "TETRAHEDRON" ); break;
- case SMDSEntity_Pyramid:
- case SMDSEntity_Quad_Pyramid:
- gtype = SMESHGUI_ElemInfo::tr( "PYRAMID" ); break;
- case SMDSEntity_Hexa:
- case SMDSEntity_Quad_Hexa:
- case SMDSEntity_TriQuad_Hexa:
- gtype = SMESHGUI_ElemInfo::tr( "HEXAHEDRON" ); break;
- case SMDSEntity_Penta:
- case SMDSEntity_Quad_Penta:
- gtype = SMESHGUI_ElemInfo::tr( "PRISM" ); break;
- case SMDSEntity_Hexagonal_Prism:
- gtype = SMESHGUI_ElemInfo::tr( "HEX_PRISM" ); break;
- case SMDSEntity_Polyhedra:
- case SMDSEntity_Quad_Polyhedra:
- gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
- default:
- break;
- }
- if ( !gtype.isEmpty() ) {
- QTreeWidgetItem* typeItem = createItem( elemItem, Bold );
- typeItem->setText( 0, SMESHGUI_ElemInfo::tr( "TYPE" ) );
- typeItem->setText( 1, gtype );
- }
- // quadratic flag (for edges, faces and volumes)
- if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
- // quadratic flag
- QTreeWidgetItem* quadItem = createItem( elemItem, Bold );
- quadItem->setText( 0, SMESHGUI_ElemInfo::tr( "QUADRATIC" ) );
- quadItem->setText( 1, e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" ) );
- }
- if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
- // ball diameter
- QTreeWidgetItem* diamItem = createItem( elemItem, Bold );
- diamItem->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" ) );
- diamItem->setText( 1, QString( "%1" ).arg( ball->GetDiameter() ));
- }
- // connectivity
- QTreeWidgetItem* conItem = createItem( elemItem, Bold );
- conItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONNECTIVITY" ) );
-
-
- if( e->GetGeomType() != SMDSGeom_POLYHEDRA ) {
- SMDS_ElemIteratorPtr nodeIt = e->nodesIterator();
- for ( int idx = 1; nodeIt->more(); idx++ ) {
- const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
- nodeInfo( node, idx, e->NbNodes(), conItem );
- }
- }
- else {
- const SMDS_VtkVolume* aVtkVolume = dynamic_cast<const SMDS_VtkVolume*>(e);
- SMDS_ElemIteratorPtr nodeIt = aVtkVolume->uniqueNodesIterator();
- QList<const SMDS_MeshElement*> uniqueNodes;
- while ( nodeIt->more() )
- uniqueNodes.append( nodeIt->next() );
-
- SMDS_VolumeTool vtool( e );
- const int nbFaces = vtool.NbFaces();
- for( int face_id = 0; face_id < nbFaces; face_id++ ) {
- QTreeWidgetItem* faceItem = createItem( conItem, Bold );
- faceItem->setText( 0, QString( "%1 %2 / %3" ).arg( SMESHGUI_ElemInfo::tr( "FACE" ) ).arg( face_id + 1 ).arg( nbFaces ) );
- faceItem->setExpanded( true );
-
- const SMDS_MeshNode** aNodeIds = vtool.GetFaceNodes( face_id );
- const int nbNodes = vtool.NbFaceNodes( face_id );
- for( int node_id = 0; node_id < nbNodes; node_id++ ) {
- const SMDS_MeshNode* node = aNodeIds[node_id];
- nodeInfo( node, uniqueNodes.indexOf(node) + 1, aVtkVolume->NbUniqueNodes(), faceItem );
- }
- }
- }
- //Controls
- QTreeWidgetItem* cntrItem = createItem( elemItem, Bold );
- cntrItem->setText( 0, SMESHGUI_ElemInfo::tr( "CONTROLS" ) );
- //Length
- if( e->GetType()==SMDSAbs_Edge){
- afunctor.reset( new SMESH::Controls::Length() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- afunctor->SetPrecision( cprecision );
- QTreeWidgetItem* lenItem = createItem( cntrItem, Bold );
- lenItem->setText( 0, tr( "LENGTH_EDGES" ) );
- lenItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- }
- if( e->GetType() == SMDSAbs_Face ) {
- //Area
- afunctor.reset( new SMESH::Controls::Area() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- afunctor->SetPrecision( cprecision );
- QTreeWidgetItem* areaItem = createItem( cntrItem, Bold );
- areaItem->setText( 0, tr( "AREA_ELEMENTS" ) );
- areaItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue(id) ) );
- //Taper
- afunctor.reset( new SMESH::Controls::Taper() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- afunctor->SetPrecision( cprecision );
- QTreeWidgetItem* taperlItem = createItem( cntrItem, Bold );
- taperlItem->setText( 0, tr( "TAPER_ELEMENTS" ) );
- taperlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- //AspectRatio2D
- afunctor.reset( new SMESH::Controls::AspectRatio() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- QTreeWidgetItem* ratlItem = createItem( cntrItem, Bold );
- ratlItem->setText( 0, tr( "ASPECTRATIO_ELEMENTS" ));
- ratlItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- //Minimum angle
- afunctor.reset( new SMESH::Controls::MinimumAngle() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- afunctor->SetPrecision( cprecision );
- QTreeWidgetItem* minanglItem = createItem( cntrItem, Bold );
- minanglItem->setText( 0, tr( "MINIMUMANGLE_ELEMENTS" ) );
- minanglItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- //Wraping angle
- afunctor.reset( new SMESH::Controls::Warping() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- afunctor->SetPrecision( cprecision );
- QTreeWidgetItem* warpItem = createItem( cntrItem, Bold );
- warpItem->setText( 0, tr( "WARP_ELEMENTS" ));
- warpItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- //Skew
- afunctor.reset( new SMESH::Controls::Skew() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- afunctor->SetPrecision( cprecision );
- QTreeWidgetItem* skewItem = createItem( cntrItem, Bold );
- skewItem->setText( 0, tr( "SKEW_ELEMENTS" ) );
- skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- //ElemDiam2D
- afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- QTreeWidgetItem* diamItem = createItem( cntrItem, Bold );
- diamItem->setText( 0, tr( "MAX_ELEMENT_LENGTH_2D" ));
- diamItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- }
- if( e->GetType() == SMDSAbs_Volume ) {
- //AspectRatio3D
- afunctor.reset( new SMESH::Controls::AspectRatio3D() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- QTreeWidgetItem* ratlItem3 = createItem( cntrItem, Bold );
- ratlItem3->setText( 0, tr( "ASPECTRATIO_3D_ELEMENTS" ) );
- ratlItem3->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- //Volume
- afunctor.reset( new SMESH::Controls::Volume() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- QTreeWidgetItem* volItem = createItem( cntrItem, Bold );
- volItem->setText( 0, tr( "VOLUME_3D_ELEMENTS" ) );
- volItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- //ElementDiameter3D
- afunctor.reset( new SMESH::Controls::MaxElementLength3D() );
- afunctor->SetMesh( actor()->GetObject()->GetMesh() );
- QTreeWidgetItem* diam3Item = createItem( cntrItem, Bold );
- diam3Item->setText( 0, tr( "MAX_ELEMENT_LENGTH_3D" ) );
- diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id ) ) );
- }
-
- // gravity center
- XYZ gc = gravityCenter( e );
- QTreeWidgetItem* gcItem = createItem( elemItem, Bold );
- gcItem->setText( 0, SMESHGUI_ElemInfo::tr( "GRAVITY_CENTER" ) );
- 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 ) ) );
-
- // normal vector
- if( e->GetType() == SMDSAbs_Face ) {
- XYZ gc = normal( e );
- QTreeWidgetItem* nItem = createItem( elemItem, Bold );
- nItem->setText( 0, SMESHGUI_ElemInfo::tr( "NORMAL_VECTOR" ) );
- QTreeWidgetItem* xItem = createItem( nItem );
- xItem->setText( 0, "X" );
- xItem->setText( 1, QString::number( gc.x(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
- QTreeWidgetItem* yItem = createItem( nItem );
- yItem->setText( 0, "Y" );
- yItem->setText( 1, QString::number( gc.y(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
- QTreeWidgetItem* zItem = createItem( nItem );
- zItem->setText( 0, "Z" );
- zItem->setText( 1, QString::number( gc.z(), precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
- }
-
- // element position
- SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
- if ( e->GetType() >= SMDSAbs_Edge && e->GetType() <= SMDSAbs_Volume ) {
- if ( !CORBA::is_nil( aMesh ) ) {
- SMESH::ElementPosition pos = aMesh->GetElementPosition( id );
- int shapeID = pos.shapeID;
- if ( shapeID > 0 ) {
- QTreeWidgetItem* shItem = createItem( elemItem, Bold );
- QString shapeType;
- switch ( pos.shapeType ) {
- case GEOM::EDGE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_EDGE" ); break;
- case GEOM::FACE: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_FACE" ); break;
- case GEOM::VERTEX: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_VERTEX" ); break;
- case GEOM::SOLID: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SOLID" ); break;
- case GEOM::SHELL: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHELL" ); break;
- default: shapeType = SMESHGUI_ElemInfo::tr( "GEOM_SHAPE" ); break;
- }
- shItem->setText( 0, SMESHGUI_ElemInfo::tr( "POSITION" ) );
- shItem->setText( 1, QString( "%1 #%2" ).arg( shapeType ).arg( shapeID ) );
- }
- }
- }
- // groups element belongs to
- if ( !CORBA::is_nil( aMesh ) ) {
- SMESH::ListOfGroups_var groups = aMesh->GetGroups();
- QTreeWidgetItem* groupsItem = 0;
- for ( int i = 0; i < groups->length(); i++ ) {
- SMESH::SMESH_GroupBase_var aGrp = groups[i];
- if ( CORBA::is_nil( aGrp ) ) continue;
- QString aName = aGrp->GetName();
- if ( aGrp->GetType() != SMESH::NODE && !aName.isEmpty() && aGrp->Contains( id ) ) {
- if ( !groupsItem ) {
- groupsItem = createItem( elemItem, Bold );
- groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) );
- }
- QTreeWidgetItem* it = createItem( groupsItem, Bold );
- it->setText( 0, aName.trimmed() );
- if ( grp_details ) {
- SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
- SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp );
- SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp );
-
- // type : group on geometry, standalone group, group on filter
- QTreeWidgetItem* typeItem = createItem( it );
- typeItem->setText( 0, SMESHGUI_AddInfo::tr( "TYPE" ) );
- if ( !CORBA::is_nil( aStdGroup ) ) {
- typeItem->setText( 1, SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) );
- }
- else if ( !CORBA::is_nil( aGeomGroup ) ) {
- typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) );
- GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
- _PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
- if ( sobj ) {
- QTreeWidgetItem* gobjItem = createItem( typeItem );
- gobjItem->setText( 0, SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) );
- gobjItem->setText( 1, sobj->GetName().c_str() );
- }
- }
- else if ( !CORBA::is_nil( aFltGroup ) ) {
- typeItem->setText( 1, SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
- }
-
- // size
- QTreeWidgetItem* sizeItem = createItem( it );
- sizeItem->setText( 0, SMESHGUI_AddInfo::tr( "SIZE" ) );
- sizeItem->setText( 1, QString::number( aGrp->Size() ) );
-
- // color
- SALOMEDS::Color color = aGrp->GetColor();
- QTreeWidgetItem* colorItem = createItem( it );
- colorItem->setText( 0, SMESHGUI_AddInfo::tr( "COLOR" ) );
- colorItem->setBackground( 1, QBrush( QColor( color.R*255., color.G*255., color.B*255.) ) );
- }
- }
- }
- }
- }
- }
- }