Salome HOME
Prevent exception at shape selection if no mesh was pre-selected
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshInfosDlg.cxx
index b1946d689aead9a227db3247f5721396ad80ce98..dd130b2fe63aa688ee7a2d4ccda4cc192ec6a131 100644 (file)
 //  Module : SMESH
 //  $Header$
 
-using namespace std;
-#include "SMESHGUI_MeshInfosDlg.h"
-
-#include "SMESHGUI.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_WaitCursor.h"
-#include "utilities.h"
-
 // QT Includes
 #include <qgroupbox.h>
 #include <qlabel.h>
@@ -44,6 +35,23 @@ using namespace std;
 #include <qmap.h>
 #include <qpushbutton.h>
 
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+#include "QAD_WaitCursor.h"
+
+#include "SMESHGUI_MeshInfosDlg.h"
+#include "SMESHGUI_Utils.h"
+#include "SMESHGUI.h"
+
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Mesh)
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
+#include "utilities.h"
+
+using namespace std;
+
 #define COLONIZE( str )   ( QString( str ).contains( ":" ) > 0 ? QString( str ) : QString( str ) + " :"  )
 
 //=================================================================================
@@ -339,6 +347,8 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg( QWidget* parent,  const char* name
   this->move( x, y );
   this->show();
 
+  cout<<"----"<<this->height()<<endl;
+  cout<<"----"<<this->width()<<endl;
   // init dialog with current selection
   onSelectionChanged();
 }
@@ -367,7 +377,7 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
     myStartSelection = false;
     mySelectLab->setText( "" );
     Handle(SALOME_InteractiveObject) IObject = mySelection->firstIObject();
-    SALOMEDS::SObject_var aSO = SMESHGUI::GetSMESHGUI()->GetStudy()->FindObjectID( IObject->getEntry() );
+    SALOMEDS::SObject_var aSO = SMESH::GetActiveStudyDocument()->FindObjectID( IObject->getEntry() );
     if ( !aSO->_is_nil() ) {
       CORBA::Object_var anObject = aSO->GetObject();
       if ( !CORBA::is_nil( anObject ) ) {
@@ -393,14 +403,14 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
          myWGStack->raiseWidget( mySubMeshWidget );
          setCaption( tr( "SMESH_MESHINFO_TITLE" ) + " [" + tr("SMESH_SUBMESH") +"]" );
          mySubMeshName->setText( aSO->GetName() );
-         mySubMeshNbNodes->setNum( (int)aSubMesh->GetNumberOfNodes() );
+         mySubMeshNbNodes->setNum( (int)aSubMesh->GetNumberOfNodes( true ) );
          mySubMeshNbElements->setNum( (int)aSubMesh->GetNumberOfElements() );
          mySubMeshNbEdges->setNum( (int)( aSubMesh->GetElementsByType( SMESH::EDGE )->length() ) );
          mySubMeshNbFaces->setNum( (int)( aSubMesh->GetElementsByType( SMESH::FACE )->length() ) );
          mySubMeshNbVolumes->setNum( (int)( aSubMesh->GetElementsByType( SMESH::VOLUME )->length() ) );
          return;
        }
-       SMESH::SMESH_Group_var aGroup = SMESH::SMESH_Group::_narrow( anObject );
+       SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( anObject );
        if ( !aGroup->_is_nil() ) {
          myWGStack->raiseWidget( myGroupWidget );
          setCaption( tr( "SMESH_MESHINFO_TITLE" ) + " [" + tr("SMESH_GROUP") +"]" );