Back to index

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

#include <BasicGUI_CurveDlg.h>

Collaboration diagram for BasicGUI_CurveDlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Protected Member Functions

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

Private Slots

void ClickOnOk ()
bool ClickOnApply ()
void ActivateThisDialog ()
void DeactivateActiveDialog ()
void ConstructorsClicked (int)
void CheckButtonToggled ()
void SelectionIntoArgument ()
void SetEditCurrentArgument ()
void CreationModeChanged ()
void ValueChangedInSpinBox (double)
void ValueChangedInSpinBox (int)
void OnEditingFinished ()

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

DlgRef_1Sel3Check * GroupPoints
QList< GEOM::GeomObjPtrmyPoints
QRadioButton * myAnaliticalBtn
QRadioButton * myBySelectionBtn
BasicGUI_ParamCurveWidgetmyParams

Detailed Description

Definition at line 43 of file BasicGUI_CurveDlg.h.


Constructor & Destructor Documentation

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

Definition at line 58 of file BasicGUI_CurveDlg.cxx.

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

  setWindowTitle( tr( "GEOM_CURVE_TITLE" ) );

  /***************************************************************/
  mainFrame()->RadioButton1->setIcon( image0 );
  mainFrame()->RadioButton2->setIcon( image3 );
  mainFrame()->RadioButton3->setIcon( image2 );

  QGroupBox* creationModeCroup = new QGroupBox(this);
  QButtonGroup* bg = new QButtonGroup(this);

  creationModeCroup->setTitle( tr( "GEOM_CURVE_CRMODE" ) );  
  QHBoxLayout * creationModeLayout = new QHBoxLayout(creationModeCroup);
  myBySelectionBtn = new QRadioButton(  tr( "GEOM_CURVE_SELECTION" ) ,creationModeCroup );
  myAnaliticalBtn = new QRadioButton(  tr( "GEOM_CURVE_ANALITICAL" ) ,creationModeCroup );

  bg->addButton(myBySelectionBtn);
  bg->addButton(myAnaliticalBtn);
  
  creationModeLayout->addWidget(myBySelectionBtn);
  creationModeLayout->addWidget(myAnaliticalBtn);

  GroupPoints = new DlgRef_1Sel3Check( centralWidget() );

  GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) );
  GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) );
  GroupPoints->PushButton1->setIcon( image1 );
  GroupPoints->PushButton1->setDown( true );

  GroupPoints->LineEdit1->setReadOnly( true );

  GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
  GroupPoints->CheckButton1->setChecked(false);
  //GroupPoints->CheckButton1->hide();

  GroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) );
  GroupPoints->CheckButton2->setChecked(false);
  GroupPoints->CheckButton2->hide();

  GroupPoints->CheckButton3->hide();

  myParams = new BasicGUI_ParamCurveWidget( centralWidget() );

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

  setHelpFileName( "create_curve_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 126 of file BasicGUI_CurveDlg.cxx.

{
}

Member Function Documentation

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

Definition at line 330 of file BasicGUI_CurveDlg.cxx.

{
  GEOMBase_Skeleton::ActivateThisDialog();
  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
           this, SLOT( SelectionIntoArgument() ) );

  globalSelection(); // close local contexts, if any
  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );

  ConstructorsClicked( getConstructorId() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_CurveDlg::addSubshapesToStudy ( ) [protected, virtual]

Definition at line 469 of file BasicGUI_CurveDlg.cxx.

{
  for ( int i = 0; i < myPoints.count(); i++ )
    GEOMBase::PublishSubObject( myPoints[i].get() );
}
void BasicGUI_CurveDlg::CheckButtonToggled ( ) [private, slot]

Definition at line 253 of file BasicGUI_CurveDlg.cxx.

{
  processPreview();
}

Here is the caller graph for this function:

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

Definition at line 273 of file BasicGUI_CurveDlg.cxx.

{
  if ( !onAccept() )
    return false;

  initName();
  globalSelection(); // close local contexts, if any
  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
  return true;
}

Here is the caller graph for this function:

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

Definition at line 262 of file BasicGUI_CurveDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_CurveDlg::ConstructorsClicked ( int  id) [private, slot]

Definition at line 206 of file BasicGUI_CurveDlg.cxx.

{
  QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" );
  mainFrame()->GroupConstructors->setTitle( aTitle );

  if (id == 0) { // polyline (wire)
    //GroupPoints->CheckButton1->hide();
    GroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) );
    GroupPoints->CheckButton2->hide();
  }
  else if (id == 1) { // bezier
    //GroupPoints->CheckButton1->hide();
    GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
    GroupPoints->CheckButton2->hide();
  }
  else { // b-spline
    //GroupPoints->CheckButton1->show();
    GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
    GroupPoints->CheckButton2->show();
  }

  myPoints.clear();

  myEditCurrentArgument->setText( "" );
  qApp->processEvents();
  updateGeometry();
  resize( minimumSizeHint() );
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 366 of file BasicGUI_CurveDlg.cxx.

