Back to index

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

#include <PrimitiveGUI_DiskDlg.h>

List of all members.

Public Member Functions

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

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 SelectionIntoArgument ()
void ConstructorsClicked (int)
void SetEditCurrentArgument ()
void ValueChangedInSpinBox ()
void SetDoubleSpinBoxStep (double)
void RadioButtonClicked ()

Private Member Functions

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

Private Attributes

int myOrientationType
GEOM::GeomObjPtr myPoint
GEOM::GeomObjPtr myDir
GEOM::GeomObjPtr myPoint1
GEOM::GeomObjPtr myPoint2
GEOM::GeomObjPtr myPoint3
DlgRef_2Sel1Spin * GroupPntVecR
DlgRef_3Sel * Group3Pnts
DlgRef_1Spin * GroupDimensions
DlgRef_3Radio * GroupOrientation

Detailed Description

Definition at line 39 of file PrimitiveGUI_DiskDlg.h.


Constructor & Destructor Documentation

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

Definition at line 50 of file PrimitiveGUI_DiskDlg.cxx.

  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
{
  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
  QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_DISK_PNT_VEC_R")));
  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
  QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_DISK_THREE_POINTS")));
  QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_DISK_R")));

  setWindowTitle(tr("GEOM_DISK_TITLE"));

  /***************************************************************/
  mainFrame()->GroupConstructors->setTitle(tr("GEOM_DISK"));
  mainFrame()->RadioButton1->setIcon(image3);
  mainFrame()->RadioButton2->setIcon(image0);
  mainFrame()->RadioButton3->setIcon(image2);

  GroupPntVecR = new DlgRef_2Sel1Spin(centralWidget());
  GroupPntVecR->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  GroupPntVecR->TextLabel1->setText(tr("GEOM_CENTER_POINT"));
  GroupPntVecR->TextLabel2->setText(tr("GEOM_VECTOR"));
  GroupPntVecR->TextLabel3->setText(tr("GEOM_RADIUS"));
  GroupPntVecR->PushButton1->setIcon(image1);
  GroupPntVecR->PushButton2->setIcon(image1);
  GroupPntVecR->LineEdit1->setReadOnly(true);
  GroupPntVecR->LineEdit2->setReadOnly(true);

  Group3Pnts = new DlgRef_3Sel(centralWidget());
  Group3Pnts->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  Group3Pnts->TextLabel1->setText(tr("GEOM_POINT1"));
  Group3Pnts->TextLabel2->setText(tr("GEOM_POINT2"));
  Group3Pnts->TextLabel3->setText(tr("GEOM_POINT3"));
  Group3Pnts->PushButton1->setIcon(image1);
  Group3Pnts->PushButton2->setIcon(image1);
  Group3Pnts->PushButton3->setIcon(image1);
  Group3Pnts->LineEdit1->setReadOnly(true);
  Group3Pnts->LineEdit2->setReadOnly(true);
  Group3Pnts->LineEdit3->setReadOnly(true);

  GroupDimensions = new DlgRef_1Spin(centralWidget());
  GroupDimensions->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
  GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS"));

  GroupOrientation = new DlgRef_3Radio(centralWidget());
  GroupOrientation->GroupBox1->setTitle(tr("GEOM_ORIENTATION"));
  GroupOrientation->RadioButton1->setText(tr("GEOM_WPLANE_OXY"));
  GroupOrientation->RadioButton2->setText(tr("GEOM_WPLANE_OYZ"));
  GroupOrientation->RadioButton3->setText(tr("GEOM_WPLANE_OZX"));

  QVBoxLayout* layout = new QVBoxLayout(centralWidget());
  layout->setMargin(0); layout->setSpacing(6);
  layout->addWidget(GroupPntVecR);
  layout->addWidget(Group3Pnts);
  layout->addWidget(GroupDimensions);
  layout->addWidget(GroupOrientation);
  /***************************************************************/

  setHelpFileName("create_disk_page.html");

  Init();
}

Here is the call graph for this function:

Definition at line 117 of file PrimitiveGUI_DiskDlg.cxx.

