Back to index

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

#include <PrimitiveGUI_FaceDlg.h>

List of all members.

Public Member Functions

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

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

Private Member Functions

void Init ()
void enterEvent (QEvent *)

Private Attributes

GEOM::GeomObjPtr myEdge
GEOM::GeomObjPtr myFace
int myOrientationType
DlgRef_2Spin * GroupDimensions
DlgRef_1Sel2Spin * GroupPlane
DlgRef_3Radio * GroupOrientation
DlgRef_3Radio * GroupType

Detailed Description

Definition at line 38 of file PrimitiveGUI_FaceDlg.h.


Constructor & Destructor Documentation

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

Definition at line 50 of file PrimitiveGUI_FaceDlg.cxx.

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

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

  GroupPlane = new DlgRef_1Sel2Spin( centralWidget() );
  GroupPlane->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
  GroupPlane->TextLabel1->setText( tr( "GEOM_EDGE" ) );
  GroupPlane->TextLabel2->setText( tr( "GEOM_HEIGHT" ) );
  GroupPlane->TextLabel3->setText( tr( "GEOM_WIDTH" ) );
  GroupPlane->PushButton1->setIcon( image1 );
  GroupPlane->LineEdit1->setReadOnly( true );

  GroupType = new DlgRef_3Radio( centralWidget() );
  GroupType->GroupBox1->setTitle( tr( "GEOM_OBJECT_TYPE" ) );
  GroupType->RadioButton1->setText( tr( "GEOM_EDGE" ) );
  GroupType->RadioButton2->setText( tr( "GEOM_FACE" ) );
  GroupType->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
  GroupType->RadioButton3->close();

  GroupDimensions = new DlgRef_2Spin( centralWidget() );
  GroupDimensions->GroupBox1->setTitle( tr( "GEOM_BOX_OBJ" ) );
  GroupDimensions->TextLabel1->setText( tr( "GEOM_HEIGHT" ) );
  GroupDimensions->TextLabel2->setText( tr( "GEOM_WIDTH" ) );

  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( GroupType );
  layout->addWidget( GroupPlane );
  layout->addWidget( GroupDimensions );
  layout->addWidget( GroupOrientation );

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

  setHelpFileName( "create_squareface_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 113 of file PrimitiveGUI_FaceDlg.cxx.

{  
}

Member Function Documentation

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

Definition at line 378 of file PrimitiveGUI_FaceDlg.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_FaceDlg::addSubshapesToStudy ( ) [protected, virtual]

Definition at line 484 of file PrimitiveGUI_FaceDlg.cxx.

{
  if ( getConstructorId() == 1 ) {
    if ( GroupType->RadioButton1->isChecked() )
     GEOMBase::PublishSubObject( myEdge.get() );
    if ( GroupType->RadioButton2->isChecked() )
     GEOMBase::PublishSubObject( myFace.get() );
  }
}

Here is the call graph for this function:

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

Definition at line 256 of file PrimitiveGUI_FaceDlg.cxx.

{
  if ( !onAccept() )
    return false;
  
  initName();

  myEditCurrentArgument->setText( "" );
  ConstructorsClicked( getConstructorId() );

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 245 of file PrimitiveGUI_FaceDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 273 of file PrimitiveGUI_FaceDlg.cxx.

{  
  erasePreview();
  switch ( constructorId ) {
  case 0:
    {
      globalSelection(); // close local contexts, if any
      GroupPlane->hide();
      GroupDimensions->show();
      GroupOrientation->show();
      GroupType->hide();
      GroupOrientation->RadioButton1->setChecked( true );
      myOrientationType = 1;
      break;
    }
  case 1:
    {
      globalSelection(); // close local contexts, if any
      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
      myEditCurrentArgument = GroupPlane->LineEdit1;
      myEditCurrentArgument->setText("");
      myEdge.nullify();
      myFace.nullify();
      GroupType->RadioButton1->setChecked( true );
      TypeButtonClicked();
      GroupDimensions->hide();
      GroupOrientation->hide();
      GroupType->show();
      GroupPlane->show();
      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_FaceDlg::createOperation ( ) [protected, virtual]

Definition at line 410 of file PrimitiveGUI_FaceDlg.cxx.

{
  return myGeomGUI->GetGeomGen()->GetI3DPrimOperations( getStudyId() );
}

Definition at line 391 of file PrimitiveGUI_FaceDlg.cxx.

Here is the caller graph for this function:

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

Definition at line 400 of file PrimitiveGUI_FaceDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 440 of file PrimitiveGUI_FaceDlg.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->MakeFaceHW(GroupDimensions->SpinBox_DX->value(),
                               GroupDimensions->SpinBox_DY->value(), myOrientationType);
    if (!anObj->_is_nil() && !IsPreview())
    {
      aParameters << GroupDimensions->SpinBox_DX->text();
      aParameters << GroupDimensions->SpinBox_DY->text();
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
    }
    res = true;
    break;
  case 1:
    anObj = GroupType->RadioButton1->isChecked() ? 
      anOper->MakeFaceObjHW(myEdge.get(), GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()) : 
      anOper->MakeFaceObjHW(myFace.get(), GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
    if (!anObj->_is_nil() && !IsPreview())
    {
      aParameters << GroupPlane->SpinBox_DX->text();
      aParameters << GroupPlane->SpinBox_DY->text();
      anObj->SetParameters(aParameters.join(":").toLatin1().constData());
    }
    res = true;
    break;
  }

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

  return res;
}

Here is the call graph for this function:

void PrimitiveGUI_FaceDlg::Init ( ) [private]

Definition at line 122 of file PrimitiveGUI_FaceDlg.cxx.

{
  /* init variables */
  myEditCurrentArgument = GroupPlane->LineEdit1;
  GroupType->RadioButton1->setChecked(true);
  myEdge.nullify();
  myFace.nullify();
  globalSelection(); // close local contexts, if any
  //  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );

  myOrientationType = 1;

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

  double aDefaultSize = 100.0;
  /* min, max, step and decimals for spin boxes */
  initSpinBox( GroupPlane->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" );
  GroupPlane->SpinBox_DX->setValue( aDefaultSize );
  initSpinBox( GroupPlane->SpinBox_DY, 0.00001, COORD_MAX, aStep, "length_precision" );
  GroupPlane->SpinBox_DY->setValue( aDefaultSize );

  initSpinBox( GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, aStep, "length_precision" );
  GroupDimensions->SpinBox_DX->setValue( aDefaultSize );
  initSpinBox( GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, aStep, "length_precision" );
  GroupDimensions->SpinBox_DY->setValue( aDefaultSize );

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

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

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

  connect( GroupPlane->PushButton1,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
  connect( GroupPlane->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
  connect( GroupPlane->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );

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

  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( GroupType->RadioButton1, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) );
  connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeButtonClicked() ) );

  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
           this, SLOT( SelectionIntoArgument() ) );
  
  initName( tr( "GEOM_FACE" ) );

  ConstructorsClicked( 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 419 of file PrimitiveGUI_FaceDlg.cxx.

{
  bool ok = false;
  if( getConstructorId() == 0 )
  {
    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() );
  }
  else if( getConstructorId() == 1 )
  {
    ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) &&
         GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) &&
         ( GroupType->RadioButton1->isChecked() ? myEdge : myFace );
  }
  return ok;
}
void PrimitiveGUI_FaceDlg::RadioButtonClicked ( ) [private, slot]

Definition at line 208 of file PrimitiveGUI_FaceDlg.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 317 of file PrimitiveGUI_FaceDlg.cxx.

{
  if (getConstructorId() == 0) {
    displayPreview(true);
    return;
  }

  myEditCurrentArgument->setText( "" );

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

  if ( aSelList.Extent() != 1 ) {
    if ( myEditCurrentArgument == GroupPlane->LineEdit1 )  myEdge.nullify();
    return;
  }

  TopAbs_ShapeEnum aNeedType = GroupType->RadioButton2->isChecked() ? TopAbs_FACE : TopAbs_EDGE;
  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 );
    
    if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_EDGE )
      myEdge = aSelectedObject;
    else if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_FACE )
      myFace = aSelectedObject;
  }

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 187 of file PrimitiveGUI_FaceDlg.cxx.

