Back to index

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

#include <TransformationGUI_OffsetDlg.h>

List of all members.

Public Member Functions

 TransformationGUI_OffsetDlg (GeometryGUI *, QWidget *=0, bool=false, Qt::WindowFlags=0)
 ~TransformationGUI_OffsetDlg ()

Protected Member Functions

virtual GEOM::GEOM_IOperations_ptr createOperation ()
virtual bool isValid (QString &)
virtual bool execute (ObjectList &)
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr)

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void ValueChangedInSpinBox ()
void CreateCopyModeChanged ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)
double GetOffset () const

Private Attributes

QList< GEOM::GeomObjPtrmyObjects
DlgRef_1Sel1Spin1Check * GroupPoints

Detailed Description

Definition at line 39 of file TransformationGUI_OffsetDlg.h.


Constructor & Destructor Documentation

TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg ( GeometryGUI *  theGeometryGUI,
QWidget *  parent = 0,
bool  modal = false,
Qt::WindowFlags  fl = 0 
)

Definition at line 45 of file TransformationGUI_OffsetDlg.cxx.

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

  setWindowTitle( tr( "GEOM_OFFSET_TITLE" ) );

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle( tr( "GEOM_OFFSET" ) );
  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_1Sel1Spin1Check( centralWidget() );
  GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
  GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
  GroupPoints->TextLabel2->setText( tr( "GEOM_OFFSET" ) );
  GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );

  // san -- modification of an exisitng object by offset is not allowed
  GroupPoints->CheckButton1->hide();

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

  setHelpFileName( "offset_operation_page.html" );
  
  Init();
}

Here is the call graph for this function:

Definition at line 89 of file TransformationGUI_OffsetDlg.cxx.

{  
  /* no need to delete child widgets, Qt does it all for us */
}

Member Function Documentation

Definition at line 216 of file TransformationGUI_OffsetDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();
  connect( myGeomGUI->getApp()->selectionMgr(), 
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
  globalSelection( GEOM_ALLSHAPES );
  myEditCurrentArgument = GroupPoints->LineEdit1;
  myEditCurrentArgument->setFocus();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 155 of file TransformationGUI_OffsetDlg.cxx.

{
  if ( !onAccept( GroupPoints->CheckButton1->isChecked() ) )
    return false;
  
  initName();
  return true;
}

Here is the caller graph for this function:

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

Definition at line 143 of file TransformationGUI_OffsetDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 327 of file TransformationGUI_OffsetDlg.cxx.

{
  mainFrame()->GroupBoxName->setEnabled( GroupPoints->CheckButton1->isChecked() );
}

Here is the caller graph for this function:

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

Definition at line 241 of file TransformationGUI_OffsetDlg.cxx.

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

Definition at line 205 of file TransformationGUI_OffsetDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 266 of file TransformationGUI_OffsetDlg.cxx.

{
  bool res = false;
  
  GEOM::GEOM_Object_var anObj;
  
  GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());

  if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
    for ( int i = 0; i < myObjects.count(); i++ ) {
      
      anObj = anOper->OffsetShapeCopy( myObjects[i].get(), GetOffset() );
      if ( !anObj->_is_nil() ) {
        if(!IsPreview()) {
          anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
        }
        objects.push_back( anObj._retn() );
      }
    }
  }
  else {
    for ( int i = 0; i < myObjects.count(); i++ ) {
      anObj = anOper->OffsetShape( myObjects[i].get(), GetOffset() );
      if ( !anObj->_is_nil() )
        objects.push_back( anObj._retn() );
    }
  }
  res = true;
    
  return res;
}

Here is the call graph for this function:

double TransformationGUI_OffsetDlg::GetOffset ( ) const [private]

Definition at line 318 of file TransformationGUI_OffsetDlg.cxx.

{
  return GroupPoints->SpinBox_DX->value();
}

Here is the caller graph for this function:

Definition at line 99 of file TransformationGUI_OffsetDlg.cxx.

{  
  /* init variables */
  myEditCurrentArgument = GroupPoints->LineEdit1;
  GroupPoints->LineEdit1->setReadOnly( true );

  myObjects.clear();
  
  /* Get setting of step value from file configuration */
  double step = 1;
   
  /* min, max, step and decimals for spin boxes & initial values */
  initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
  GroupPoints->SpinBox_DX->setValue( 1e-05 );
  
  // Activate Create a Copy mode
  GroupPoints->CheckButton1->setChecked( true );
  CreateCopyModeChanged();

  mainFrame()->GroupBoxPublish->show();

  /* 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( myGeomGUI->getApp()->selectionMgr(), 
           SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );

  connect( GroupPoints->SpinBox_DX,   SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
  connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ),        this, SLOT( CreateCopyModeChanged() ) );
  
  initName( tr( "GEOM_OFFSET" ) );

  globalSelection( GEOM_ALLSHAPES );
  resize(100,100);
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 250 of file TransformationGUI_OffsetDlg.cxx.

{
  bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myObjects.isEmpty();
  for ( int i = 0; i < myObjects.count() && ok; i++ ) {
    GEOM::shape_type aType = myObjects[i]->GetShapeType();
    ok = aType == GEOM::FACE || aType == GEOM::SHELL || aType == GEOM::SOLID;
    if ( !ok )
      msg = tr( "ERROR_SHAPE_TYPE" );
  }
  return ok;
}
void TransformationGUI_OffsetDlg::restoreSubShapes ( SALOMEDS::Study_ptr  theStudy,
SALOMEDS::SObject_ptr  theSObject 
) [protected, virtual]

Definition at line 302 of file TransformationGUI_OffsetDlg.cxx.

{
  if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
    // empty list of arguments means that all arguments should be restored
    getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
                                         /*theFindMethod=*/GEOM::FSM_Transformed,
                                         /*theInheritFirstArg=*/true,
                                         mainFrame()->CheckBoxAddPrefix->isChecked() );
  }
}

Definition at line 169 of file TransformationGUI_OffsetDlg.cxx.

{
  myObjects = getSelected( TopAbs_SHAPE, -1 );
  if ( !myObjects.isEmpty() ) {
    QString aName = myObjects.count() > 1 ? QString( "%1_objects").arg( myObjects.count() ) : GEOMBase::GetName( myObjects[0].get() );
    myEditCurrentArgument->setText( aName );
  }
  else {
    myEditCurrentArgument->setText("");
  }

  processPreview();
}

Here is the caller graph for this function:

Definition at line 188 of file TransformationGUI_OffsetDlg.cxx.

{
  QPushButton* send = (QPushButton*)sender();
  
  if ( send == GroupPoints->PushButton1 ) {
    GroupPoints->PushButton1->setDown(true);
    myEditCurrentArgument = GroupPoints->LineEdit1;
    myEditCurrentArgument->setFocus();
    SelectionIntoArgument();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 231 of file TransformationGUI_OffsetDlg.cxx.

{
  processPreview();
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_1Sel1Spin1Check* TransformationGUI_OffsetDlg::GroupPoints [private]

Definition at line 63 of file TransformationGUI_OffsetDlg.h.

Definition at line 61 of file TransformationGUI_OffsetDlg.h.


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