Back to index

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

#include <PrimitiveGUI_SphereDlg.h>

List of all members.

Public Member Functions

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

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

Private Member Functions

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

Private Attributes

GEOM::GeomObjPtr myPoint
DlgRef_1Sel1Spin * GroupPoints
DlgRef_1Spin * GroupDimensions

Detailed Description

Definition at line 40 of file PrimitiveGUI_SphereDlg.h.


Constructor & Destructor Documentation

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

Definition at line 53 of file PrimitiveGUI_SphereDlg.cxx.

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

  setWindowTitle( tr( "GEOM_SPHERE_TITLE" ) );

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

  GroupPoints = new DlgRef_1Sel1Spin( centralWidget() );
  GroupPoints->GroupBox1->setTitle( tr( "GEOM_SPHERE_CR" ) );
  GroupPoints->TextLabel1->setText( tr( "GEOM_CENTER" ) );
  GroupPoints->TextLabel2->setText( tr( "GEOM_RADIUS" ) );
  GroupPoints->PushButton1->setIcon( image2 );

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

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

  setHelpFileName( "create_sphere_page.html" );

  Init();
}

Here is the call graph for this function:

Definition at line 96 of file PrimitiveGUI_SphereDlg.cxx.

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

Member Function Documentation

Definition at line 281 of file PrimitiveGUI_SphereDlg.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_SphereDlg::addSubshapesToStudy ( ) [protected, virtual]

Definition at line 412 of file PrimitiveGUI_SphereDlg.cxx.

{
  if ( getConstructorId() == 0 ) {
    GEOMBase::PublishSubObject( myPoint.get() );
  }
}

Here is the call graph for this function:

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

Definition at line 217 of file PrimitiveGUI_SphereDlg.cxx.

{
  if ( !onAccept() )
    return false;
  
  initName();
  ConstructorsClicked( getConstructorId() );
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 205 of file PrimitiveGUI_SphereDlg.cxx.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 160 of file PrimitiveGUI_SphereDlg.cxx.

{
  disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
  
  switch ( constructorId ) {
  case 0:
    {
      globalSelection(); // close local contexts, if any
      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );

      GroupDimensions->hide();
      GroupPoints->show();
      
      myEditCurrentArgument = GroupPoints->LineEdit1;
      GroupPoints->LineEdit1->setText( "" );
      myPoint.nullify();
      
      connect( myGeomGUI->getApp()->selectionMgr(), 
               SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
      break;
    }
  case 1:
    {
      globalSelection(); // close local contexts, if any
      
      GroupPoints->hide();
      GroupDimensions->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_SphereDlg::createOperation ( ) [protected, virtual]

Definition at line 326 of file PrimitiveGUI_SphereDlg.cxx.

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

Definition at line 305 of file PrimitiveGUI_SphereDlg.cxx.

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

Here is the call graph for this function:

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

Definition at line 350 of file PrimitiveGUI_SphereDlg.cxx.

{
  bool res = false;
  
  GEOM::GEOM_Object_var anObj;

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

  switch ( getConstructorId() ) {
  case 0 :
    {
      if ( myPoint ) {
        anObj = anOper->MakeSpherePntR( myPoint.get(), getRadius() );
        if (!anObj->_is_nil() && !IsPreview())
        {
          QStringList aParameters;
          aParameters << GroupPoints->SpinBox_DX->text();
          anObj->SetParameters(aParameters.join(":").toLatin1().constData());
        }
        res = true;
      }
      break;
    }
  case 1 :
    {
      anObj = anOper->MakeSphereR( getRadius() );
      if (!anObj->_is_nil() && !IsPreview())
      {
        QStringList aParameters;
        aParameters << GroupDimensions->SpinBox_DX->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:

double PrimitiveGUI_SphereDlg::getRadius ( ) const [private]

Definition at line 398 of file PrimitiveGUI_SphereDlg.cxx.

{
  int aConstructorId = getConstructorId();
  if ( aConstructorId == 0 )
    return GroupPoints->SpinBox_DX->value();
  else if ( aConstructorId == 1 )
    return GroupDimensions->SpinBox_DX->value();
  return 0;
}

Here is the caller graph for this function:

void PrimitiveGUI_SphereDlg::Init ( ) [private]

Definition at line 106 of file PrimitiveGUI_SphereDlg.cxx.

{
  /* init variables */
  myEditCurrentArgument = GroupPoints->LineEdit1;
  GroupPoints->LineEdit1->setReadOnly( true );
  
  myPoint.nullify();
  
  /* Get setting of step value from file configuration */
  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
  double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );

  /* min, max, step and decimals for spin boxes */
  initSpinBox( GroupPoints->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" );
  initSpinBox( GroupDimensions->SpinBox_DX, 0.000001, COORD_MAX, step, "length_precision" );
  GroupPoints->SpinBox_DX->setValue( 100.0 );
  GroupDimensions->SpinBox_DX->setValue( 100.0 );
  
  /* 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( GroupPoints->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );

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

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

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

  initName( tr( "GEOM_SPHERE" ) );

  setConstructorId( 1 ); // simplest constructor
  ConstructorsClicked( 1 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 336 of file PrimitiveGUI_SphereDlg.cxx.

{
  bool ok = false;
  if( getConstructorId() == 0 )
    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint;
  else if( getConstructorId() == 1 )
    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() );
  return ok;
}

Definition at line 232 of file PrimitiveGUI_SphereDlg.cxx.

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

  myEditCurrentArgument->setText( "" );

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

  if (aSelList.Extent() != 1) {
    myPoint.nullify();
    return;
  }

  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
  TopoDS_Shape aShape;
  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
    QString aName = GEOMBase::GetName( aSelectedObject.get() );
    myEditCurrentArgument->setText( aName );
    myPoint = aSelectedObject;
  }

  displayPreview(true);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 150 of file PrimitiveGUI_SphereDlg.cxx.

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

Here is the caller graph for this function:

Definition at line 263 of file PrimitiveGUI_SphereDlg.cxx.

{
  QPushButton* send = (QPushButton*)sender();
  
  if ( send == GroupPoints->PushButton1 ) {
    GroupPoints->LineEdit1->setFocus();
    myEditCurrentArgument = GroupPoints->LineEdit1;
    globalSelection(); // close local contexts, if any
    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
    SelectionIntoArgument();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 316 of file PrimitiveGUI_SphereDlg.cxx.

{
  displayPreview(true);
}

Here is the caller graph for this function:


Member Data Documentation

DlgRef_1Spin* PrimitiveGUI_SphereDlg::GroupDimensions [private]

Definition at line 64 of file PrimitiveGUI_SphereDlg.h.

DlgRef_1Sel1Spin* PrimitiveGUI_SphereDlg::GroupPoints [private]

Definition at line 63 of file PrimitiveGUI_SphereDlg.h.

Definition at line 61 of file PrimitiveGUI_SphereDlg.h.


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