Back to index

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

#include <RepairGUI_SewingDlg.h>

List of all members.

Public Member Functions

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

Protected Member Functions

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

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void LineEditReturnPressed ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void onDetect ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)
void initSelection ()

Private Attributes

GEOM::GEOM_Object_var myObject
DlgRef_1SelExt * GroupPoints
SalomeApp_DoubleSpinBox * myTolEdt
QPushButton * myFreeBoundBtn
int myClosed
int myOpen

Detailed Description

Definition at line 40 of file RepairGUI_SewingDlg.h.


Constructor & Destructor Documentation

RepairGUI_SewingDlg::RepairGUI_SewingDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0,
bool  modal = false 
)

Definition at line 54 of file RepairGUI_SewingDlg.cxx.

  : GEOMBase_Skeleton( theGeometryGUI, parent, modal )
{
  QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SEWING" ) ) );
  QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );

  setWindowTitle( tr( "GEOM_SEWING_TITLE" ) );

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SEWING_TITLE" ) );
  mainFrame()->RadioButton1->setIcon( image0 );
  mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
  mainFrame()->RadioButton2->close();
  mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
  mainFrame()->RadioButton3->close();

  GroupPoints = new DlgRef_1SelExt( centralWidget() );
  GroupPoints->GroupBox1->setTitle( tr( "GEOM_SEWING" ) );
  GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
  GroupPoints->PushButton1->setIcon( image1 );
  GroupPoints->LineEdit1->setReadOnly( true );

  QGridLayout* aLay = new QGridLayout( GroupPoints->Box );
  aLay->setMargin( 0 ); aLay->setSpacing( 6 );
  myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
  initSpinBox( myTolEdt, 0.0, 100.0, DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
  myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
  QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
  myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GEOM_FREE_BOUNDARIES" ) ), 
                                    GroupPoints->Box );
  aLay->addWidget( aLbl1,          0, 0 );
  aLay->addWidget( myTolEdt,       0, 1 );
  aLay->addWidget( myFreeBoundBtn, 1, 0, 1, 2 );

  QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
  layout->setMargin( 0 ); layout->setSpacing( 6 );
  layout->addWidget( GroupPoints );
  /***************************************************************/

  setHelpFileName( "sewing_operation_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 104 of file RepairGUI_SewingDlg.cxx.

{
}

Member Function Documentation

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

Definition at line 229 of file RepairGUI_SewingDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();
  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );

  GroupPoints->LineEdit1->setText( "" );
  myObject = GEOM::GEOM_Object::_nil();

  myClosed = -1;
  myOpen = -1;

  //myGeomGUI->SetState( 0 );
  initSelection();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool RepairGUI_SewingDlg::ClickOnApply ( ) [private, slot]

Definition at line 159 of file RepairGUI_SewingDlg.cxx.

