Salome HOME
Copyright update 2021
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshInfo.cxx
index bcbd1b86876eab3b62d283980cc41494ef1aa0ed..bdf2f2bb2dc1e1c710bb08a22c1a96150cc2b3f2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -81,7 +81,7 @@ public:
 /*!
   \brief Constructor.
   \param parent Parent widget.
 /*!
   \brief Constructor.
   \param parent Parent widget.
-  \param name Field name. Defauls to null string.
+  \param name Field name. Defaults to null string.
 */
 Field::Field( QWidget* parent, const QString& name ): QLabel( parent )
 {
 */
 Field::Field( QWidget* parent, const QString& name ): QLabel( parent )
 {
@@ -382,7 +382,7 @@ namespace
     \brief Format connectivity data to string representation.
     \param connectivity Connectivity map.
     \param type Element type or face index if negative
     \brief Format connectivity data to string representation.
     \param connectivity Connectivity map.
     \param type Element type or face index if negative
-    \return Stringifed representation of the connectivity.
+    \return Stringified representation of the connectivity.
   */
   QString formatConnectivity( SMESH::Connectivity connectivity, int type )
   {
   */
   QString formatConnectivity( SMESH::Connectivity connectivity, int type )
   {
@@ -974,6 +974,8 @@ void SMESHGUI_BaseInfo::clear()
         widget( i, j )->setProperty( "value", 0 );
     }
   }
         widget( i, j )->setProperty( "value", 0 );
     }
   }
+  // hide 'Load' button
+  widget( iEnd, iSingle )->setVisible( false );
 }
 
 /*!
 }
 
 /*!
@@ -1034,7 +1036,7 @@ void SMESHGUI_BaseInfo::setFieldsVisible( int startRow, int lastRow, bool on )
 }
 
 /*!
 }
 
 /*!
-  \brief Write information from panel to ouput stream.
+  \brief Write information from panel to output stream.
   \param out Text stream output.
 */
 void SMESHGUI_BaseInfo::saveInfo( QTextStream& out )
   \param out Text stream output.
 */
 void SMESHGUI_BaseInfo::saveInfo( QTextStream& out )
@@ -1802,8 +1804,8 @@ void SMESHGUI_ElemInfo::writeInfo( InfoWriter* writer, const QList<uint>& ids )
               writer->write( SMESHGUI_AddInfo::tr( "TYPE" ), SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
             }
             int size = group.size();
               writer->write( SMESHGUI_AddInfo::tr( "TYPE" ), SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
             }
             int size = group.size();
-            if ( size != -1 );
-            writer->write( SMESHGUI_AddInfo::tr( "SIZE" ), size );
+            if ( size != -1 )
+              writer->write( SMESHGUI_AddInfo::tr( "SIZE" ), size );
             QColor color = group.color();
             if ( color.isValid() )
               writer->write( SMESHGUI_AddInfo::tr( "COLOR" ), color.name() );
             QColor color = group.color();
             if ( color.isValid() )
               writer->write( SMESHGUI_AddInfo::tr( "COLOR" ), color.name() );
@@ -1933,7 +1935,7 @@ void SMESHGUI_ElemInfo::writeInfo( InfoWriter* writer, const QList<uint>& ids )
               writer->write( SMESHGUI_AddInfo::tr( "TYPE" ), SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
             }
             int size = group.size();
               writer->write( SMESHGUI_AddInfo::tr( "TYPE" ), SMESHGUI_AddInfo::tr( "GROUP_ON_FILTER" ) );
             }
             int size = group.size();
-            if ( size != -1 );
+            if ( size != -1 )
               writer->write( SMESHGUI_AddInfo::tr( "SIZE" ), size );
             QColor color = group.color();
             if ( color.isValid() )
               writer->write( SMESHGUI_AddInfo::tr( "SIZE" ), size );
             QColor color = group.color();
             if ( color.isValid() )
@@ -1997,7 +1999,7 @@ void SMESHGUI_ElemInfo::updateControls()
 }
 
 /*!
 }
 
 /*!
-  \brief Write information from panel to ouput stream.
+  \brief Write information from panel to output stream.
   \param out Text stream output.
 */
 void SMESHGUI_ElemInfo::saveInfo( QTextStream &out )
   \param out Text stream output.
 */
 void SMESHGUI_ElemInfo::saveInfo( QTextStream &out )
