/>
</FileConfiguration>
</File>
+ <File
+ RelativePath="..\..\src\SVTK\Plot3d_FitDataDlg.h"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generate moc_$(InputName).cxx..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Generate moc_$(InputName).cxx..."
+ CommandLine="type $(InputPath) > $(GUI_SRC_DIR)\$(ConfigurationName)\include\$(InputFileName)
$(QTDIR)\bin\moc.exe $(InputPath) -o ..\..\moc\moc_$(InputName).cxx
"
+ Outputs="$(GUI_SRC_DIR)\$(ConfigurationName)\include\$(InputFileName);..\..\moc\moc_$(InputName).cxx"
+ />
+ </FileConfiguration>
+ </File>
<File
RelativePath="..\..\src\SVTK\Plot3d_SetupSurfacesDlg.h"
>
RelativePath="..\..\src\SVTK\Plot3d_Actor.cxx"
>
</File>
+ <File
+ RelativePath="..\..\src\SVTK\Plot3d_FitDataDlg.cxx"
+ >
+ </File>
<File
RelativePath="..\..\src\SVTK\Plot3d_SetupSurfacesDlg.cxx"
>
Name="Meta Object Files"
Filter="moc_*.cxx"
>
+ <File
+ RelativePath="..\..\moc\moc_Plot3d_FitDataDlg.cxx"
+ >
+ </File>
<File
RelativePath="..\..\moc\moc_Plot3d_SetupSurfacesDlg.cxx"
>
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot3d_FitDataDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#include "Plot3d_FitDataDlg.h"
+
+#include <QLabel>
+#include <QLayout>
+#include <QValidator>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QGroupBox>
+#include <QLineEdit>
+
+#define SPACING_SIZE 6
+#define MARGIN_SIZE 11
+#define MIN_EDIT_SIZE 100
+
+/*!
+ Constructor
+*/
+Plot3d_FitDataDlg::Plot3d_FitDataDlg( QWidget* parent, bool secondAxisY )
+ : QDialog( parent ? parent : 0,
+ Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+ myY2MinEdit( 0 ), myY2MaxEdit( 0 ), mySecondAxisY( secondAxisY )
+{
+ setObjectName( "Plot3d_FitDataDlg" );
+ setModal( true );
+ setWindowTitle( tr( "FIT_DATA_TLT" ) );
+ setSizeGripEnabled( TRUE );
+ QGridLayout* topLayout = new QGridLayout( this );
+ topLayout->setSpacing( SPACING_SIZE );
+ topLayout->setMargin( MARGIN_SIZE );
+
+ // 'Range' group
+ myRangeGrp = new QGroupBox( this );
+ QGridLayout* aGridLayout = new QGridLayout( myRangeGrp );
+ myRangeGrp->setLayout( aGridLayout );
+ aGridLayout->setAlignment( Qt::AlignTop );
+ aGridLayout->setMargin( MARGIN_SIZE );
+ aGridLayout->setSpacing( SPACING_SIZE );
+
+ myModeAllRB = new QRadioButton( tr( "FIT_ALL" ), myRangeGrp );
+ myModeHorRB = new QRadioButton( tr( "FIT_HORIZONTAL" ), myRangeGrp );
+ myModeVerRB = new QRadioButton( tr( "FIT_VERTICAL" ), myRangeGrp );
+
+ QDoubleValidator* aValidator = new QDoubleValidator( this );
+ myXMinEdit = new QLineEdit( myRangeGrp );
+ myXMinEdit->setValidator( aValidator );
+ myXMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myXMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myXMinEdit->setText( "0.0" );
+
+ myYMinEdit = new QLineEdit( myRangeGrp );
+ myYMinEdit->setValidator( aValidator );
+ myYMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myYMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myYMinEdit->setText( "0.0" );
+
+ myXMaxEdit = new QLineEdit( myRangeGrp );
+ myXMaxEdit->setValidator( aValidator );
+ myXMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myXMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myXMaxEdit->setText( "0.0" );
+
+ myYMaxEdit = new QLineEdit( myRangeGrp );
+ myYMaxEdit->setValidator( aValidator );
+ myYMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myYMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myYMaxEdit->setText( "0.0" );
+
+ if (mySecondAxisY) {
+ myY2MinEdit = new QLineEdit( myRangeGrp );
+ myY2MinEdit->setValidator( aValidator );
+ myY2MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myY2MinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myY2MinEdit->setText( "0.0" );
+
+ myY2MaxEdit = new QLineEdit( myRangeGrp );
+ myY2MaxEdit->setValidator( aValidator );
+ myY2MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myY2MaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myY2MaxEdit->setText( "0.0" );
+ }
+
+ QFrame* aHLine = new QFrame( myRangeGrp );
+ aHLine->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+
+ QHBoxLayout* aModeLayout = new QHBoxLayout;
+ aModeLayout->setMargin( 0 );
+ aModeLayout->setSpacing( SPACING_SIZE );
+ aModeLayout->addWidget( myModeAllRB );
+ aModeLayout->addWidget( myModeHorRB );
+ aModeLayout->addWidget( myModeVerRB );
+
+ QLabel* horLab = new QLabel( tr( "HORIZONTAL_AXIS" ), myRangeGrp );
+ QLabel* verLab = new QLabel( tr( "VERTICAL_AXIS" ), myRangeGrp );
+ if (mySecondAxisY)
+ verLab->setText( tr( "VERTICAL_LEFT_AXIS" ) );
+
+ QFont font = horLab->font(); font.setBold( true );
+ horLab->setFont( font ); verLab->setFont( font );
+
+ aGridLayout->addLayout( aModeLayout, 0, 0, 1, 5 );
+ aGridLayout->addWidget( aHLine, 1, 0, 1, 5 );
+ aGridLayout->addWidget( horLab, 2, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 2, 1 );
+ aGridLayout->addWidget( myXMinEdit, 2, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 2, 3 );
+ aGridLayout->addWidget( myXMaxEdit, 2, 4 );
+ aGridLayout->addWidget( verLab, 3, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 3, 1 );
+ aGridLayout->addWidget( myYMinEdit, 3, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 3, 3 );
+ aGridLayout->addWidget( myYMaxEdit, 3, 4 );
+
+ if (mySecondAxisY) {
+ QLabel* ver2Lab = new QLabel(tr( "VERTICAL_RIGHT_AXIS" ), myRangeGrp );
+ ver2Lab->setFont( font );
+ aGridLayout->addWidget( ver2Lab, 4, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 4, 1 );
+ aGridLayout->addWidget( myY2MinEdit, 4, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 4, 3 );
+ aGridLayout->addWidget( myY2MaxEdit, 4, 4 );
+ }
+
+ // OK/Cancel buttons
+ myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
+ myOkBtn->setObjectName( "buttonOk" );
+ myOkBtn->setAutoDefault( TRUE );
+ myOkBtn->setDefault( TRUE );
+ myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
+ myCancelBtn->setObjectName( "buttonCancel" );
+ myCancelBtn->setAutoDefault( TRUE );
+
+ topLayout->addWidget( myRangeGrp, 0, 0, 1, 3 );
+ topLayout->addWidget( myOkBtn, 1, 0 );
+ topLayout->setColumnStretch( 1, 5 );
+ topLayout->addWidget( myCancelBtn, 1, 2 );
+
+ // connect signals
+ connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( myRangeGrp, SIGNAL( clicked( int ) ), this, SLOT( onModeChanged( int ) ) );
+
+ // initial state
+ myModeAllRB->setChecked( true );
+ onModeChanged( 0 );
+}
+
+/*!
+ Sets range
+*/
+void Plot3d_FitDataDlg::setRange( const double xMin,
+ const double xMax,
+ const double yMin,
+ const double yMax,
+ const double y2Min,
+ const double y2Max)
+{
+ myXMinEdit->setText( QString::number( xMin ) );
+ myXMaxEdit->setText( QString::number( xMax ) );
+ myYMinEdit->setText( QString::number( yMin ) );
+ myYMaxEdit->setText( QString::number( yMax ) );
+ if (mySecondAxisY) {
+ myY2MinEdit->setText( QString::number( y2Min ) );
+ myY2MaxEdit->setText( QString::number( y2Max ) );
+ }
+}
+
+/*!
+ Gets range, returns mode (see getMode())
+*/
+int Plot3d_FitDataDlg::getRange( double& xMin,
+ double& xMax,
+ double& yMin,
+ double& yMax,
+ double& y2Min,
+ double& y2Max)
+{
+ xMin = myXMinEdit->text().toDouble();
+ xMax = myXMaxEdit->text().toDouble();
+ yMin = myYMinEdit->text().toDouble();
+ yMax = myYMaxEdit->text().toDouble();
+ if (mySecondAxisY) {
+ y2Min = myY2MinEdit->text().toDouble();
+ y2Max = myY2MaxEdit->text().toDouble();
+ }
+ else {
+ y2Min = 0;
+ y2Max = 0;
+ }
+ int myMode = 0;
+ if ( myModeAllRB->isChecked() )
+ myMode = 0;
+ if ( myModeHorRB->isChecked() )
+ myMode = 1;
+ if ( myModeVerRB->isChecked() )
+ myMode = 2;
+ return myMode;
+}
+
+/*!
+ Gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical
+*/
+int Plot3d_FitDataDlg::getMode()
+{
+ int myMode = 0;
+ if ( myModeAllRB->isChecked() )
+ myMode = 0;
+ if ( myModeHorRB->isChecked() )
+ myMode = 1;
+ if ( myModeVerRB->isChecked() )
+ myMode = 2;
+ return myMode;
+}
+
+/*!
+ Called when range mode changed
+*/
+void Plot3d_FitDataDlg::onModeChanged(int mode)
+{
+ bool badFocus;
+ switch( mode ) {
+ case 0: // fit all mode
+ myXMinEdit->setEnabled(true);
+ myXMaxEdit->setEnabled(true);
+ myYMinEdit->setEnabled(true);
+ myYMaxEdit->setEnabled(true);
+ if (mySecondAxisY) {
+ myY2MinEdit->setEnabled(true);
+ myY2MaxEdit->setEnabled(true);
+ }
+ break;
+ case 1: // fit horizontal mode
+ badFocus = myYMinEdit->hasFocus() || myYMaxEdit->hasFocus();
+ myXMinEdit->setEnabled(true);
+ myXMaxEdit->setEnabled(true);
+ myYMinEdit->setEnabled(false);
+ myYMaxEdit->setEnabled(false);
+ if (mySecondAxisY) {
+ myY2MinEdit->setEnabled(false);
+ myY2MaxEdit->setEnabled(false);
+ }
+ if (badFocus)
+ myXMinEdit->setFocus();
+ break;
+ case 2: // fit vertical mode
+ badFocus = myXMinEdit->hasFocus() || myXMaxEdit->hasFocus();
+ myXMinEdit->setEnabled(false);
+ myXMaxEdit->setEnabled(false);
+ myYMinEdit->setEnabled(true);
+ myYMaxEdit->setEnabled(true);
+ if (mySecondAxisY) {
+ myY2MinEdit->setEnabled(true);
+ myY2MaxEdit->setEnabled(true);
+ }
+ if (badFocus)
+ myYMinEdit->setFocus();
+ break;
+ }
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef PLOT3D_FITDATADLG_H
+#define PLOT3D_FITDATADLG_H
+
+#include "SVTK.h"
+
+#include <QDialog>
+
+class QGroupBox;
+class QRadioButton;
+class QLineEdit;
+class QPushButton;
+
+class SVTK_EXPORT Plot3d_FitDataDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+// constuctor
+ Plot3d_FitDataDlg( QWidget* parent, bool secondAxisY );
+
+// sets range
+ void setRange(const double xMin,
+ const double xMax,
+ const double yMin,
+ const double yMax,
+ const double y2Min = 0,
+ const double y2Max = 0);
+// gets range, returns mode (see getMode())
+ int getRange(double& xMin,
+ double& xMax,
+ double& yMin,
+ double& yMax,
+ double& y2Min,
+ double& y2Max);
+// gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical
+ int getMode();
+
+protected slots:
+// called when range mode changed
+ void onModeChanged(int);
+
+private:
+ QGroupBox* myRangeGrp;
+ QRadioButton* myModeAllRB;
+ QRadioButton* myModeHorRB;
+ QRadioButton* myModeVerRB;
+ QLineEdit* myXMinEdit;
+ QLineEdit* myYMinEdit;
+ QLineEdit* myY2MinEdit;
+ QLineEdit* myXMaxEdit;
+ QLineEdit* myYMaxEdit;
+ QLineEdit* myY2MaxEdit;
+ QPushButton* myOkBtn;
+ QPushButton* myCancelBtn;
+ bool mySecondAxisY;
+};
+
+#endif
connect( myTable, SIGNAL( valueChanged( int, int ) ), SLOT( onValueChanged( int, int ) ) );
setButtonPosition( Right, Cancel );
- setMinimumWidth( 500 );
+ setMinimumWidth( 300 );
setMinimumHeight( 250 );
}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : Plot2d_FitDataDlg.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#include "Plot2d_FitDataDlg.h"
+#include <QLabel>
+#include <QLayout>
+#include <QValidator>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QGroupBox>
+#include <QLineEdit>
+
+#define SPACING_SIZE 6
+#define MARGIN_SIZE 11
+#define MIN_EDIT_SIZE 100
+
+/*!
+ Constructor
+*/
+Plot2d_FitDataDlg::Plot2d_FitDataDlg( QWidget* parent, bool secondAxisY )
+ : QDialog( parent ? parent : 0,
+ Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+ myY2MinEdit( 0 ), myY2MaxEdit( 0 ), mySecondAxisY( secondAxisY )
+
+{
+ setObjectName( "Plot2d_FitDataDlg" );
+ setModal( true );
+ setWindowTitle( tr( "FIT_DATA_TLT" ) );
+ setSizeGripEnabled( TRUE );
+ QGridLayout* topLayout = new QGridLayout( this );
+ topLayout->setSpacing( SPACING_SIZE );
+ topLayout->setMargin( MARGIN_SIZE );
+
+ // 'Range' group
+ myRangeGrp = new QGroupBox( this );
+ QGridLayout* aGridLayout = new QGridLayout( myRangeGrp );
+ myRangeGrp->setLayout( aGridLayout );
+ aGridLayout->setAlignment( Qt::AlignTop );
+ aGridLayout->setMargin( MARGIN_SIZE );
+ aGridLayout->setSpacing( SPACING_SIZE );
+
+ myModeAllRB = new QRadioButton( tr( "FIT_ALL" ), myRangeGrp );
+ myModeHorRB = new QRadioButton( tr( "FIT_HORIZONTAL" ), myRangeGrp );
+ myModeVerRB = new QRadioButton( tr( "FIT_VERTICAL" ), myRangeGrp );
+
+ QDoubleValidator* aValidator = new QDoubleValidator( this );
+ myXMinEdit = new QLineEdit( myRangeGrp );
+ myXMinEdit->setValidator( aValidator );
+ myXMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myXMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myXMinEdit->setText( "0.0" );
+
+ myYMinEdit = new QLineEdit( myRangeGrp );
+ myYMinEdit->setValidator( aValidator );
+ myYMinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myYMinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myYMinEdit->setText( "0.0" );
+
+ myXMaxEdit = new QLineEdit( myRangeGrp );
+ myXMaxEdit->setValidator( aValidator );
+ myXMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myXMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myXMaxEdit->setText( "0.0" );
+
+ myYMaxEdit = new QLineEdit( myRangeGrp );
+ myYMaxEdit->setValidator( aValidator );
+ myYMaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myYMaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myYMaxEdit->setText( "0.0" );
+
+ if (mySecondAxisY) {
+ myY2MinEdit = new QLineEdit( myRangeGrp );
+ myY2MinEdit->setValidator( aValidator );
+ myY2MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myY2MinEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myY2MinEdit->setText( "0.0" );
+
+ myY2MaxEdit = new QLineEdit( myRangeGrp );
+ myY2MaxEdit->setValidator( aValidator );
+ myY2MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myY2MaxEdit->setMinimumSize( MIN_EDIT_SIZE, 0 );
+ myY2MaxEdit->setText( "0.0" );
+ }
+
+ QFrame* aHLine = new QFrame( myRangeGrp );
+ aHLine->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+
+ QHBoxLayout* aModeLayout = new QHBoxLayout;
+ aModeLayout->setMargin( 0 );
+ aModeLayout->setSpacing( SPACING_SIZE );
+ aModeLayout->addWidget( myModeAllRB );
+ aModeLayout->addWidget( myModeHorRB );
+ aModeLayout->addWidget( myModeVerRB );
+
+ QLabel* horLab = new QLabel( tr( "HORIZONTAL_AXIS" ), myRangeGrp );
+ QLabel* verLab = new QLabel( tr( "VERTICAL_AXIS" ), myRangeGrp );
+ if (mySecondAxisY)
+ verLab->setText( tr( "VERTICAL_LEFT_AXIS" ) );
+
+ QFont font = horLab->font(); font.setBold( true );
+ horLab->setFont( font ); verLab->setFont( font );
+
+ aGridLayout->addLayout( aModeLayout, 0, 0, 1, 5 );
+ aGridLayout->addWidget( aHLine, 1, 0, 1, 5 );
+ aGridLayout->addWidget( horLab, 2, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 2, 1 );
+ aGridLayout->addWidget( myXMinEdit, 2, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 2, 3 );
+ aGridLayout->addWidget( myXMaxEdit, 2, 4 );
+ aGridLayout->addWidget( verLab, 3, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 3, 1 );
+ aGridLayout->addWidget( myYMinEdit, 3, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 3, 3 );
+ aGridLayout->addWidget( myYMaxEdit, 3, 4 );
+
+ if (mySecondAxisY) {
+ QLabel* ver2Lab = new QLabel(tr( "VERTICAL_RIGHT_AXIS" ), myRangeGrp );
+ ver2Lab->setFont( font );
+ aGridLayout->addWidget( ver2Lab, 4, 0 );
+ aGridLayout->addWidget( new QLabel( tr( "MIN_VALUE_LAB" ), myRangeGrp ),
+ 4, 1 );
+ aGridLayout->addWidget( myY2MinEdit, 4, 2 );
+ aGridLayout->addWidget( new QLabel( tr( "MAX_VALUE_LAB" ), myRangeGrp ),
+ 4, 3 );
+ aGridLayout->addWidget( myY2MaxEdit, 4, 4 );
+ }
+
+ // OK/Cancel buttons
+ myOkBtn = new QPushButton( tr( "BUT_OK" ), this );
+ myOkBtn->setObjectName( "buttonOk" );
+ myOkBtn->setAutoDefault( TRUE );
+ myOkBtn->setDefault( TRUE );
+ myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this );
+ myCancelBtn->setObjectName( "buttonCancel" );
+ myCancelBtn->setAutoDefault( TRUE );
+
+ topLayout->addWidget( myRangeGrp, 0, 0, 1, 3 );
+ topLayout->addWidget( myOkBtn, 1, 0 );
+ topLayout->setColumnStretch( 1, 5 );
+ topLayout->addWidget( myCancelBtn, 1, 2 );
+
+ // connect signals
+ connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( myRangeGrp, SIGNAL( clicked( int ) ), this, SLOT( onModeChanged( int ) ) );
+
+ // initial state
+ myModeAllRB->setChecked( true );
+ onModeChanged( 0 );
+}
+
+/*!
+ Sets range
+*/
+void Plot2d_FitDataDlg::setRange( const double xMin,
+ const double xMax,
+ const double yMin,
+ const double yMax,
+ const double y2Min,
+ const double y2Max)
+{
+ myXMinEdit->setText( QString::number( xMin ) );
+ myXMaxEdit->setText( QString::number( xMax ) );
+ myYMinEdit->setText( QString::number( yMin ) );
+ myYMaxEdit->setText( QString::number( yMax ) );
+ if (mySecondAxisY) {
+ myY2MinEdit->setText( QString::number( y2Min ) );
+ myY2MaxEdit->setText( QString::number( y2Max ) );
+ }
+}
+
+/*!
+ Gets range, returns mode (see getMode())
+*/
+int Plot2d_FitDataDlg::getRange( double& xMin,
+ double& xMax,
+ double& yMin,
+ double& yMax,
+ double& y2Min,
+ double& y2Max)
+{
+ xMin = myXMinEdit->text().toDouble();
+ xMax = myXMaxEdit->text().toDouble();
+ yMin = myYMinEdit->text().toDouble();
+ yMax = myYMaxEdit->text().toDouble();
+ if (mySecondAxisY) {
+ y2Min = myY2MinEdit->text().toDouble();
+ y2Max = myY2MaxEdit->text().toDouble();
+ }
+ else {
+ y2Min = 0;
+ y2Max = 0;
+ }
+ int myMode = 0;
+ if ( myModeAllRB->isChecked() )
+ myMode = 0;
+ if ( myModeHorRB->isChecked() )
+ myMode = 1;
+ if ( myModeVerRB->isChecked() )
+ myMode = 2;
+ return myMode;
+}
+
+/*!
+ Gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical
+*/
+int Plot2d_FitDataDlg::getMode()
+{
+ int myMode = 0;
+ if ( myModeAllRB->isChecked() )
+ myMode = 0;
+ if ( myModeHorRB->isChecked() )
+ myMode = 1;
+ if ( myModeVerRB->isChecked() )
+ myMode = 2;
+ return myMode;
+}
+
+/*!
+ Called when range mode changed
+*/
+void Plot2d_FitDataDlg::onModeChanged(int mode)
+{
+ bool badFocus;
+ switch( mode ) {
+ case 0: // fit all mode
+ myXMinEdit->setEnabled(true);
+ myXMaxEdit->setEnabled(true);
+ myYMinEdit->setEnabled(true);
+ myYMaxEdit->setEnabled(true);
+ if (mySecondAxisY) {
+ myY2MinEdit->setEnabled(true);
+ myY2MaxEdit->setEnabled(true);
+ }
+ break;
+ case 1: // fit horizontal mode
+ badFocus = myYMinEdit->hasFocus() || myYMaxEdit->hasFocus();
+ myXMinEdit->setEnabled(true);
+ myXMaxEdit->setEnabled(true);
+ myYMinEdit->setEnabled(false);
+ myYMaxEdit->setEnabled(false);
+ if (mySecondAxisY) {
+ myY2MinEdit->setEnabled(false);
+ myY2MaxEdit->setEnabled(false);
+ }
+ if (badFocus)
+ myXMinEdit->setFocus();
+ break;
+ case 2: // fit vertical mode
+ badFocus = myXMinEdit->hasFocus() || myXMaxEdit->hasFocus();
+ myXMinEdit->setEnabled(false);
+ myXMaxEdit->setEnabled(false);
+ myYMinEdit->setEnabled(true);
+ myYMaxEdit->setEnabled(true);
+ if (mySecondAxisY) {
+ myY2MinEdit->setEnabled(true);
+ myY2MaxEdit->setEnabled(true);
+ }
+ if (badFocus)
+ myYMinEdit->setFocus();
+ break;
+ }
+}
+
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef PLOT2D_FITDATADLG_H
+#define PLOT2D_FITDATADLG_H
+
+#include "Plot2d.h"
+#include <QDialog>
+
+class QGroupBox;
+class QRadioButton;
+class QLineEdit;
+class QPushButton;
+
+class PLOT2D_EXPORT Plot2d_FitDataDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+// constuctor
+ Plot2d_FitDataDlg( QWidget* parent, bool secondAxisY );
+
+// sets range
+ void setRange(const double xMin,
+ const double xMax,
+ const double yMin,
+ const double yMax,
+ const double y2Min = 0,
+ const double y2Max = 0);
+// gets range, returns mode (see getMode())
+ int getRange(double& xMin,
+ double& xMax,
+ double& yMin,
+ double& yMax,
+ double& y2Min,
+ double& y2Max);
+// gets mode : 0 - Fit all; 1 - Fit horizontal, 2 - Fit vertical
+ int getMode();
+
+protected slots:
+// called when range mode changed
+ void onModeChanged(int);
+
+private:
+ QGroupBox* myRangeGrp;
+ QRadioButton* myModeAllRB;
+ QRadioButton* myModeHorRB;
+ QRadioButton* myModeVerRB;
+ QLineEdit* myXMinEdit;
+ QLineEdit* myYMinEdit;
+ QLineEdit* myY2MinEdit;
+ QLineEdit* myXMaxEdit;
+ QLineEdit* myYMaxEdit;
+ QLineEdit* myY2MaxEdit;
+ QPushButton* myOkBtn;
+ QPushButton* myCancelBtn;
+ bool mySecondAxisY;
+};
+
+#endif
*/
void SVTK_Viewer::contextMenuPopup( QMenu* thePopup )
{
+ SVTK_ViewWindow* aView = (SVTK_ViewWindow*)myViewManager->getActiveView();
+ if( aView )
+ aView->contextMenuPopup( thePopup );
+
+ if( !thePopup->isEmpty() )
+ thePopup->addSeparator();
+
thePopup->addAction( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
thePopup->addAction( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
#include "SVTK_ViewParameterDlg.h"
#include "Plot3d_Actor.h"
+#include "Plot3d_FitDataDlg.h"
#include "Plot3d_SetupSurfacesDlg.h"
#include "SALOME_Actor.h"
+#include <QMenu>
#include <QToolBar>
#include <QEvent>
#include <QXmlStreamWriter>
#include <vtkAxisActor2D.h>
#include <vtkGL2PSExporter.h>
#include <vtkInteractorStyle.h>
+#include <vtkScalarBarActor.h>
#include "QtxAction.h"
SVTK_ViewWindow::~SVTK_ViewWindow()
{}
+/*!
+ Fill the context menu
+ \param thePopup context menu
+*/
+void SVTK_ViewWindow::contextMenuPopup( QMenu* thePopup )
+{
+ if( myMode2D )
+ thePopup->addAction( tr( "TOT_SVTK_FITDATA" ), this, SLOT( onFitData() ) );
+}
/*!
\return corresponding view
if( Plot3d_Actor* aSurface = dynamic_cast<Plot3d_Actor*>( anActor ) )
{
aSurfaces << aSurface;
- aNameList << aSurface->getName();
+ if( vtkScalarBarActor* aScalarBar = aSurface->GetScalarBarActor().GetPointer() )
+ aNameList << aScalarBar->GetTitle();
}
}
Plot3d_Actor* aSurface = aSurfaces[ anIndex ];
aSurfaces.removeAt( anIndex );
aSurface->RemoveFromRender( aRenderer );
+ aSurface->Delete();
}
}
{
Plot3d_Actor* aSurface = anIndexToSurface[ i ];
QString aText = aTexts[ i ];
- aSurface->setName( aText.toLatin1().constData() );
+ if( vtkScalarBarActor* aScalarBar = aSurface->GetScalarBarActor().GetPointer() )
+ aScalarBar->SetTitle( aText.toLatin1().constData() );
}
vtkFloatingPointType aGlobalBounds[6] = { VTK_DOUBLE_MAX, VTK_DOUBLE_MIN,
SetScale( aScale );
onFitAll();
}
+
+/*!
+ Fit 2D surfaces to the specified data range
+*/
+void SVTK_ViewWindow::onFitData()
+{
+ // to do
+}
//! To initialize #SVTK_ViewWindow instance
virtual void Initialize(SVTK_ViewModelBase* theModel);
+ //! Fill the context menu
+ void contextMenuPopup( QMenu* thePopup );
+
//! Get #SVTK_View
SVTK_View* getView();
void onSurfacesSettings();
+ void onFitData();
+
void onStartRecording();
void onPlayRecording();
void onPauseRecording();
<translation>Tool jpeg2yuv, necessary for AVI recording, is not available.
Please, refer to the documentation.</translation>
</message>
+ <message>
+ <source>TOT_SVTK_FITDATA</source>
+ <translation>Fit range</translation>
+ </message>
</context>
<context>
<name>SVTK_NonIsometricDlg</name>
<translation>Change background...</translation>
</message>
</context>
+<context>
+ <name>Plot3d_FitDataDlg</name>
+ <message>
+ <source>FIT_HORIZONTAL</source>
+ <translation>Fit horizontally</translation>
+ </message>
+ <message>
+ <source>MIN_VALUE_LAB</source>
+ <translation>Min:</translation>
+ </message>
+ <message>
+ <source>VERTICAL_AXIS</source>
+ <translation>Vertical axis</translation>
+ </message>
+ <message>
+ <source>MAX_VALUE_LAB</source>
+ <translation>Max:</translation>
+ </message>
+ <message>
+ <source>HORIZONTAL_AXIS</source>
+ <translation>Horizontal axis</translation>
+ </message>
+ <message>
+ <source>VERTICAL_LEFT_AXIS</source>
+ <translation>Vertical left axis</translation>
+ </message>
+ <message>
+ <source>FIT_ALL</source>
+ <translation>Fit both</translation>
+ </message>
+ <message>
+ <source>VERTICAL_RIGHT_AXIS</source>
+ <translation>Vertical right axis</translation>
+ </message>
+ <message>
+ <source>FIT_VERTICAL</source>
+ <translation>Fit vertically</translation>
+ </message>
+</context>
<context>
<name>Plot3d_SetupSurfacesDlg</name>
<message>