Version: 6.3.1
Public Member Functions | Protected Member Functions | Private Slots | Private Attributes

SMESHGUI_StandardMeshInfosDlg Class Reference

#include <SMESHGUI_StandardMeshInfosDlg.h>

Inheritance diagram for SMESHGUI_StandardMeshInfosDlg:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_StandardMeshInfosDlg (SMESHGUI *)
 SMESHGUI_StandardMeshInfosDlg.SMESHGUI_StandardMeshInfosDlg.
 ~SMESHGUI_StandardMeshInfosDlg ()
 SMESHGUI_StandardMeshInfosDlg.~SMESHGUI_StandardMeshInfosDlg.

Protected Member Functions

void closeEvent (QCloseEvent *)
void keyPressEvent (QKeyEvent *)
void windowActivationChange (bool)
void DumpMeshInfos ()
 SMESHGUI_StandardMeshInfosDlg.DumpMeshInfos.

Private Slots

void onSelectionChanged ()
void DeactivateActiveDialog ()
void ActivateThisDialog ()
void onStartSelection ()
void onHelp ()

Private Attributes

SMESHGUImySMESHGUI
LightApp_SelectionMgr * mySelectionMgr
bool myStartSelection
bool myIsActiveWindow
SUIT_SelectionFiltermyMeshFilter
QLabel * myNameLab
QPushButton * mySelectBtn
QLineEdit * myMeshLine
QTextBrowser * myInfo
QGroupBoxmyMeshGroup
QGroupBoxmyInfoGroup
QGroupBoxmyButtonsGroup
QPushButton * myOkBtn
QPushButton * myHelpBtn
QString myHelpFileName

Detailed Description

Definition at line 45 of file SMESHGUI_StandardMeshInfosDlg.h.


Constructor & Destructor Documentation

SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg ( SMESHGUI theModule)

SMESHGUI_StandardMeshInfosDlg.SMESHGUI_StandardMeshInfosDlg.

Constructor

Definition at line 77 of file SMESHGUI_StandardMeshInfosDlg.cxx.