{
  return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
}
void BasicGUI_CurveDlg::CreationModeChanged ( ) [private, slot]

Definition at line 479 of file BasicGUI_CurveDlg.cxx.

                                            {
  const QObject* s = sender();
  GroupPoints->setVisible(myBySelectionBtn == s);
  myParams->setVisible(myBySelectionBtn != s);
  
  ConstructorsClicked( getConstructorId() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 346 of file BasicGUI_CurveDlg.cxx.

{
  // myGeomGUI->SetState( -1 );
  GEOMBase_Skeleton::DeactivateActiveDialog();
}

Here is the caller graph for this function:

void BasicGUI_CurveDlg::enterEvent ( QEvent *  ) [private]

Definition at line 356 of file BasicGUI_CurveDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 394 of file BasicGUI_CurveDlg.cxx.

{
  bool res = false;

  GEOM::GEOM_Object_var anObj;

  GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() );

  GEOM::ListOfGO_var points = new GEOM::ListOfGO();
  points->length( myPoints.count() );
  for ( int i = 0; i < myPoints.count(); i++ )
    points[i] = myPoints[i].copy();

  switch ( getConstructorId() ) {
  case 0 :
    if( myBySelectionBtn->isChecked() )
      anObj = anOper->MakePolyline( points.in(), GroupPoints->CheckButton1->isChecked() );
    else
      anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()),
                                     qPrintable(myParams->myYExpr->text()),
                                     qPrintable(myParams->myZExpr->text()),
                                     myParams->myPMin->value(),
                                     myParams->myPMax->value(),
                                     myParams->myPStep->value(),
                                     GEOM::Polyline);
    res = true;
    break;
  case 1 :
    if( myBySelectionBtn->isChecked() )
      anObj = anOper->MakeSplineBezier( points.in(), GroupPoints->CheckButton1->isChecked() );
    else
      anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()),
                                     qPrintable(myParams->myYExpr->text()),
                                     qPrintable(myParams->myZExpr->text()),
                                     myParams->myPMin->value(),
                                     myParams->myPMax->value(),
                                     myParams->myPStep->value(),
                                     GEOM::Bezier);

    res = true;
    break;
  case 2 :
    if( myBySelectionBtn->isChecked() )
      anObj = anOper->MakeSplineInterpolation( points.in(), GroupPoints->CheckButton1->isChecked(),
                                          GroupPoints->CheckButton2->isChecked() );
    else
      anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()),
                                     qPrintable(myParams->myYExpr->text()),
                                     qPrintable(myParams->myZExpr->text()),
                                     myParams->myPMin->value(),
                                     myParams->myPMax->value(),
                                     myParams->myPStep->value(),
                                     GEOM::Interpolation);
    res = true;
    break;
  }

  if ( !anObj->_is_nil() ) {
    if(myAnaliticalBtn->isChecked() && !IsPreview()) {
      QStringList aParameters;
      aParameters<<myParams->myPMin->text();
      aParameters<<myParams->myPMax->text();
      aParameters<<myParams->myPStep->text();
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
    }
    objects.push_back( anObj._retn() );
  }
  
  return res;
}
void BasicGUI_CurveDlg::Init ( ) [private]

