Salome HOME
54355: 'Compute' button is absent for 'Number of the double nodes' value in 'Mesh...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshInfo.cxx
index 8ff92dd40a6f1c8a9bbde0203761b6c1bc1bd548..34c737faf5fdd533c84526a18d1a95159dff5e6d 100644 (file)
@@ -610,11 +610,11 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
     myWidgets[i3DHexaPrisms][iTotal]        ->setProperty( "text", QString::number( info[SMDSEntity_Hexagonal_Prism] ));
     myWidgets[i3DPolyhedrons][iTotal]       ->setProperty( "text", QString::number( info[SMDSEntity_Polyhedra] ));
     long nbElemTotal       = info[SMDSEntity_0D] + info[SMDSEntity_Ball] + nbEdges + nb2DTotal + nb3DTotal;
-    long nbElemLinerial    = info[SMDSEntity_Edge] + nb2DLinear + nb3DLinear;
+    long nbElemLinearial   = info[SMDSEntity_Edge] + nb2DLinear + nb3DLinear;
     long nbElemQuadratic   = info[SMDSEntity_Quad_Edge] + nb2DQuadratic + nb3DQuadratic;
     long nbElemBiQuadratic = nb2DBiQuadratic + nb3DBiQuadratic;
     myWidgets[iNb][iTotal]      ->setProperty( "text", QString::number( nbElemTotal ));
-    myWidgets[iNb][iLinear]     ->setProperty( "text", QString::number( nbElemLinerial ));
+    myWidgets[iNb][iLinear]     ->setProperty( "text", QString::number( nbElemLinearial ));
     myWidgets[iNb][iQuadratic]  ->setProperty( "text", QString::number( nbElemQuadratic ));
     myWidgets[iNb][iBiQuadratic]->setProperty( "text", QString::number( nbElemBiQuadratic ));
     // before full loading from study file, type of elements in a sub-mesh can't be defined