References DeactivateActiveDialog(), MARGIN, myButtonsGroup, myHelpBtn, myHelpFileName, myInfo, myInfoGroup, myIsActiveWindow, myMeshFilter, myMeshGroup, myMeshLine, myNameLab, myOkBtn, mySelectBtn, mySelectionMgr, mySMESHGUI, myStartSelection, onHelp(), onSelectionChanged(), onStartSelection(), SMESHGUI.SetActiveDialogBox(), and SPACING.

  : QDialog( SMESH::GetDesktop( theModule ) ),
    mySMESHGUI( theModule ),
    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
  setModal(false);
  setAttribute(Qt::WA_DeleteOnClose, true);
  setWindowTitle(tr("SMESH_STANDARD_MESHINFO_TITLE"));
  setSizeGripEnabled(true);

  myStartSelection = true;
  myIsActiveWindow = true;

  // dialog layout
  QVBoxLayout* aDlgLayout = new QVBoxLayout(this);
  aDlgLayout->setSpacing(SPACING);
  aDlgLayout->setMargin(MARGIN);

  // mesh group box
  myMeshGroup = new QGroupBox(tr("SMESH_MESH"), this);
  QHBoxLayout* myMeshGroupLayout = new QHBoxLayout(myMeshGroup);
  myMeshGroupLayout->setSpacing(SPACING);
  myMeshGroupLayout->setMargin(MARGIN);

  // select button, label and line edit with mesh name
  myNameLab = new QLabel(tr("SMESH_NAME"), myMeshGroup);
  myMeshGroupLayout->addWidget(myNameLab);

  QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
  mySelectBtn = new QPushButton(myMeshGroup);
  mySelectBtn->setIcon(image0);
  myMeshGroupLayout->addWidget(mySelectBtn);

  myMeshLine = new QLineEdit(myMeshGroup);
  myMeshGroupLayout->addWidget(myMeshLine);

  aDlgLayout->addWidget(myMeshGroup);

  // information group box
  myInfoGroup  = new QGroupBox(tr("SMESH_INFORMATION"), this);
  QVBoxLayout* myInfoGroupLayout = new QVBoxLayout(myInfoGroup);
  myInfoGroupLayout->setSpacing(SPACING);
  myInfoGroupLayout->setMargin(MARGIN);

  // information text browser
  myInfo = new QTextBrowser(myInfoGroup);
  myInfo->setMinimumSize(200, 150);
  myInfoGroupLayout->addWidget(myInfo);

  aDlgLayout->addWidget(myInfoGroup);

  // buttons group
  myButtonsGroup = new QGroupBox(this);
  QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup);
  myButtonsGroupLayout->setSpacing(SPACING);
  myButtonsGroupLayout->setMargin(MARGIN);

  // buttons --> OK and Help buttons
  myOkBtn = new QPushButton(tr("SMESH_BUT_OK"), myButtonsGroup);
  myOkBtn->setAutoDefault(true); myOkBtn->setDefault(true);
  myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), myButtonsGroup);
  myHelpBtn->setAutoDefault(true);

  myButtonsGroupLayout->addWidget(myOkBtn);
  myButtonsGroupLayout->addSpacing(10);
  myButtonsGroupLayout->addStretch();
  myButtonsGroupLayout->addWidget(myHelpBtn);

  aDlgLayout->addWidget(myButtonsGroup);

  mySMESHGUI->SetActiveDialogBox(this);

  // connect signals
  connect( myOkBtn,         SIGNAL(clicked()),                      this, SLOT(close()));
  connect( myHelpBtn,       SIGNAL(clicked()),                      this, SLOT(onHelp()));
  connect( mySelectBtn,     SIGNAL(clicked()),                      this, SLOT(onStartSelection()));
  connect( mySMESHGUI,      SIGNAL(SignalCloseAllDialogs()),        this, SLOT(close()));
  connect( mySMESHGUI,      SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
  connect( mySelectionMgr,  SIGNAL(currentSelectionChanged()),      this, SLOT(onSelectionChanged()));

  // init dialog with current selection
  myMeshFilter = new SMESH_TypeFilter (MESH);
  mySelectionMgr->installFilter(myMeshFilter);
  onSelectionChanged();

  myHelpFileName = "mesh_infos_page.html#standard_mesh_infos_anchor";
}
SMESHGUI_StandardMeshInfosDlg::~SMESHGUI_StandardMeshInfosDlg ( )

Member Function Documentation

void SMESHGUI_StandardMeshInfosDlg::ActivateThisDialog ( ) [private, slot]

Definition at line 415 of file SMESHGUI_StandardMeshInfosDlg.cxx.

References SMESHGUI.EmitSignalDeactivateDialog(), mySelectionMgr, mySMESHGUI, and onSelectionChanged().

Referenced by windowActivationChange().

{
  /* Emit a signal to deactivate any active dialog */
  mySMESHGUI->EmitSignalDeactivateDialog();
  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
}
void SMESHGUI_StandardMeshInfosDlg::closeEvent ( QCloseEvent *  e) [protected]
void SMESHGUI_StandardMeshInfosDlg::DeactivateActiveDialog ( ) [private, slot]

Definition at line 406 of file SMESHGUI_StandardMeshInfosDlg.cxx.

References mySelectionMgr.

Referenced by SMESHGUI_StandardMeshInfosDlg().

{
  disconnect(mySelectionMgr, 0, this, 0);
}
void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos ( ) [protected]

SMESHGUI_StandardMeshInfosDlg.DumpMeshInfos.

Definition at line 181 of file SMESHGUI_StandardMeshInfosDlg.cxx.

References _PTR(), SMESH_controls.aGroup, SMESH.GetMeshByIO(), SMESH.GetNameOfSelectedIObjects(), myInfo, myMeshLine, mySelectionMgr, myStartSelection, SMESH.SObjectToObject(), SMESH.Tag_EdgeGroups, SMESH.Tag_FaceGroups, SMESH.Tag_NodeGroups, and SMESH.Tag_VolumeGroups.

Referenced by onSelectionChanged().

