Version: 6.3.1
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Slots | Private Attributes

SMESHGUI_MeshDlg Class Reference

Dialog for mech creation or editing. More...

#include <SMESHGUI_MeshDlg.h>

Inheritance diagram for SMESHGUI_MeshDlg:
Inheritance graph
[legend]

Public Types

enum  Controls { Obj, Mesh, Geom }
enum  Dimensions { Dim0D = 0, Dim1D, Dim2D, Dim3D }
 

Describes dimensions.

More...

Signals

void hypoSet (const QString &)
void geomSelectionByMesh (bool)

Public Member Functions

 SMESHGUI_MeshDlg (const bool, const bool)
 Dialog for mech creation or editing.
virtual ~SMESHGUI_MeshDlg ()
SMESHGUI_MeshTabtab (const int) const
 Gets tab with given id.
void reset ()
 Resets all dialog fields.
void setCurrentTab (const int)
 Sets curent tab.
void setMaxHypoDim (const int)
 Enable/disable tabs.
void setHypoSets (const QStringList &)
 Sets list of available Sets of Hypotheses.
void setGeomPopupEnabled (const bool)
void disableTab (const int)
 Disable tab.
void enableTab (const int)
 Enable tabs.
bool isTabEnabled (const int) const
 Check if tab enabled.
int getActiveObject ()
virtual void show ()
virtual void setContentActive (const bool)
 set all content to enable (parameter is true) or disable state

Static Public Member Functions

static int prefix (const QString &)
 Return hard-coded prefix using to differ overlapping types.

Protected Member Functions

SUIT_Desktop * desktop () const
 find desktop of active application
SUIT_ResourceMgr * resourceMgr () const
 gets resource manager

Private Slots

void onHypoSetPopup (QAction *)
 Emits hypoSet signal.
void onGeomPopup (QAction *)
void onGeomSelectionButton (bool)

Private Attributes

QMap< int, SMESHGUI_MeshTab * > myTabs
QTabWidget * myTabWg
QToolButton * myHypoSetButton
QMenu * myGeomPopup

Detailed Description

Dialog for mech creation or editing.

This dialog is used for mech creation or editing.

Definition at line 52 of file SMESHGUI_MeshDlg.h.


Member Enumeration Documentation

Enumerator:
Obj 
Mesh 
Geom 

Definition at line 58 of file SMESHGUI_MeshDlg.h.

{ Obj, Mesh, Geom };

Describes dimensions.

Enumerator:
Dim0D 
Dim1D 
Dim2D 
Dim3D 

Definition at line 61 of file SMESHGUI_MeshDlg.h.

{ Dim0D = 0, Dim1D, Dim2D, Dim3D };      

Constructor & Destructor Documentation

SMESHGUI_MeshDlg::SMESHGUI_MeshDlg ( const bool  theToCreate,
const bool  theIsMesh 
)

Dialog for mech creation or editing.

This dialog is used for mech creation or editing.

Constructor

Parameters:
theToCreate- if this parameter is true then dialog is used for creation, for editing otherwise
theIsMesh- if this parameter is true then dialog is used for mesh, for sub-mesh otherwise

Makes dialog's look and feel

Definition at line 352 of file SMESHGUI_MeshDlg.cxx.

References Control(), Dim0D, Dim1D, Dim2D, Dim3D, Geom, Mesh, myGeomPopup, myHypoSetButton, myTabs, myTabWg, Obj, and SPACING.