@@ -2145,11 +2147,7 @@ SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
   myInfo->setColumnCount( 2 );
   myInfo->setHeaderLabels( QStringList() << tr( "PROPERTY" ) << tr( "VALUE" ) );
   myInfo->header()->setStretchLastSection( true );
   myInfo->setColumnCount( 2 );
   myInfo->setHeaderLabels( QStringList() << tr( "PROPERTY" ) << tr( "VALUE" ) );
   myInfo->header()->setStretchLastSection( true );
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-  myInfo->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
-#else
   myInfo->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
   myInfo->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
-#endif
   myInfo->setItemDelegate( new ItemDelegate( myInfo ) );
   QVBoxLayout* l = new QVBoxLayout( centralWidget() );
   l->setMargin( 0 );
   myInfo->setItemDelegate( new ItemDelegate( myInfo ) );
   QVBoxLayout* l = new QVBoxLayout( centralWidget() );
   l->setMargin( 0 );
@@ -2177,8 +2175,8 @@ void SMESHGUI_TreeElemInfo::information( const QList<uint>& ids )
   \param nbNodes number of unique nodes in element
   \param parentItem parent item of tree
 */
   \param nbNodes number of unique nodes in element
   \param parentItem parent item of tree
 */
-void SMESHGUI_TreeElemInfo::nodeInfo( const SMDS_MeshNode* node, int index,
-                                      int nbNodes, QTreeWidgetItem* parentItem )
+void SMESHGUI_TreeElemInfo::nodeInfo( const SMDS_MeshNode* /*node*/, int /*index*/,
+                                      int /*nbNodes*/, QTreeWidgetItem* /*parentItem*/ )
 {
   // int precision   = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
   // // node number and ID
 {
   // int precision   = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
   // // node number and ID
@@ -2286,7 +2284,7 @@ void SMESHGUI_TreeElemInfo::contextMenuEvent( QContextMenuEvent* e )
   }
 }
 
   }
 }
 
-void SMESHGUI_TreeElemInfo::itemDoubleClicked( QTreeWidgetItem* theItem, int theColumn )
+void SMESHGUI_TreeElemInfo::itemDoubleClicked( QTreeWidgetItem* theItem, int /*theColumn*/ )
 {
   if ( theItem ) {
     int type = theItem->data( 1, TypeRole ).toInt();
 {
   if ( theItem ) {
     int type = theItem->data( 1, TypeRole ).toInt();
@@ -2336,6 +2334,7 @@ void InfoComputor::compute()
   if ( myProxy )
   {
     SUIT_OverrideCursor wc;
   if ( myProxy )
   {
     SUIT_OverrideCursor wc;
+    myProxy.load();
     switch ( myOperation )
     {
     case GrpSize:
     switch ( myOperation )
     {
     case GrpSize:
@@ -2376,11 +2375,7 @@ SMESHGUI_AddInfo::SMESHGUI_AddInfo( QWidget* parent ): SMESHGUI_Info( parent )
 
   myTree->setColumnCount( 2 );
   myTree->header()->setStretchLastSection( true );
 
   myTree->setColumnCount( 2 );
   myTree->header()->setStretchLastSection( true );
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
-  myTree->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
-#else
   myTree->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
   myTree->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
-#endif
   myTree->header()->hide();
 
   l->addWidget( myTree );
   myTree->header()->hide();
 
   l->addWidget( myTree );
@@ -2861,7 +2856,7 @@ void SMESHGUI_AddInfo::showNextSubMeshes()
 }
 
 /*!
 }
 
 /*!
-  \brief Write information from panel to ouput stream.
+  \brief Write information from panel to output stream.
   \param out Text stream output.
 */
 void SMESHGUI_AddInfo::saveInfo( QTextStream &out )
   \param out Text stream output.
 */
 void SMESHGUI_AddInfo::saveInfo( QTextStream &out )
@@ -2923,7 +2918,7 @@ public:
 };
 
 /*!
 };
 
 /*!
-  \brief Contructor.
+  \brief Constructor.
   \param parent Parent widget.
   \internal
 */
   \param parent Parent widget.
   \internal
 */
@@ -3407,7 +3402,11 @@ void SMESHGUI_MeshInfoDlg::dump()
       if ( fd.isChecked( BaseInfo ) ) myBaseInfo->saveInfo( out );
       if ( fd.isChecked( ElemInfo ) ) myElemInfo->saveInfo( out );
       if ( fd.isChecked( AddInfo ) )  myAddInfo->saveInfo( out );
       if ( fd.isChecked( BaseInfo ) ) myBaseInfo->saveInfo( out );
       if ( fd.isChecked( ElemInfo ) ) myElemInfo->saveInfo( out );
       if ( fd.isChecked( AddInfo ) )  myAddInfo->saveInfo( out );
-      if ( fd.isChecked( CtrlInfo ) ) myCtrlInfo->saveInfo( out );
+      if ( fd.isChecked( CtrlInfo ) )
+      {
+        myCtrlInfo->showInfo( myProxy ); // it saves what is shown only
+        myCtrlInfo->saveInfo( out );
+      }
     }
   }
 }
     }
   }
 }