{
}

Member Function Documentation

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

Definition at line 423 of file PrimitiveGUI_DiskDlg.cxx.

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

  ConstructorsClicked( getConstructorId() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 549 of file PrimitiveGUI_DiskDlg.cxx.

{
  switch (getConstructorId()) {
  case 1:
    GEOMBase::PublishSubObject( myPoint.get() );
    GEOMBase::PublishSubObject( myDir.get() );
    break;
  case 2:
    GEOMBase::PublishSubObject( myPoint1.get() );
    GEOMBase::PublishSubObject( myPoint2.get() );
    GEOMBase::PublishSubObject( myPoint3.get() );
    break;
  default:
    break;
  }
}

Here is the call graph for this function:

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

Definition at line 272 of file PrimitiveGUI_DiskDlg.cxx.

{
  if (!onAccept())
    return false;

  initName();
  // activate selection and connect selection manager
  ConstructorsClicked(getConstructorId());
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 261 of file PrimitiveGUI_DiskDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void PrimitiveGUI_DiskDlg::ConstructorsClicked ( int  constructorId) [private, slot]

Definition at line 211 of file PrimitiveGUI_DiskDlg.cxx.

{
  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);

  switch (constructorId) {
  case 0:
    {
      GroupPntVecR->hide();
      Group3Pnts->hide();
      GroupDimensions->show();
      GroupOrientation->show();

      disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
      globalSelection(); // close local contexts, if any
      break;
    }
  case 1:
    {
      GroupDimensions->hide();
      GroupOrientation->hide();
      GroupPntVecR->show();
      Group3Pnts->hide();

      GroupPntVecR->PushButton1->click();
      break;
    }
  case 2:
    {
      GroupDimensions->hide();
      GroupOrientation->hide();
      GroupPntVecR->hide();
      Group3Pnts->show();

      Group3Pnts->PushButton1->click();
      break;
    }
  }

  qApp->processEvents();
  updateGeometry();
  resize(minimumSizeHint());
  SelectionIntoArgument();

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 455 of file PrimitiveGUI_DiskDlg.cxx.

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

Definition at line 436 of file PrimitiveGUI_DiskDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 489 of file PrimitiveGUI_DiskDlg.cxx.

{
  bool res = false;
  QStringList aParameters;

  GEOM::GEOM_Object_var anObj;

  GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());

  switch (getConstructorId()) {
  case 0:
    anObj = anOper->MakeDiskR(getRadius(), myOrientationType);
    if (!anObj->_is_nil() && !IsPreview())
    {
      aParameters << GroupDimensions->SpinBox_DX->text();
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
    }
    res = true;
    break;
  case 1:
    anObj = anOper->MakeDiskPntVecR(myPoint.get(), myDir.get(), getRadius());
    if (!anObj->_is_nil() && !IsPreview())
    {
      aParameters << GroupPntVecR->SpinBox_DX->text();
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
    }
    res = true;
    break;
  case 2:
    anObj = anOper->MakeDiskThreePnt(myPoint1.get(), myPoint2.get(), myPoint3.get());
    res = true;
    break;
  }

  if (!anObj->_is_nil())
    objects.push_back(anObj._retn());

  return res;
}

Here is the call graph for this function:

double PrimitiveGUI_DiskDlg::getRadius ( ) const [private]

Definition at line 533 of file PrimitiveGUI_DiskDlg.cxx.

{
  double r = 0.;
  switch (getConstructorId()) {
  case 0:
    r = GroupDimensions->SpinBox_DX->value(); break;
  case 1:
    r = GroupPntVecR->SpinBox_DX->value(); break;
  }
  return r;
}

Here is the caller graph for this function:

void PrimitiveGUI_DiskDlg::Init ( ) [private]

Definition at line 125 of file PrimitiveGUI_DiskDlg.cxx.

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

  // min, max, step and decimals for spin boxes & initial values
  initSpinBox(GroupPntVecR->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" );
  initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" );

  // init variables
  myEditCurrentArgument = GroupPntVecR->LineEdit1;
  myOrientationType = 1;
  GroupOrientation->RadioButton1->setChecked(true);

  GroupPntVecR->LineEdit1->setText("");
  GroupPntVecR->LineEdit2->setText("");
  Group3Pnts->LineEdit1->setText("");
  Group3Pnts->LineEdit2->setText("");
  Group3Pnts->LineEdit3->setText("");
  myPoint.nullify();
  myDir.nullify();
  myPoint1.nullify();
  myPoint2.nullify();
  myPoint3.nullify();

  GroupPntVecR->SpinBox_DX->setValue(100);
  GroupDimensions->SpinBox_DX->setValue(100);

  // signals and slots connections
  connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
  connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));

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

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

  connect(Group3Pnts->PushButton1,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group3Pnts->PushButton2,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
  connect(Group3Pnts->PushButton3,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));

  connect(GroupPntVecR->SpinBox_DX,    SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
  connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));

  connect(GroupOrientation->RadioButton1, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
  connect(GroupOrientation->RadioButton2, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));
  connect(GroupOrientation->RadioButton3, SIGNAL(clicked()), this, SLOT(RadioButtonClicked()));

  connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
  connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()),               this, SLOT(ClickOnCancel()));

  initName(tr("GEOM_DISK"));

  ConstructorsClicked(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 473 of file PrimitiveGUI_DiskDlg.cxx.

{
  bool ok = false;
  if ( getConstructorId() == 0 )
    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && getRadius() > 0;
  else if ( getConstructorId() == 1 )
    ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint && myDir && getRadius() > 0;
  else if ( getConstructorId() == 2 )
    ok = myPoint1 && myPoint2 && myPoint3 && myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3;
  return ok;
}

Here is the call graph for this function:

void PrimitiveGUI_DiskDlg::RadioButtonClicked ( ) [private, slot]

Definition at line 196 of file PrimitiveGUI_DiskDlg.cxx.

{
  if (GroupOrientation->RadioButton1->isChecked())
    myOrientationType = 1;
  else if (GroupOrientation->RadioButton2->isChecked())
    myOrientationType = 2;
  else if (GroupOrientation->RadioButton3->isChecked())
    myOrientationType = 3;
  displayPreview(true);
}

Here is the caller graph for this function:

Definition at line 287 of file PrimitiveGUI_DiskDlg.cxx.

{
  if (getConstructorId() == 0)
    return;

  erasePreview();
  myEditCurrentArgument->setText("");

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

  if (aSelList.Extent() != 1) {
    if      (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint.nullify();
    else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir.nullify();
    else if (myEditCurrentArgument == Group3Pnts->LineEdit1)   myPoint1.nullify();
    else if (myEditCurrentArgument == Group3Pnts->LineEdit2)   myPoint2.nullify();
    else if (myEditCurrentArgument == Group3Pnts->LineEdit3)   myPoint3.nullify();
    return;
  }

  TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPntVecR->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX;
  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
  TopoDS_Shape aShape;
  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
    QString aName = GEOMBase::GetName( aSelectedObject.get() );

    myEditCurrentArgument->setText(aName);
    
    // clear selection
    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
    myGeomGUI->getApp()->selectionMgr()->clearSelected();
    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
           this, SLOT(SelectionIntoArgument()));
    
    if (myEditCurrentArgument == GroupPntVecR->LineEdit1) {
      myPoint = aSelectedObject;
      if (myPoint && !myDir)
       GroupPntVecR->PushButton2->click();
    }
    else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
      myDir = aSelectedObject;
      if (myDir && !myPoint)
       GroupPntVecR->PushButton1->click();
    }
    else if (myEditCurrentArgument == Group3Pnts->LineEdit1) {
      myPoint1 = aSelectedObject;
      if (myPoint1 && !myPoint2)
       Group3Pnts->PushButton2->click();
    }
    else if (myEditCurrentArgument == Group3Pnts->LineEdit2) {
      myPoint2 = aSelectedObject;
      if (myPoint2 && !myPoint3)
       Group3Pnts->PushButton3->click();
    }
    else if (myEditCurrentArgument == Group3Pnts->LineEdit3) {
      myPoint3 = aSelectedObject;
      if (myPoint3 && !myPoint1)
       Group3Pnts->PushButton1->click();
    }
  }

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PrimitiveGUI_DiskDlg::SetDoubleSpinBoxStep ( double  step) [private, slot]

