Back to index

salome-gui  6.5.0
Public Member Functions | Protected Slots | Static Protected Member Functions | Protected Attributes
SVTK_UpdateRateDlg Class Reference

#include <SVTK_UpdateRateDlg.h>

Collaboration diagram for SVTK_UpdateRateDlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SVTK_UpdateRateDlg (QtxAction *theAction, SVTK_ViewWindow *theParent, const char *theName)
 Constructor.
 ~SVTK_UpdateRateDlg ()
 Destroys the object and frees any allocated resources.
void Update ()
 Update.

Protected Slots

void onClickOk ()
 SLOT on OK clicked.
void onClickApply ()
 SLOT on Apply clicked.
void onClickClose ()
 SLOT on Close clicked.

Static Protected Member Functions

static void ProcessEvents (vtkObject *object, unsigned long event, void *clientdata, void *calldata)
 Processes events.

Protected Attributes

SVTK_RenderWindowInteractormyRWInteractor
QtxDoubleSpinBoxmyDesiredUpdateRateSblSpinBox
QtxDoubleSpinBoxmyStillUpdateRateSblSpinBox
QGroupBox * myIsEnableUpdateRateGroupBox
QLineEdit * myCurrentUpdateRateLineEdit
QLineEdit * myNumberOfCellsLineEdit
QtxActionmyAction
vtkFloatingPointType myPriority
vtkSmartPointer
< vtkCallbackCommand > 
myEventCallbackCommand

Detailed Description

Definition at line 47 of file SVTK_UpdateRateDlg.h.


Constructor & Destructor Documentation

SVTK_UpdateRateDlg::SVTK_UpdateRateDlg ( QtxAction theAction,
SVTK_ViewWindow *  theParent,
const char *  theName 
)

Constructor.

Definition at line 165 of file SVTK_UpdateRateDlg.cxx.

                                         :
  ViewerTools_DialogBase(theAction,
                         theParent, 
                         theName),
  myPriority(0.0),
  myEventCallbackCommand(vtkCallbackCommand::New()),
  myRWInteractor(theParent->GetInteractor()),
  myAction(theAction)
{
  vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice();
  bool anIsEnabledUpdateRate = false;

  setWindowTitle(tr("DLG_TITLE"));
  QVBoxLayout* aVBoxLayout = new QVBoxLayout(this);
  aVBoxLayout->setMargin(5);
  aVBoxLayout->setSpacing(5);
  {
    QGroupBox* aGroupBox = new QGroupBox(tr("INPUT_FRAME_TITLE"), this);

    aGroupBox->setCheckable(true);
    aGroupBox->setChecked(anIsEnabledUpdateRate);
    myIsEnableUpdateRateGroupBox = aGroupBox;

    QGridLayout* aGridLayout = new QGridLayout(aGroupBox);
    aGridLayout->setSpacing( 6 );
    aGridLayout->setMargin( 11 );
    {
      QLabel* aLabel = new QLabel(tr("DESIRED"), aGroupBox);
      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
      aGridLayout->addWidget(aLabel, 0, 0);

      QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox);
      aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
      aGridLayout->addWidget(aDblSpinBox, 0, 1);

      aDblSpinBox->setValue(aRWI->GetDesiredUpdateRate());
      aDblSpinBox->setEnabled(anIsEnabledUpdateRate);
      connect(aGroupBox, SIGNAL(toggled(bool)), aDblSpinBox, SLOT(setEnabled(bool)));
      myDesiredUpdateRateSblSpinBox = aDblSpinBox;
    }
    {
      QLabel* aLabel = new QLabel(tr("STILL"), aGroupBox);
      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
      aGridLayout->addWidget(aLabel, 1, 0);

      QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox);
      aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
      aGridLayout->addWidget(aDblSpinBox, 1, 1);

      aDblSpinBox->setValue(aRWI->GetStillUpdateRate());
      aDblSpinBox->setEnabled(anIsEnabledUpdateRate);
      connect(aGroupBox, SIGNAL(toggled(bool)), aDblSpinBox, SLOT(setEnabled(bool)));
      myStillUpdateRateSblSpinBox = aDblSpinBox;
    }
    aVBoxLayout->addWidget(aGroupBox);
  }
  {
    QGroupBox* aGroupBox = new QGroupBox(tr("INFORMATION_FRAME_TITLE"), this);
    
    QGridLayout* aGridLayout = new QGridLayout(aGroupBox);
    aGridLayout->layout()->setSpacing( 6 );
    aGridLayout->layout()->setMargin( 11 );
    {
      QLabel* aLabel = new QLabel(tr("CURRENT_FPS"), aGroupBox);
      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
      aGridLayout->addWidget(aLabel, 0, 0);

      QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
      aLineEdit->setReadOnly( TRUE );
      aGridLayout->addWidget(aLineEdit, 0, 1);

      myCurrentUpdateRateLineEdit = aLineEdit;
      myCurrentUpdateRateLineEdit->setText( GetUpdateRate(myRWInteractor) );
    }
    {
      QLabel* aLabel = new QLabel(tr("NUMBER_CELLS"), aGroupBox);
      aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
      aGridLayout->addWidget(aLabel, 1, 0);

      QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
      aLineEdit->setReadOnly( TRUE );
      aGridLayout->addWidget(aLineEdit, 1, 1);

      myNumberOfCellsLineEdit = aLineEdit;
      myNumberOfCellsLineEdit->setText( GetNumberOfCells(myRWInteractor) );
    }
    aVBoxLayout->addWidget(aGroupBox);
  }
  {
    QGroupBox* aGroupBox = new QGroupBox(this);
    QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox);
    aHBoxLayout->setMargin(11);
    aHBoxLayout->setSpacing(6);
    {
      QPushButton* aPushButton = new QPushButton(tr("OK"), aGroupBox);
      aPushButton->setDefault(TRUE);
      aPushButton->setAutoDefault(TRUE);
      aHBoxLayout->addWidget(aPushButton);
      connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickOk()));
    }
    {
      QPushButton* aPushButton = new QPushButton(tr("Apply"), aGroupBox);
      aPushButton->setDefault(TRUE);
      aPushButton->setAutoDefault(TRUE);
      aHBoxLayout->addWidget(aPushButton);
      connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickApply()));
    }
    aHBoxLayout->addStretch();
    {
      QPushButton* aPushButton = new QPushButton(tr("Close"), aGroupBox);
      aPushButton->setDefault(TRUE);
      aPushButton->setAutoDefault(TRUE);
      aHBoxLayout->addWidget(aPushButton);
      connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickClose()));
    }
    aVBoxLayout->addWidget(aGroupBox);
  }

  if(!anIsEnabledUpdateRate){
    aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE);
    aRWI->SetStillUpdateRate(OFF_UPDATE_RATE);  
  }

  myEventCallbackCommand->Delete();
  myEventCallbackCommand->SetClientData(this);
  myEventCallbackCommand->SetCallback(SVTK_UpdateRateDlg::ProcessEvents);
  vtkRenderer *aRenderer = myRWInteractor->getRenderer();
  aRenderer->AddObserver(vtkCommand::EndEvent,
                         myEventCallbackCommand.GetPointer(), 
                         myPriority);
}

