mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
0021858: EDF 2171 SMESH : Add an information about the groups an element or node belongs to
This commit is contained in:
parent
b31f9cd66a
commit
5e7fae6a20
@ -81,6 +81,7 @@
|
||||
<parameter name="auto_groups" value="false"/>
|
||||
<parameter name="show_result_notification" value="2"/>
|
||||
<parameter name="mesh_elem_info" value="1"/>
|
||||
<parameter name="elem_info_grp_details" value="false"/>
|
||||
<parameter name="info_groups_nodes_limit" value="100000"/>
|
||||
<parameter name="info_dump_base" value="true" />
|
||||
<parameter name="info_dump_elem" value="true" />
|
||||
|
@ -4750,6 +4750,7 @@ void SMESHGUI::createPreferences()
|
||||
setPreferenceProperty( nodesLim, "max", 10000000 );
|
||||
setPreferenceProperty( nodesLim, "step", 10000 );
|
||||
setPreferenceProperty( nodesLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
|
||||
addPreference( tr( "PREF_ELEM_INFO_GRP_DETAILS" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "elem_info_grp_details" );
|
||||
addPreference( tr( "PREF_DUMP_BASE_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_base" );
|
||||
addPreference( tr( "PREF_DUMP_ELEM_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_elem" );
|
||||
addPreference( tr( "PREF_DUMP_ADD_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_add" );
|
||||
|
@ -1057,6 +1057,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
|
||||
clearInternal();
|
||||
|
||||
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 ) )
|
||||
@ -1136,6 +1137,59 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
|
||||
}
|
||||
}
|
||||
}
|
||||
// groups node belongs to
|
||||
SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
|
||||
if ( !CORBA::is_nil( aMesh ) ) {
|
||||
SMESH::ListOfGroups_var groups = aMesh->GetGroups();
|
||||
myInfo->append( "" ); // separator
|
||||
bool top_created = false;
|
||||
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 ( !top_created ) {
|
||||
myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) );
|
||||
top_created = true;
|
||||
}
|
||||
myInfo->append( QString( "+ <b>%1:</b>" ).arg( aName ) );
|
||||
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
|
||||
if ( !CORBA::is_nil( aStdGroup ) ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) );
|
||||
}
|
||||
else if ( !CORBA::is_nil( aGeomGroup ) ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) );
|
||||
GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
|
||||
_PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
|
||||
if ( sobj ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) );
|
||||
}
|
||||
}
|
||||
else if ( !CORBA::is_nil( aFltGroup ) ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) );
|
||||
}
|
||||
|
||||
// size
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ).
|
||||
arg( QString::number( aGrp->Size() ) ) );
|
||||
|
||||
// color
|
||||
SALOMEDS::Color color = aGrp->GetColor();
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ).
|
||||
arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
//
|
||||
@ -1252,7 +1306,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
|
||||
// separator
|
||||
myInfo->append( "" );
|
||||
//controls
|
||||
myInfo->append( QString( "<b>%1:</b>" ).arg( tr( "CONTROLS" ) ) );
|
||||
myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_ElemInfo::tr( "CONTROLS" ) ) );
|
||||
//Length
|
||||
if ( e->GetType() == SMDSAbs_Edge ) {
|
||||
afunctor.reset( new SMESH::Controls::Length() );
|
||||
@ -1330,6 +1384,58 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
|
||||
}
|
||||
}
|
||||
}
|
||||
// groups element belongs to
|
||||
SMESH::SMESH_Mesh_ptr aMesh = actor()->GetObject()->GetMeshServer();
|
||||
if ( !CORBA::is_nil( aMesh ) ) {
|
||||
SMESH::ListOfGroups_var groups = aMesh->GetGroups();
|
||||
myInfo->append( "" ); // separator
|
||||
bool top_created = false;
|
||||
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 ( !top_created ) {
|
||||
myInfo->append( QString( "<b>%1:</b>" ).arg( SMESHGUI_AddInfo::tr( "GROUPS" ) ) );
|
||||
top_created = true;
|
||||
}
|
||||
myInfo->append( QString( "+ <b>%1:</b>" ).arg( aName ) );
|
||||
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
|
||||
if ( !CORBA::is_nil( aStdGroup ) ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "STANDALONE_GROUP" ) ) );
|
||||
}
|
||||
else if ( !CORBA::is_nil( aGeomGroup ) ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "GROUP_ON_GEOMETRY" ) ) );
|
||||
GEOM::GEOM_Object_var gobj = aGeomGroup->GetShape();
|
||||
_PTR(SObject) sobj = SMESH::ObjectToSObject( gobj );
|
||||
if ( sobj ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2: %3" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "GEOM_OBJECT" ) ).arg( sobj->GetName().c_str() ) );
|
||||
}
|
||||
}
|
||||
else if ( !CORBA::is_nil( aFltGroup ) ) {
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "TYPE" ) ).
|
||||
arg( SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) ) );
|
||||
}
|
||||
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "SIZE" ) ).
|
||||
arg( QString::number( aGrp->Size() ) ) );
|
||||
|
||||
// color
|
||||
SALOMEDS::Color color = aGrp->GetColor();
|
||||
myInfo->append( QString( " - <b>%1:</b> %2" ).arg( SMESHGUI_AddInfo::tr( "COLOR" ) ).
|
||||
arg( QColor( color.R*255., color.G*255., color.B*255. ).name() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// separator
|
||||
if ( ids.count() > 1 ) {
|
||||
@ -1423,6 +1529,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
||||
clearInternal();
|
||||
|
||||
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 ) )
|
||||
@ -1530,6 +1637,61 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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 );
|
||||
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 {
|
||||
//
|
||||
@ -1793,6 +1955,61 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
|
||||
}
|
||||
}
|
||||
}
|
||||
// groups element 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( elemItem, Bold );
|
||||
groupsItem->setText( 0, SMESHGUI_AddInfo::tr( "GROUPS" ) );
|
||||
}
|
||||
QTreeWidgetItem* it = createItem( groupsItem, Bold );
|
||||
it->setText( 0, aName );
|
||||
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.) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1867,9 +2084,6 @@ void SMESHGUI_TreeElemInfo::saveInfo( QTextStream &out )
|
||||
out << SMESHGUI_ElemInfo::tr( "ELEM_INFO" ) << "\n";
|
||||
out << QString( 12, '-' ) << "\n";
|
||||
|
||||
int mode = SMESHGUI::resourceMgr()->integerValue( "SMESH", "mesh_elem_info", 1 );
|
||||
mode = qMin( 1, qMax( 0, mode ) );
|
||||
if ( mode == 1 ) {
|
||||
QTreeWidgetItemIterator it( myInfo );
|
||||
while ( *it ) {
|
||||
if ( !( *it )->text(0).isEmpty() ) {
|
||||
@ -1879,7 +2093,6 @@ void SMESHGUI_TreeElemInfo::saveInfo( QTextStream &out )
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
out << "\n";
|
||||
}
|
||||
|
||||
|
@ -4235,6 +4235,10 @@ Please, create VTK viewer and try again</translation>
|
||||
<source>PREF_ELEM_INFO_TREE</source>
|
||||
<translation>Tree</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_ELEM_INFO_GRP_DETAILS</source>
|
||||
<translation>Show details on groups in element information tab</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_DUMP_BASE_INFO</source>
|
||||
<translation>Dump base information</translation>
|
||||
|
@ -4142,6 +4142,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
|
||||
<source>PREF_ELEM_INFO_TREE</source>
|
||||
<translation>Arbre</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_ELEM_INFO_GRP_DETAILS</source>
|
||||
<translation type="unfinished">Show details on groups in element information tab</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_DUMP_BASE_INFO</source>
|
||||
<translation type="unfinished">Dump base information</translation>
|
||||
|
Loading…
Reference in New Issue
Block a user