@@ -3908,9 +3907,15 @@ void SMESHGUI_CtrlInfo::clearInternal()
 
 void SMESHGUI_CtrlInfo::setTolerance( double theTolerance )
 {
 
 void SMESHGUI_CtrlInfo::setTolerance( double theTolerance )
 {
-  //SMESH::long_array_var anElems = getElementsByType( SMESH::NODE );
-  myButtons[1]->setEnabled( true );
-  myWidgets[2]->setText("");
+  myButtons[2]->setEnabled( true );
+  myWidgets[3]->setText("");
+  for ( int i = 0; i < myPredicates.count(); ++i )
+    if ( myPredicates[i]->GetFunctorType() == SMESH::FT_EqualNodes )
+    {
+      SMESH::EqualNodes_var functor = SMESH::EqualNodes::_narrow( myPredicates[i] );
+      if ( !functor->_is_nil() )
+        functor->SetTolerance( theTolerance );
+    }
 }
 
 #ifndef DISABLE_PLOT2DVIEWER
 }
 
 #ifndef DISABLE_PLOT2DVIEWER
@@ -3961,15 +3966,15 @@ void SMESHGUI_CtrlInfo::saveInfo( QTextStream &out )
   out << tr( "NAME_LAB" ) << "  " << myWidgets[0]->text() << endl;
   out << tr( "NODES_INFO" ) << endl;
   out << indent() << tr( "NUMBER_OF_THE_FREE_NODES" ) << ": " << myWidgets[1]->text() << endl;
   out << tr( "NAME_LAB" ) << "  " << myWidgets[0]->text() << endl;
   out << tr( "NODES_INFO" ) << endl;
   out << indent() << tr( "NUMBER_OF_THE_FREE_NODES" ) << ": " << myWidgets[1]->text() << endl;
-  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_NODES" ) << ": " << myWidgets[2]->text() << endl;
+  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_NODES" ) << ": " << myWidgets[3]->text() << endl;
   out << tr( "EDGES_INFO" ) << endl;
   out << tr( "EDGES_INFO" ) << endl;
-  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_EDGES" ) << ": " << myWidgets[3]->text() << endl;
+  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_EDGES" ) << ": " << myWidgets[4]->text() << endl;
   out << tr( "FACES_INFO" ) << endl;
   out << tr( "FACES_INFO" ) << endl;
-  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_FACES" ) << ": " << myWidgets[4]->text() << endl;
-  out << indent() << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[5]->text() << endl;
+  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_FACES" ) << ": " << myWidgets[5]->text() << endl;
+  out << indent() << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[6]->text() << endl;
   out << tr( "VOLUMES_INFO" ) << endl;
   out << tr( "VOLUMES_INFO" ) << endl;
-  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_VOLUMES" ) << ": " << myWidgets[6]->text() << endl;
-  out << indent() << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[7]->text() << endl;
+  out << indent() << tr( "NUMBER_OF_THE_DOUBLE_VOLUMES" ) << ": " << myWidgets[7]->text() << endl;
+  out << indent() << tr( "NUMBER_OF_THE_OVER_CONSTRAINED" ) << ": " << myWidgets[8]->text() << endl;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 }
 
 ////////////////////////////////////////////////////////////////////////////////