Definition at line 135 of file BasicGUI_CurveDlg.cxx.

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

  myPoints.clear();

  globalSelection(); // close local contexts, if any
  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );

  showOnlyPreviewControl();
  myBySelectionBtn->setChecked(true);

  /* Get setting of step value from file configuration */
  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
  double step = resMgr ? resMgr->doubleValue( "Geometry", "SettingsGeomStep", 10. ) : 10.;

  double aMax( 100. ), aMin( 0.0 );

  /* min, max, step and decimals for spin boxes & initial values */
  initSpinBox( myParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" );
  initSpinBox( myParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" );
  myParams->myPStep->setValue( 10 );
  myParams->myPStep->setMaximum( 999 );
  myParams->myPStep->setSingleStep( 10 );
  myParams->myPMin->setValue( aMin );
  myParams->myPMax->setValue( aMax );
  myParams->myPStep->setValue( step );
  myParams->myXExpr->setText("t");
  myParams->myYExpr->setText("t");
  myParams->myZExpr->setText("t");
  
  myParams->hide();

  /* signals and slots connections */
  connect( myGeomGUI,        SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog( ) ) );
  connect( myGeomGUI,        SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );

  connect( buttonOk(),       SIGNAL( clicked() ),                      this, SLOT( ClickOnOk() ) );
  connect( buttonApply(),    SIGNAL( clicked() ),                      this, SLOT( ClickOnApply() ) );

  connect( this,             SIGNAL( constructorsClicked( int ) ),     this, SLOT( ConstructorsClicked( int ) ) );

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

  connect( GroupPoints->CheckButton1, SIGNAL( toggled(bool) ),         this, SLOT( CheckButtonToggled() ) );
  connect( GroupPoints->CheckButton2, SIGNAL( toggled(bool) ),         this, SLOT( CheckButtonToggled() ) );

  connect( myGeomGUI->getApp()->selectionMgr(),
           SIGNAL( currentSelectionChanged() ),                        this, SLOT( SelectionIntoArgument() ) );

  connect( myBySelectionBtn, SIGNAL( clicked() ),                      this, SLOT( CreationModeChanged() ) );
  connect( myAnaliticalBtn,  SIGNAL( clicked() ),                      this, SLOT( CreationModeChanged() ) );

  connect(myParams->myPMin,  SIGNAL(valueChanged(double)),             this, SLOT(ValueChangedInSpinBox(double)));
  connect(myParams->myPMax,  SIGNAL(valueChanged(double)),             this, SLOT(ValueChangedInSpinBox(double)));
  connect(myParams->myPStep, SIGNAL(valueChanged(int)),                this, SLOT(ValueChangedInSpinBox(int)));

  connect(myParams->myXExpr, SIGNAL(editingFinished()),                this, SLOT(OnEditingFinished()));
  connect(myParams->myYExpr, SIGNAL(editingFinished()),                this, SLOT(OnEditingFinished()));
  connect(myParams->myZExpr, SIGNAL(editingFinished()),                this, SLOT(OnEditingFinished()));

  initName( tr( "GEOM_CURVE" ) );
  resize(100,100);
  ConstructorsClicked( 0 );  
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 375 of file BasicGUI_CurveDlg.cxx.

{
  if( myBySelectionBtn->isChecked() )
    return myPoints.count() > 1;
  else {
    bool ok = myParams->myPMin->isValid( msg, !IsPreview() ) &&
              myParams->myPMax->isValid( msg, !IsPreview() ) &&
              myParams->myPStep->isValid( msg, !IsPreview() );
    ok &= !myParams->myXExpr->text().isEmpty();
    ok &= !myParams->myYExpr->text().isEmpty();
    ok &= !myParams->myZExpr->text().isEmpty();
    return ok;
  }
}
void BasicGUI_CurveDlg::OnEditingFinished ( ) [private, slot]

Definition at line 509 of file BasicGUI_CurveDlg.cxx.

                                          {
  processPreview();
}

Here is the caller graph for this function:

void BasicGUI_CurveDlg::SelectionIntoArgument ( ) [private, slot]

Definition at line 314 of file BasicGUI_CurveDlg.cxx.

{
  QList<GEOM::GeomObjPtr> points = getSelected( TopAbs_VERTEX, -1 );
  synchronize( myPoints, points );
  if ( !myPoints.isEmpty()  )
    GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
  else
    GroupPoints->LineEdit1->setText( "" );
  processPreview();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 241 of file BasicGUI_CurveDlg.cxx.

{
  if ( sender() == GroupPoints->PushButton1 )
    myEditCurrentArgument = GroupPoints->LineEdit1;
  myEditCurrentArgument->setFocus();
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BasicGUI_CurveDlg::ValueChangedInSpinBox ( double  ) [private, slot]

Definition at line 491 of file BasicGUI_CurveDlg.cxx.

{
  processPreview();
}

Here is the caller graph for this function:

void BasicGUI_CurveDlg::ValueChangedInSpinBox ( int  ) [private, slot]

Definition at line 500 of file BasicGUI_CurveDlg.cxx.

{
  processPreview();
}

Member Data Documentation

DlgRef_1Sel3Check* BasicGUI_CurveDlg::GroupPoints [private]

Definition at line 63 of file BasicGUI_CurveDlg.h.

QRadioButton* BasicGUI_CurveDlg::myAnaliticalBtn [private]

Definition at line 65 of file BasicGUI_CurveDlg.h.

QRadioButton* BasicGUI_CurveDlg::myBySelectionBtn [private]

Definition at line 66 of file BasicGUI_CurveDlg.h.

Definition at line 67 of file BasicGUI_CurveDlg.h.

Definition at line 64 of file BasicGUI_CurveDlg.h.


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