mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
WIP
This commit is contained in:
parent
61b937e2e0
commit
06834617de
@ -19,7 +19,8 @@ class qCloneWidget : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim, std::string FilePath,
|
||||
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim,
|
||||
QString filePath, QString fileName, int fileIndex,
|
||||
bool displayStats, QString min, QString max, QString sum);
|
||||
~qCloneWidget();
|
||||
|
||||
@ -35,7 +36,7 @@ class qCloneWidget : public QMainWindow {
|
||||
* @param lines style of plot if lines or dots
|
||||
* @param markers style of plot markers or not
|
||||
*/
|
||||
void SetCloneHists(int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers);
|
||||
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers);
|
||||
|
||||
/**
|
||||
* Get the 1D hist values to plot for angle plotting
|
||||
@ -76,7 +77,9 @@ class qCloneWidget : public QMainWindow {
|
||||
|
||||
private:
|
||||
int id;
|
||||
std::string filePath;
|
||||
QString filePath;
|
||||
QString fileName;
|
||||
int imageIndex;
|
||||
SlsQt1DPlot *cloneplot1D;
|
||||
SlsQt2DPlotLayout *cloneplot2D;
|
||||
QVector<SlsQtH1D *> cloneplot1D_hists;
|
||||
|
@ -32,27 +32,33 @@ class qDrawPlot : public QWidget {
|
||||
/** Destructor */
|
||||
~qDrawPlot();
|
||||
|
||||
/** If the gui client has started or stopped */
|
||||
// measurement tab
|
||||
void SetClientInitiated();
|
||||
bool GetClientInitiated();
|
||||
// main
|
||||
bool isRunning();
|
||||
// from measurement tabs
|
||||
int GetProgress();
|
||||
int GetCurrentFrameIndex();
|
||||
// from plot tab
|
||||
void Select1dPlot(bool enable);
|
||||
void SetPlotTitlePrefix(QString title);
|
||||
void SetXAxisTitle(QString title);
|
||||
void SetYAxisTitle(QString title);
|
||||
void SetZAxisTitle(QString title);
|
||||
void DisableZoom(bool disable);
|
||||
void SetXYRange(bool changed);
|
||||
void SetXYRangeChanged();
|
||||
void SetXYRangeValues(double val, qDefs::range xy);
|
||||
void IsXYRangeValues(bool changed, qDefs::range xy);
|
||||
double GetXMinimum();
|
||||
double GetXMaximum();
|
||||
double GetYMinimum();
|
||||
double GetYMaximum();
|
||||
void SetZRange(bool isZmin, bool isZmax, double zmin, double zmax);
|
||||
void SetDataCallBack(bool enable);
|
||||
void SetBinary(bool enable, int from = 0, int to = 0);
|
||||
|
||||
|
||||
/** Starts or stop acquisition
|
||||
* Calls startDaq() function
|
||||
* @param stop_if_running is 0 to stop acquisition and 1 to start
|
||||
@ -61,25 +67,29 @@ class qDrawPlot : public QWidget {
|
||||
void StartStopDaqToggle(bool stop_if_running = 0);
|
||||
|
||||
public slots:
|
||||
void StopAcquisition();
|
||||
void SetPersistency(int val);
|
||||
void SetLines(bool enable);
|
||||
void SetMarkers(bool enable);
|
||||
void Set1dLogY(bool enable);
|
||||
void SetInterpolate(bool enable);
|
||||
void SetContour(bool enable);
|
||||
void SetLogz(bool enable);
|
||||
void SetPedestal(bool enable);
|
||||
void RecalculatePedestal();
|
||||
void SetAccumulate(bool enable);
|
||||
void ResetAccumulate();
|
||||
void DisplayStatistics(bool enable);
|
||||
void EnableGainPlot(bool enable);
|
||||
void ClonePlot();
|
||||
void CloseClones();
|
||||
void SaveClones();
|
||||
void SavePlot();
|
||||
void Select1DPlot();
|
||||
void Select2DPlot();
|
||||
void SavePlot();
|
||||
|
||||
|
||||
private slots:
|
||||
void SetSaveFileName(QString val);
|
||||
void CloneCloseEvent(int id);
|
||||
void EnableGainPlot(bool e);
|
||||
|
||||
|
||||
void UpdatePlot();
|
||||
void StartDaq(bool start);
|
||||
@ -87,31 +97,24 @@ class qDrawPlot : public QWidget {
|
||||
|
||||
signals:
|
||||
void UpdatingPlotFinished();
|
||||
void InterpolateSignal(bool);
|
||||
void ContourSignal(bool);
|
||||
void LogzSignal(bool);
|
||||
void LogySignal(bool);
|
||||
void ResetZMinZMaxSignal(bool, bool, double, double);
|
||||
void SetCurrentMeasurementSignal(int);
|
||||
void AcquisitionErrorSignal(QString);
|
||||
void UpdatePlotSignal();
|
||||
void GainPlotSignal(bool);
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void SetupStatistics();
|
||||
void SetupPlots();
|
||||
const char *GetTitle1d(int histIndex);
|
||||
double *GetHistYAxis(int histIndex);
|
||||
void SetStyle(SlsQtH1D *h);
|
||||
void GetStatistics(double &min, double &max, double &sum, double *array, int size);
|
||||
void SelectPlot(int i = 2);
|
||||
void Clear1DPlot();
|
||||
|
||||
|
||||
void SetupStatistics();
|
||||
void SetupPlots();
|
||||
|
||||
int LockLastImageArray();
|
||||
int UnlockLastImageArray();
|
||||
void SetStyle(SlsQtH1D *h);
|
||||
void GetStatistics(double &min, double &max, double &sum, double *array, int size);
|
||||
void DetachHists();
|
||||
|
||||
|
||||
|
||||
int StartDaqForGui();
|
||||
int StopDaqForGui();
|
||||
bool StartOrStopThread(bool start);
|
||||
@ -132,7 +135,7 @@ class qDrawPlot : public QWidget {
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
QVector<SlsQtH1D *> hists1d;
|
||||
QVector<SlsQtH1D *> hists1d;
|
||||
SlsQt2DPlotLayout *plot2d{nullptr};
|
||||
SlsQt2DPlotLayout *gainplot2d{nullptr};
|
||||
|
||||
@ -145,18 +148,17 @@ class qDrawPlot : public QWidget {
|
||||
bool plotRequired{false};/**?? */
|
||||
bool running{false};
|
||||
int progress{0};
|
||||
volatile bool stopSignal{false};
|
||||
bool clientInitiated{false};
|
||||
bool clientInitiated{false};
|
||||
|
||||
// titles
|
||||
QString plotTitle{""};
|
||||
QString plotTitle{""};
|
||||
QString plotTitle_prefix{""};
|
||||
QLabel *lblFrameIndexTitle1d{nullptr};
|
||||
std::vector<std::string> title1d;
|
||||
std::string title2d{""};
|
||||
std::string title2d{""};
|
||||
QString xTitle1d{"Channel Number"};
|
||||
QString yTitle1d{"Counts"};
|
||||
QString xTitle2d{"Pixel"};
|
||||
QString xTitle2d{"Pixel"};
|
||||
QString yTitle2d{"Pixel"};
|
||||
QString zTitle2d{"Intensity"};
|
||||
bool XYRangeChanged{false};
|
||||
@ -164,17 +166,16 @@ class qDrawPlot : public QWidget {
|
||||
bool isXYRangeEnable[4]{false, false, false, false};
|
||||
|
||||
// data
|
||||
unsigned int nHists{0};
|
||||
int histNBins{0};
|
||||
double *x1d{nullptr};
|
||||
std::vector<double *> y1d;
|
||||
double *image2d{nullptr};
|
||||
unsigned int nHists{1};
|
||||
double *datax1d{nullptr};
|
||||
std::vector<double *> datay1d;
|
||||
double *data2d{nullptr};
|
||||
|
||||
//options
|
||||
bool binary{false};
|
||||
int binaryFrom{0};
|
||||
int binaryTo{0};
|
||||
int persistency0};
|
||||
int persistency{0};
|
||||
int currentPersistency0};
|
||||
bool isLines{true};
|
||||
bool isMarkers{false};
|
||||
|
@ -66,8 +66,7 @@ private:
|
||||
|
||||
signals:
|
||||
void StartSignal();
|
||||
void StopSignal();
|
||||
|
||||
void FileNameChangedSignal(QString);
|
||||
private:
|
||||
multiSlsDetector *myDet;
|
||||
qDrawPlot *myPlot;
|
||||
|
@ -40,7 +40,6 @@ private slots:
|
||||
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
void ResetZMinZMaxSignal(bool,bool,double,double);
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
@ -53,7 +52,7 @@ private:
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
qDrawPlot *myPlot;
|
||||
bool isOneD;
|
||||
bool is1d;
|
||||
|
||||
QButtonGroup *btnGroupPlotType;
|
||||
QStackedLayout *stackedLayout;
|
||||
|
@ -133,6 +133,9 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
||||
|
||||
void alignScales();
|
||||
|
||||
void SetLogX(bool yes=1);
|
||||
void SetLogY(bool yes=1);
|
||||
private:
|
||||
|
||||
SlsQtH1DList* hist_list;
|
||||
@ -160,11 +163,6 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void UnZoom();
|
||||
void Update();
|
||||
|
||||
void SetLogX(bool yes=1);
|
||||
void SetLogY(bool yes=1);
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -101,10 +101,10 @@ public:
|
||||
void FillTestPlot(int i=0);
|
||||
void Update();
|
||||
|
||||
public slots:
|
||||
void LogZ(bool on=1);
|
||||
void InterpolatedPlot(bool on);
|
||||
void showContour(bool on);
|
||||
public slots:
|
||||
void showSpectrogram(bool on);
|
||||
// void printPlot();
|
||||
|
||||
|
@ -23,7 +23,11 @@ public:
|
||||
void SetYTitle(QString st);
|
||||
void SetZTitle(QString st);
|
||||
void KeepZRangeIfSet();
|
||||
|
||||
// recalculate zmin and zmax from plot and update z range
|
||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||
void SetInterpolate(bool enable);
|
||||
void SetContour(bool enable);
|
||||
void SetLogz(bool enable);
|
||||
|
||||
private:
|
||||
QGridLayout* the_layout;
|
||||
@ -32,7 +36,6 @@ private:
|
||||
QToolButton* btnLogz;
|
||||
SlsQt2DPlot* the_plot;
|
||||
|
||||
void ConnectSignalsAndSlots();
|
||||
void Layout();
|
||||
bool isLog;
|
||||
double zmin;
|
||||
@ -43,14 +46,8 @@ private:
|
||||
public slots:
|
||||
void SetZScaleToLog(bool enable);
|
||||
void ResetRange();
|
||||
// recalculate zmin and zmax from plot and update z range
|
||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||
|
||||
// update z range
|
||||
void UpdateZRange(double min, double max) ;
|
||||
|
||||
signals:
|
||||
void InterpolateSignal(bool);
|
||||
void ContourSignal(bool);
|
||||
void LogzSignal(bool);
|
||||
|
||||
};
|
||||
|
@ -18,7 +18,6 @@ SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
||||
isZmin = false;
|
||||
isZmax = false;
|
||||
Layout();
|
||||
ConnectSignalsAndSlots();
|
||||
}
|
||||
|
||||
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
||||
@ -32,11 +31,7 @@ void SlsQt2DPlotLayout::Layout(){
|
||||
the_layout->addWidget(the_plot,2,0,3,3);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool)));
|
||||
connect(this, SIGNAL(LogzSignal(bool)), this, SLOT(SetZScaleToLog(bool)));
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
||||
UpdateZRange(zmin, zmax);
|
||||
@ -52,6 +47,7 @@ void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max
|
||||
UpdateZRange(min, max);
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
||||
if(isLog) {
|
||||
the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
@ -72,8 +68,15 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZScaleToLog(bool enable) {
|
||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Z Scale to log";
|
||||
void SlsQt2DPlotLayout::SetInterpolate(bool enable) {
|
||||
the_plot->InterpolatedPlot(enable);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetContour(bool enable) {
|
||||
the_plot->showContour(enable);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetLogz(bool enable) {
|
||||
isLog = enable;
|
||||
the_plot->LogZ(enable);
|
||||
SetZRange(isZmin, isZmax, zmin, zmax);
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include <QPainter>
|
||||
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
|
||||
int numDim, std::string FilePath, bool displayStats, QString min, QString max, QString sum) :
|
||||
QMainWindow(parent), id(id), filePath(FilePath), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
||||
int numDim, QString fPath, QString fName, int fIndex, bool displayStats, QString min, QString max, QString sum) :
|
||||
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), fileIndex(fIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
||||
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), cloneBox(nullptr), lblHistTitle(nullptr) {
|
||||
// Window title
|
||||
char winTitle[300], currTime[50];
|
||||
@ -123,9 +123,9 @@ void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTit
|
||||
resize(500, 350);
|
||||
}
|
||||
|
||||
void qCloneWidget::SetCloneHists(int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers) {
|
||||
void qCloneWidget::SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers) {
|
||||
//for each plot, create hists
|
||||
for (int hist_num = 0; hist_num < nHists; ++hist_num) {
|
||||
for (unsigned int hist_num = 0; hist_num < nHists; ++hist_num) {
|
||||
SlsQtH1D *k;
|
||||
if (hist_num + 1 > cloneplot1D_hists.size()) {
|
||||
cloneplot1D_hists.append(k = new SlsQtH1D("1d plot", histNBins, histXAxis, histYAxis[hist_num]));
|
||||
@ -213,13 +213,8 @@ void qCloneWidget::SavePlot() {
|
||||
char cID[10];
|
||||
sprintf(cID, "%d", id);
|
||||
//title
|
||||
QString fName = QString(filePath.c_str());
|
||||
if (cloneBox->title().contains('.')) {
|
||||
fName.append(QString('/') + cloneBox->title());
|
||||
fName.replace(".dat", ".png");
|
||||
fName.replace(".raw", ".png");
|
||||
} else
|
||||
fName.append(QString("/Snapshot_unknown_title.png"));
|
||||
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
|
||||
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||
//save
|
||||
QImage img(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);
|
||||
QPainter painter(&img);
|
||||
@ -243,13 +238,7 @@ int qCloneWidget::SavePlotAutomatic() {
|
||||
char cID[10];
|
||||
sprintf(cID, "%d", id);
|
||||
//title
|
||||
QString fName = QString(filePath.c_str());
|
||||
if (cloneBox->title().contains('.')) {
|
||||
fName.append(QString('/') + cloneBox->title());
|
||||
fName.replace(".dat", ".png");
|
||||
fName.replace(".raw", ".png");
|
||||
} else
|
||||
fName.append(QString("/Snapshot_unknown_title.png"));
|
||||
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
|
||||
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||
//save
|
||||
QImage img(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);
|
||||
|
@ -286,37 +286,31 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
||||
|
||||
void qDetectorMain::Initialization() {
|
||||
// Dockable Plot
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool)));
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this, SLOT(ResizeMainWindow(bool)));
|
||||
// tabs
|
||||
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
// Measurement tab
|
||||
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||
connect(tabMeasurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
|
||||
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tablPlot, SLOT(SetSaveFileName(QString)));
|
||||
// Plot tab
|
||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||
|
||||
// Plotting
|
||||
// When the acquisition is finished, must update the meas tab
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tabMeasurement,
|
||||
SLOT(UpdateFinished()));
|
||||
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tabMeasurement,
|
||||
SLOT(SetCurrentMeasurement(int)));
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tabMeasurement, SLOT(UpdateFinished()));
|
||||
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tabMeasurement, SLOT(SetCurrentMeasurement(int)));
|
||||
|
||||
// menubar
|
||||
// Modes Menu
|
||||
connect(menuModes, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(EnableModes(QAction *)));
|
||||
connect(menuModes, SIGNAL(triggered(QAction *)), this, SLOT(EnableModes(QAction *)));
|
||||
// Utilities Menu
|
||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(ExecuteUtilities(QAction *)));
|
||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteUtilities(QAction *)));
|
||||
// Help Menu
|
||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(ExecuteHelp(QAction *)));
|
||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteHelp(QAction *)));
|
||||
|
||||
// server
|
||||
connect(myServer, SIGNAL(ServerStoppedSignal()), this,
|
||||
SLOT(UncheckServer()));
|
||||
connect(myServer, SIGNAL(ServerStoppedSignal()), this, SLOT(UncheckServer()));
|
||||
}
|
||||
|
||||
void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||
@ -756,8 +750,6 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start) {
|
||||
if (start) {
|
||||
if (tabMeasurement->GetStartStatus() != start) {
|
||||
tabMeasurement->ClentStartAcquisition();
|
||||
while (myPlot->GetClientInitiated())
|
||||
usleep(500);
|
||||
}
|
||||
} else {
|
||||
tabMeasurement->StopAcquisition();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,8 @@ bool qTabMeasurement::GetStartStatus(){
|
||||
void qTabMeasurement::ClentStartAcquisition(){
|
||||
StartAcquisition();
|
||||
myPlot->SetClientInitiated();
|
||||
while (myPlot->GetClientInitiated())
|
||||
usleep(500);
|
||||
}
|
||||
|
||||
int qTabMeasurement::GetProgress(){
|
||||
@ -502,11 +504,13 @@ void qTabMeasurement::GetFileName() {
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetFileName() {
|
||||
auto val = dispFileName->text().toAscii().constData();
|
||||
std::string val = std::string(dispFileName->text().toAscii().constData());
|
||||
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
|
||||
try {
|
||||
myDet->setFileName(val);
|
||||
} CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
|
||||
|
||||
emit FileNameChangedSignal(dispFileName->text());
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetRunIndex() {
|
||||
|
@ -20,7 +20,7 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
|
||||
QWidget(parent), myDet(detector), myPlot(plot), isOneD(false),
|
||||
QWidget(parent), myDet(detector), myPlot(plot), is1d(false),
|
||||
btnGroupPlotType(0), stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
@ -92,10 +92,10 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
dispZAxis->setText(defaultImageZAxisTitle);
|
||||
|
||||
// enabling according to det type
|
||||
isOneD = false;
|
||||
is1d = false;
|
||||
switch(myDet->getDetectorTypeAsEnum()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
isOneD = true;
|
||||
is1d = true;
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
@ -108,7 +108,7 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
break;
|
||||
}
|
||||
|
||||
Select1DPlot(isOneD);
|
||||
Select1DPlot(is1d);
|
||||
Initialization();
|
||||
Refresh();
|
||||
}
|
||||
@ -134,13 +134,13 @@ void qTabPlot::Initialization() {
|
||||
connect(spinPersistency, SIGNAL(valueChanged(int)), myPlot, SLOT(SetPersistency(int)));
|
||||
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool)));
|
||||
connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool)));
|
||||
connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool)));
|
||||
connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SLOT(Set1dLogY(bool)));
|
||||
connect(chkStatistics, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
||||
|
||||
// 2D Plot box
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), myPlot, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)), myPlot, SIGNAL(ContourSignal(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogzSignal(bool)));
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), myPlot, SLOT(SetInterpolate(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)), myPlot, SLOT(SetContour(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SLOT(SetLogz(bool)));
|
||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
||||
//pedstal
|
||||
connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
|
||||
@ -161,7 +161,7 @@ void qTabPlot::Initialization() {
|
||||
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||
//gainplot
|
||||
if (chkGainPlot->isEnabled())
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SIGNAL(GainPlotSignal(bool)));
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SLOT(EnableGainPlot(bool)));
|
||||
// gap pixels
|
||||
if (chkGapPixels->isEnabled())
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
@ -198,12 +198,11 @@ void qTabPlot::Initialization() {
|
||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
||||
connect(this, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)));
|
||||
}
|
||||
|
||||
void qTabPlot::Select1DPlot(bool enable) {
|
||||
FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
||||
isOneD = enable;
|
||||
is1d = enable;
|
||||
box1D->setEnabled(enable);
|
||||
box2D->setEnabled(!enable);
|
||||
chkZAxis->setEnabled(!enable);
|
||||
@ -212,14 +211,10 @@ void qTabPlot::Select1DPlot(bool enable) {
|
||||
chkZMax->setEnabled(!enable);
|
||||
dispZMin->setEnabled(!enable);
|
||||
dispZMax->setEnabled(!enable);
|
||||
if(enable) {
|
||||
myPlot->Select1DPlot();
|
||||
} else {
|
||||
myPlot->Select2DPlot();
|
||||
}
|
||||
myplot->Select1dPlot(enable);
|
||||
SetTitles();
|
||||
SetXYRange();
|
||||
if (!isOneD) {
|
||||
if (!is1d) {
|
||||
SetZRange();
|
||||
}
|
||||
}
|
||||
@ -242,7 +237,7 @@ void qTabPlot::SetPlot() {
|
||||
if (plotEnable) {
|
||||
SetTitles();
|
||||
SetXYRange();
|
||||
if (!isOneD) {
|
||||
if (!is1d) {
|
||||
SetZRange();
|
||||
}
|
||||
}
|
||||
@ -303,7 +298,7 @@ void qTabPlot::EnablePersistency(bool enable) {
|
||||
void qTabPlot::SetBinary() {
|
||||
bool binary1D = chkBinary->isChecked();
|
||||
bool binary2D = chkBinary_2->isChecked();
|
||||
if (isOneD) {
|
||||
if (is1d) {
|
||||
FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
|
||||
lblFrom->setEnabled(binary1D);
|
||||
lblTo->setEnabled(binary1D);
|
||||
@ -364,15 +359,15 @@ void qTabPlot::SetTitles() {
|
||||
}
|
||||
// x
|
||||
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
||||
dispXAxis->setText(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
myPlot->SetXAxisTitle(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
dispXAxis->setText(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
myPlot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
} else {
|
||||
myPlot->SetXAxisTitle(dispXAxis->text());
|
||||
}
|
||||
// y
|
||||
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
||||
dispYAxis->setText(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
myPlot->SetYAxisTitle(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
dispYAxis->setText(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
myPlot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
} else {
|
||||
myPlot->SetYAxisTitle(dispYAxis->text());
|
||||
}
|
||||
@ -490,7 +485,7 @@ void qTabPlot::SetXYRange() {
|
||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
|
||||
// to update plot with range
|
||||
myPlot->SetXYRange(true);
|
||||
myplot->SetXYRangeChanged();
|
||||
myPlot->DisableZoom(disablezoom);
|
||||
emit DisableZoomSignal(disablezoom);
|
||||
}
|
||||
@ -594,7 +589,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
myPlot->IsXYRangeValues(true, qDefs::YMAXIMUM);
|
||||
|
||||
// to update plot with range
|
||||
myPlot->SetXYRange(true);
|
||||
myplot->SetXYRangeChanged();
|
||||
myPlot->DisableZoom(true);
|
||||
emit DisableZoomSignal(true);
|
||||
}
|
||||
@ -609,7 +604,7 @@ void qTabPlot::SetZRange() {
|
||||
if (!dispZMax->text().isEmpty()) {
|
||||
zmax = dispZMax->text().toDouble();
|
||||
}
|
||||
emit ResetZMinZMaxSignal(isZmin, isZmax, zmin, zmax);
|
||||
myPlot->SetZRange(isZmin, isZmax, zmin, zmax);
|
||||
}
|
||||
|
||||
void qTabPlot::GetStreamingFrequency() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user