Salome HOME
add possibility to change the size of histogram
authorsecher <secher>
Wed, 31 Jan 2007 10:29:53 +0000 (10:29 +0000)
committersecher <secher>
Wed, 31 Jan 2007 10:29:53 +0000 (10:29 +0000)
src/FILTERGUI/FILTER_msg_en.po
src/FILTERGUI/SelectParams.cxx
src/FILTERGUI/SelectParams.h

index acd9df9ba15a9a1b140cbee8d94c6998d5f34037..424387d05e9edf8c2168badba26c4596d7f8d62b 100644 (file)
@@ -80,6 +80,10 @@ msgstr "Field"
 msgid "FILTER_GRADIENT"
 msgstr "Gradient"
 
+#: SelectParams.cxx:162
+msgid "FILTER_SIZE_HISTO"
+msgstr "Histogram size  "
+
 #: SelectParams.cxx:174
 msgid "FILTER_DISPLAY_HISTO"
 msgstr "Display Histogram"
index 181a4f710aabf52c0ec97568344bd09d8b98ad73..10da73f8fe9def90a24c942bc4e9bb1811db1286 100644 (file)
@@ -41,7 +41,7 @@
 SelectParams::SelectParams(FilterGUI* theModule,SelectField *sel,
                           const char* name,
                           bool modal, WFlags fl)
-  : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),  _size(128)
+  : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),  _size(1024)
 {
   // Allocate histogram arrays
   _x = new double[_size];
@@ -154,6 +154,16 @@ void SelectParams::buildFrame()
   _myGroupLayout->addWidget( _myFunc, row, 0 );
   row++;
 
+  // 01)  histogram size (line edit)
+  _myHSize = new QButtonGroup( tr(""), _GroupC1 );
+  _myHSize->setExclusive( true );
+  _myHSize->setColumnLayout( 0, Qt::Horizontal );
+  QGridLayout* shLay = new QGridLayout( _myHSize->layout() );
+  shLay->addWidget( _myLSH = new QLabel( tr("FILTER_SIZE_HISTO") , _myHSize ), 0, 0 );
+  shLay->addWidget( _myLESH = new QLineEdit( "1024", _myHSize ), 0, 1 );
+  _myGroupLayout->addWidget( _myHSize, row, 0 );
+  row++;
+
   // 1)  display histogram button (pushbutton)
   _myHisto = new QPushButton( "", _GroupC1 );
   _myHisto->setText(tr("FILTER_DISPLAY_HISTO"));
@@ -294,6 +304,7 @@ void SelectParams::buildFrame()
   _myHistoSThresh = _myPlot->insertCurve( QString() );
   _myPlot->setCurvePen( _myHistoSThresh, QPen( Qt::black, 1 ) );
 
+  connect( _myLESH, SIGNAL(returnPressed()), this, SLOT(enterSHisto()));
   connect( _myHisto, SIGNAL(clicked()), this, SLOT(updateHisto()));
   connect( _myLinear, SIGNAL(clicked()), this, SLOT(scaleSelected()));
   connect( _myLog, SIGNAL(clicked()), this, SLOT(scaleSelected()));
@@ -316,6 +327,20 @@ void SelectParams::buildFrame()
   this->show();  /* displays Dialog */
 }
 
+void SelectParams::enterSHisto()
+{
+  // Deallocate old histogram arrays
+  delete _x;
+  delete _y;
+
+  // get new histogram size
+  _size = atoi(_myLESH->text());
+
+  // Allocate new histogram arrays
+  _x = new double[_size];
+  _y = new double[_size];
+}
+
 void SelectParams::scaleSelected()
 {
   // draw linear or log Y scale depend on user
@@ -426,11 +451,11 @@ void SelectParams::calcHisto()
 
 void SelectParams::displayHisto()
 {
+  // associate values to curve
+  _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
   // give extrema values for each axis
   _myPlot->setAxisScale( _myPlot->curveXAxis( _myHistoCurve ), _xmin, _xmax );
   _myPlot->setAxisScale( _myPlot->curveYAxis( _myHistoCurve ), _ymin, _ymax );
-  // associate values to curve
-  _myPlot->setCurveData( _myHistoCurve, _x, _y, _size );
   if( _myLinear->isChecked() )
     _myPlot->setAxisOptions(_myPlot->curveYAxis( _myHistoCurve ), QwtAutoScale::None );
   else
index 549f0c4e2daa98ada8b4ca79804357b71fbd3fa8..f86bf8829a0d7caa7fd4fc3a2d7bba8e5e4d7530 100644 (file)
@@ -65,6 +65,7 @@ protected:
   virtual void     enableWidgets();
 
 protected slots:
+  virtual void     enterSHisto();
   virtual void     updateHisto();
   virtual void     scaleSelected();
   virtual void     nbThreshSelected();
@@ -87,14 +88,14 @@ private:
   double *_x, *_y;
   double _xft[100], _yft[100], _xst[100], _yst[100];
 
-  QLineEdit *_myFThresh, *_myExpr, *_myLEST, *_myLEFT, *_myOFN;
-  QButtonGroup *_myFunc, *_myFScale, *_myNbThresh, *_myArea, *_myVThresh, *_myOutFile;
+  QLineEdit *_myLESH, *_myFThresh, *_myExpr, *_myLEST, *_myLEFT, *_myOFN;
+  QButtonGroup *_myHSize, *_myFunc, *_myFScale, *_myNbThresh, *_myArea, *_myVThresh, *_myOutFile;
   QGridLayout *_myGroupLayout, *_myGroupLayout2, *_lay, *_GroupButtonsLayout;
   QRadioButton *_myCutNeg, *_myInt, *_myExt, *_myOneThresh, *_myTwoThresh, *_myFieldB, *_myLinear, *_myLog;
   QPushButton *_myHisto, *_myOFB, *_myProc, * _buttonClose, * _buttonHelp;
   QGroupBox* _GroupC1, *_GroupC2, *_GroupButtons;
   QwtPlot *_myPlot;
-  QLabel *_myLFT, *_myLST, *_myLRR;
+  QLabel *_myLSH, *_myLFT, *_myLST, *_myLRR;
   QwtDiMap _qmap;
   QFrame *_fr;
   QString _inputFile, _inputMesh, _inputField;