: SMESHGUI_Dialog( 0, false, true )
{
  // Create top controls

  setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
  // name 
  createObject( tr( "NAME" ), mainFrame(), Obj );
  setNameIndication( Obj, OneName );
  setReadOnly( Obj, false );
  // mesh
  createObject( tr( "MESH" ), mainFrame(), Mesh );
  // geometry
  createObject( tr( "GEOMETRY" ), mainFrame(), Geom );
  myGeomPopup = 0;
  
  // Create tab widget
  
  myTabWg = new QTabWidget( mainFrame() );
  myTabs[ Dim0D ] = new SMESHGUI_MeshTab( myTabWg );
  myTabs[ Dim1D ] = new SMESHGUI_MeshTab( myTabWg );
  myTabs[ Dim2D ] = new SMESHGUI_MeshTab( myTabWg );
  myTabs[ Dim3D ] = new SMESHGUI_MeshTab( myTabWg );
  myTabWg->addTab( myTabs[ Dim3D ], tr( "DIM_3D" ) );
  myTabWg->addTab( myTabs[ Dim2D ], tr( "DIM_2D" ) );
  myTabWg->addTab( myTabs[ Dim1D ], tr( "DIM_1D" ) );
  myTabWg->addTab( myTabs[ Dim0D ], tr( "DIM_0D" ) );

  // Hypotheses Sets
  myHypoSetButton = new QToolButton( mainFrame() );
  myHypoSetButton->setText( tr( "HYPOTHESES_SETS" ) );
  myHypoSetButton->setEnabled( false );
  myHypoSetButton->setSizePolicy( QSizePolicy::MinimumExpanding, 
                                  myHypoSetButton->sizePolicy().verticalPolicy() );
  
  // Fill layout
  QGridLayout* aLay = new QGridLayout( mainFrame() );
  aLay->setMargin( 0 );
  aLay->setSpacing( SPACING );

  aLay->addWidget( objectWg( Obj,  Label ),   0, 0 );
  aLay->addWidget( objectWg( Obj,  Btn ),     0, 1 );
  aLay->addWidget( objectWg( Obj,  Control ), 0, 2 );
  aLay->addWidget( objectWg( Mesh, Label ),   1, 0 );
  aLay->addWidget( objectWg( Mesh, Btn ),     1, 1 );
  aLay->addWidget( objectWg( Mesh, Control ), 1, 2 );
  aLay->addWidget( objectWg( Geom, Label ),   2, 0 );
  aLay->addWidget( objectWg( Geom, Btn ),     2, 1 );
  aLay->addWidget( objectWg( Geom, Control ), 2, 2 );
  aLay->addWidget( myTabWg,                   4, 0, 1, 3 );
  aLay->addWidget( myHypoSetButton,           5, 0, 1, 3 );
  aLay->setRowMinimumHeight( 3, 20 );

  // Disable controls if necessary
  setObjectShown( Mesh, false );
  if ( theToCreate )
  {
    setWindowTitle( tr( "CREATE_MESH" ) );
    objectWg( Obj, Btn )->hide();
    if ( theIsMesh )
      setWindowTitle( tr( "CREATE_MESH" ) );
    else
    {
      setWindowTitle( tr( "CREATE_SUBMESH" ) );
      setObjectShown( Mesh, true );
    }
  }
  else
  {
    setWindowTitle( tr( "EDIT_MESH_SUBMESH" ) );
    objectWg( Mesh, Btn )->hide();
    objectWg( Geom, Btn )->hide();
  }
}
SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg ( ) [virtual]

Definition at line 427 of file SMESHGUI_MeshDlg.cxx.

{
}

Member Function Documentation

SUIT_Desktop * SMESHGUI_Dialog::desktop ( ) const [protected, inherited]

find desktop of active application

Definition at line 93 of file SMESHGUI_Dialog.cxx.

References ex13_hole1partial.d.

{
  SUIT_Desktop* d = 0;
  SUIT_Session* s = SUIT_Session::session();
  if( s )
  {
    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( s->activeApplication() );
    if( app )
      d = app->desktop();
  }
  return d;
}
void SMESHGUI_MeshDlg::disableTab ( const int  theTabId)

Disable tab.

Parameters:
int- tab ID

Definition at line 570 of file SMESHGUI_MeshDlg.cxx.

References Dim3D, myHypoSetButton, myTabs, and myTabWg.

Referenced by SMESHGUI_MeshOp.selectionDone(), and setMaxHypoDim().

                                                    {
  myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), false );
  if ( theTabId == Dim3D ) myHypoSetButton->setEnabled( false );
}
void SMESHGUI_MeshDlg::enableTab ( const int  theTabId)

Enable tabs.

Parameters:
int- tab ID

Definition at line 581 of file SMESHGUI_MeshDlg.cxx.

References Dim3D, myHypoSetButton, myTabs, and myTabWg.

Referenced by SMESHGUI_MeshOp.selectionDone(), and setMaxHypoDim().

                                                   {
  myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), true );
  if ( theTabId == Dim3D ) {
    QMenu* aHypoSetPopup = myHypoSetButton->menu();
    myHypoSetButton->setEnabled( aHypoSetPopup && !aHypoSetPopup->actions().isEmpty() );
  }
}
void SMESHGUI_MeshDlg.geomSelectionByMesh ( bool  ) [signal]

Referenced by onGeomPopup().

int SMESHGUI_MeshDlg::getActiveObject ( )

Definition at line 610 of file SMESHGUI_MeshDlg.cxx.

Referenced by SMESHGUI_MeshOp.onHypoCreated(), and SMESHGUI_MeshOp.onHypoEdited().

{
  for (int i = 0; i < 3; ++i )
    if ( isObjectShown( i ) &&
         (( QToolButton* )objectWg( i, Btn ))->isChecked())
      return i;
  return -1;
}
void SMESHGUI_MeshDlg.hypoSet ( const QString &  ) [signal]

Referenced by onHypoSetPopup().

bool SMESHGUI_MeshDlg::isTabEnabled ( const int  theTabId) const

Check if tab enabled.

Parameters:
int- tab ID

Definition at line 595 of file SMESHGUI_MeshDlg.cxx.

References myTabs, and myTabWg.

Referenced by SMESHGUI_MeshOp.isAccessibleDim().

                                                            {
  return myTabWg->isTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ) );
}
void SMESHGUI_MeshDlg::onGeomPopup ( QAction *  a) [private, slot]

Definition at line 605 of file SMESHGUI_MeshDlg.cxx.

References GEOM_BY_MESH_INDEX, and geomSelectionByMesh().

Referenced by setGeomPopupEnabled().

{
  emit geomSelectionByMesh( a->data().toInt() == GEOM_BY_MESH_INDEX );
}
void SMESHGUI_MeshDlg::onGeomSelectionButton ( bool  isBtnOn) [private, slot]

Definition at line 599 of file SMESHGUI_MeshDlg.cxx.

References myGeomPopup.

Referenced by setGeomPopupEnabled().

{
  if ( myGeomPopup && isBtnOn )
    myGeomPopup->exec( QCursor::pos() );
}
void SMESHGUI_MeshDlg::onHypoSetPopup ( QAction *  a) [private, slot]

Emits hypoSet signal.

SLOT is called when a hypotheses set is selected. Emits hypoSet signal to notify operation about this event

Definition at line 526 of file SMESHGUI_MeshDlg.cxx.

References hypoSet().

Referenced by setHypoSets().

{
  emit hypoSet( a->text() );
}
int SMESHGUI_Dialog::prefix ( const QString &  name) [static, inherited]

Return hard-coded prefix using to differ overlapping types.

Definition at line 110 of file SMESHGUI_Dialog.cxx.

Referenced by SMESHGUI_Dialog.SMESHGUI_Dialog(), and SMESHGUI_SelectionOp.typeById().

{
  if( name == "GEOM" )
    return 100;
  else if( name == "SMESH" )
    return 200;
  else if( name == "SMESH element" )
    return 300;
  else
    return 0;
}
void SMESHGUI_MeshDlg::reset ( )

Resets all dialog fields.

Definition at line 451 of file SMESHGUI_MeshDlg.cxx.

References Dim0D, Dim1D, Dim2D, Dim3D, and myTabs.

Referenced by SMESHGUI_MeshOp.selectionDone().

{
  clearSelection();
  myTabs[ Dim0D ]->reset();
  myTabs[ Dim1D ]->reset();
  myTabs[ Dim2D ]->reset();
  myTabs[ Dim3D ]->reset();
}
SUIT_ResourceMgr * SMESHGUI_Dialog::resourceMgr ( ) const [protected, inherited]

gets resource manager

Definition at line 126 of file SMESHGUI_Dialog.cxx.

Referenced by SMESHGUI_ComputeDlg.createMainFrame(), and SMESHGUI_GroupOnShapeDlg.SMESHGUI_GroupOnShapeDlg().

{
  return SUIT_Session::session()->resourceMgr();
}
void SMESHGUI_Dialog::setContentActive ( const bool  active) [virtual, inherited]

set all content to enable (parameter is true) or disable state

Definition at line 79 of file SMESHGUI_Dialog.cxx.

Referenced by SMESHGUI_Operation.setDialogActive().

{
  mainFrame()->setEnabled( active );
  setButtonEnabled( active, OK );
  setButtonEnabled( active, Apply );
  setButtonEnabled( active, Cancel );
  setButtonEnabled( active, Close );
  setButtonEnabled( active, Help );
}
void SMESHGUI_MeshDlg::setCurrentTab ( const int  theId)

Sets curent tab.

Definition at line 465 of file SMESHGUI_MeshDlg.cxx.

References Dim3D, and myTabWg.

Referenced by setMaxHypoDim(), and SMESHGUI_MeshOp.startOperation().

{
  myTabWg->setCurrentIndex( Dim3D - theId );
}
void SMESHGUI_MeshDlg::setGeomPopupEnabled ( const bool  enable)

Definition at line 540 of file SMESHGUI_MeshDlg.cxx.

References DIRECT_GEOM_INDEX, Geom, GEOM_BY_MESH_INDEX, myGeomPopup, onGeomPopup(), and onGeomSelectionButton().

