-using namespace std;
-// File : SALOMEGUI_NonIsometricDlg.cxx
-// Created : Thu Dec 18 12:01:00 2002
-// Author : Vasily Rusyaev
-// Project : SALOME PRO
-// Module : SALOMEGUI
-// Copyright : Open CASCADE
-// $Header$
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : SALOMEGUI_NonIsometricDlg.cxx
+// Author : Vasily Rusyaev
+// Module : VISU
+// $Header$
#include "VisuGUI_NonIsometricDlg.h"
+#include "VisuGUI_Tools.h"
+
+#include "VISU_Actor.h"
+#include "VISU_PipeLine.hxx"
+
+#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
+
+#include "SVTK_ViewWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
+#include "SUIT_ViewWindow.h"
+
+#include "SALOME_ListIteratorOfListIO.hxx"
+#include "SALOME_ListIO.hxx"
+
+#include "QtxDblSpinBox.h"
+
+#include "utilities.h"
+
#include <qgroupbox.h>
#include <qlabel.h>
#include <qpushbutton.h>
-#include <qspinbox.h>
-#include <qcombobox.h>
#include <qlayout.h>
-#include <qlistbox.h>
-//#include <qapplication.h>
-
-#include "QAD_SpinBoxDbl.h"
-#include "utilities.h"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_StudyFrame.h"
-#include "QAD_RightFrame.h"
-#include "VTKViewer_ViewFrame.h"
-#include "VISU_Actor.h"
-#include <vtkTransformPolyDataFilter.h>
-#include <vtkDataSetMapper.h>
+using namespace std;
/*!
Constructor
*/
-VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg (QWidget* parent, const char* name, bool modal, WFlags fl)
+ : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
-
- QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame();
- VTKViewer_NonIsometricTransform *aTransform = NULL;
- if ( sf->getTypeView() == VIEW_VTK )
- {
- VTKViewer_ViewFrame* vf = (VTKViewer_ViewFrame*) ( sf->getRightFrame()->getViewFrame() );
- aTransform = vf->getNonIsometricTransform();
- }
-
- if ( !name )
- setName( "NonIsometricDlg" );
- setCaption( tr( "Scaling" ) );
- setSizeGripEnabled( TRUE );
-
- // Create layout for this dialog
- QGridLayout* layoutDlg = new QGridLayout( this );
- layoutDlg->setSpacing(6);
- layoutDlg->setMargin(11);
-
- // Create croup box with grid layout
- QGroupBox* GroupBox = new QGroupBox( this, "GroupBox" );
-
- QGridLayout* glGroupBox = new QGridLayout( GroupBox );
- glGroupBox->setMargin(11);
- glGroupBox->setSpacing(6);
-
- //Create font: 14pnts, bold, italic
- //It will be used for all labels in this group box
- QFont m_font14bi = font();
- m_font14bi.setPointSize((int)(m_font14bi.pointSize()*1.4));
-// m_font14bi.setItalic( TRUE );
- m_font14bi.setBold( TRUE );
-
- // Create "Choose function" label
- QLabel* TextLabel1 = new QLabel( tr( "Choose function:" ), GroupBox, "TextLabel1" );
- glGroupBox->addWidget ( TextLabel1, 1, 0 );
-
- // Create "Type the coefficient" label
- QLabel* TextLabel2 = new QLabel( tr( "Coefficient:" ), GroupBox, "TextLabel2" );
- glGroupBox->addWidget ( TextLabel2, 2, 0 );
-
- // Create "Applying function" label
- QLabel* TextLabel3 = new QLabel( tr( "Applying function:" ), GroupBox, "TextLabel3" );
- glGroupBox->addWidget ( TextLabel3, 3, 0 );
-
- glGroupBox->addColSpacing ( 1, 10 );
-
- // Create "X" label
- QLabel* TextLabelX = new QLabel( "X", GroupBox, "TextLabelX" );
- TextLabelX->setAlignment( int( QLabel::AlignCenter ) );
- TextLabelX->setFont( m_font14bi );
- glGroupBox->addWidget ( TextLabelX, 0, 2 );
-
- // Create combobox for selecting scaling function on a X axis
- m_cbXfunction = new QComboBox( FALSE, GroupBox, "m_cbXFunction");
- m_cbXfunction->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_cbXfunction->setMinimumWidth( 80 );
- glGroupBox->addWidget(m_cbXfunction, 1, 2 );
-
- // Create double spinbox for changing coef. in the scaling function on a X axis
- m_sbXcoeff = new QAD_SpinBoxDbl( GroupBox, "m_sbXcoeff" );
- m_sbXcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbXcoeff->setMinimumWidth( 80 );
- glGroupBox->addWidget(m_sbXcoeff, 2, 2 );
-
- // Create informative label about the applying scaling function on a X axis
- m_lXFunction = new QLabel( GroupBox, "m_lXFunction" );
- m_lXFunction->setFont( m_font14bi );
- m_lXFunction->setAlignment( int( QLabel::AlignCenter ) );
- glGroupBox->addWidget(m_lXFunction, 3, 2 );
-
- FillComboBox( m_cbXfunction );
-
- // Create "Y" label
- QLabel* TextLabelY = new QLabel( "Y", GroupBox, "TextLabelY" );
- TextLabelY->setAlignment( int( QLabel::AlignCenter ) );
- TextLabelY->setFont( m_font14bi );
- glGroupBox->addWidget ( TextLabelY, 0, 3 );
-
- // Create combobox for selecting scaling function on a Y axis
- m_cbYfunction = new QComboBox( FALSE, GroupBox, "m_cbYFunction");
- m_cbYfunction->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_cbYfunction->setMinimumWidth( 80 );
- glGroupBox->addWidget(m_cbYfunction, 1, 3 );
-
- // Create double spinbox for changing coef. in the scaling function on a Y axis
- m_sbYcoeff = new QAD_SpinBoxDbl( GroupBox, "m_sbYcoeff" );
- m_sbYcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbYcoeff->setMinimumWidth( 80 );
- glGroupBox->addWidget(m_sbYcoeff, 2, 3 );
-
- // Create informative label about the applying scaling function on a Y axis
- m_lYFunction = new QLabel( GroupBox, "m_lYFunction" );
- m_lYFunction->setAlignment( int( QLabel::AlignCenter ) );
- m_lYFunction->setFont( m_font14bi );
- glGroupBox->addWidget(m_lYFunction, 3, 3 );
-
- FillComboBox( m_cbYfunction );
-
- // Create "Z" label
- QLabel* TextLabelZ = new QLabel( "Z", GroupBox, "TextLabelZ" );
- TextLabelZ->setAlignment( int( QLabel::AlignCenter ) );
- TextLabelZ->setFont( m_font14bi );
- glGroupBox->addWidget ( TextLabelZ, 0, 4 );
-
- // Create combobox for selecting scaling function on a Z axis
- m_cbZfunction = new QComboBox( FALSE, GroupBox, "m_cbZFunction");
- m_cbZfunction->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_cbZfunction->setMinimumWidth( 80 );
- glGroupBox->addWidget(m_cbZfunction, 1, 4 );
-
- // Create double spinbox for changing coef. in the scaling function on a Z axis
- m_sbZcoeff = new QAD_SpinBoxDbl( GroupBox, "m_sbZcoeff" );
- m_sbZcoeff->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
- m_sbZcoeff->setMinimumWidth( 80 );
- glGroupBox->addWidget(m_sbZcoeff, 2, 4 );
-
- // Create informative label about the applying scaling function on a Z axis
- m_lZFunction = new QLabel( GroupBox, "m_lZFunction" );
- m_lZFunction->setAlignment( int( QLabel::AlignCenter ) );
- m_lZFunction->setFont( m_font14bi );
- glGroupBox->addWidget(m_lZFunction, 3, 4 );
-
- FillComboBox( m_cbZfunction );
-
- if ( aTransform ) {
- int item = aTransform->GetFunctionType(AxisFunction::XAxis);
- m_cbXfunction->setCurrentItem(item);
- if (item) {
- m_sbXcoeff ->setEnabled (TRUE);
- FunctionChanged( m_cbXfunction);
- }
- item = aTransform->GetFunctionType(AxisFunction::YAxis);
- m_cbYfunction->setCurrentItem(item);
- if (item) {
- m_sbYcoeff ->setEnabled (TRUE);
- FunctionChanged( m_cbYfunction );
- }
- item = aTransform->GetFunctionType(AxisFunction::ZAxis);
- m_cbZfunction->setCurrentItem(item);
- if (item) {
- m_sbZcoeff ->setEnabled (TRUE);
- FunctionChanged( m_cbZfunction);
- }
- m_sbXcoeff -> setValue(aTransform->GetCoeff(AxisFunction::XAxis));
- m_sbYcoeff -> setValue(aTransform->GetCoeff(AxisFunction::YAxis));
- m_sbZcoeff -> setValue(aTransform->GetCoeff(AxisFunction::ZAxis));
- }
-
- // Create <Reset> button
- QPushButton* m_bReset = new QPushButton( tr( "&Reset" ), GroupBox, "m_bReset" );
- glGroupBox->addWidget( m_bReset, 4, 4 );
-
- layoutDlg->addWidget(GroupBox,0,0);
-
- // OK, CANCEL, Apply button
- QGroupBox* aWgt = new QGroupBox( this );
- QHBoxLayout* aHBoxLayout = new QHBoxLayout( aWgt );
- aHBoxLayout->setMargin(11);
- aHBoxLayout->setSpacing(6);
-
- // Create <OK> button
- QPushButton* m_bOk = new QPushButton( tr( "O&K" ), aWgt, "m_bOk" );
- m_bOk->setDefault( TRUE );
- m_bOk->setAutoDefault( TRUE );
- aHBoxLayout->addWidget( m_bOk );
- aHBoxLayout->addStretch();
-
- // Create <Apply> button
- QPushButton* m_bApply = new QPushButton( tr( "&Apply" ), aWgt, "m_bApply" );
- m_bApply->setAutoDefault( TRUE );
- aHBoxLayout->addWidget( m_bApply );
- aHBoxLayout->addStretch();
-
- // Create <Cancel> button
- QPushButton* m_bCancel = new QPushButton( tr( "&Cancel" ), aWgt, "m_bCancel" );
- m_bCancel->setAutoDefault( TRUE );
- aHBoxLayout->addWidget( m_bCancel );
-
- layoutDlg->addWidget(aWgt,1,0);
-
- // signals and slots connections
- connect( m_bCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( m_bOk, SIGNAL( clicked() ), this, SLOT( onClickOk( ) ) );
- connect( m_bApply, SIGNAL( clicked() ), this, SLOT( onClickApply( ) ) );
- connect( m_bReset, SIGNAL( clicked() ), this, SLOT( onClickReset( ) ) );
+ if (!name)
+ setName("NonIsometricDlg");
+ setCaption(tr("DLG_TITLE"));
+ setSizeGripEnabled(TRUE);
+
+ SVTK_ViewWindow* aViewWnd = VISU::GetViewWindow();
+
+ // Create layout for this dialog
+ QGridLayout* layoutDlg = new QGridLayout (this);
+ layoutDlg->setSpacing(6);
+ layoutDlg->setMargin(11);
+
+ // Create croup box with grid layout
+ QGroupBox* GroupBox = new QGroupBox(this, "GroupBox");
+ QGridLayout* glGroupBox = new QGridLayout(GroupBox);
+ glGroupBox->setMargin(11);
+ glGroupBox->setSpacing(6);
+
+ // "X" scaling
+ QLabel* TextLabelX = new QLabel (tr("LBL_X"), GroupBox, "TextLabelX");
+ m_sbXcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbXcoeff->setMinimumWidth(80);
+ m_sbXcoeff->setValue(1.0);
+
+ // "Y" scaling
+ QLabel* TextLabelY = new QLabel (tr("LBL_Y"), GroupBox, "TextLabelY");
+ m_sbYcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbYcoeff->setMinimumWidth(80);
+ m_sbYcoeff->setValue(1.0);
+
+ // "Z" scaling
+ QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), GroupBox, "TextLabelZ");
+ m_sbZcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
+ m_sbZcoeff->setMinimumWidth(80);
+ m_sbZcoeff->setValue(1.0);
+
+ // Get initial values from the current VTK viewer
+ if (aViewWnd) {
+ double aScaleFactor[3];
+ aViewWnd->GetScale(aScaleFactor);
+ m_sbXcoeff -> setValue(aScaleFactor[0]);
+ m_sbYcoeff -> setValue(aScaleFactor[1]);
+ m_sbZcoeff -> setValue(aScaleFactor[2]);
+ }
+
+ // Create <Reset> button
+ m_bReset = new QPushButton(tr("&Reset"), GroupBox, "m_bReset");
+
+ // Layout widgets in the group box
+ glGroupBox->addWidget(TextLabelX, 0, 0);
+ glGroupBox->addWidget(m_sbXcoeff, 0, 1);
+ glGroupBox->addWidget(TextLabelY, 0, 2);
+ glGroupBox->addWidget(m_sbYcoeff, 0, 3);
+ glGroupBox->addWidget(TextLabelZ, 0, 4);
+ glGroupBox->addWidget(m_sbZcoeff, 0, 5);
+ glGroupBox->addWidget(m_bReset, 0, 6);
+
+ // OK, CANCEL, Apply button
+ QGroupBox* aWgt = new QGroupBox(this);
+ QHBoxLayout* aHBoxLayout = new QHBoxLayout(aWgt);
+ aHBoxLayout->setMargin(11);
+ aHBoxLayout->setSpacing(6);
+ // Create <OK> button
+ QPushButton* m_bOk = new QPushButton(tr("O&K"), aWgt, "m_bOk");
+ m_bOk->setDefault(TRUE);
+ m_bOk->setAutoDefault(TRUE);
+ // Create <Apply> button
+ QPushButton* m_bApply = new QPushButton(tr("&Apply"), aWgt, "m_bApply");
+ m_bApply->setAutoDefault(TRUE);
+ // Create <Cancel> button
+ QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aWgt, "m_bCancel");
+ m_bCancel->setAutoDefault(TRUE);
+
+ // Layout buttons
+ aHBoxLayout->addWidget(m_bOk);
+ aHBoxLayout->addWidget(m_bApply);
+ aHBoxLayout->addStretch();
+ aHBoxLayout->addWidget(m_bCancel);
+
+ // Layout top level widgets
+ layoutDlg->addWidget(GroupBox,0,0);
+ layoutDlg->addWidget(aWgt,1,0);
+
+ // signals and slots connections
+ connect(m_bCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(m_bOk, SIGNAL(clicked()), this, SLOT(onClickOk()));
+ connect(m_bApply, SIGNAL(clicked()), this, SLOT(onClickApply()));
+ connect(m_bReset, SIGNAL(clicked()), this, SLOT(onClickReset()));
+
+ this->resize(100, this->sizeHint().height());
}
-/*
+/*
* Destroys the object and frees any allocated resources
*/
VisuGUI_NonIsometricDlg::~VisuGUI_NonIsometricDlg()
{
- // no need to delete child widgets, Qt does it all for us
+ // no need to delete child widgets, Qt does it all for us
}
void VisuGUI_NonIsometricDlg::onClickOk()
void VisuGUI_NonIsometricDlg::onClickApply()
{
- bool changed = false;
- QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame();
- if ( sf->getTypeView() == VIEW_VTK )
- {
- int Xfunction = m_cbXfunction->currentItem();
- int Yfunction = m_cbYfunction->currentItem();
- int Zfunction = m_cbZfunction->currentItem();
-
-
- VTKViewer_ViewFrame* vf = (VTKViewer_ViewFrame*) ( sf->getRightFrame()->getViewFrame() );
- VTKViewer_NonIsometricTransform *aTransform = vf->getNonIsometricTransform();
-
- vtkRenderer* Renderer = vf->getRenderer();
- vtkActorCollection* theActors = Renderer->GetActors();
- theActors->InitTraversal();
- vtkActor *actor = theActors->GetNextActor();
-
- aTransform->SetFunction( AxisFunction::XAxis,
- (VTKViewer_NonIsometricTransform::Function) Xfunction,
- m_sbXcoeff->value() );
-
- aTransform->SetFunction( AxisFunction::YAxis,
- (VTKViewer_NonIsometricTransform::Function) Yfunction,
- m_sbYcoeff->value() );
-
- aTransform->SetFunction( AxisFunction::ZAxis,
- (VTKViewer_NonIsometricTransform::Function) Zfunction,
- m_sbZcoeff->value() );
-
- while( actor )
- {
- //SALOME_Actor* pSA = dynamic_cast<SALOME_Actor*> (actor);
- SALOME_Actor* pSA = dynamic_cast<VISU_Actor*> (actor);
- if (pSA)
- {
- //MESSAGE (actor->GetMapper()->GetClassName ())
- vtkPolyDataMapper* mapper = NULL;
- vtkMapper* initialMapper = pSA->GetInitialMapper();
- if ( initialMapper == NULL )
- initialMapper = actor->GetMapper();
- if ( initialMapper->IsA("vtkDataSetMapper") )
- mapper = vtkDataSetMapper::SafeDownCast( initialMapper )->GetPolyDataMapper ();
- else
- mapper = vtkPolyDataMapper::SafeDownCast( initialMapper );
- //MESSAGE (mapper->GetClassName ())
-
- if (mapper)
- {
- //create transformation
-
- //create Filter
- vtkTransformPolyDataFilter *aTransformFilter = vtkTransformPolyDataFilter::New();
- aTransformFilter->SetInput ( mapper->GetInput() );
- aTransformFilter->SetTransform (aTransform);
-
- //create new mapper
- vtkDataSetMapper *aMapper = vtkDataSetMapper::New();
- aMapper->SetInput (aTransformFilter->GetOutput());
- aMapper->ShallowCopy ( actor->GetMapper());
-
- //set new mapper
- actor->SetMapper (aMapper);
-
- aTransformFilter->Delete();
- aMapper->Delete();
- changed = true;
- }
- }
- actor = theActors->GetNextActor();
- }
- if (changed)
- vf->Repaint();
- //in order to improve perfomance
- if ( !Xfunction && !Yfunction && !Zfunction )
- vf->setNonIsometricTransform( NULL );
- }
-}
-
-void VisuGUI_NonIsometricDlg::onClickReset()
-{
- //it's workaround for QComboBox - it doesn't send activated signal using setCurrentItem function
- //therefore we connect on highlighted signal, use setCurrentItem() and disconnect highlighted signal
-
- connect (m_cbXfunction, SIGNAL( highlighted ( const QString& ) ), this, SLOT( onFunctionChanged ( ) ) );
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
+ (SUIT_Session::session()->activeApplication());
+ LightApp_SelectionMgr* mgr = anApp->selectionMgr();
- m_cbXfunction->setCurrentItem ( 0 );
- m_cbXfunction->disconnect( SIGNAL( highlighted ( const QString& ) ) );
+ SVTK_ViewWindow* vf = VISU::GetViewWindow();
+ if (!vf)
+ return;
- connect (m_cbYfunction, SIGNAL( highlighted ( const QString& ) ), this, SLOT( onFunctionChanged ( ) ) );
- m_cbYfunction->setCurrentItem ( 0 );
- m_cbYfunction->disconnect( SIGNAL( highlighted ( const QString& ) ) );
+ double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
+ vf->SetScale(aScale);
- connect (m_cbZfunction, SIGNAL( highlighted ( const QString& ) ), this, SLOT( onFunctionChanged ( ) ) );
- m_cbZfunction->setCurrentItem ( 0 );
- m_cbZfunction->disconnect( SIGNAL( highlighted ( const QString& ) ) );
-}
-
-//Populates combobox and makes all needed connects
-void VisuGUI_NonIsometricDlg::FillComboBox(QComboBox* cb)
-{
- cb->insertItem( tr ("None") );
- cb->insertItem ( tr ("Linear") );
-// cb->insertItem ( tr ("Logarithmic") );
+ SALOME_ListIO selected;
+ mgr->selectedObjects(selected);
+ SALOME_ListIteratorOfListIO Itinit(selected);
-
- connect (cb, SIGNAL( activated ( const QString& ) ), this, SLOT( onFunctionChanged ( ) ) );
-
- //it's workaround for QComboBox - it doesn't send activated signal using setCurrentItem function
- //therefore we connect on highlighted signal, use setCurrentItem() and disconnect highlighted signal
- cb->setCurrentItem ( 1 );
- connect (cb, SIGNAL( highlighted ( const QString& ) ), this, SLOT( onFunctionChanged ( ) ) );
- cb->setCurrentItem ( 0 );
- cb->disconnect( SIGNAL( highlighted ( const QString& ) ) );
-
-}
-
-void VisuGUI_NonIsometricDlg::onFunctionChanged()
-{
- //TODO
- const QComboBox* cbFunction = (const QComboBox* ) sender();
- FunctionChanged(cbFunction);
+ if (vf)
+ for (; Itinit.More(); Itinit.Next()) {
+ vf->highlight(Itinit.Value(), true);
+ }
}
-void VisuGUI_NonIsometricDlg::FunctionChanged(const QComboBox* cbFunction )
+void VisuGUI_NonIsometricDlg::onClickReset()
{
- //TODO
- const QString & function = cbFunction-> currentText();
- QAD_SpinBoxDbl* sbCoeff;
- QLabel* lFunction;
- QString axis;
- QString formula;
- //this variable stores index in bounds array for vtkRenderer
- // 0 - xmin, xmax
- // 2 - ymin, ymax
- // 4 - zmin, zmax
- int boundIndex;
-
- if (cbFunction == m_cbXfunction)
- {
- sbCoeff = m_sbXcoeff;
- lFunction = m_lXFunction;
- axis = "x";
- boundIndex = 0;
- }
- else
- if (cbFunction == m_cbYfunction)
- {
- sbCoeff = m_sbYcoeff;
- lFunction = m_lYFunction;
- axis = "y";
- boundIndex = 2;
- }
- else
- if (cbFunction == m_cbZfunction)
- {
- sbCoeff = m_sbZcoeff;
- lFunction = m_lZFunction;
- axis = "z";
- boundIndex = 4;
- }
- else
- return ;
-
- sbCoeff->setEnabled (TRUE);
- formula = axis;
-
- if ( function == tr ("None") )
- {
- sbCoeff->setMinValue( 1.0 );
- sbCoeff->setMaxValue( 1.0 );
- sbCoeff->setValue( 1.0 );
- sbCoeff->setEnabled ( FALSE );
- formula += QString(" = ");
- formula += axis;
- lFunction->setText( formula );
- }
- else
- if ( function == tr ("Linear") )
- {
- sbCoeff->setMinValue( -1.7E308 );
- sbCoeff->setMaxValue( 1.7E+308 );
- // sbCoeff->setValue( 1.0 );
- formula += QString(" = k");
- formula += axis;
- lFunction->setText( formula );
- }
- else
- if ( function == tr ("Logarithmic") )
- {
- // TODO
- QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame();
- if ( sf->getTypeView() == VIEW_VTK )
- {
- vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer();
- float bounds[6];
- Renderer->ComputeVisiblePropBounds (bounds);
- //we use following formula lg (x+a) and x+a >= 1
- //therefore a >= 1-x
- double minValue;
- if ( bounds[boundIndex] > 0 && bounds[boundIndex+1] > 0 )
- minValue = 1 - bounds[boundIndex+1];
- else
- minValue = 1 - bounds[boundIndex];
- MESSAGE ( "Bounds " << bounds[0] << " " << bounds[1] << " " << bounds[2] << " " << bounds[3] << " " << bounds[4] << " " << bounds[5] << " " )
- sbCoeff->setMinValue( minValue );
- sbCoeff->setMaxValue( 1.7E+308 );
- sbCoeff->setValue( minValue );
- formula += QString(" = lg(");
- formula += axis;
- formula += QString("+a), a >= %1").arg( minValue );
- }
- else
- {
- sbCoeff->setEnabled (FALSE);
- formula = "";
- }
- lFunction->setText( formula );
- }
+ m_bReset->setFocus();
+ m_sbXcoeff->setValue(1.0);
+ m_sbYcoeff->setValue(1.0);
+ m_sbZcoeff->setValue(1.0);
}