{
  SUIT_OverrideCursor wc;

  SALOME_ListIO aList;
  mySelectionMgr->selectedObjects(aList);

  int nbSel = aList.Extent();
  myInfo->clear();
  if (nbSel == 1) {
    myStartSelection = false;
    myMeshLine->setText("");
    SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());

    if (!aMesh->_is_nil()) {
      QString aName, anInfo;
      SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
      myMeshLine->setText(aName);
      int aNbNodes =   (int)aMesh->NbNodes();
      int aNbEdges =   (int)aMesh->NbEdges();
      int aNbFaces =   (int)aMesh->NbFaces();
      int aNbVolumes = (int)aMesh->NbVolumes();

      int aDimension = 0;
      double aNbDimElements = 0;
      if (aNbVolumes > 0) {
        aNbDimElements = aNbVolumes;
        aDimension = 3;
      }
      else if(aNbFaces > 0) {
        aNbDimElements = aNbFaces;
        aDimension = 2;
      }
      else if(aNbEdges > 0) {
        aNbDimElements = aNbEdges;
        aDimension = 1;
      }
      else if(aNbNodes > 0) {
        aNbDimElements = aNbNodes;
        aDimension = 0;
      }

      // information about the mesh
      anInfo.append(QString("Nb of element of dimension %1:<b> %2</b><br>").arg(aDimension).arg(aNbDimElements));
      anInfo.append(QString("Nb of nodes: <b>%1</b><br><br>").arg(aNbNodes));

      // information about the groups of the mesh
      _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
      _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
      _PTR(SObject) anObj;

      bool hasGroup = false;

      // info about groups on nodes
      aMeshSO->FindSubObject(SMESH::Tag_NodeGroups, anObj);
      if (anObj) {
        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (it->More()) {
          anInfo.append(QString("Groups:<br><br>"));
          hasGroup = true;
        }
        for ( ; it->More(); it->Next()) {
          _PTR(SObject) subObj = it->Value();
          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
          SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
          if (!aGroup->_is_nil()) {
            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
            anInfo.append(QString("%1<br>").arg("on nodes"));
            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
            // check if the group based on geometry
            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
            if (!aGroupOnGeom->_is_nil()) {
              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
              QString aShapeName = "<unknown>";
              _PTR(SObject) aGeomObj, aRef;
              if (subObj->FindSubObject(1, aGeomObj) &&  aGeomObj->ReferencedObject(aRef))
                aShapeName = aRef->GetName().c_str();
              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
            } else {
              anInfo.append(QString("<br>"));
            }
          }
        }
      }

      // info about groups on edges
      anObj.reset();
      aMeshSO->FindSubObject(SMESH::Tag_EdgeGroups, anObj);
      if (anObj) {
        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (!hasGroup && it->More()) {
          anInfo.append(QString("Groups:<br><br>"));
          hasGroup = true;
        }
        for ( ; it->More(); it->Next()) {
          _PTR(SObject) subObj = it->Value();
          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
          SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
          if (!aGroup->_is_nil()) {
            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
            anInfo.append(QString("%1<br>").arg("on edges"));
            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
            // check if the group based on geometry
            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
            if (!aGroupOnGeom->_is_nil()) {
              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
              QString aShapeName = "<unknown>";
              _PTR(SObject) aGeomObj, aRef;
              if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
                aShapeName = aRef->GetName().c_str();
              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
            } else {
              anInfo.append(QString("<br>"));
            }
          }
        }
      }

      // info about groups on faces
      anObj.reset();
      aMeshSO->FindSubObject(SMESH::Tag_FaceGroups, anObj);
      if (anObj) {
        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (!hasGroup && it->More()) {
          anInfo.append(QString("Groups:<br><br>"));
          hasGroup = true;
        }
        for ( ; it->More(); it->Next()) {
          _PTR(SObject) subObj = it->Value();
          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
          SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
          if (!aGroup->_is_nil()) {
            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
            anInfo.append(QString("%1<br>").arg("on faces"));
            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
            // check if the group based on geometry
            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
            if (!aGroupOnGeom->_is_nil()) {
              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
              QString aShapeName = "<unknown>";
              _PTR(SObject) aGeomObj, aRef;
              if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
                aShapeName = aRef->GetName().c_str();
              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
            } else {
              anInfo.append(QString("<br>"));
            }
          }
        }
      }

      // info about groups on volumes
      anObj.reset();
      aMeshSO->FindSubObject(SMESH::Tag_VolumeGroups, anObj);
      if (anObj) {
        _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
        if (!hasGroup && it->More())
          anInfo.append(QString("Groups:<br>"));
        for ( ; it->More(); it->Next()) {
          _PTR(SObject) subObj = it->Value();
          CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
          SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
          if (!aGroup->_is_nil()) {
            anInfo.append(QString("-   <b>%1</b><br>").arg(aGroup->GetName()));
            anInfo.append(QString("%1<br>").arg("on volumes"));
            anInfo.append(QString("%1<br>").arg(aGroup->Size()));
            // check if the group based on geometry
            SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
            if (!aGroupOnGeom->_is_nil()) {
              GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
              QString aShapeName = "<unknown>";
              _PTR(SObject) aGeomObj, aRef;
              if (subObj->FindSubObject(1, aGeomObj) &&  aGeomObj->ReferencedObject(aRef))
                aShapeName = aRef->GetName().c_str();
              anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
            } else {
              anInfo.append(QString("<br>"));
            }
          }
        }
      }

      myInfo->setText(anInfo);
      return;
    }
  }
}
void SMESHGUI_StandardMeshInfosDlg::keyPressEvent ( QKeyEvent *  e) [protected]