Definition at line 186 of file PrimitiveGUI_DiskDlg.cxx.

{
  GroupDimensions->SpinBox_DX->setSingleStep(step);
  GroupPntVecR->SpinBox_DX->setSingleStep(step);
}

Here is the caller graph for this function:

Definition at line 356 of file PrimitiveGUI_DiskDlg.cxx.

{
  QPushButton* send = (QPushButton*)sender();

  if (send == GroupPntVecR->PushButton1) {
    myEditCurrentArgument = GroupPntVecR->LineEdit1;

    GroupPntVecR->PushButton2->setDown(false);
    GroupPntVecR->LineEdit2->setEnabled(false);
  }
  else if (send == GroupPntVecR->PushButton2) {
    myEditCurrentArgument = GroupPntVecR->LineEdit2;

    GroupPntVecR->PushButton1->setDown(false);
    GroupPntVecR->LineEdit1->setEnabled(false);
  }
  else if (send == Group3Pnts->PushButton1) {
    myEditCurrentArgument = Group3Pnts->LineEdit1;

    Group3Pnts->PushButton2->setDown(false);
    Group3Pnts->PushButton3->setDown(false);
    Group3Pnts->LineEdit2->setEnabled(false);
    Group3Pnts->LineEdit3->setEnabled(false);
  }
  else if (send == Group3Pnts->PushButton2) {
    myEditCurrentArgument = Group3Pnts->LineEdit2;

    Group3Pnts->PushButton1->setDown(false);
    Group3Pnts->PushButton3->setDown(false);
    Group3Pnts->LineEdit1->setEnabled(false);
    Group3Pnts->LineEdit3->setEnabled(false);
  }
  else if (send == Group3Pnts->PushButton3) {
    myEditCurrentArgument = Group3Pnts->LineEdit3;

    Group3Pnts->PushButton1->setDown(false);
    Group3Pnts->PushButton2->setDown(false);
    Group3Pnts->LineEdit1->setEnabled(false);
    Group3Pnts->LineEdit2->setEnabled(false);
  }

  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
  if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
    globalSelection(); // close local contexts, if any
    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
  }
  else {
    globalSelection(); // close local contexts, if any
    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
  }
  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
          this, SLOT(SelectionIntoArgument()));

  // enable line edit
  myEditCurrentArgument->setEnabled(true);
  myEditCurrentArgument->setFocus();
  // after setFocus(), because it will be setDown(false) when loses focus
  send->setDown(true);

  // seems we need it only to avoid preview disappearing, caused by selection mode change
  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 446 of file PrimitiveGUI_DiskDlg.cxx.

{
  displayPreview(true);
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_3Sel* PrimitiveGUI_DiskDlg::Group3Pnts [private]

Definition at line 65 of file PrimitiveGUI_DiskDlg.h.

DlgRef_1Spin* PrimitiveGUI_DiskDlg::GroupDimensions [private]

Definition at line 66 of file PrimitiveGUI_DiskDlg.h.

DlgRef_3Radio* PrimitiveGUI_DiskDlg::GroupOrientation [private]

Definition at line 67 of file PrimitiveGUI_DiskDlg.h.

DlgRef_2Sel1Spin* PrimitiveGUI_DiskDlg::GroupPntVecR [private]

Definition at line 64 of file PrimitiveGUI_DiskDlg.h.

Definition at line 62 of file PrimitiveGUI_DiskDlg.h.

Definition at line 59 of file PrimitiveGUI_DiskDlg.h.

Definition at line 62 of file PrimitiveGUI_DiskDlg.h.

Definition at line 62 of file PrimitiveGUI_DiskDlg.h.

Definition at line 62 of file PrimitiveGUI_DiskDlg.h.

Definition at line 62 of file PrimitiveGUI_DiskDlg.h.


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