Here is the call graph for this function:

Destroys the object and frees any allocated resources.

Definition at line 303 of file SVTK_UpdateRateDlg.cxx.

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

Member Function Documentation

void SVTK_UpdateRateDlg::onClickApply ( ) [protected, slot]

SLOT on Apply clicked.

Definition at line 365 of file SVTK_UpdateRateDlg.cxx.

{
  Update();
}
void SVTK_UpdateRateDlg::onClickClose ( ) [protected, slot]

SLOT on Close clicked.

Definition at line 375 of file SVTK_UpdateRateDlg.cxx.

{
  reject();
}
void SVTK_UpdateRateDlg::onClickOk ( ) [protected, slot]

SLOT on OK clicked.

Definition at line 354 of file SVTK_UpdateRateDlg.cxx.

{
  Update();
  onClickClose();
}
void SVTK_UpdateRateDlg::ProcessEvents ( vtkObject *  object,
unsigned long  event,
void clientdata,
void calldata 
) [static, protected]

Processes events.

Definition at line 313 of file SVTK_UpdateRateDlg.cxx.

{
  SVTK_UpdateRateDlg* self = reinterpret_cast<SVTK_UpdateRateDlg*>(theClientData);

  if(theEvent == vtkCommand::EndEvent){
    self->myCurrentUpdateRateLineEdit->setText( GetUpdateRate(self->myRWInteractor) );
    self->myNumberOfCellsLineEdit->setText( GetNumberOfCells(self->myRWInteractor) );
  }
}

Here is the caller graph for this function:

Update.

Definition at line 331 of file SVTK_UpdateRateDlg.cxx.

{
  vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice();

  vtkFloatingPointType anUpdateRate;
  if(myIsEnableUpdateRateGroupBox->isChecked()){
    anUpdateRate = AdjustUpdateRate(myRWInteractor,myDesiredUpdateRateSblSpinBox->value());
    aRWI->SetDesiredUpdateRate(anUpdateRate);
    anUpdateRate = AdjustUpdateRate(myRWInteractor,myStillUpdateRateSblSpinBox->value());
    aRWI->SetStillUpdateRate(anUpdateRate);
  }else{
    aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE);
    aRWI->SetStillUpdateRate(OFF_UPDATE_RATE);
  }

  myRWInteractor->getRenderWindow()->Render();
}

Member Data Documentation

Definition at line 69 of file SVTK_UpdateRateDlg.h.

Definition at line 66 of file SVTK_UpdateRateDlg.h.

Definition at line 62 of file SVTK_UpdateRateDlg.h.

vtkSmartPointer<vtkCallbackCommand> SVTK_UpdateRateDlg::myEventCallbackCommand [protected]

Definition at line 76 of file SVTK_UpdateRateDlg.h.

Definition at line 64 of file SVTK_UpdateRateDlg.h.

Definition at line 67 of file SVTK_UpdateRateDlg.h.

Definition at line 73 of file SVTK_UpdateRateDlg.h.

Definition at line 61 of file SVTK_UpdateRateDlg.h.

Definition at line 63 of file SVTK_UpdateRateDlg.h.


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