Referenced by SMESHGUI_MeshOp.selectionDone(), and SMESHGUI_MeshOp.startOperation().

{
  if ( QToolButton* selBtn = qobject_cast<QToolButton*>( objectWg( Geom, Btn )))
  {
    if ( enable ) {
      if ( ! myGeomPopup ) {
        myGeomPopup = new QMenu();
        myGeomPopup->addAction( tr("DIRECT_GEOM_SELECTION") )->setData( DIRECT_GEOM_INDEX );
        myGeomPopup->addAction( tr("GEOM_BY_MESH_ELEM_SELECTION") )->setData( GEOM_BY_MESH_INDEX );
        connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) );
        connect( selBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
      }
    }
    else {
      disconnect( selBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
      if ( myGeomPopup ) {
        delete myGeomPopup;
        myGeomPopup = 0;
      }
    }
  }
}
void SMESHGUI_MeshDlg::setHypoSets ( const QStringList &  theSets)

Sets list of available Sets of Hypotheses.

Definition at line 501 of file SMESHGUI_MeshDlg.cxx.

References myHypoSetButton, and onHypoSetPopup().

Referenced by SMESHGUI_MeshOp.selectionDone().

{
  QMenu* aHypoSetPopup = myHypoSetButton->menu();
  if ( !aHypoSetPopup ) {
    aHypoSetPopup = new QMenu( myHypoSetButton );
    connect( aHypoSetPopup, SIGNAL( triggered( QAction* ) ), SLOT( onHypoSetPopup( QAction* ) ) );
    myHypoSetButton->setMenu( aHypoSetPopup );
    myHypoSetButton->setPopupMode( QToolButton::InstantPopup );
  }
  aHypoSetPopup->clear();
  for ( int i = 0, n = theSets.count(); i < n; i++ ) {
    aHypoSetPopup->addAction( theSets[ i ] );
  }
  myHypoSetButton->setEnabled( !aHypoSetPopup->isEmpty() );
}
void SMESHGUI_MeshDlg::setMaxHypoDim ( const int  maxDim)

Enable/disable tabs.

Parameters:
int- maximum possible dimention

Definition at line 477 of file SMESHGUI_MeshDlg.cxx.

References Dim0D, Dim3D, disableTab(), enableTab(), myTabs, myTabWg, and setCurrentTab().

Referenced by SMESHGUI_MeshOp.selectionDone().

{
  const int DIM = maxDim;
  for ( int dim = Dim0D; dim <= Dim3D; ++dim ) {
    bool enable = ( dim <= DIM );
    if ( !enable ) {
      myTabs[ dim ]->reset();
      disableTab( dim );
    }
    else {
      enableTab( dim );
    }
  }
  // deselect desabled tab
  if ( !myTabWg->isTabEnabled( myTabWg->currentIndex() ) )
    setCurrentTab( DIM );
}
void SMESHGUI_Dialog::show ( ) [virtual, inherited]
SMESHGUI_MeshTab * SMESHGUI_MeshDlg::tab ( const int  theId) const

Gets tab with given id.

Parameters:
theId- Tab identifier. Possible values are in "Dimensions" enumeration
Return values:
SMESHGUI_MeshTab*- pointer to the tab or null if given parameter is invalid

Gets tab containing controls for definition of algorithms and AddHypotheses

Definition at line 441 of file SMESHGUI_MeshDlg.cxx.

References Dim0D, Dim3D, and myTabs.

Referenced by SMESHGUI_MeshOp.currentHyp(), getTabDim(), SMESHGUI_MeshOp.onAlgoSelected(), SMESHGUI_MeshOp.onHypoCreated(), SMESHGUI_MeshOp.processSet(), SMESHGUI_MeshOp.readMesh(), SMESHGUI_MeshOp.selectionDone(), SMESHGUI_MeshOp.setCurrentHyp(), and SMESHGUI_MeshOp.startOperation().

{
  return ( theId >= Dim0D && theId <= Dim3D ? myTabs[ theId ] : 0 );
}

Field Documentation

QMenu* SMESHGUI_MeshDlg.myGeomPopup [private]

Definition at line 91 of file SMESHGUI_MeshDlg.h.

Referenced by onGeomSelectionButton(), setGeomPopupEnabled(), and SMESHGUI_MeshDlg().

QToolButton* SMESHGUI_MeshDlg.myHypoSetButton [private]

Definition at line 90 of file SMESHGUI_MeshDlg.h.

Referenced by disableTab(), enableTab(), setHypoSets(), and SMESHGUI_MeshDlg().

QTabWidget* SMESHGUI_MeshDlg.myTabWg [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