Back to index

salome-geom  6.5.0
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
RepairGUI_FreeFacesDlg Class Reference

#include <RepairGUI_FreeFacesDlg.h>

List of all members.

Public Member Functions

 RepairGUI_FreeFacesDlg (GeometryGUI *, QWidget *=0, bool=false)
 ~RepairGUI_FreeFacesDlg ()

Protected Member Functions

virtual GEOM::GEOM_IOperations_ptr createOperation ()
virtual bool isValid (QString &)
virtual bool execute (ObjectList &)

Private Slots

void onClose ()
void onHelp ()
void onDeactivate ()
void onActivate ()
void onSelectionDone ()
void onSetEditCurrentArgument ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)
void closeEvent (QCloseEvent *)
void keyPressEvent (QKeyEvent *)
void activateSelection ()
GEOM_Displayer * getDisplayer ()

Private Attributes

GEOM_Displayer * myDisplayer
GEOM::GEOM_Object_var myObj
QPushButton * mySelBtn
QLineEdit * myEdit
GeometryGUI * myGeomGUI
QString myHelpFileName

Detailed Description

Definition at line 42 of file RepairGUI_FreeFacesDlg.h.


Constructor & Destructor Documentation

RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg ( GeometryGUI *  GUI,
QWidget *  parent = 0,
bool  modal = false 
)

Definition at line 69 of file RepairGUI_FreeFacesDlg.cxx.

  : QDialog( parent, 0 ),
    GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
    myGeomGUI( GUI ), 
    myDisplayer( 0 )
{
  setAttribute( Qt::WA_DeleteOnClose );

  setSizeGripEnabled( true );

  QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );

  setWindowTitle( tr( "GEOM_FREE_FACES_TITLE" ) );

  /***************************************************************/

  QGroupBox* aMainGrp = new QGroupBox( tr( "GEOM_SELECTED_SHAPE" ), this );
  
  QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
  mySelBtn = new QPushButton( aMainGrp );
  mySelBtn->setIcon( image1 );
  myEdit = new QLineEdit( aMainGrp );
  myEdit->setReadOnly( true );
  myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
  myEdit->setMinimumWidth( MIN_WIDTH );

  QHBoxLayout* aMainLay = new QHBoxLayout( aMainGrp );
  aMainLay->setSpacing( SPACING );
  aMainLay->setMargin( MARGIN );
  aMainLay->addWidget( lab );
  aMainLay->addWidget( mySelBtn );
  aMainLay->addWidget( myEdit );

  QFrame* aFrame = new QFrame( this );
  aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
  QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame );
  QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame );

  QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame );
  aBtnLay->setSpacing( SPACING );
  aBtnLay->setMargin( MARGIN );
  aBtnLay->addWidget( aCloseBtn );
  aBtnLay->addSpacing( SPACING );
  aBtnLay->addStretch();
  aBtnLay->addWidget( aHelpBtn );

  QVBoxLayout* aLay = new QVBoxLayout( this );
  aLay->setSpacing( SPACING );
  aLay->setMargin( MARGIN );
  aLay->addWidget( aMainGrp );
  aLay->addStretch();
  aLay->addWidget( aFrame );

  myHelpFileName = "using_measurement_tools_page.html#faces_anchor";

  connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
  connect( aHelpBtn,  SIGNAL( clicked() ), SLOT( onHelp() ) );
  connect( mySelBtn,  SIGNAL( clicked() ),
           this,      SLOT  ( onSetEditCurrentArgument() ) );
  /***************************************************************/

  Init();
}

Here is the call graph for this function:

Definition at line 139 of file RepairGUI_FreeFacesDlg.cxx.

{
}

Member Function Documentation

Definition at line 268 of file RepairGUI_FreeFacesDlg.cxx.

{
  TColStd_MapOfInteger aMap;
  aMap.Add( GEOM_SOLID );
  aMap.Add( GEOM_COMPOUND );
  globalSelection( aMap );
}

Here is the caller graph for this function:

void RepairGUI_FreeFacesDlg::closeEvent ( QCloseEvent *  ) [private]

Definition at line 280 of file RepairGUI_FreeFacesDlg.cxx.

{
  onClose();
}

Here is the call graph for this function:

GEOM::GEOM_IOperations_ptr RepairGUI_FreeFacesDlg::createOperation ( ) [protected, virtual]

Definition at line 289 of file RepairGUI_FreeFacesDlg.cxx.

{
  return getGeomEngine()->GetIShapesOperations( getStudyId() );
}
void RepairGUI_FreeFacesDlg::enterEvent ( QEvent *  ) [private]

Definition at line 259 of file RepairGUI_FreeFacesDlg.cxx.

{
  onActivate();
}

Here is the call graph for this function:

bool RepairGUI_FreeFacesDlg::execute ( ObjectList objects) [protected, virtual]

Definition at line 307 of file RepairGUI_FreeFacesDlg.cxx.