{
  if ( !onAccept() )
        return false;

  initName();

  GroupPoints->LineEdit1->setText( "" );
  myObject = GEOM::GEOM_Object::_nil();

  initSelection();

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RepairGUI_SewingDlg::ClickOnOk ( ) [private, slot]

Definition at line 148 of file RepairGUI_SewingDlg.cxx.

{
  setIsApplyAndClose( true );
  if ( ClickOnApply() )
    ClickOnCancel();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 261 of file RepairGUI_SewingDlg.cxx.

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

Definition at line 250 of file RepairGUI_SewingDlg.cxx.

{
  if ( !mainFrame()->GroupConstructors->isEnabled() )
    ActivateThisDialog();
}

Here is the call graph for this function:

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

Definition at line 281 of file RepairGUI_SewingDlg.cxx.

{
  bool aResult = false;
  GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );

  if ( IsPreview() ) { // called from onDetect(): detect free boundary edges, highlight them (add to objects), display message dialog
    GEOM::ListOfGO_var aClosed, anOpen;

    aResult = anOper->GetFreeBoundary( myObject, aClosed, anOpen );

    if ( aResult ) {
      myClosed = aClosed->length();
      myOpen = anOpen->length();
      int i;
      for ( i = 0; i < myClosed; i++ )
        objects.push_back( aClosed[i]._retn() );
      for ( i = 0; i < myOpen; i++ )
        objects.push_back( anOpen[i]._retn() );
    }
    else
      myClosed = -1;
  }
  else {
    GEOM::GEOM_Object_var anObj = anOper->Sew( myObject, myTolEdt->value() );
    aResult = !anObj->_is_nil();
    if ( aResult )
    {
      if ( !IsPreview() )
      {
        QStringList aParameters;
        aParameters << myTolEdt->text();
        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
      }
      objects.push_back( anObj._retn() );
    }
  }

  return aResult;
}
void RepairGUI_SewingDlg::Init ( ) [private]

Definition at line 113 of file RepairGUI_SewingDlg.cxx.

{
  /* init variables */
  myEditCurrentArgument = GroupPoints->LineEdit1;

  myObject = GEOM::GEOM_Object::_nil();

  //myGeomGUI->SetState( 0 );
  initSelection();

  myClosed = -1;
  myOpen = -1;
        
  /* signals and slots connections */
  connect( buttonOk(),    SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
  connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );

  connect( GroupPoints->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
  connect( GroupPoints->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );

  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );

  connect( myFreeBoundBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );

  initName( tr( "SEWING_NEW_OBJ_NAME" ) );
  resize(100,100);
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 325 of file RepairGUI_SewingDlg.cxx.

{
  TColStd_MapOfInteger aTypes;
  aTypes.Add( GEOM_SHELL );
  aTypes.Add( GEOM_SOLID );
  aTypes.Add( GEOM_COMPOUND );
  globalSelection( aTypes );
}

Here is the caller graph for this function:

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

Definition at line 270 of file RepairGUI_SewingDlg.cxx.

{
  myClosed = -1;
  bool ok = myTolEdt->isValid( msg, !IsPreview() );
  return !myObject->_is_nil() && ( IsPreview() || myTolEdt->value() > 0. ) && ok;
}

Definition at line 215 of file RepairGUI_SewingDlg.cxx.

{
  const QObject* send = sender();
  if( send == GroupPoints->LineEdit1 ) {
    myEditCurrentArgument = GroupPoints->LineEdit1;
    GEOMBase_Skeleton::LineEditReturnPressed();
  }
}

Here is the caller graph for this function:

void RepairGUI_SewingDlg::onDetect ( ) [private, slot]

Definition at line 338 of file RepairGUI_SewingDlg.cxx.

{
  displayPreview( true, false, true, true, 3 );

  // field myClosed,myOpen is initialized in execute() method, called by displayPreview().
  QString msg;
  if ( myClosed != -1 )
    msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen );
  else
    msg = tr( "GEOM_FREE_BOUNDS_ERROR" );
  SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg );
}

Here is the caller graph for this function:

Definition at line 179 of file RepairGUI_SewingDlg.cxx.

{
  erasePreview();
  myEditCurrentArgument->setText( "" );
  myObject = GEOM::GEOM_Object::_nil();

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

  if ( aSelList.Extent() == 1 ) {
    Handle(SALOME_InteractiveObject) anIO = aSelList.First();
    myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
    if ( !CORBA::is_nil( myObject ) )
      myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 201 of file RepairGUI_SewingDlg.cxx.

{
  const QObject* send = sender();
  if ( send == GroupPoints->PushButton1 ) {
    myEditCurrentArgument->setFocus();
    SelectionIntoArgument();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

DlgRef_1SelExt* RepairGUI_SewingDlg::GroupPoints [private]

Definition at line 62 of file RepairGUI_SewingDlg.h.

Definition at line 66 of file RepairGUI_SewingDlg.h.

QPushButton* RepairGUI_SewingDlg::myFreeBoundBtn [private]

Definition at line 64 of file RepairGUI_SewingDlg.h.

GEOM::GEOM_Object_var RepairGUI_SewingDlg::myObject [private]

Definition at line 60 of file RepairGUI_SewingDlg.h.

Definition at line 67 of file RepairGUI_SewingDlg.h.

SalomeApp_DoubleSpinBox* RepairGUI_SewingDlg::myTolEdt [private]

Definition at line 63 of file RepairGUI_SewingDlg.h.


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