{
  GroupPlane->SpinBox_DX->setSingleStep(step);
  GroupPlane->SpinBox_DY->setSingleStep(step);
  GroupDimensions->SpinBox_DX->setSingleStep(step);
  GroupDimensions->SpinBox_DY->setSingleStep(step);
}

Here is the caller graph for this function:

Definition at line 357 of file PrimitiveGUI_FaceDlg.cxx.

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

  globalSelection(); // close previous local contexts
  if ( send == GroupPlane->PushButton1 ) {
    myEditCurrentArgument = GroupPlane->LineEdit1;
    if (GroupType->RadioButton1->isChecked())
      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
    else if (GroupType->RadioButton1->isChecked())
      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
  }

  myEditCurrentArgument->setFocus();
  SelectionIntoArgument();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PrimitiveGUI_FaceDlg::TypeButtonClicked ( ) [private, slot]

Definition at line 223 of file PrimitiveGUI_FaceDlg.cxx.

{
  if ( GroupType->RadioButton1->isChecked() ) {
    globalSelection(); // close local contexts, if any
    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
    GroupPlane->TextLabel1->setText( tr( "GEOM_EDGE" ) );
  }
  else if ( GroupType->RadioButton2->isChecked() ) {
    globalSelection(); // close local contexts, if any
    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
    GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) );
  }
  myEditCurrentArgument = GroupPlane->LineEdit1;
  myEditCurrentArgument->setText( "" );
  myEdge.nullify();
  myFace.nullify();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PrimitiveGUI_FaceDlg::ValueChangedInSpinBox ( double  newValue) [private, slot]

Definition at line 199 of file PrimitiveGUI_FaceDlg.cxx.

{
  displayPreview(true);
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_2Spin* PrimitiveGUI_FaceDlg::GroupDimensions [private]

Definition at line 63 of file PrimitiveGUI_FaceDlg.h.

DlgRef_3Radio* PrimitiveGUI_FaceDlg::GroupOrientation [private]

Definition at line 65 of file PrimitiveGUI_FaceDlg.h.

DlgRef_1Sel2Spin* PrimitiveGUI_FaceDlg::GroupPlane [private]

Definition at line 64 of file PrimitiveGUI_FaceDlg.h.

DlgRef_3Radio* PrimitiveGUI_FaceDlg::GroupType [private]

Definition at line 66 of file PrimitiveGUI_FaceDlg.h.

Definition at line 58 of file PrimitiveGUI_FaceDlg.h.

Definition at line 59 of file PrimitiveGUI_FaceDlg.h.

Definition at line 61 of file PrimitiveGUI_FaceDlg.h.


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