mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 09:30:02 +02:00
WIP
This commit is contained in:
parent
8ac7d96ef3
commit
0e0e5db7c5
@ -26,8 +26,7 @@ class qCloneWidget : public QMainWindow {
|
|||||||
|
|
||||||
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
|
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
|
||||||
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, QString histTitle, bool lines, bool markers);
|
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, QString histTitle, bool lines, bool markers);
|
||||||
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle);
|
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle, bool isZmax, bool isZmin, double zmin, double zmax);
|
||||||
void SetRange(bool IsXYRange[], double XYRange[]);
|
|
||||||
SlsQt1DPlot *Get1dPlot();
|
SlsQt1DPlot *Get1dPlot();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -27,15 +27,12 @@ class qDrawPlot : public QWidget {
|
|||||||
void SetXAxisTitle(QString title);
|
void SetXAxisTitle(QString title);
|
||||||
void SetYAxisTitle(QString title);
|
void SetYAxisTitle(QString title);
|
||||||
void SetZAxisTitle(QString title);
|
void SetZAxisTitle(QString title);
|
||||||
void DisableZoom(bool disable);
|
void SetXYRangeChanged(bool disable, double* xy, bool* isXY);
|
||||||
void SetXYRangeChanged();
|
void SetZRange(double* z, bool* isZ);
|
||||||
void SetXYRangeValues(double val, qDefs::range xy);
|
|
||||||
void IsXYRangeValues(bool changed, qDefs::range xy);
|
|
||||||
double GetXMinimum();
|
double GetXMinimum();
|
||||||
double GetXMaximum();
|
double GetXMaximum();
|
||||||
double GetYMinimum();
|
double GetYMinimum();
|
||||||
double GetYMaximum();
|
double GetYMaximum();
|
||||||
void SetZRange(bool isZmin, bool isZmax, double zmin, double zmax);
|
|
||||||
void SetDataCallBack(bool enable);
|
void SetDataCallBack(bool enable);
|
||||||
void SetBinary(bool enable, int from = 0, int to = 0);
|
void SetBinary(bool enable, int from = 0, int to = 0);
|
||||||
void StartAcquisition();
|
void StartAcquisition();
|
||||||
@ -78,7 +75,7 @@ class qDrawPlot : public QWidget {
|
|||||||
void SetupPlots();
|
void SetupPlots();
|
||||||
int LockLastImageArray();
|
int LockLastImageArray();
|
||||||
int UnlockLastImageArray();
|
int UnlockLastImageArray();
|
||||||
void SetStyle(SlsQtH1D *h);
|
void SetStyleandSymbol(SlsQtH1D *h);
|
||||||
void GetStatistics(double &min, double &max, double &sum);
|
void GetStatistics(double &min, double &max, double &sum);
|
||||||
void DetachHists();
|
void DetachHists();
|
||||||
static void GetProgressCallBack(double currentProgress, void *this_pointer);
|
static void GetProgressCallBack(double currentProgress, void *this_pointer);
|
||||||
@ -122,9 +119,11 @@ class qDrawPlot : public QWidget {
|
|||||||
QString zTitle2d{"Intensity"};
|
QString zTitle2d{"Intensity"};
|
||||||
QString plotTitle{""};
|
QString plotTitle{""};
|
||||||
QString indexTitle{""};
|
QString indexTitle{""};
|
||||||
bool XYRangeChanged{false};
|
bool xyRangeChanged{false};
|
||||||
double XYRange[4]{0, 0, 0, 0};
|
double xyRange[4]{0, 0, 0, 0};
|
||||||
bool isXYRange[4]{false, false, false, false};
|
bool isXYRange[4]{false, false, false, false};
|
||||||
|
double zRange[2]{0, 1};
|
||||||
|
bool isZRange[2]{false, false};
|
||||||
|
|
||||||
// data
|
// data
|
||||||
unsigned int nHists{1};
|
unsigned int nHists{1};
|
||||||
@ -159,11 +158,13 @@ class qDrawPlot : public QWidget {
|
|||||||
std::vector<qCloneWidget *> cloneWidgets;
|
std::vector<qCloneWidget *> cloneWidgets;
|
||||||
QString fileSavePath{"/tmp"};
|
QString fileSavePath{"/tmp"};
|
||||||
QString fileSaveName{"Image"};
|
QString fileSaveName{"Image"};
|
||||||
bool isGainDataExtracted{false};
|
|
||||||
bool hasGainData{false};
|
bool hasGainData{false};
|
||||||
|
bool isGainDataExtracted{false};
|
||||||
|
bool disableZoom{false};
|
||||||
|
|
||||||
int progress{0};
|
int progress{0};
|
||||||
int64_t currentFrame{0};
|
int64_t currentFrame{0};
|
||||||
|
mutable std::mutex mPlots;
|
||||||
pthread_mutex_t lastImageCompleteMutex;
|
pthread_mutex_t lastImageCompleteMutex;
|
||||||
|
|
||||||
unsigned int nPixelsX{0};
|
unsigned int nPixelsX{0};
|
||||||
|
@ -119,7 +119,7 @@ class SlsQt1DPlot:public QwtPlot{
|
|||||||
|
|
||||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||||
use zooming functionality without mouse control*/
|
use zooming functionality without mouse control*/
|
||||||
void DisableZoom(bool disableZoom);
|
void DisableZoom(bool disable);
|
||||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
|
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
|
||||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
|
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
|
||||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||||
@ -146,6 +146,7 @@ class SlsQt1DPlot:public QwtPlot{
|
|||||||
|
|
||||||
QwtPlotMarker *hline;
|
QwtPlotMarker *hline;
|
||||||
QwtPlotMarker *vline;
|
QwtPlotMarker *vline;
|
||||||
|
bool disableZoom{false};
|
||||||
|
|
||||||
void SetupZoom();
|
void SetupZoom();
|
||||||
void UnknownStuff();
|
void UnknownStuff();
|
||||||
|
@ -49,6 +49,7 @@ private:
|
|||||||
QList<double> contourLevelsLinear;
|
QList<double> contourLevelsLinear;
|
||||||
QList<double> contourLevelsLog;
|
QList<double> contourLevelsLog;
|
||||||
#endif
|
#endif
|
||||||
|
bool disableZoom{false};
|
||||||
|
|
||||||
void SetupZoom();
|
void SetupZoom();
|
||||||
void SetupColorMap();
|
void SetupColorMap();
|
||||||
@ -69,7 +70,7 @@ public:
|
|||||||
|
|
||||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||||
use zooming functionality without mouse control*/
|
use zooming functionality without mouse control*/
|
||||||
void DisableZoom(bool disableZoom);
|
void DisableZoom(bool disable);
|
||||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
|
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
|
||||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
|
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
|
||||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||||
|
@ -22,12 +22,8 @@ class SlsQt2DPlotLayout : public QGroupBox {
|
|||||||
void SetZTitle(QString st);
|
void SetZTitle(QString st);
|
||||||
void SetInterpolate(bool enable);
|
void SetInterpolate(bool enable);
|
||||||
void SetContour(bool enable);
|
void SetContour(bool enable);
|
||||||
void SetLogz(bool enable);
|
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
|
||||||
void KeepZRangeIfSet();
|
|
||||||
// recalculate zmin and zmax from plot and update z range
|
|
||||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||||
public slots:
|
|
||||||
void UpdateZRange(double min, double max);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Layout();
|
void Layout();
|
||||||
@ -39,8 +35,4 @@ class SlsQt2DPlotLayout : public QGroupBox {
|
|||||||
SlsQt2DPlot *the_plot;
|
SlsQt2DPlot *the_plot;
|
||||||
|
|
||||||
bool isLog;
|
bool isLog;
|
||||||
double zmin;
|
|
||||||
double zmax;
|
|
||||||
bool isZmin;
|
|
||||||
bool isZmax;
|
|
||||||
};
|
};
|
||||||
|
@ -535,14 +535,16 @@ void SlsQt1DPlot::UnknownStuff() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||||
void SlsQt1DPlot::DisableZoom(bool disableZoom) {
|
void SlsQt1DPlot::DisableZoom(bool disable) {
|
||||||
|
if (disableZoom != disable) {
|
||||||
|
disableZoom = disable;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if (disableZoom)
|
if (disable)
|
||||||
std::cout << "Disabling zoom\n";
|
std::cout << "Disabling zoom\n";
|
||||||
else
|
else
|
||||||
std::cout << "Enabling zoom\n";
|
std::cout << "Enabling zoom\n";
|
||||||
#endif
|
#endif
|
||||||
if (disableZoom) {
|
if (disable) {
|
||||||
if (zoomer) {
|
if (zoomer) {
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||||
#if QT_VERSION < 0x040000
|
#if QT_VERSION < 0x040000
|
||||||
@ -568,3 +570,4 @@ void SlsQt1DPlot::DisableZoom(bool disableZoom) {
|
|||||||
panner->setMouseButton(Qt::MidButton);
|
panner->setMouseButton(Qt::MidButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -304,14 +304,17 @@ void SlsQt2DPlot::LogZ(bool on) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||||
void SlsQt2DPlot::DisableZoom(bool disableZoom) {
|
void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||||
|
if (disableZoom != disable) {
|
||||||
|
disableZoom = disable;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if (disableZoom)
|
if (disable)
|
||||||
std::cout << "Disabling zoom\n";
|
std::cout << "Disabling zoom\n";
|
||||||
else
|
else
|
||||||
std::cout << "Enabling zoom\n";
|
std::cout << "Enabling zoom\n";
|
||||||
#endif
|
#endif
|
||||||
if (disableZoom) {
|
if (disable) {
|
||||||
if (zoomer) {
|
if (zoomer) {
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||||
#if QT_VERSION < 0x040000
|
#if QT_VERSION < 0x040000
|
||||||
@ -337,6 +340,7 @@ void SlsQt2DPlot::DisableZoom(bool disableZoom) {
|
|||||||
panner->setMouseButton(Qt::MidButton);
|
panner->setMouseButton(Qt::MidButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void SlsQt2DPlot::printPlot(){
|
void SlsQt2DPlot::printPlot(){
|
||||||
|
@ -13,10 +13,6 @@ SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
|||||||
the_layout=0;
|
the_layout=0;
|
||||||
the_plot = new SlsQt2DPlot(this);
|
the_plot = new SlsQt2DPlot(this);
|
||||||
isLog = false;
|
isLog = false;
|
||||||
zmin = 0;
|
|
||||||
zmax = 0;
|
|
||||||
isZmin = false;
|
|
||||||
isZmax = false;
|
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,10 +51,10 @@ void SlsQt2DPlotLayout::SetContour(bool enable) {
|
|||||||
the_plot->showContour(enable);
|
the_plot->showContour(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::SetLogz(bool enable) {
|
void SlsQt2DPlotLayout::SetLogz(bool enable, bool isMin, bool isMax, double min, double max) {
|
||||||
isLog = enable;
|
isLog = enable;
|
||||||
the_plot->LogZ(enable);
|
the_plot->LogZ(enable);
|
||||||
SetZRange(isZmin, isZmax, zmin, zmax);
|
SetZRange(isMin, isMax, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::Layout(){
|
void SlsQt2DPlotLayout::Layout(){
|
||||||
@ -67,34 +63,19 @@ void SlsQt2DPlotLayout::Layout(){
|
|||||||
the_layout->addWidget(the_plot,2,0,3,3);
|
the_layout->addWidget(the_plot,2,0,3,3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
|
||||||
UpdateZRange(zmin, zmax);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max){
|
void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max){
|
||||||
isZmin = isMin;
|
|
||||||
isZmax = isMax;
|
|
||||||
// reset zmin and zmax first (recalculate from plot)
|
|
||||||
the_plot->SetZMinMax();
|
|
||||||
|
|
||||||
UpdateZRange(min, max);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
|
||||||
if(isLog) {
|
if(isLog) {
|
||||||
the_plot->SetZMinimumToFirstGreaterThanZero();
|
the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set zmin and zmax
|
// set zmin and zmax
|
||||||
if (isZmin || isZmax) {
|
if (isMin || isMax) {
|
||||||
zmin = (isZmin ? min : the_plot->GetZMinimum());
|
double zmin = (isMin ? min : the_plot->GetZMinimum());
|
||||||
zmax = (isZmax ? max : the_plot->GetZMaximum());
|
double zmax = (isMax ? max : the_plot->GetZMaximum());
|
||||||
// if it is the same values, we should reset it to plots min and max (not doing this now: not foolproof now)
|
|
||||||
// setting the range of values possible in the dispZMin and dispZMax (not doin this now: not foolproof)
|
|
||||||
the_plot->SetZMinMax(zmin, zmax);
|
the_plot->SetZMinMax(zmin, zmax);
|
||||||
} else {
|
}
|
||||||
zmin = 0;
|
|
||||||
zmax = -1;
|
the_plot->Update();
|
||||||
}
|
|
||||||
the_plot->Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,23 +142,13 @@ void qCloneWidget::SetCloneHists(unsigned int nHists, int histNBins, double *his
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle) {
|
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle, bool isZmax, bool isZmin, double zmin, double zmax) {
|
||||||
cloneplot2D->GetPlot()->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d);
|
cloneplot2D->GetPlot()->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d);
|
||||||
cloneplot2D->KeepZRangeIfSet();
|
|
||||||
cloneplot2D->setTitle(frameIndexTitle.toAscii().constData());
|
cloneplot2D->setTitle(frameIndexTitle.toAscii().constData());
|
||||||
|
cloneplot2D->SetZRange(isZmin, isZmax, zmin, zmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qCloneWidget::SetRange(bool IsXYRange[], double XYRange[]) {
|
|
||||||
if (cloneplot1D) {
|
|
||||||
cloneplot1D->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
|
||||||
cloneplot1D->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
|
||||||
cloneplot1D->Update();
|
|
||||||
} else {
|
|
||||||
cloneplot2D->GetPlot()->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
|
||||||
cloneplot2D->GetPlot()->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
|
||||||
cloneplot2D->GetPlot()->Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void qCloneWidget::SavePlot() {
|
void qCloneWidget::SavePlot() {
|
||||||
char cID[10];
|
char cID[10];
|
||||||
|
@ -206,7 +206,7 @@ void qDrawPlot::SetupPlots() {
|
|||||||
DetachHists();
|
DetachHists();
|
||||||
SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[0]);
|
SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[0]);
|
||||||
h->SetLineColor(0);
|
h->SetLineColor(0);
|
||||||
SetStyle(h);
|
SetStyleandSymbol(h);
|
||||||
hists1d.append(h);
|
hists1d.append(h);
|
||||||
|
|
||||||
// setup 2d plot
|
// setup 2d plot
|
||||||
@ -278,7 +278,6 @@ int64_t qDrawPlot::GetCurrentFrameIndex() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Select1dPlot(bool enable) {
|
void qDrawPlot::Select1dPlot(bool enable) {
|
||||||
LockLastImageArray();
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
// DetachHists(); it clears the last measurement
|
// DetachHists(); it clears the last measurement
|
||||||
plot1d->SetXTitle(xTitle1d.toAscii().constData());
|
plot1d->SetXTitle(xTitle1d.toAscii().constData());
|
||||||
@ -301,74 +300,50 @@ void qDrawPlot::Select1dPlot(bool enable) {
|
|||||||
layout->removeWidget(lblFrameIndexTitle1d);
|
layout->removeWidget(lblFrameIndexTitle1d);
|
||||||
plotLayout->setContentsMargins(0, 0, 0, 0);
|
plotLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetPlotTitlePrefix(QString title) {
|
void qDrawPlot::SetPlotTitlePrefix(QString title) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << "Setting Title to " << title.toAscii().constData();
|
FILE_LOG(logINFO) << "Setting Title to " << title.toAscii().constData();
|
||||||
plotTitlePrefix = title;
|
plotTitlePrefix = title;
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetXAxisTitle(QString title) {
|
void qDrawPlot::SetXAxisTitle(QString title) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData();
|
FILE_LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData();
|
||||||
if (is1d) {
|
if (is1d) {
|
||||||
xTitle1d = title;
|
xTitle1d = title;
|
||||||
} else {
|
} else {
|
||||||
xTitle2d = title;
|
xTitle2d = title;
|
||||||
}
|
}
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetYAxisTitle(QString title) {
|
void qDrawPlot::SetYAxisTitle(QString title) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData();
|
FILE_LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData();
|
||||||
if (is1d) {
|
if (is1d) {
|
||||||
yTitle1d = title;
|
yTitle1d = title;
|
||||||
} else {
|
} else {
|
||||||
yTitle2d = title;
|
yTitle2d = title;
|
||||||
}
|
}
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetZAxisTitle(QString title) {
|
void qDrawPlot::SetZAxisTitle(QString title) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData();
|
FILE_LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData();
|
||||||
zTitle2d = title;
|
zTitle2d = title;
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::DisableZoom(bool disable) {
|
void qDrawPlot::SetXYRangeChanged(bool disable, double* xy, bool* isXY) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << "Setting Disable zoom to " << std::boolalpha << disable << std::noboolalpha;
|
|
||||||
if (is1d)
|
|
||||||
plot1d->DisableZoom(disable);
|
|
||||||
else
|
|
||||||
plot2d->GetPlot()->DisableZoom(disable);
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
void qDrawPlot::SetXYRangeChanged() {
|
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << "XY Range has changed";
|
FILE_LOG(logINFO) << "XY Range has changed";
|
||||||
XYRangeChanged = true;
|
xyRangeChanged = true;
|
||||||
UnlockLastImageArray();
|
std::copy(xy, xy + 4, xyRange);
|
||||||
|
std::copy(isXY, isXY + 4, isXYRange);
|
||||||
|
|
||||||
|
FILE_LOG(logDEBUG) << "Setting Disable zoom to " << std::boolalpha << disable << std::noboolalpha;
|
||||||
|
disableZoom = disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetXYRangeValues(double val, qDefs::range xy) {
|
void qDrawPlot::SetZRange(double* z, bool* isZ) {
|
||||||
LockLastImageArray();
|
std::copy(z, z + 2, zRange);
|
||||||
FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(xy) << " to " << val;
|
std::copy(isZ, isZ + 2, isZRange);
|
||||||
XYRange[xy] = val;
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
void qDrawPlot::IsXYRangeValues(bool changed, qDefs::range xy) {
|
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(xy) << " to " << std::boolalpha << changed << std::noboolalpha;;
|
|
||||||
isXYRange[xy] = changed;
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double qDrawPlot::GetXMinimum() {
|
double qDrawPlot::GetXMinimum() {
|
||||||
@ -399,17 +374,7 @@ double qDrawPlot::GetYMaximum() {
|
|||||||
return plot2d->GetPlot()->GetYMaximum();
|
return plot2d->GetPlot()->GetYMaximum();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetZRange(bool isZmin, bool isZmax, double zmin, double zmax) {
|
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << std::boolalpha << "Setting Z Range to "
|
|
||||||
"Zmin (" << isZmin << ", " << zmin << ") "
|
|
||||||
"Zmax (" << isZmax << ", " << zmax << ")";
|
|
||||||
plot2d->SetZRange(isZmin, isZmax, zmin, zmax);
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
void qDrawPlot::SetDataCallBack(bool enable) {
|
void qDrawPlot::SetDataCallBack(bool enable) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
isPlot = true;
|
isPlot = true;
|
||||||
@ -418,138 +383,99 @@ void qDrawPlot::SetDataCallBack(bool enable) {
|
|||||||
isPlot = false;
|
isPlot = false;
|
||||||
myDet->registerDataCallback(nullptr, this);
|
myDet->registerDataCallback(nullptr, this);
|
||||||
}
|
}
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetBinary(bool enable, int from, int to) {
|
void qDrawPlot::SetBinary(bool enable, int from, int to) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Binary output from " << from << " to " << to;
|
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Binary output from " << from << " to " << to;
|
||||||
isBinary = enable;
|
|
||||||
binaryFrom = from;
|
binaryFrom = from;
|
||||||
binaryTo = to;
|
binaryTo = to;
|
||||||
UnlockLastImageArray();
|
isBinary = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetPersistency(int val) {
|
void qDrawPlot::SetPersistency(int val) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << "Setting Persistency to " << val;
|
FILE_LOG(logINFO) << "Setting Persistency to " << val;
|
||||||
persistency = val;
|
persistency = val;
|
||||||
for(int i = datay1d.size(); i <= val; ++i) {
|
|
||||||
datay1d[i] = new double [nPixelsX];
|
|
||||||
SlsQtH1D* h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[i]);
|
|
||||||
h->SetLineColor(i);
|
|
||||||
hists1d.append(h);
|
|
||||||
}
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetLines(bool enable) {
|
void qDrawPlot::SetLines(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
isLines = enable;
|
isLines = enable;
|
||||||
UnlockLastImageArray();
|
for (unsigned int i = 0; i < nHists; ++i) {
|
||||||
|
SlsQtH1D* h = hists1d.at(i);
|
||||||
|
SetStyleandSymbol(h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetMarkers(bool enable) {
|
void qDrawPlot::SetMarkers(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
isMarkers = enable;
|
isMarkers = enable;
|
||||||
UnlockLastImageArray();
|
for (unsigned int i = 0; i < nHists; ++i) {
|
||||||
|
SlsQtH1D* h = hists1d.at(i);
|
||||||
|
SetStyleandSymbol(h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Set1dLogY(bool enable) {
|
void qDrawPlot::Set1dLogY(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << "Setting Log Y to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting Log Y to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
plot1d->SetLogY(enable);
|
plot1d->SetLogY(enable);
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetInterpolate(bool enable) {
|
void qDrawPlot::SetInterpolate(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << "Setting Interpolate to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting Interpolate to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
plot2d->SetInterpolate(enable);
|
plot2d->SetInterpolate(enable);
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetContour(bool enable) {
|
void qDrawPlot::SetContour(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << "Setting Countour to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting Countour to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
plot2d->SetContour(enable);
|
plot2d->SetContour(enable);
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetLogz(bool enable) {
|
void qDrawPlot::SetLogz(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << "Setting Log Z to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting Log Z to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
plot2d->SetLogz(enable);
|
plot2d->SetLogz(enable, isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetPedestal(bool enable) {
|
void qDrawPlot::SetPedestal(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Pedestal";
|
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Pedestal";
|
||||||
if (enable) {
|
isPedestal = enable;
|
||||||
isPedestal = true;
|
resetPedestal = true;
|
||||||
if (pedestalVals == nullptr)
|
|
||||||
RecalculatePedestal();
|
|
||||||
} else {
|
|
||||||
isPedestal = false;
|
|
||||||
}
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::RecalculatePedestal() {
|
void qDrawPlot::RecalculatePedestal() {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logDEBUG) << "Recalculating Pedestal";
|
FILE_LOG(logDEBUG) << "Recalculating Pedestal";
|
||||||
|
|
||||||
resetPedestal = true;
|
resetPedestal = true;
|
||||||
pedestalCount = 0;
|
|
||||||
|
|
||||||
if (pedestalVals != nullptr)
|
|
||||||
delete [] pedestalVals;
|
|
||||||
int nPixels = nPixelsX * nPixelsY;
|
|
||||||
pedestalVals = new double[nPixels];
|
|
||||||
std::fill(pedestalVals, pedestalVals + nPixels, 0);
|
|
||||||
|
|
||||||
if (tempPedestalVals != nullptr)
|
|
||||||
delete [] tempPedestalVals;
|
|
||||||
tempPedestalVals = new double[nPixels];
|
|
||||||
std::fill(tempPedestalVals, tempPedestalVals + nPixels, 0);
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetAccumulate(bool enable) {
|
void qDrawPlot::SetAccumulate(bool enable) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Accumulation";
|
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Accumulation";
|
||||||
isAccumulate = enable;
|
isAccumulate = enable;
|
||||||
UnlockLastImageArray();
|
resetAccumulate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::ResetAccumulate() {
|
void qDrawPlot::ResetAccumulate() {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logDEBUG) << "Resetting Accumulation";
|
FILE_LOG(logDEBUG) << "Resetting Accumulation";
|
||||||
resetAccumulate = true;
|
resetAccumulate = true;
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::DisplayStatistics(bool enable) {
|
void qDrawPlot::DisplayStatistics(bool enable) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Statistics Display";
|
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Statistics Display";
|
||||||
if (!enable)
|
|
||||||
widgetStatistics->hide();
|
|
||||||
// shown when calculated
|
|
||||||
displayStatistics = enable;
|
displayStatistics = enable;
|
||||||
lblMinDisp->setText("-");
|
|
||||||
lblMaxDisp->setText("-");
|
|
||||||
lblSumDisp->setText("-");
|
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::EnableGainPlot(bool enable) {
|
void qDrawPlot::EnableGainPlot(bool enable) {
|
||||||
LockLastImageArray();
|
|
||||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Gain Plot";
|
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Gain Plot";
|
||||||
hasGainData = enable;
|
hasGainData = enable;
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetSaveFileName(QString val) {
|
void qDrawPlot::SetSaveFileName(QString val) {
|
||||||
@ -558,7 +484,8 @@ void qDrawPlot::SetSaveFileName(QString val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::ClonePlot() {
|
void qDrawPlot::ClonePlot() {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if (is1d) {
|
if (is1d) {
|
||||||
FILE_LOG(logINFO) << "Cloning 1D Image";
|
FILE_LOG(logINFO) << "Cloning 1D Image";
|
||||||
@ -580,13 +507,9 @@ void qDrawPlot::ClonePlot() {
|
|||||||
index = cloneWidgets.size();
|
index = cloneWidgets.size();
|
||||||
cloneWidgets[index]->SetCloneHists2D(nPixelsX, -0.5, nPixelsX - 0.5,
|
cloneWidgets[index]->SetCloneHists2D(nPixelsX, -0.5, nPixelsX - 0.5,
|
||||||
nPixelsY, -0.5, nPixelsY - 0.5,
|
nPixelsY, -0.5, nPixelsY - 0.5,
|
||||||
data2d, plot2d->title());
|
data2d, plot2d->title(), isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isXYRange[qDefs::XMIN] || isXYRange[qDefs::XMAX] ||isXYRange[qDefs::YMIN] ||isXYRange[qDefs::YMAX]) {
|
|
||||||
cloneWidgets[index]->SetRange(isXYRange, XYRange);
|
|
||||||
}
|
|
||||||
UnlockLastImageArray();
|
|
||||||
cloneWidgets[index]->show();
|
cloneWidgets[index]->show();
|
||||||
|
|
||||||
// to remember which all clone widgets were closed
|
// to remember which all clone widgets were closed
|
||||||
@ -651,15 +574,7 @@ void qDrawPlot::SavePlot() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int qDrawPlot::LockLastImageArray() {
|
void qDrawPlot::SetStyleandSymbol(SlsQtH1D *h) {
|
||||||
return pthread_mutex_lock(&lastImageCompleteMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
int qDrawPlot::UnlockLastImageArray() {
|
|
||||||
return pthread_mutex_unlock(&lastImageCompleteMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void qDrawPlot::SetStyle(SlsQtH1D *h) {
|
|
||||||
h->setStyle(isLines ? QwtPlotCurve::Lines : QwtPlotCurve::Dots);
|
h->setStyle(isLines ? QwtPlotCurve::Lines : QwtPlotCurve::Dots);
|
||||||
#if QWT_VERSION < 0x060000
|
#if QWT_VERSION < 0x060000
|
||||||
h->setSymbol(isMarkers ? *marker : *noMarker);
|
h->setSymbol(isMarkers ? *marker : *noMarker);
|
||||||
@ -720,16 +635,11 @@ void qDrawPlot::StartAcquisition() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// refixing all the zooming
|
// refixing all the zooming
|
||||||
XYRangeChanged = true;
|
{
|
||||||
/*
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
plot2d->GetPlot()->SetXMinMax(-0.5, nPixelsX + 0.5);
|
pedestalCount = 0;
|
||||||
plot2d->GetPlot()->SetYMinMax(-0.5, nPixelsY + 0.5);
|
xyRangeChanged = true;
|
||||||
plot2d->GetPlot()->SetZoom(-0.5, -0.5, nPixelsX, nPixelsY);
|
}
|
||||||
if (boxPlot->title() == "Sample Plot")
|
|
||||||
plot2d->GetPlot()->UnZoom();
|
|
||||||
else
|
|
||||||
plot2d->GetPlot()->UnZoom(false);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// acquisition in another thread
|
// acquisition in another thread
|
||||||
QFuture<std::string> future = QtConcurrent::run(this, &qDrawPlot::AcquireThread);
|
QFuture<std::string> future = QtConcurrent::run(this, &qDrawPlot::AcquireThread);
|
||||||
@ -792,8 +702,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex) {
|
void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex) {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
|
|
||||||
FILE_LOG(logDEBUG)
|
FILE_LOG(logDEBUG)
|
||||||
<< "* GetData Callback *" << std::endl
|
<< "* GetData Callback *" << std::endl
|
||||||
<< " frame index: " << frameIndex << std::endl
|
<< " frame index: " << frameIndex << std::endl
|
||||||
@ -819,8 +728,10 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
|||||||
double* rawData = new double[nPixels];
|
double* rawData = new double[nPixels];
|
||||||
if (hasGainData) {
|
if (hasGainData) {
|
||||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange, gainData);
|
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange, gainData);
|
||||||
|
isGainDataExtracted = true;
|
||||||
} else {
|
} else {
|
||||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange);
|
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange);
|
||||||
|
isGainDataExtracted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// title and frame index titles
|
// title and frame index titles
|
||||||
@ -830,8 +741,21 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
|||||||
indexTitle = QString("%1 %2").arg(frameIndex, subFrameIndex);
|
indexTitle = QString("%1 %2").arg(frameIndex, subFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate pedestal
|
// reset pedestal
|
||||||
if (resetPedestal) {
|
if (resetPedestal) {
|
||||||
|
pedestalCount = 0;
|
||||||
|
if (pedestalVals != nullptr)
|
||||||
|
delete [] pedestalVals;
|
||||||
|
pedestalVals = new double[nPixels];
|
||||||
|
std::fill(pedestalVals, pedestalVals + nPixels, 0);
|
||||||
|
if (tempPedestalVals != nullptr)
|
||||||
|
delete [] tempPedestalVals;
|
||||||
|
tempPedestalVals = new double[nPixels];
|
||||||
|
std::fill(tempPedestalVals, tempPedestalVals + nPixels, 0);
|
||||||
|
resetPedestal = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isPedestal) {
|
||||||
// add pedestals frames
|
// add pedestals frames
|
||||||
if (pedestalCount < NUM_PEDESTAL_FRAMES) {
|
if (pedestalCount < NUM_PEDESTAL_FRAMES) {
|
||||||
for (unsigned int px = 0; px < nPixels; ++px)
|
for (unsigned int px = 0; px < nPixels; ++px)
|
||||||
@ -844,7 +768,6 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
|||||||
for (unsigned int px = 0; px < nPixels; ++px)
|
for (unsigned int px = 0; px < nPixels; ++px)
|
||||||
tempPedestalVals[px] = tempPedestalVals[px] / (double)NUM_PEDESTAL_FRAMES;
|
tempPedestalVals[px] = tempPedestalVals[px] / (double)NUM_PEDESTAL_FRAMES;
|
||||||
memcpy(pedestalVals, tempPedestalVals, nPixels * sizeof(double));
|
memcpy(pedestalVals, tempPedestalVals, nPixels * sizeof(double));
|
||||||
resetPedestal = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,11 +778,11 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "End of Get Data";
|
FILE_LOG(logDEBUG) << "End of Get Data";
|
||||||
UnlockLastImageArray();
|
|
||||||
emit UpdateSignal();
|
emit UpdateSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Get1dData(double* rawData) {
|
void qDrawPlot::Get1dData(double* rawData) {
|
||||||
|
|
||||||
// persistency
|
// persistency
|
||||||
if (currentPersistency < persistency)
|
if (currentPersistency < persistency)
|
||||||
currentPersistency++;
|
currentPersistency++;
|
||||||
@ -867,6 +790,14 @@ void qDrawPlot::Get1dData(double* rawData) {
|
|||||||
currentPersistency = persistency; // when reducing persistency
|
currentPersistency = persistency; // when reducing persistency
|
||||||
nHists = currentPersistency + 1;
|
nHists = currentPersistency + 1;
|
||||||
if (currentPersistency) {
|
if (currentPersistency) {
|
||||||
|
// allocate
|
||||||
|
for(int i = datay1d.size(); i <= persistency; ++i) {
|
||||||
|
datay1d[i] = new double [nPixelsX];
|
||||||
|
SlsQtH1D* h = new SlsQtH1D("", nPixelsX, datax1d, datay1d[i]);
|
||||||
|
h->SetLineColor(i);
|
||||||
|
SetStyleandSymbol(h);
|
||||||
|
hists1d.append(h);
|
||||||
|
}
|
||||||
// copy previous data
|
// copy previous data
|
||||||
for (int i = currentPersistency; i > 0; --i)
|
for (int i = currentPersistency; i > 0; --i)
|
||||||
memcpy(datay1d[i], datay1d[i - 1], nPixelsX * sizeof(double));
|
memcpy(datay1d[i], datay1d[i - 1], nPixelsX * sizeof(double));
|
||||||
@ -879,17 +810,20 @@ void qDrawPlot::Get1dData(double* rawData) {
|
|||||||
}
|
}
|
||||||
// accumulate
|
// accumulate
|
||||||
if (resetAccumulate) {
|
if (resetAccumulate) {
|
||||||
|
std::fill(datay1d[0], datay1d[0] + nPixelsX, 0);
|
||||||
resetAccumulate = false;
|
resetAccumulate = false;
|
||||||
}
|
}
|
||||||
else if (isAccumulate) {
|
if (isAccumulate) {
|
||||||
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
||||||
rawData[px] += datay1d[0][px];
|
rawData[px] += datay1d[0][px];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// binary
|
// binary
|
||||||
if (isBinary) {
|
if (isBinary) {
|
||||||
|
int lBinaryFrom = binaryFrom;
|
||||||
|
int lBinaryTo = binaryTo;
|
||||||
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
||||||
if ((rawData[px] >= binaryFrom) && (rawData[px] <= binaryTo))
|
if ((rawData[px] >= lBinaryFrom) && (rawData[px] <= lBinaryTo))
|
||||||
rawData[px] = 1;
|
rawData[px] = 1;
|
||||||
else
|
else
|
||||||
rawData[px] = 0;
|
rawData[px] = 0;
|
||||||
@ -908,17 +842,20 @@ void qDrawPlot::Get2dData(double* rawData) {
|
|||||||
}
|
}
|
||||||
// accumulate
|
// accumulate
|
||||||
if (resetAccumulate) {
|
if (resetAccumulate) {
|
||||||
|
std::fill(data2d, data2d + nPixels, 0);
|
||||||
resetAccumulate = false;
|
resetAccumulate = false;
|
||||||
}
|
}
|
||||||
else if (isAccumulate) {
|
if (isAccumulate) {
|
||||||
for (unsigned int px = 0; px < nPixels; ++px) {
|
for (unsigned int px = 0; px < nPixels; ++px) {
|
||||||
rawData[px] += data2d[px];
|
rawData[px] += data2d[px];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// binary
|
// binary
|
||||||
if (isBinary) {
|
if (isBinary) {
|
||||||
|
int lBinaryFrom = binaryFrom;
|
||||||
|
int lBinaryTo = binaryTo;
|
||||||
for (unsigned int px = 0; px < nPixels; ++px) {
|
for (unsigned int px = 0; px < nPixels; ++px) {
|
||||||
if ((rawData[px] >= binaryFrom) && (rawData[px] <= binaryTo))
|
if ((rawData[px] >= lBinaryFrom) && (rawData[px] <= lBinaryTo))
|
||||||
rawData[px] = 1;
|
rawData[px] = 1;
|
||||||
else
|
else
|
||||||
rawData[px] = 0;
|
rawData[px] = 0;
|
||||||
@ -928,17 +865,19 @@ void qDrawPlot::Get2dData(double* rawData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Update1dPlot() {
|
void qDrawPlot::Update1dPlot() {
|
||||||
// Plot data
|
|
||||||
DetachHists();
|
DetachHists();
|
||||||
plot1d->SetXTitle(xTitle1d.toAscii().constData());
|
plot1d->SetXTitle(xTitle1d.toAscii().constData());
|
||||||
plot1d->SetYTitle(yTitle1d.toAscii().constData());
|
plot1d->SetYTitle(yTitle1d.toAscii().constData());
|
||||||
for (unsigned int i = 0; i < nHists; ++i) {
|
for (unsigned int i = 0; i < nHists; ++i) {
|
||||||
SlsQtH1D* h = hists1d.at(i);
|
SlsQtH1D* h = hists1d.at(i);
|
||||||
h->SetData(nPixelsX, datax1d, datay1d[i]);
|
h->SetData(nPixelsX, datax1d, datay1d[i]);
|
||||||
SetStyle(h);
|
|
||||||
h->Attach(plot1d);
|
h->Attach(plot1d);
|
||||||
}
|
}
|
||||||
|
if (xyRangeChanged) {
|
||||||
Update1dXYRange();
|
Update1dXYRange();
|
||||||
|
xyRangeChanged = false;
|
||||||
|
}
|
||||||
|
plot1d->DisableZoom(disableZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Update2dPlot() {
|
void qDrawPlot::Update2dPlot() {
|
||||||
@ -947,8 +886,7 @@ void qDrawPlot::Update2dPlot() {
|
|||||||
plot2d->SetZTitle(zTitle2d);
|
plot2d->SetZTitle(zTitle2d);
|
||||||
plot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5,
|
plot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5,
|
||||||
nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||||
plot2d->KeepZRangeIfSet();
|
if (isGainDataExtracted) {
|
||||||
if (hasGainData) {
|
|
||||||
gainplot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
|
gainplot2d->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
|
||||||
-0.5, nPixelsY - 0.5, gainData);
|
-0.5, nPixelsY - 0.5, gainData);
|
||||||
gainplot2d->setFixedWidth(plot2d->width() / 4);
|
gainplot2d->setFixedWidth(plot2d->width() / 4);
|
||||||
@ -957,60 +895,51 @@ void qDrawPlot::Update2dPlot() {
|
|||||||
} else {
|
} else {
|
||||||
gainplot2d->hide();
|
gainplot2d->hide();
|
||||||
}
|
}
|
||||||
|
if (xyRangeChanged) {
|
||||||
Update2dXYRange();
|
Update2dXYRange();
|
||||||
|
xyRangeChanged = false;
|
||||||
|
}
|
||||||
|
plot2d->GetPlot()->DisableZoom(disableZoom);
|
||||||
|
plot2d->SetZRange(isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::Update1dXYRange() {
|
void qDrawPlot::Update1dXYRange() {
|
||||||
if (XYRangeChanged) {
|
|
||||||
if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
|
if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
|
||||||
plot1d->EnableXAutoScaling();
|
plot1d->EnableXAutoScaling();
|
||||||
} else {
|
} else {
|
||||||
if (!isXYRange[qDefs::XMIN])
|
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN] : plot1d->GetXMinimum());
|
||||||
XYRange[qDefs::XMIN] = plot1d->GetXMinimum();
|
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX] : plot1d->GetXMaximum());
|
||||||
if (!isXYRange[qDefs::XMAX])
|
plot1d->SetXMinMax(xmin, xmax);
|
||||||
XYRange[qDefs::XMAX] = plot1d->GetXMaximum();
|
|
||||||
plot1d->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
|
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
|
||||||
plot1d->EnableYAutoScaling();
|
plot1d->EnableYAutoScaling();
|
||||||
} else {
|
} else {
|
||||||
if (!isXYRange[qDefs::YMIN])
|
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN] : plot1d->GetYMinimum());
|
||||||
XYRange[qDefs::YMIN] = plot1d->GetYMinimum();
|
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX] : plot1d->GetYMaximum());
|
||||||
if (!isXYRange[qDefs::YMAX])
|
plot1d->SetYMinMax(ymin, ymax);
|
||||||
XYRange[qDefs::YMAX] = plot1d->GetYMaximum();
|
|
||||||
plot1d->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
|
||||||
}
|
}
|
||||||
XYRangeChanged = false;
|
|
||||||
plot1d->Update();
|
plot1d->Update();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void qDrawPlot::Update2dXYRange() {
|
void qDrawPlot::Update2dXYRange() {
|
||||||
if (XYRangeChanged) {
|
|
||||||
if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
|
if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
|
||||||
plot2d->GetPlot()->EnableXAutoScaling();
|
plot2d->GetPlot()->EnableXAutoScaling();
|
||||||
} else {
|
} else {
|
||||||
if (!isXYRange[qDefs::XMIN])
|
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN] : plot2d->GetPlot()->GetXMinimum());
|
||||||
XYRange[qDefs::XMIN] = plot2d->GetPlot()->GetXMinimum();
|
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX] : plot2d->GetPlot()->GetXMaximum());
|
||||||
if (!isXYRange[qDefs::XMAX])
|
plot2d->GetPlot()->SetXMinMax(xmin, xmax);
|
||||||
XYRange[qDefs::XMAX] = plot2d->GetPlot()->GetXMaximum();
|
|
||||||
plot2d->GetPlot()->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
|
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
|
||||||
plot2d->GetPlot()->EnableYAutoScaling();
|
plot2d->GetPlot()->EnableYAutoScaling();
|
||||||
} else {
|
} else {
|
||||||
if (!isXYRange[qDefs::YMIN])
|
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN] : plot2d->GetPlot()->GetYMinimum());
|
||||||
XYRange[qDefs::YMIN] = plot2d->GetPlot()->GetYMinimum();
|
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX] : plot2d->GetPlot()->GetYMaximum());
|
||||||
if (!isXYRange[qDefs::YMAX])
|
plot2d->GetPlot()->SetYMinMax(ymin, ymax);
|
||||||
XYRange[qDefs::YMAX] = plot2d->GetPlot()->GetYMaximum();
|
|
||||||
plot2d->GetPlot()->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
|
||||||
}
|
}
|
||||||
XYRangeChanged = false;
|
|
||||||
plot2d->GetPlot()->Update();
|
plot2d->GetPlot()->Update();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest) {
|
void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest) {
|
||||||
int ichan = 0;
|
int ichan = 0;
|
||||||
@ -1084,7 +1013,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
|||||||
|
|
||||||
|
|
||||||
void qDrawPlot::UpdatePlot() {
|
void qDrawPlot::UpdatePlot() {
|
||||||
LockLastImageArray();
|
std::lock_guard<std::mutex> lock(mPlots);
|
||||||
FILE_LOG(logDEBUG) << "Update Plot";
|
FILE_LOG(logDEBUG) << "Update Plot";
|
||||||
|
|
||||||
boxPlot->setTitle(plotTitle);
|
boxPlot->setTitle(plotTitle);
|
||||||
@ -1093,7 +1022,7 @@ void qDrawPlot::UpdatePlot() {
|
|||||||
Update1dPlot();
|
Update1dPlot();
|
||||||
} else {
|
} else {
|
||||||
plot2d->setTitle(indexTitle.toAscii().constData());
|
plot2d->setTitle(indexTitle.toAscii().constData());
|
||||||
if (hasGainData)
|
if (isGainDataExtracted)
|
||||||
gainplot2d->setTitle(indexTitle.toAscii().constData());
|
gainplot2d->setTitle(indexTitle.toAscii().constData());
|
||||||
Update2dPlot();
|
Update2dPlot();
|
||||||
}
|
}
|
||||||
@ -1104,8 +1033,10 @@ void qDrawPlot::UpdatePlot() {
|
|||||||
lblMinDisp->setText(QString("%1").arg(min));
|
lblMinDisp->setText(QString("%1").arg(min));
|
||||||
lblMaxDisp->setText(QString("%1").arg(max));
|
lblMaxDisp->setText(QString("%1").arg(max));
|
||||||
lblSumDisp->setText(QString("%1").arg(sum));
|
lblSumDisp->setText(QString("%1").arg(sum));
|
||||||
|
widgetStatistics->show();
|
||||||
|
} else {
|
||||||
|
widgetStatistics->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "End of Update Plot";
|
FILE_LOG(logDEBUG) << "End of Update Plot";
|
||||||
UnlockLastImageArray();
|
|
||||||
}
|
}
|
||||||
|
@ -383,78 +383,24 @@ void qTabPlot::CheckAspectRatio() {
|
|||||||
|
|
||||||
void qTabPlot::SetXYRange() {
|
void qTabPlot::SetXYRange() {
|
||||||
FILE_LOG(logDEBUG) << "Set XY Range";
|
FILE_LOG(logDEBUG) << "Set XY Range";
|
||||||
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
|
||||||
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
|
||||||
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
|
||||||
disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
|
||||||
|
|
||||||
bool disablezoom = false;
|
bool disablezoom = false;
|
||||||
|
bool isRange[4]{false, false, false, false};
|
||||||
|
double xyRange[4]{0, 0, 0, 0};
|
||||||
|
|
||||||
// xmin
|
QString dispVal[4] {dispXMin->text(), dispXMax->text(), dispYMin->text(), dispYMax->text()};
|
||||||
// if unchecked, empty or invalid (set to false so it takes the min/max of plot)
|
bool chkVal[4] {chkXMin->isChecked(), chkXMax->isChecked(), chkYMin->isChecked(), chkYMax->isChecked()};
|
||||||
if (!chkXMin->isChecked() || dispXMin->text().isEmpty()) {
|
|
||||||
myPlot->IsXYRangeValues(false, qDefs::XMIN);
|
for (int i = 0; i < 4; ++i) {
|
||||||
} else if (dispXMin->text().toDouble() < myPlot->GetXMinimum()) {
|
if (chkVal[i] && !dispVal[i].isEmpty()) {
|
||||||
qDefs::Message(qDefs::WARNING, "XMin Outside Plot Range", "qTabPlot::SetXRange");
|
double val = dispVal[i].toDouble();
|
||||||
FILE_LOG(logWARNING) << "Xmin entered " << dispXMin->text().toDouble() << " outside xmin range " << myPlot->GetXMinimum();
|
FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(static_cast<qDefs::range>(i)) << " to " << val;
|
||||||
dispXMin->setText("");
|
xyRange[i] = val;
|
||||||
myPlot->IsXYRangeValues(false, qDefs::XMIN);
|
isRange[i] = true;
|
||||||
} else {
|
|
||||||
myPlot->SetXYRangeValues(dispXMin->text().toDouble(), qDefs::XMIN);
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::XMIN);
|
|
||||||
disablezoom = true;
|
disablezoom = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//xmax
|
|
||||||
if (!chkXMax->isChecked() || dispXMax->text().isEmpty()) {
|
|
||||||
myPlot->IsXYRangeValues(false, qDefs::XMAX);
|
|
||||||
} else if (dispXMax->text().toDouble() > myPlot->GetXMaximum()) {
|
|
||||||
qDefs::Message(qDefs::WARNING, "XMax Outside Plot Range", "qTabPlot::SetXYRange");
|
|
||||||
FILE_LOG(logWARNING) << "Xmax entered " << dispXMax->text().toDouble() << " outside xmax range " << myPlot->GetXMaximum();
|
|
||||||
dispXMax->setText("");
|
|
||||||
myPlot->IsXYRangeValues(false, qDefs::XMAX);
|
|
||||||
} else {
|
|
||||||
myPlot->SetXYRangeValues(dispXMax->text().toDouble(), qDefs::XMAX);
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::XMAX);
|
|
||||||
disablezoom = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ymin
|
myPlot->SetXYRangeChanged(disablezoom, xyRange, isRange);
|
||||||
if (!chkYMin->isChecked() || dispYMin->text().isEmpty()) {
|
|
||||||
myPlot->IsXYRangeValues(false, qDefs::YMIN);
|
|
||||||
} else if (dispYMin->text().toDouble() < myPlot->GetYMinimum()) {
|
|
||||||
qDefs::Message(qDefs::WARNING, "YMin Outside Plot Range", "qTabPlot::SetXYRange");
|
|
||||||
FILE_LOG(logWARNING) << "Ymin entered " << dispYMin->text().toDouble() << " outside ymin range " << myPlot->GetYMinimum();
|
|
||||||
dispYMin->setText("");
|
|
||||||
myPlot->IsXYRangeValues(false, qDefs::YMIN);
|
|
||||||
} else {
|
|
||||||
myPlot->SetXYRangeValues(dispYMin->text().toDouble(), qDefs::YMIN);
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::YMIN);
|
|
||||||
disablezoom = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ymax
|
|
||||||
if (!chkYMax->isChecked() || dispYMax->text().isEmpty()) {
|
|
||||||
myPlot->IsXYRangeValues(false, qDefs::YMAX);
|
|
||||||
} else if (dispYMax->text().toDouble() > myPlot->GetYMaximum()) {
|
|
||||||
qDefs::Message(qDefs::WARNING, "YMax Outside Plot Range", "qTabPlot::SetXYRange");
|
|
||||||
FILE_LOG(logWARNING) << "Ymax entered " << dispYMax->text().toDouble() << " outside ymax range " << myPlot->GetYMaximum();
|
|
||||||
dispYMax->setText("");
|
|
||||||
myPlot->IsXYRangeValues(false, qDefs::YMAX);
|
|
||||||
} else {
|
|
||||||
myPlot->SetXYRangeValues(dispYMax->text().toDouble(), qDefs::YMAX);
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::YMAX);
|
|
||||||
disablezoom = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
|
||||||
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
|
||||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
|
||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
|
||||||
|
|
||||||
// to update plot with range
|
|
||||||
myPlot->SetXYRangeChanged();
|
|
||||||
myPlot->DisableZoom(disablezoom);
|
|
||||||
emit DisableZoomSignal(disablezoom);
|
emit DisableZoomSignal(disablezoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,10 +460,12 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
if (dimension == static_cast<int>(slsDetectorDefs::X)) {
|
if (dimension == static_cast<int>(slsDetectorDefs::X)) {
|
||||||
newval = idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) + ranges[qDefs::XMIN];
|
newval = idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) + ranges[qDefs::XMIN];
|
||||||
if (newval <= myPlot->GetXMaximum()) {
|
if (newval <= myPlot->GetXMaximum()) {
|
||||||
|
ranges[qDefs::XMAX] = newval;
|
||||||
dispXMax->setText(QString::number(newval));
|
dispXMax->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New XMax: " << newval;
|
FILE_LOG(logDEBUG) << "New XMax: " << newval;
|
||||||
} else {
|
} else {
|
||||||
newval = ranges[qDefs::XMAX] - (idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
newval = ranges[qDefs::XMAX] - (idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
||||||
|
ranges[qDefs::XMIN] = newval;
|
||||||
dispXMin->setText(QString::number(newval));
|
dispXMin->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New XMin: " << newval;
|
FILE_LOG(logDEBUG) << "New XMin: " << newval;
|
||||||
}
|
}
|
||||||
@ -526,10 +474,12 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
else {
|
else {
|
||||||
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio) + ranges[qDefs::YMIN];
|
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio) + ranges[qDefs::YMIN];
|
||||||
if (newval <= myPlot->GetYMaximum()) {
|
if (newval <= myPlot->GetYMaximum()) {
|
||||||
|
ranges[qDefs::YMAX] = newval;
|
||||||
dispYMax->setText(QString::number(newval));
|
dispYMax->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||||
} else {
|
} else {
|
||||||
newval = ranges[qDefs::YMAX] - ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio);
|
newval = ranges[qDefs::YMAX] - ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio);
|
||||||
|
ranges[qDefs::YMIN] = newval;
|
||||||
dispYMin->setText(QString::number(newval));
|
dispYMin->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||||
}
|
}
|
||||||
@ -545,34 +495,26 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
|
|
||||||
// set XY values in plot
|
bool isRange[4] {true, true, true, true};
|
||||||
myPlot->SetXYRangeValues(dispXMin->text().toDouble(), qDefs::XMIN);
|
myPlot->SetXYRangeChanged(true, ranges, isRange);
|
||||||
myPlot->SetXYRangeValues(dispXMax->text().toDouble(), qDefs::XMAX);
|
|
||||||
myPlot->SetXYRangeValues(dispYMin->text().toDouble(), qDefs::YMIN);
|
|
||||||
myPlot->SetXYRangeValues(dispYMax->text().toDouble(), qDefs::YMAX);
|
|
||||||
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::XMIN);
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::XMAX);
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::YMIN);
|
|
||||||
myPlot->IsXYRangeValues(true, qDefs::YMAX);
|
|
||||||
|
|
||||||
// to update plot with range
|
|
||||||
myPlot->SetXYRangeChanged();
|
|
||||||
myPlot->DisableZoom(true);
|
|
||||||
emit DisableZoomSignal(true);
|
emit DisableZoomSignal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::SetZRange() {
|
void qTabPlot::SetZRange() {
|
||||||
bool isZmin = chkZMin->isChecked();
|
bool isZRange[2] {chkZMin->isChecked(), chkZMax->isChecked()};
|
||||||
bool isZmax = chkZMax->isChecked();
|
double zRange[2] {0 , 0};
|
||||||
double zmin = 0, zmax = 1;
|
|
||||||
if (!dispZMin->text().isEmpty()) {
|
if (isZRange[0] && !dispZMin->text().isEmpty()) {
|
||||||
zmin = dispZMin->text().toDouble();
|
double val = dispZMin->text().toDouble();
|
||||||
|
FILE_LOG(logDEBUG) << "Setting zmin to " << val;
|
||||||
|
zRange[0] = val;
|
||||||
}
|
}
|
||||||
if (!dispZMax->text().isEmpty()) {
|
if (isZRange[1] && !dispZMax->text().isEmpty()) {
|
||||||
zmax = dispZMax->text().toDouble();
|
double val = dispZMax->text().toDouble();
|
||||||
|
FILE_LOG(logDEBUG) << "Setting zmax to " << val;
|
||||||
|
zRange[1] = val;
|
||||||
}
|
}
|
||||||
myPlot->SetZRange(isZmin, isZmax, zmin, zmax);
|
myPlot->SetZRange(zRange, isZRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::GetStreamingFrequency() {
|
void qTabPlot::GetStreamingFrequency() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user