@@ -1121,7 +1121,7 @@ SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::gravityCenter( const SMDS_MeshElement*
 */
 SMESHGUI_ElemInfo::XYZ SMESHGUI_ElemInfo::normal( const SMDS_MeshElement* element )
 {
-  gp_XYZ n = SMESH::getNormale( dynamic_cast<const SMDS_MeshFace*>( element ));
+  gp_XYZ n = SMESH::getNormale( SMDS_Mesh::DownCast<SMDS_MeshFace>( element ));
   return XYZ(n.X(), n.Y(), n.Z());
 }
 
@@ -1397,7 +1397,7 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
         if ( e->GetEntityType() > SMDSEntity_0D && e->GetEntityType() < SMDSEntity_Ball ) {
           myInfo->append( QString( "<b>%1?</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "QUADRATIC" )).arg( e->IsQuadratic() ? SMESHGUI_ElemInfo::tr( "YES" ) : SMESHGUI_ElemInfo::tr( "NO" )) );
         }
-        if ( const SMDS_BallElement* ball = dynamic_cast<const SMDS_BallElement*>( e )) {
+        if ( const SMDS_BallElement* ball = SMDS_Mesh::DownCast<SMDS_BallElement>( e )) {
           // Ball diameter
           myInfo->append( QString( "<b>%1:</b> %2" ).arg( SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" )).arg( ball->GetDiameter() ));
         }
@@ -1915,7 +1915,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
         case SMDSEntity_Polyhedra:
         case SMDSEntity_Quad_Polyhedra:
           gtype = SMESHGUI_ElemInfo::tr( "POLYHEDRON" ); break;
-        default: 
+        default:
           break;
         }
         if ( !gtype.isEmpty() ) {
@@ -1930,7 +1930,7 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
           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 )) {
+        if ( const SMDS_BallElement* ball = SMDS_Mesh::DownCast< SMDS_BallElement >( e )) {
           // ball diameter
           QTreeWidgetItem* diamItem = createItem( elemItem, Bold );
           diamItem->setText( 0, SMESHGUI_ElemInfo::tr( "BALL_DIAMETER" ));
@@ -1949,12 +1949,14 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
           }
         }
         else {
-          const SMDS_VtkVolume* aVtkVolume = dynamic_cast<const SMDS_VtkVolume*>(e);
-          SMDS_ElemIteratorPtr nodeIt = aVtkVolume->uniqueNodesIterator();
+          SMDS_NodeIteratorPtr nodeIt = e->nodeIterator();
+          std::set< const SMDS_MeshNode* > addedNodes;
           QList<const SMDS_MeshElement*> uniqueNodes;
-          while ( nodeIt->more() )
-            uniqueNodes.append( nodeIt->next() );
-
+          while ( nodeIt->more() ) {
+            const SMDS_MeshNode* node = nodeIt->next();
+            if ( addedNodes.insert( node ).second )
+              uniqueNodes.append( nodeIt->next() );
+          }
           SMDS_VolumeTool vtool( e );
           const int nbFaces = vtool.NbFaces();
           for( int face_id = 0; face_id < nbFaces; face_id++ ) {
@@ -1963,10 +1965,10 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
             faceItem->setExpanded( true );
 
             const SMDS_MeshNode** aNodeIds = vtool.GetFaceNodes( face_id );
-            const int nbNodes = vtool.NbFaceNodes( 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 );
+              nodeInfo( node, uniqueNodes.indexOf(node) + 1, uniqueNodes.size(), faceItem );
             }
           }
         }
@@ -2081,7 +2083,9 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
         afunctor->SetMesh( actor()->GetObject()->GetMesh() );
         QTreeWidgetItem* minEdgeItem = createItem( cntrItem, Bold );
         minEdgeItem->setText( 0, tr( "MIN_ELEM_EDGE" ));
-        minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
+        SMESH::Controls::TSequenceOfXYZ points;
+        afunctor->GetPoints( e, points ); // "non-standard" way, to make it work for all elem types
+        minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( points )) );
 
         // gravity center
         XYZ gc = gravityCenter( e );
@@ -3114,8 +3118,8 @@ void SMESHGUI_MeshInfoDlg::updateSelection()
 void SMESHGUI_MeshInfoDlg::help()
 {
   SMESH::ShowHelpFile( ( myTabWidget->currentIndex() == BaseInfo || myTabWidget->currentIndex() == AddInfo ) ?
-                       "mesh_infos_page.html#advanced_mesh_infos_anchor" : 
-                       "mesh_infos_page.html#mesh_element_info_anchor" );
+                       "mesh_infos.html#advanced-mesh-infos-anchor" : 
+                       "mesh_infos.html#mesh-element-info-anchor" );
 }
 
 /*!
@@ -3245,12 +3249,6 @@ void SMESHGUI_MeshInfoDlg::showItemInfo( const QString& theStr )
 
 void SMESHGUI_MeshInfoDlg::dump()
 {
-  SUIT_Application* app = SUIT_Session::session()->activeApplication();
-  if ( !app ) return;
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
-  if ( !appStudy ) return;
-  _PTR( Study ) aStudy = appStudy->studyDS();
-
   QStringList aFilters;
   aFilters.append( tr( "TEXT_FILES" ));
 
@@ -3578,17 +3576,17 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
 
   // nodes info
   const CORBA::Long nbNodes =   nbElemsByType[ SMESH::NODE ];
-  const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] +
-                                nbElemsByType[ SMESH::FACE ] +
-                                nbElemsByType[ SMESH::VOLUME ] );
-  if ( nbNodes + nbElems > 0 ) {
-    if ( Max( (int)nbNodes, (int)nbElems ) <= ctrlLimit ) {
+  // const CORBA::Long nbElems = ( nbElemsByType[ SMESH::EDGE ] +
+  //                               nbElemsByType[ SMESH::FACE ] +
+  //                               nbElemsByType[ SMESH::VOLUME ] );
+  if ( nbNodes > 0 ) {
+    if ( nbNodes <= ctrlLimit ) {
       // free nodes
       computeFreeNodesInfo();
+      // node connectivity number
       computeNodesNbConnInfo();
       // double nodes
-      if ( Max( (int)mesh->NbNodes(), (int)mesh->NbElements() ) <= ctrlLimit )
-        computeDoubleNodesInfo();
+      computeDoubleNodesInfo();
     }
     else {
       myButtons[0]->setEnabled( true );
@@ -3597,7 +3595,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
     }
   }
   else {
-    for( int i=2; i<=11; i++)
+    for( int i=2; i<=13; i++)
       myMainLayout->itemAt(i)->widget()->setVisible( false );
   }
 
@@ -3610,7 +3608,7 @@ void SMESHGUI_CtrlInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
       myButtons[3]->setEnabled( true );
   }
   else {
-    for( int i=11; i<=14; i++)
+    for( int i=14; i<=17; i++)
       myMainLayout->itemAt(i)->widget()->setVisible( false );
   }
  
@@ -4002,12 +4000,6 @@ void SMESHGUI_CtrlInfoDlg::deactivate()
  */
 void SMESHGUI_CtrlInfoDlg::dump()
 {
-  SUIT_Application* app = SUIT_Session::session()->activeApplication();
-  if ( !app ) return;
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
-  if ( !appStudy ) return;
-  _PTR( Study ) aStudy = appStudy->studyDS();
-
   QStringList aFilters;
   aFilters.append( tr( "TEXT_FILES" ));
 
@@ -4041,5 +4033,5 @@ void SMESHGUI_CtrlInfoDlg::dump()
  */
 void SMESHGUI_CtrlInfoDlg::help()
 {
-  SMESH::ShowHelpFile("mesh_infos_page.html#mesh_quality_info_anchor");
+  SMESH::ShowHelpFile("mesh_infos.html#mesh_quality_info_anchor");
 }