Definition at line 463 of file SMESHGUI_StandardMeshInfosDlg.cxx.

References onHelp().

{
  QDialog::keyPressEvent( e );
  if ( e->isAccepted() )
    return;

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    onHelp();
  }
}
void SMESHGUI_StandardMeshInfosDlg::onHelp ( ) [private, slot]

Definition at line 439 of file SMESHGUI_StandardMeshInfosDlg.cxx.

References myHelpFileName, and mySMESHGUI.

Referenced by keyPressEvent(), and SMESHGUI_StandardMeshInfosDlg().

{
  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
  if (app)
    app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
  else {
    QString platform;
#ifdef WIN32
    platform = "winapplication";
#else
    platform = "application";
#endif
    SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
                             tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
                             arg(app->resourceMgr()->stringValue("ExternalBrowser",
                                                                 platform)).
                             arg(myHelpFileName));
  }
}
void SMESHGUI_StandardMeshInfosDlg::onSelectionChanged ( ) [private, slot]
void SMESHGUI_StandardMeshInfosDlg::onStartSelection ( ) [private, slot]
void SMESHGUI_StandardMeshInfosDlg::windowActivationChange ( bool  oldActive) [protected]

Definition at line 394 of file SMESHGUI_StandardMeshInfosDlg.cxx.

References ActivateThisDialog(), and myIsActiveWindow.

{
  QDialog::windowActivationChange(oldActive);
  if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
    ActivateThisDialog();
  myIsActiveWindow = isActiveWindow();
}

Field Documentation

Definition at line 83 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by SMESHGUI_StandardMeshInfosDlg().

Definition at line 85 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by SMESHGUI_StandardMeshInfosDlg().

Definition at line 87 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by onHelp(), and SMESHGUI_StandardMeshInfosDlg().

QTextBrowser* SMESHGUI_StandardMeshInfosDlg.myInfo [private]

Definition at line 78 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by DumpMeshInfos(), and SMESHGUI_StandardMeshInfosDlg().

Definition at line 81 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by SMESHGUI_StandardMeshInfosDlg().

Definition at line 80 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by SMESHGUI_StandardMeshInfosDlg().

Definition at line 74 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by SMESHGUI_StandardMeshInfosDlg().

QPushButton* SMESHGUI_StandardMeshInfosDlg.myOkBtn [private]

Definition at line 84 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by SMESHGUI_StandardMeshInfosDlg().

Definition at line 75 of file SMESHGUI_StandardMeshInfosDlg.h.

Referenced by SMESHGUI_StandardMeshInfosDlg().

LightApp_SelectionMgr* SMESHGUI_StandardMeshInfosDlg.mySelectionMgr [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS