mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
gainplot added for jungfrau, aspect ratio check in gui added, npixels-1 as endpixel bug fix
This commit is contained in:
parent
3fb92aa9dd
commit
277dc2cfd9
@ -99,7 +99,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_6">
|
<widget class="QWidget" name="page_6">
|
||||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||||
@ -107,7 +107,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>327</width>
|
<width>336</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -192,7 +192,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>25</x>
|
<x>25</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>95</width>
|
<width>100</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -300,7 +300,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>20</x>
|
<x>20</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>77</width>
|
<width>81</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -548,7 +548,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>25</x>
|
<x>25</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>128</width>
|
<width>314</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -577,6 +577,43 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_19">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkGainPlot">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><nobr>
|
||||||
|
Displays minimum, maximum and sum of values for each plot.
|
||||||
|
<nobr></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Gain Plot</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -771,7 +808,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||||
@ -779,7 +816,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>25</x>
|
<x>25</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>107</width>
|
<width>108</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1024,7 +1061,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>25</x>
|
<x>25</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>95</width>
|
<width>100</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1057,7 +1094,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>25</x>
|
<x>25</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>77</width>
|
<width>81</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1315,7 +1352,7 @@ All values between <b>from</b> and <b>to</b> will be res
|
|||||||
<rect>
|
<rect>
|
||||||
<x>25</x>
|
<x>25</x>
|
||||||
<y>5</y>
|
<y>5</y>
|
||||||
<width>128</width>
|
<width>132</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1533,7 +1570,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>227</width>
|
<width>233</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1658,7 +1695,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>342</width>
|
<width>331</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -1828,28 +1865,6 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="7">
|
|
||||||
<widget class="QLineEdit" name="dispTitle">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>250</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::Normal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="7">
|
<item row="3" column="7">
|
||||||
<widget class="QLineEdit" name="dispZMax">
|
<widget class="QLineEdit" name="dispZMax">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -2158,6 +2173,41 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1" colspan="4">
|
||||||
|
<widget class="QLineEdit" name="dispTitle">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Normal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="6" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="chkAspectRatio">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Keep Aspect Ratio</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -2187,7 +2237,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>358</width>
|
<width>355</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -2243,11 +2293,11 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>45</width>
|
<width>40</width>
|
||||||
<height>10</height>
|
<height>10</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -2259,11 +2309,11 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeType">
|
<property name="sizeType">
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>45</width>
|
<width>40</width>
|
||||||
<height>10</height>
|
<height>10</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -2471,9 +2521,9 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>15</y>
|
<y>12</y>
|
||||||
<width>331</width>
|
<width>331</width>
|
||||||
<height>31</height>
|
<height>36</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
@ -2788,7 +2838,7 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>351</width>
|
<width>331</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -145,6 +145,15 @@ public:
|
|||||||
/** Enable/Disable Histogram */
|
/** Enable/Disable Histogram */
|
||||||
void SetHistogram(bool enable,int histArg, int min=0, int max=0, double size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;};
|
void SetHistogram(bool enable,int histArg, int min=0, int max=0, double size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;};
|
||||||
|
|
||||||
|
/** Get X Minimum value from plot */
|
||||||
|
double GetXMinimum() { if(plot_in_scope==1) return plot1D->GetXMinimum(); else plot2D->GetPlot()->GetXMinimum();};
|
||||||
|
/** Get X Maximum value from plot */
|
||||||
|
double GetXMaximum() { if(plot_in_scope==1) return plot1D->GetXMaximum(); else plot2D->GetPlot()->GetXMaximum();};
|
||||||
|
/** Get Y Minimum value from plot */
|
||||||
|
double GetYMinimum() { if(plot_in_scope==1) return plot1D->GetYMinimum(); else plot2D->GetPlot()->GetYMinimum();};
|
||||||
|
/** Get Y Maximum value from plot */
|
||||||
|
double GetYMaximum() { if(plot_in_scope==1) return plot1D->GetYMaximum(); else plot2D->GetPlot()->GetYMaximum();};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/** To select 1D or 2D plot
|
/** To select 1D or 2D plot
|
||||||
@param i is 1 for 1D, else 2D plot */
|
@param i is 1 for 1D, else 2D plot */
|
||||||
@ -313,6 +322,11 @@ void ShowSaveErrorMessage(QString fileName);
|
|||||||
* @param status is the status of the detector
|
* @param status is the status of the detector
|
||||||
* */
|
* */
|
||||||
void ShowAcquisitionErrorMessage(QString status);
|
void ShowAcquisitionErrorMessage(QString status);
|
||||||
|
/**
|
||||||
|
* Enable Gain Plot
|
||||||
|
* @param e true for enable, false for disable
|
||||||
|
*/
|
||||||
|
void EnableGainPlot(bool e);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -348,7 +362,6 @@ SlsQt2DPlotLayout* plot2D;
|
|||||||
/** vector of 1D hist values */
|
/** vector of 1D hist values */
|
||||||
QVector<SlsQtH1D*> plot1D_hists;
|
QVector<SlsQtH1D*> plot1D_hists;
|
||||||
|
|
||||||
|
|
||||||
/**label with frame index for those with many frames per file*/
|
/**label with frame index for those with many frames per file*/
|
||||||
QLabel *histFrameIndexTitle;
|
QLabel *histFrameIndexTitle;
|
||||||
|
|
||||||
@ -571,7 +584,12 @@ QVector<QwtIntervalSample> histogramSamples;
|
|||||||
bool plotRequired;
|
bool plotRequired;
|
||||||
|
|
||||||
|
|
||||||
|
/** 2D object second plot */
|
||||||
|
SlsQt2DPlotLayout* gainplot2D;
|
||||||
|
/** Current Image Values in 2D gain plot */
|
||||||
|
double* gainImageArray;
|
||||||
|
/** gain plot enable */
|
||||||
|
bool gainPlotEnable;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void UpdatingPlotFinished();
|
void UpdatingPlotFinished();
|
||||||
@ -579,12 +597,12 @@ void InterpolateSignal(bool);
|
|||||||
void ContourSignal(bool);
|
void ContourSignal(bool);
|
||||||
void LogzSignal(bool);
|
void LogzSignal(bool);
|
||||||
void LogySignal(bool);
|
void LogySignal(bool);
|
||||||
void SetZRangeSignal(double,double);
|
|
||||||
void ResetZMinZMaxSignal(bool,bool,double,double);
|
void ResetZMinZMaxSignal(bool,bool,double,double);
|
||||||
void SetCurrentMeasurementSignal(int);
|
void SetCurrentMeasurementSignal(int);
|
||||||
void saveErrorSignal(QString);
|
void saveErrorSignal(QString);
|
||||||
void AcquisitionErrorSignal(QString);
|
void AcquisitionErrorSignal(QString);
|
||||||
void UpdatePlotSignal();
|
void UpdatePlotSignal();
|
||||||
|
void GainPlotSignal(bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,10 +124,30 @@ private slots:
|
|||||||
/** Enables/Sets default Titles to default */
|
/** Enables/Sets default Titles to default */
|
||||||
void EnableTitles();
|
void EnableTitles();
|
||||||
|
|
||||||
/** Enables range of the axes */
|
/** check aspect ratio */
|
||||||
|
void checkAspectRatio();
|
||||||
|
|
||||||
|
/** maintain aspect ratio
|
||||||
|
* @param axis axis to be changed: 0 for x(y axis values changed), 1 for y (xaxis values changes), -1 for the larger one (aspect ratio checked)
|
||||||
|
*/
|
||||||
|
void maintainAspectRatio(int axis);
|
||||||
|
|
||||||
|
/** Enables range of the X axis */
|
||||||
|
void EnableXRange();
|
||||||
|
|
||||||
|
/** Enables range of the Y axis */
|
||||||
|
void EnableYRange();
|
||||||
|
|
||||||
|
/** Enables range of all axes, called by EnableXRange and EnableYRange */
|
||||||
void EnableRange();
|
void EnableRange();
|
||||||
|
|
||||||
/** Sets the range of the x and y axes */
|
/** Sets the range of the x axis */
|
||||||
|
void SetXAxisRange();
|
||||||
|
|
||||||
|
/** Sets the range of the y axis */
|
||||||
|
void SetYAxisRange();
|
||||||
|
|
||||||
|
/** Sets the range of both axes, called by SetXAxisRange and SetYAxisRange */
|
||||||
void SetAxesRange();
|
void SetAxesRange();
|
||||||
|
|
||||||
/** Sets the range of the z axis */
|
/** Sets the range of the z axis */
|
||||||
@ -156,7 +176,6 @@ private slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void DisableZoomSignal(bool);
|
void DisableZoomSignal(bool);
|
||||||
void SetZRangeSignal(double,double);
|
|
||||||
void ResetZMinZMaxSignal(bool,bool,double,double);
|
void ResetZMinZMaxSignal(bool,bool,double,double);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -49,6 +49,7 @@ qDrawPlot::~qDrawPlot(){
|
|||||||
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h;
|
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();h!=plot1D_hists.end();h++) delete *h;
|
||||||
plot1D_hists.clear();
|
plot1D_hists.clear();
|
||||||
if(lastImageArray) delete[] lastImageArray; lastImageArray=0;
|
if(lastImageArray) delete[] lastImageArray; lastImageArray=0;
|
||||||
|
if(gainImageArray) delete[] gainImageArray; gainImageArray=0;
|
||||||
StartOrStopThread(0);
|
StartOrStopThread(0);
|
||||||
delete myDet; myDet = 0;
|
delete myDet; myDet = 0;
|
||||||
for(int i=0;i<MAXCloneWindows;i++) if(winClone[i]) {delete winClone[i]; winClone[i] = NULL;}
|
for(int i=0;i<MAXCloneWindows;i++) if(winClone[i]) {delete winClone[i]; winClone[i] = NULL;}
|
||||||
@ -132,6 +133,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
histYAngleAxis = 0;
|
histYAngleAxis = 0;
|
||||||
histTrimbits=0;
|
histTrimbits=0;
|
||||||
lastImageArray = 0;
|
lastImageArray = 0;
|
||||||
|
gainImageArray = 0;
|
||||||
|
|
||||||
persistency = 0;
|
persistency = 0;
|
||||||
currentPersistency = 0;
|
currentPersistency = 0;
|
||||||
@ -318,8 +320,27 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
|
|
||||||
plotLayout = new QGridLayout(boxPlot);
|
plotLayout = new QGridLayout(boxPlot);
|
||||||
plotLayout->setContentsMargins(0,0,0,0);
|
plotLayout->setContentsMargins(0,0,0,0);
|
||||||
plotLayout->addWidget(plot1D,0,0,1,1);
|
plotLayout->addWidget(plot1D,0,0,3,3);
|
||||||
plotLayout->addWidget(plot2D,0,0,1,1);
|
plotLayout->addWidget(plot2D,0,0,3,3);
|
||||||
|
|
||||||
|
|
||||||
|
//gainplot
|
||||||
|
gainplot2D = new SlsQt2DPlotLayout(boxPlot);
|
||||||
|
gainImageArray = new double[nPixelsY*nPixelsX];
|
||||||
|
for(unsigned int px=0;px<nPixelsX;px++)
|
||||||
|
for(unsigned int py=0;py<nPixelsY;py++)
|
||||||
|
gainImageArray[py*nPixelsX+px] = sqrt(pow(0+1,2)*pow(double(px)-nPixelsX/2,2)/pow(nPixelsX/2,2)/pow(1+1,2) + pow(double(py)-nPixelsY/2,2)/pow(nPixelsY/2,2))/sqrt(2);
|
||||||
|
gainplot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||||
|
gainplot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,gainImageArray);
|
||||||
|
gainplot2D->setTitle(GetImageTitle());
|
||||||
|
gainplot2D->SetXTitle(imageXAxisTitle);
|
||||||
|
gainplot2D->SetYTitle(imageYAxisTitle);
|
||||||
|
gainplot2D->SetZTitle(QString("Gain ") + imageZAxisTitle);
|
||||||
|
gainplot2D->setAlignment(Qt::AlignLeft);
|
||||||
|
plotLayout->addWidget(gainplot2D,1,3,1,1);
|
||||||
|
gainplot2D->hide();
|
||||||
|
gainPlotEnable = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//callbacks
|
//callbacks
|
||||||
@ -348,11 +369,10 @@ void qDrawPlot::Initialization(){
|
|||||||
connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool)));
|
connect(this, SIGNAL(LogySignal(bool)), plot1D, SLOT(SetLogY(bool)));
|
||||||
connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double)));
|
connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)),plot2D, SLOT(ResetZMinZMax(bool,bool,double,double)));
|
||||||
|
|
||||||
connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double)));
|
|
||||||
|
|
||||||
connect(this, SIGNAL(AcquisitionErrorSignal(QString)), this, SLOT(ShowAcquisitionErrorMessage(QString)));
|
connect(this, SIGNAL(AcquisitionErrorSignal(QString)), this, SLOT(ShowAcquisitionErrorMessage(QString)));
|
||||||
|
|
||||||
|
|
||||||
|
connect(this, SIGNAL(GainPlotSignal(bool)), this, SLOT(EnableGainPlot(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -583,15 +603,20 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
|||||||
|
|
||||||
//2d
|
//2d
|
||||||
if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX];
|
if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX];
|
||||||
|
if(gainImageArray) delete [] gainImageArray; gainImageArray = new double[nPixelsY*nPixelsX];
|
||||||
|
|
||||||
//initializing 1d x axis
|
//initializing 1d x axis
|
||||||
for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px;/*+10;*/
|
for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px;/*+10;*/
|
||||||
|
|
||||||
//initializing 2d array
|
//initializing 2d array
|
||||||
for(int py=0;py<(int)nPixelsY;py++)
|
memset(lastImageArray,0,nPixelsY *nPixelsX * sizeof(double));
|
||||||
for(int px=0;px<(int)nPixelsX;px++)
|
memset(gainImageArray,0,nPixelsY *nPixelsX * sizeof(double));
|
||||||
|
/*for(int py=0;py<(int)nPixelsY;py++)
|
||||||
|
for(int px=0;px<(int)nPixelsX;px++) {
|
||||||
lastImageArray[py*nPixelsX+px] = 0;
|
lastImageArray[py*nPixelsX+px] = 0;
|
||||||
|
gainImageArray[py*nPixelsX+px] = 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//histogram
|
//histogram
|
||||||
if(histogram){
|
if(histogram){
|
||||||
@ -644,10 +669,15 @@ void qDrawPlot::SetupMeasurement(){
|
|||||||
if(!running)
|
if(!running)
|
||||||
lastImageNumber = 0;/**Just now */
|
lastImageNumber = 0;/**Just now */
|
||||||
//initializing 2d array
|
//initializing 2d array
|
||||||
|
memset(lastImageArray,0,nPixelsY *nPixelsX * sizeof(double));
|
||||||
|
memset(gainImageArray,0,nPixelsY *nPixelsX * sizeof(double));
|
||||||
|
/*
|
||||||
for(int py=0;py<(int)nPixelsY;py++)
|
for(int py=0;py<(int)nPixelsY;py++)
|
||||||
for(int px=0;px<(int)nPixelsX;px++)
|
for(int px=0;px<(int)nPixelsX;px++) {
|
||||||
lastImageArray[py*nPixelsX+px] = 0;
|
lastImageArray[py*nPixelsX+px] = 0;
|
||||||
|
gainImageArray[py*nPixelsX+px] = 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
//1d with no scan
|
//1d with no scan
|
||||||
if ((!originally2D) && (scanArgument==qDefs::None)){
|
if ((!originally2D) && (scanArgument==qDefs::None)){
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
@ -666,7 +696,7 @@ void qDrawPlot::SetupMeasurement(){
|
|||||||
#endif
|
#endif
|
||||||
//2d with no scan
|
//2d with no scan
|
||||||
if ((originally2D) && (scanArgument==qDefs::None)){
|
if ((originally2D) && (scanArgument==qDefs::None)){
|
||||||
maxPixelsY = nPixelsY;
|
maxPixelsY = nPixelsY-1;
|
||||||
minPixelsY = 0;
|
minPixelsY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1122,6 +1152,15 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
|||||||
else{
|
else{
|
||||||
// Titles
|
// Titles
|
||||||
imageTitle = temp_title;
|
imageTitle = temp_title;
|
||||||
|
|
||||||
|
//jungfrau mask gain
|
||||||
|
if(data->gvalues != NULL) {
|
||||||
|
memcpy(gainImageArray, data->gvalues, nPixelsX*nPixelsY*sizeof(double));
|
||||||
|
gainPlotEnable = true;
|
||||||
|
}else
|
||||||
|
gainPlotEnable = false;
|
||||||
|
|
||||||
|
|
||||||
//recalculating pedestal
|
//recalculating pedestal
|
||||||
if(startPedestalCal){
|
if(startPedestalCal){
|
||||||
//start adding frames to get to the pedestal value
|
//start adding frames to get to the pedestal value
|
||||||
@ -1458,6 +1497,17 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
plot2D->SetYTitle(imageYAxisTitle);
|
plot2D->SetYTitle(imageYAxisTitle);
|
||||||
plot2D->SetZTitle(imageZAxisTitle);
|
plot2D->SetZTitle(imageZAxisTitle);
|
||||||
plot2D->UpdateNKeepSetRangeIfSet(); //keep a "set" z range, and call Update();
|
plot2D->UpdateNKeepSetRangeIfSet(); //keep a "set" z range, and call Update();
|
||||||
|
if (gainPlotEnable) {
|
||||||
|
gainplot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,gainImageArray);
|
||||||
|
gainplot2D->setTitle(GetImageTitle());
|
||||||
|
gainplot2D->SetXTitle(imageXAxisTitle);
|
||||||
|
gainplot2D->SetYTitle(imageYAxisTitle);
|
||||||
|
gainplot2D->SetZTitle(QString("Gain ") + imageZAxisTitle);
|
||||||
|
|
||||||
|
gainplot2D->show();
|
||||||
|
}else {
|
||||||
|
gainplot2D->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// update range if required
|
// update range if required
|
||||||
if(XYRangeChanged){
|
if(XYRangeChanged){
|
||||||
@ -1467,9 +1517,16 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum();
|
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum();
|
||||||
plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||||
plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||||
|
if (gainPlotEnable) {
|
||||||
|
gainplot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||||
|
gainplot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||||
|
}
|
||||||
XYRangeChanged = false;
|
XYRangeChanged = false;
|
||||||
}
|
}
|
||||||
plot2D->GetPlot()->Update();
|
plot2D->GetPlot()->Update();
|
||||||
|
if (gainPlotEnable) {
|
||||||
|
gainplot2D->GetPlot()->Update();
|
||||||
|
}
|
||||||
//Display Statistics
|
//Display Statistics
|
||||||
if(displayStatistics){
|
if(displayStatistics){
|
||||||
double min=0,max=0,sum=0;
|
double min=0,max=0,sum=0;
|
||||||
@ -1853,9 +1910,12 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
|
|||||||
nPixelsY = 100;
|
nPixelsY = 100;
|
||||||
if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX];
|
if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX];
|
||||||
//initializing 2d array
|
//initializing 2d array
|
||||||
|
memset(lastImageArray, 0 ,nPixelsY * nPixelsX * sizeof(double));
|
||||||
|
/*
|
||||||
for(int py=0;py<(int)nPixelsY;py++)
|
for(int py=0;py<(int)nPixelsY;py++)
|
||||||
for(int px=0;px<(int)nPixelsX;px++)
|
for(int px=0;px<(int)nPixelsX;px++)
|
||||||
lastImageArray[py*nPixelsX+px] = 0;
|
lastImageArray[py*nPixelsX+px] = 0;
|
||||||
|
*/
|
||||||
//get trimbits
|
//get trimbits
|
||||||
ret = 1;/*myDet->getChanRegs(lastImageArray,fromDetector);*/
|
ret = 1;/*myDet->getChanRegs(lastImageArray,fromDetector);*/
|
||||||
if(!ret){
|
if(!ret){
|
||||||
@ -2066,3 +2126,11 @@ void qDrawPlot::GetStatistics(double &min, double &max, double &sum, double* arr
|
|||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qDrawPlot::EnableGainPlot(bool e) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Setting Gain Plot enable to " << e << endl;
|
||||||
|
#endif
|
||||||
|
myDet->setGainDataEnableinDataCallback(e);
|
||||||
|
}
|
||||||
|
@ -156,6 +156,9 @@ void qTabPlot::SetupWidgetWindow(){
|
|||||||
stackedWidget->setCurrentIndex(0);
|
stackedWidget->setCurrentIndex(0);
|
||||||
stackedWidget_2->setCurrentIndex(0);
|
stackedWidget_2->setCurrentIndex(0);
|
||||||
|
|
||||||
|
//gain plot
|
||||||
|
chkGainPlot->setEnabled(false);
|
||||||
|
|
||||||
// Depending on whether the detector is 1d or 2d
|
// Depending on whether the detector is 1d or 2d
|
||||||
switch(myDet->getDetectorsType()){
|
switch(myDet->getDetectorsType()){
|
||||||
case slsDetectorDefs::MYTHEN:
|
case slsDetectorDefs::MYTHEN:
|
||||||
@ -176,9 +179,14 @@ void qTabPlot::SetupWidgetWindow(){
|
|||||||
isOriginallyOneD = true;
|
isOriginallyOneD = true;
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::PROPIX:
|
case slsDetectorDefs::PROPIX:
|
||||||
|
isOriginallyOneD = false;
|
||||||
|
break;
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
|
isOriginallyOneD = false;
|
||||||
|
break;
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
isOriginallyOneD = false;
|
isOriginallyOneD = false;
|
||||||
|
chkGainPlot->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cout << "ERROR: Detector Type is Generic" << endl;
|
cout << "ERROR: Detector Type is Generic" << endl;
|
||||||
@ -325,26 +333,25 @@ void qTabPlot::Initialization(){
|
|||||||
connect(dispYAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles()));
|
connect(dispYAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles()));
|
||||||
connect(dispZAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles()));
|
connect(dispZAxis, SIGNAL(textChanged(const QString&)), this, SLOT(SetTitles()));
|
||||||
|
|
||||||
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
|
||||||
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
|
||||||
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
|
||||||
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
|
||||||
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
|
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
|
||||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
|
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
|
||||||
|
connect(chkAspectRatio, SIGNAL(toggled(bool)), this, SLOT(checkAspectRatio()));
|
||||||
connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)));
|
connect(this, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool,bool,double,double)));
|
||||||
|
|
||||||
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
|
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
|
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
// Save
|
// Save
|
||||||
connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
|
connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
|
||||||
connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool)));
|
connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool)));
|
||||||
|
|
||||||
connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double)));
|
|
||||||
|
|
||||||
//pedstal
|
//pedstal
|
||||||
connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
|
connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
|
||||||
connect(btnRecalPedestal, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal()));
|
connect(btnRecalPedestal, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal()));
|
||||||
@ -364,6 +371,10 @@ void qTabPlot::Initialization(){
|
|||||||
connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
|
|
||||||
|
//gainplot
|
||||||
|
if (chkGainPlot->isEnabled())
|
||||||
|
connect(chkGainPlot, SIGNAL(toggled(bool)),myPlot, SIGNAL(GainPlotSignal(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -456,18 +467,220 @@ void qTabPlot::EnableTitles(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::EnableRange(){
|
void qTabPlot::checkAspectRatio() {
|
||||||
bool disableZoom = false;
|
if (chkAspectRatio->isChecked()) {
|
||||||
if(!chkXMin->isChecked()) dispXMin->setEnabled(false);
|
maintainAspectRatio(-1);
|
||||||
else{disableZoom = true; dispXMin->setEnabled(true); }
|
}
|
||||||
if(!chkXMax->isChecked()) dispXMax->setEnabled(false);
|
}
|
||||||
else{disableZoom = true; dispXMax->setEnabled(true); }
|
|
||||||
if(!chkYMin->isChecked()) dispYMin->setEnabled(false);
|
|
||||||
else{disableZoom = true; dispYMin->setEnabled(true); }
|
|
||||||
if(!chkYMax->isChecked()) dispYMax->setEnabled(false);
|
|
||||||
else{disableZoom = true; dispYMax->setEnabled(true); }
|
|
||||||
|
|
||||||
myPlot->DisableZoom(disableZoom);
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qTabPlot::maintainAspectRatio(int axis) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Maintaining Aspect Ratio" << endl;
|
||||||
|
#endif
|
||||||
|
disconnect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
|
||||||
|
disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
|
||||||
|
disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
|
||||||
|
disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
|
||||||
|
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
|
||||||
|
double ranges[4];
|
||||||
|
//get previous plot limits
|
||||||
|
ranges[qDefs::XMINIMUM] = myPlot->GetXMinimum();
|
||||||
|
ranges[qDefs::XMAXIMUM] = myPlot->GetXMaximum();
|
||||||
|
ranges[qDefs::YMINIMUM] = myPlot->GetYMinimum();
|
||||||
|
ranges[qDefs::YMAXIMUM] = myPlot->GetYMaximum();
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cprintf(BLUE,"ideal values: xmin:%f, xmax:%f ymin:%f ymax:%f\n",ranges[qDefs::XMINIMUM],ranges[qDefs::XMAXIMUM],ranges[qDefs::YMINIMUM],ranges[qDefs::YMAXIMUM]);
|
||||||
|
#endif
|
||||||
|
double idealAspectratio = (ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]);
|
||||||
|
|
||||||
|
// enable all
|
||||||
|
chkXMin->setChecked(true); dispXMin->setEnabled(true);
|
||||||
|
chkXMax->setChecked(true); dispXMax->setEnabled(true);
|
||||||
|
chkYMin->setChecked(true); dispYMin->setEnabled(true);
|
||||||
|
chkYMax->setChecked(true); dispYMax->setEnabled(true);
|
||||||
|
|
||||||
|
// if any empty, set it to previous plots boundaries
|
||||||
|
if (dispXMin->text().isEmpty()) dispXMin->setText(QString::number(myPlot->GetXMinimum()));
|
||||||
|
if (dispXMax->text().isEmpty()) dispXMax->setText(QString::number(myPlot->GetXMaximum()));
|
||||||
|
if (dispYMin->text().isEmpty()) dispYMin->setText(QString::number(myPlot->GetYMinimum()));
|
||||||
|
if (dispYMax->text().isEmpty()) dispYMax->setText(QString::number(myPlot->GetYMaximum()));
|
||||||
|
|
||||||
|
//get actual limits
|
||||||
|
ranges[qDefs::XMINIMUM] = dispXMin->text().toDouble();
|
||||||
|
ranges[qDefs::XMAXIMUM] = dispXMax->text().toDouble();
|
||||||
|
ranges[qDefs::YMINIMUM] = dispYMin->text().toDouble();
|
||||||
|
ranges[qDefs::YMAXIMUM] = dispYMax->text().toDouble();
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cprintf(BLUE,"new limits: xmin:%f, xmax:%f ymin:%f ymax:%f\n",ranges[qDefs::XMINIMUM],ranges[qDefs::XMAXIMUM],ranges[qDefs::YMINIMUM],ranges[qDefs::YMAXIMUM]);
|
||||||
|
#endif
|
||||||
|
// calcualte new aspect ratio
|
||||||
|
double newAspectRatio = (ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]);
|
||||||
|
|
||||||
|
// if not ideal aspect ratio
|
||||||
|
if (newAspectRatio != idealAspectratio) {
|
||||||
|
|
||||||
|
// find the larger difference
|
||||||
|
if (axis == -1) {
|
||||||
|
if ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) > (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM])) {
|
||||||
|
//change x
|
||||||
|
axis = 0;
|
||||||
|
} else {
|
||||||
|
//change y
|
||||||
|
axis = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if x changed: y adjusted, y changed: x adjusted, aspect ratio clicked: larger one adjusted
|
||||||
|
switch(axis) {
|
||||||
|
case 0:
|
||||||
|
//change x
|
||||||
|
dispXMax->setText(QString::number(idealAspectratio * (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]) + ranges[qDefs::XMINIMUM]));
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cprintf(BLUE,"new xmax: %f\n",dispXMax->text().toDouble());
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// change y
|
||||||
|
dispYMax->setText(QString::number(((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / idealAspectratio) + ranges[qDefs::YMINIMUM]));
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cprintf(BLUE,"new ymax: %f\n",dispYMax->text().toDouble());
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
|
||||||
|
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableXRange()));
|
||||||
|
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
|
||||||
|
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableYRange()));
|
||||||
|
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
|
||||||
|
// disable mouse zooming if any checked
|
||||||
|
myPlot->DisableZoom(true);
|
||||||
|
emit DisableZoomSignal(true);
|
||||||
|
|
||||||
|
// set XY values in plot
|
||||||
|
myPlot->SetXYRangeValues(dispXMin->text().toDouble(),qDefs::XMINIMUM);
|
||||||
|
myPlot->SetXYRangeValues(dispXMax->text().toDouble(),qDefs::XMAXIMUM);
|
||||||
|
myPlot->SetXYRangeValues(dispYMin->text().toDouble(),qDefs::YMINIMUM);
|
||||||
|
myPlot->SetXYRangeValues(dispYMax->text().toDouble(),qDefs::YMAXIMUM);
|
||||||
|
|
||||||
|
|
||||||
|
myPlot->IsXYRangeValues(true,qDefs::XMINIMUM);
|
||||||
|
myPlot->IsXYRangeValues(true,qDefs::XMAXIMUM);
|
||||||
|
myPlot->IsXYRangeValues(true,qDefs::YMINIMUM);
|
||||||
|
myPlot->IsXYRangeValues(true,qDefs::YMAXIMUM);
|
||||||
|
|
||||||
|
// To remind the updateplot in qdrawplot to set range after updating plot
|
||||||
|
myPlot->SetXYRange(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void qTabPlot::EnableXRange(){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Enable X Axis Range" << endl;
|
||||||
|
#endif
|
||||||
|
// keeping aspect ratio
|
||||||
|
if (chkAspectRatio->isChecked()) {
|
||||||
|
maintainAspectRatio(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
|
||||||
|
// enable/disable lineedit
|
||||||
|
if(chkXMin->isChecked()) {
|
||||||
|
dispXMin->setEnabled(true);
|
||||||
|
// if any empty, set it to previous plots boundaries
|
||||||
|
if (dispXMin->text().isEmpty())
|
||||||
|
dispXMin->setText(QString::number(myPlot->GetXMinimum()));
|
||||||
|
} else {
|
||||||
|
dispXMin->setEnabled(false);
|
||||||
|
}
|
||||||
|
// enable/disable lineedit
|
||||||
|
if(chkXMax->isChecked()) {
|
||||||
|
dispXMax->setEnabled(true);
|
||||||
|
// if any empty, set it to previous plots boundaries
|
||||||
|
if (dispXMax->text().isEmpty())
|
||||||
|
dispXMax->setText(QString::number(myPlot->GetXMaximum()));
|
||||||
|
} else {
|
||||||
|
dispXMax->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
|
||||||
|
EnableRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qTabPlot::EnableYRange(){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Enable Y Axis Range" << endl;
|
||||||
|
#endif
|
||||||
|
// keeping aspect ratio
|
||||||
|
if (chkAspectRatio->isChecked()) {
|
||||||
|
maintainAspectRatio(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
|
||||||
|
// enable/disable lineedit
|
||||||
|
if(chkYMin->isChecked()) {
|
||||||
|
dispYMin->setEnabled(true);
|
||||||
|
// if any empty, set it to previous plots boundaries
|
||||||
|
if (dispYMin->text().isEmpty())
|
||||||
|
dispYMin->setText(QString::number(myPlot->GetYMinimum()));
|
||||||
|
} else {
|
||||||
|
dispYMin->setEnabled(false);
|
||||||
|
}
|
||||||
|
// enable/disable lineedit
|
||||||
|
if(chkYMax->isChecked()) {
|
||||||
|
dispYMax->setEnabled(true);
|
||||||
|
// if any empty, set it to previous plots boundaries
|
||||||
|
if (dispYMax->text().isEmpty())
|
||||||
|
dispYMax->setText(QString::number(myPlot->GetYMaximum()));
|
||||||
|
} else {
|
||||||
|
dispYMax->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
|
||||||
|
EnableRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qTabPlot::EnableRange(){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Enable Axes Range" << endl;
|
||||||
|
#endif
|
||||||
|
// disable mouse zooming if any checked
|
||||||
|
bool disableZoom= false;
|
||||||
|
if(chkYMin->isChecked() || chkYMax->isChecked() || chkYMin->isChecked() || chkYMax->isChecked())
|
||||||
|
disableZoom = true;
|
||||||
emit DisableZoomSignal(disableZoom);
|
emit DisableZoomSignal(disableZoom);
|
||||||
SetAxesRange();
|
SetAxesRange();
|
||||||
}
|
}
|
||||||
@ -476,31 +689,75 @@ void qTabPlot::EnableRange(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qTabPlot::SetXAxisRange(){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Setting X Axis Range" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// keeping aspect ratio
|
||||||
|
if (chkAspectRatio->isChecked()) {
|
||||||
|
maintainAspectRatio(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAxesRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qTabPlot::SetYAxisRange(){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Setting X Axis Range" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// keeping aspect ratio
|
||||||
|
if (chkAspectRatio->isChecked()) {
|
||||||
|
maintainAspectRatio(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAxesRange();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::SetAxesRange(){
|
void qTabPlot::SetAxesRange(){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting Range" << endl;
|
cout << "Setting Axes Range" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool changed = false;
|
|
||||||
// x min
|
// x min
|
||||||
changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty());
|
if (dispXMin->isEnabled()) {
|
||||||
if(changed) myPlot->SetXYRangeValues(dispXMin->text().toDouble(),qDefs::XMINIMUM);
|
myPlot->SetXYRangeValues(dispXMin->text().toDouble(),qDefs::XMINIMUM);
|
||||||
myPlot->IsXYRangeValues(changed,qDefs::XMINIMUM);
|
myPlot->IsXYRangeValues(true,qDefs::XMINIMUM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myPlot->IsXYRangeValues(false,qDefs::XMINIMUM);
|
||||||
// x max
|
// x max
|
||||||
changed = (dispXMax->isEnabled())&&(!dispXMax->text().isEmpty());
|
if (dispXMax->isEnabled()) {
|
||||||
if(changed) myPlot->SetXYRangeValues(dispXMax->text().toDouble(),qDefs::XMAXIMUM);
|
myPlot->SetXYRangeValues(dispXMax->text().toDouble(),qDefs::XMAXIMUM);
|
||||||
myPlot->IsXYRangeValues(changed,qDefs::XMAXIMUM);
|
myPlot->IsXYRangeValues(true,qDefs::XMAXIMUM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myPlot->IsXYRangeValues(false,qDefs::XMAXIMUM);
|
||||||
// y min
|
// y min
|
||||||
changed = (dispYMin->isEnabled())&&(!dispYMin->text().isEmpty());
|
if (dispYMin->isEnabled()) {
|
||||||
if(changed) myPlot->SetXYRangeValues(dispYMin->text().toDouble(),qDefs::YMINIMUM);
|
myPlot->SetXYRangeValues(dispYMin->text().toDouble(),qDefs::YMINIMUM);
|
||||||
myPlot->IsXYRangeValues(changed,qDefs::YMINIMUM);
|
myPlot->IsXYRangeValues(true,qDefs::YMINIMUM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myPlot->IsXYRangeValues(false,qDefs::YMINIMUM);
|
||||||
// y max
|
// y max
|
||||||
changed = (dispYMax->isEnabled())&&(!dispYMax->text().isEmpty());
|
if (dispYMax->isEnabled()) {
|
||||||
if(changed) myPlot->SetXYRangeValues(dispYMax->text().toDouble(),qDefs::YMAXIMUM);
|
myPlot->SetXYRangeValues(dispYMax->text().toDouble(),qDefs::YMAXIMUM);
|
||||||
myPlot->IsXYRangeValues(changed,qDefs::YMAXIMUM);
|
myPlot->IsXYRangeValues(true,qDefs::YMAXIMUM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
myPlot->IsXYRangeValues(false,qDefs::YMAXIMUM);
|
||||||
|
|
||||||
// To remind the updateplot in qdrawplot to set range after updating plot
|
// To remind the updateplot in qdrawplot to set range after updating plot
|
||||||
myPlot->SetXYRange(true);
|
myPlot->SetXYRange(true);
|
||||||
@ -524,6 +781,9 @@ void qTabPlot::SetZRange(){
|
|||||||
|
|
||||||
void qTabPlot::EnableZRange(){
|
void qTabPlot::EnableZRange(){
|
||||||
|
|
||||||
|
disconnect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
|
disconnect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
|
|
||||||
dispZMin->setEnabled(chkZMin->isChecked());
|
dispZMin->setEnabled(chkZMin->isChecked());
|
||||||
dispZMax->setEnabled(chkZMax->isChecked());
|
dispZMax->setEnabled(chkZMax->isChecked());
|
||||||
emit ResetZMinZMaxSignal(
|
emit ResetZMinZMaxSignal(
|
||||||
@ -531,6 +791,9 @@ void qTabPlot::EnableZRange(){
|
|||||||
(chkZMax->isChecked() && CheckZRange(dispZMax->text())),
|
(chkZMax->isChecked() && CheckZRange(dispZMax->text())),
|
||||||
dispZMin->text().toDouble(),
|
dispZMin->text().toDouble(),
|
||||||
dispZMax->text().toDouble());
|
dispZMax->text().toDouble());
|
||||||
|
|
||||||
|
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
|
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -543,8 +806,11 @@ bool qTabPlot::CheckZRange(QString value){
|
|||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
value.toDouble(&ok);
|
value.toDouble(&ok);
|
||||||
if(!ok)
|
if(!ok) {
|
||||||
|
qDefs::Message(qDefs::WARNING,"<nobr>Check Z Range</nobr><br><nobr>"
|
||||||
|
"Zmin and Zmax should be in double</nobr>","qTabPlot::CheckZRange");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user