{
  bool aResult = false;
  GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
  GEOM::ListOfLong_var aFaceLst = anOper->GetFreeFacesIDs( myObj );
  TopoDS_Shape aSelShape;
  TopoDS_Shape aFace; 
  TopTools_IndexedMapOfShape anIndices;
  if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) {
    myEdit->setText( GEOMBase::GetName( myObj ) );
    QString aMess;
    if ( !isValid( aMess ) ) {
      erasePreview( true );
      return false;
    }
    
    SUIT_OverrideCursor();

    TopExp::MapShapes( aSelShape, anIndices);
    SALOME_Prs* aPrs = 0;
    
    for ( int i = 0, n = aFaceLst->length(); i < n; i++ ) {
      aFace = anIndices.FindKey( aFaceLst[i] );
      try {
        getDisplayer()->SetColor( Quantity_NOC_RED );
        getDisplayer()->SetToActivate( false );
        aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0;
        if ( aPrs )
          displayPreview( aPrs, true );
      }
      catch( const SALOME::SALOME_Exception& e )
      {
        SalomeApp_Tools::QtCatchCorbaException( e );
      }
    }
  }
  return aResult;
}

Here is the call graph for this function:

GEOM_Displayer * RepairGUI_FreeFacesDlg::getDisplayer ( ) [private]

Definition at line 350 of file RepairGUI_FreeFacesDlg.cxx.

{
  if ( !myDisplayer )
    myDisplayer = new GEOM_Displayer( getStudy() );
  return myDisplayer;
}

Here is the caller graph for this function:

void RepairGUI_FreeFacesDlg::Init ( ) [private]

Definition at line 212 of file RepairGUI_FreeFacesDlg.cxx.

{
  myObj = GEOM::GEOM_Object::_nil();

  /* signals and slots connections */
  connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT  ( onDeactivate() ) );
  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 
           SIGNAL( currentSelectionChanged() ), SLOT  ( onSelectionDone() ) );

  activateSelection();
  onSelectionDone();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool RepairGUI_FreeFacesDlg::isValid ( QString &  ) [protected, virtual]

Definition at line 298 of file RepairGUI_FreeFacesDlg.cxx.

{
  return !myObj->_is_nil() ;
}

Here is the caller graph for this function:

void RepairGUI_FreeFacesDlg::keyPressEvent ( QKeyEvent *  e) [private]

Definition at line 371 of file RepairGUI_FreeFacesDlg.cxx.

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

  if ( e->key() == Qt::Key_F1 ) {
    e->accept();
    onHelp();
  }
}

Here is the call graph for this function:

void RepairGUI_FreeFacesDlg::onActivate ( ) [private, slot]

Definition at line 198 of file RepairGUI_FreeFacesDlg.cxx.

{
  myGeomGUI->EmitSignalDeactivateDialog();
  setEnabled( true );
  myGeomGUI->SetActiveDialogBox( this );
  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 
           SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
  activateSelection();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RepairGUI_FreeFacesDlg::onClose ( ) [private, slot]

Definition at line 148 of file RepairGUI_FreeFacesDlg.cxx.

{
  globalSelection();
  disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
  myGeomGUI->SetActiveDialogBox( 0 );
  reject();
  erasePreview();
}

Here is the caller graph for this function:

void RepairGUI_FreeFacesDlg::onDeactivate ( ) [private, slot]

Definition at line 186 of file RepairGUI_FreeFacesDlg.cxx.

{
  setEnabled( false );
  globalSelection();
  disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
  myGeomGUI->SetActiveDialogBox( 0 );
}

Here is the caller graph for this function:

void RepairGUI_FreeFacesDlg::onHelp ( ) [private, slot]

Definition at line 161 of file RepairGUI_FreeFacesDlg.cxx.

{
  LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
  if ( app )
    app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->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 ) );
  }
}

Here is the caller graph for this function:

void RepairGUI_FreeFacesDlg::onSelectionDone ( ) [private, slot]

Definition at line 229 of file RepairGUI_FreeFacesDlg.cxx.

{
  erasePreview();

  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
  SALOME_ListIO aSelList;
  aSelMgr->selectedObjects(aSelList);

  if ( aSelList.Extent() != 1 ) {
    myEdit->setText( "" );
    return;
  }

  GEOM::GEOM_Object_var anObj =
    GEOMBase::ConvertIOinGEOMObject( aSelList.First() );

  if ( !GEOMBase::IsShape( anObj ) ) {
    myEdit->setText( "" );
    return;
  }
  else {
    myObj = anObj;
    displayPreview( true, false, true, true, 3 );
  }
}

Here is the caller graph for this function:

Definition at line 361 of file RepairGUI_FreeFacesDlg.cxx.

{
  myEdit->setFocus();
  onSelectionDone();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

GEOM_Displayer* RepairGUI_FreeFacesDlg::myDisplayer [private]

Definition at line 74 of file RepairGUI_FreeFacesDlg.h.

QLineEdit* RepairGUI_FreeFacesDlg::myEdit [private]

Definition at line 77 of file RepairGUI_FreeFacesDlg.h.

GeometryGUI* RepairGUI_FreeFacesDlg::myGeomGUI [private]

Definition at line 78 of file RepairGUI_FreeFacesDlg.h.

Definition at line 79 of file RepairGUI_FreeFacesDlg.h.

GEOM::GEOM_Object_var RepairGUI_FreeFacesDlg::myObj [private]

Definition at line 75 of file RepairGUI_FreeFacesDlg.h.

QPushButton* RepairGUI_FreeFacesDlg::mySelBtn [private]

Definition at line 76 of file RepairGUI_FreeFacesDlg.h.


The documentation for this class was generated from the following files: