This commit is contained in:
maliakal_d 2019-06-14 16:38:42 +02:00
parent ca9fca88c4
commit 4213a161fe
6 changed files with 1222 additions and 1643 deletions

File diff suppressed because it is too large Load Diff

View File

@ -67,18 +67,27 @@ public:
* file index wont increase and so you need secondary titles to differentitate between plots*/ * file index wont increase and so you need secondary titles to differentitate between plots*/
void SetFileWrite(bool enable){fileSaveEnable = enable;}; void SetFileWrite(bool enable){fileSaveEnable = enable;};
/** sets plot Title prefix*/ /** sets plot Title prefix*/
void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;} void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;}
/** sets 1D X Axis Title */
void SetHistXAxisTitle(QString title) {histXAxisTitle = title;} void SetXAxisTitle(QString title) {
/** sets 1D Y Axis Title */ if(plot_in_scope==1) {
void SetHistYAxisTitle(QString title) {histYAxisTitle = title;} histXAxisTitle = title;
/** sets 2D X Axis Title */ } else {
void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;} imageXAxisTitle = title;
/** sets 2D Y Axis Title */ }
void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;} }
void SetYAxisTitle(QString title) {
if(plot_in_scope==1) {
histYAxisTitle = title;
} else {
imageYAxisTitle = title;
}
}
/** sets 2D Z Axis Title */ /** sets 2D Z Axis Title */
void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;} void SetZAxisTitle(QString title) {imageZAxisTitle = title;}
/** Disables zoom if any of the axes range are checked and fixed with a value */ /** Disables zoom if any of the axes range are checked and fixed with a value */
void DisableZoom(bool disable); void DisableZoom(bool disable);
/** Enables plot from the plot tab*/ /** Enables plot from the plot tab*/
@ -98,8 +107,6 @@ public:
* @param xy is xmin,xmax,ymin or ymax */ * @param xy is xmin,xmax,ymin or ymax */
void IsXYRangeValues(bool changed,qDefs::range xy){IsXYRange[xy]=changed;}; void IsXYRangeValues(bool changed,qDefs::range xy){IsXYRange[xy]=changed;};
/** Get minimum Plot timer - between plots */
double GetMinimumPlotTimer(){return PLOT_TIMER_MS;};
/** Set Plot timer - between plots in ms*/ /** Set Plot timer - between plots in ms*/
void SetPlotTimer(double time); void SetPlotTimer(double time);
/** Set Plot frame factor - between plots, also for receiver if exists */ /** Set Plot frame factor - between plots, also for receiver if exists */
@ -500,9 +507,6 @@ double XYRangeValues[4];
/**if the specific min/max of x/y is enabled */ /**if the specific min/max of x/y is enabled */
bool IsXYRange[4]; bool IsXYRange[4];
/** Default timer between plots*/
static const double PLOT_TIMER_MS;
/** Specific timer value between plots */ /** Specific timer value between plots */
double timerValue; double timerValue;
/** every nth frame when to plot */ /** every nth frame when to plot */

View File

@ -27,33 +27,36 @@ public slots:
void EnableScanBox(); void EnableScanBox();
private slots: private slots:
void Select1DPlot(bool b);
/**Enables Persistency depending on Superimpose checkbox */ xxxxxxxxxxxxxxx
void Set1DPlotOptionsRight();
void Set1DPlotOptionsLeft();
void Set2DPlotOptionsRight();
void Set2DPlotOptionsLeft();
void EnablePersistency(bool enable); void EnablePersistency(bool enable);
void SetTitles();
void EnableTitles();
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);
void EnableXRange();
void EnableYRange();
void EnableRange();
void SetXAxisRange();
void SetYAxisRange();
void SetAxesRange();
void SetZRange();
void EnableZRange();
bool CheckZRange(QString value);
void SetPlot();
void SetPlotOptionsRightPage();
void SetPlotOptionsLeftPage();
void SetBinary(); void SetBinary();
void SetHistogramOptions(); void SetGapPixels(bool enable);
void EnableGapPixels(bool enable); void SetTitles();
void SetXRange();
void SetYRange();
void CheckAspectRatio();
void SetXYRange();
/**
* Maintain aspect ratio
*/
void MaintainAspectRatio(int dimension);
void SetZRange();
void Select1DPlot(bool b);
void SetPlot();
signals: signals:
void DisableZoomSignal(bool); void DisableZoomSignal(bool);
@ -62,36 +65,30 @@ signals:
private: private:
void SetupWidgetWindow(); void SetupWidgetWindow();
void Initialization(); void Initialization();
void GetGapPixels();
void EnableRange();
void SetAxesRange();
bool CheckZRange(QString value);
multiSlsDetector *myDet; multiSlsDetector *myDet;
qDrawPlot *myPlot; qDrawPlot *myPlot;
bool isOneD; bool isOneD;
bool isOriginallyOneD; bool isOriginallyOneD;
/**is set if its a possible wrong interval between plots*/ QButtonGroup *btnGroupPlotType;
bool wrongInterval; /** interval between plots */
QStackedLayout *stackedLayout; QStackedLayout *stackedLayout;
QSpinBox *spinNthFrame; QSpinBox *spinNthFrame;
QDoubleSpinBox *spinTimeGap; QDoubleSpinBox *spinTimeGap;
QComboBox *comboTimeGapUnit; QComboBox *comboTimeGapUnit;
QButtonGroup *btnGroupScan;
QButtonGroup *btnGroupPlotType;
QButtonGroup *btnGroupHistogram;
QPalette *red;
QString intervalTip;
/** some Default Values */ /** default plot and axis titles */
static QString defaultPlotTitle; static QString defaultPlotTitle;
static QString defaultHistXAxisTitle; static QString defaultHistXAxisTitle;
static QString defaultHistYAxisTitle; static QString defaultHistYAxisTitle;
static QString defaultImageXAxisTitle; static QString defaultImageXAxisTitle;
static QString defaultImageYAxisTitle; static QString defaultImageYAxisTitle;
static QString defaultImageZAxisTitle; static QString defaultImageZAxisTitle;
/** scans */
static const QString modeNames[5];
}; };

View File

@ -22,10 +22,8 @@ SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
z_range_ne = new SlsQtNumberEntry(this,1,(char*)"Set the z axis range from",2,(char*)"to",2); z_range_ne = new SlsQtNumberEntry(this,1,(char*)"Set the z axis range from",2,(char*)"to",2);
z_range_ne->setFixedWidth(402); z_range_ne->setFixedWidth(402);
#ifndef IAN
zRangeChecked = false; zRangeChecked = false;
z_range_ne->hide(); z_range_ne->hide();
#endif
CreateTheButtons(); CreateTheButtons();
Layout(); Layout();
@ -43,69 +41,32 @@ SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
void SlsQt2DPlotLayout::CreateTheButtons(){ void SlsQt2DPlotLayout::CreateTheButtons(){
/** Dhanya: All these buttons are already in another class, logz is used and a wrapper around it*/
#ifdef IAN
btnInterpolate = new QToolButton(this);
btnInterpolate->setText("Interpolate");
btnInterpolate->setCheckable(true);
btnInterpolate->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
btnContour = new QToolButton(this);
btnContour->setText("Contour");
btnContour->setCheckable(true);
btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif
btnLogz = new QToolButton(this); btnLogz = new QToolButton(this);
btnLogz->setText("Log Scale (Z)"); btnLogz->setText("Log Scale (Z)");
btnLogz->setCheckable(true); btnLogz->setCheckable(true);
btnLogz->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); btnLogz->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#ifndef IAN
btnLogz->hide(); btnLogz->hide();
#endif
} }
void SlsQt2DPlotLayout::Layout(){ void SlsQt2DPlotLayout::Layout(){
if(the_layout) delete the_layout; if(the_layout) delete the_layout;
the_layout = new QGridLayout(this); the_layout = new QGridLayout(this);
#ifdef IAN
the_layout->addWidget(btnInterpolate,1,1);
the_layout->addWidget(btnContour,1,2);
the_layout->addWidget(btnLogz,1,3);
the_layout->addWidget(the_plot,2,1,3,3);
the_layout->addWidget(z_range_ne,5,1,1,3);
the_layout->setMargin(12);
#else
the_layout->addWidget(the_plot,2,0,3,3); the_layout->addWidget(the_plot,2,0,3,3);
the_layout->addWidget(z_range_ne,5,0,1,3); the_layout->addWidget(z_range_ne,5,0,1,3);
#endif
} }
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){ void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
#ifndef IAN
connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool))); connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool)));
connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool))); connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool)));
#else
connect(btnInterpolate, SIGNAL(toggled(bool)),the_plot, SLOT(InterpolatedPlot(bool)));
connect(btnContour, SIGNAL(toggled(bool)),the_plot, SLOT(showContour(bool)));
connect(btnLogz, SIGNAL(toggled(bool)),this,SLOT(SetZScaleToLog(bool)));
btnInterpolate->setChecked(false);
btnContour->setChecked(false);
#endif
connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange())); connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange()));
connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange())); connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange()));
btnLogz->setChecked(false); btnLogz->setChecked(false);
} }
void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){ void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
#ifdef IAN
if(z_range_ne->CheckBoxState()){
#endif
//just reset histogram range before update //just reset histogram range before update
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
#ifdef IAN
}
#endif
the_plot->Update(); the_plot->Update();
} }
@ -113,11 +74,7 @@ void SlsQt2DPlotLayout::ResetRange(){
//refind z limits //refind z limits
the_plot->SetZMinMax(); the_plot->SetZMinMax();
if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero(); if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
#ifdef IAN
if(z_range_ne->CheckBoxState()){
#else
if(zRangeChecked){ if(zRangeChecked){
#endif
//first time check validity //first time check validity
bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0; bool same = (z_range_ne->GetValue(0)==z_range_ne->GetValue(1)) ? 1:0;
if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0); if(!z_range_ne->IsValueOk(0)||same) z_range_ne->SetValue(the_plot->GetZMinimum(),0);
@ -175,49 +132,34 @@ void SlsQt2DPlotLayout::ResetZMinZMax(bool zmin, bool zmax, double min, double m
void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){ void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
#ifndef IAN
#ifdef VERBOSE #ifdef VERBOSE
cout<<"Setting ZScale to log:"<<yes<<endl; cout<<"Setting ZScale to log:"<<yes<<endl;
#endif #endif
btnLogz->setChecked(yes); btnLogz->setChecked(yes);
#endif
the_plot->LogZ(yes); the_plot->LogZ(yes);
ResetRange(); ResetRange();
} }
void SlsQt2DPlotLayout::SetXTitle(QString st){ void SlsQt2DPlotLayout::SetXTitle(QString st){
#ifndef IAN
QwtText title(st); QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal)); title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title); GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
#else
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
#endif
} }
void SlsQt2DPlotLayout::SetYTitle(QString st){ void SlsQt2DPlotLayout::SetYTitle(QString st){
#ifndef IAN
QwtText title(st); QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal)); title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title); GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
#else
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
#endif
} }
void SlsQt2DPlotLayout::SetZTitle(QString st){ void SlsQt2DPlotLayout::SetZTitle(QString st){
#ifndef IAN
QwtText title(st); QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal)); title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title); GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
#else
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
#endif
} }
#ifndef IAN
void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){ void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){
#ifdef VERBOSE #ifdef VERBOSE
cout<<"zmin:"<<zmin<<"\tzmax:"<<zmax<<endl; cout<<"zmin:"<<zmin<<"\tzmax:"<<zmax<<endl;
@ -236,4 +178,3 @@ void SlsQt2DPlotLayout::EnableZRange(bool enable){
ResetRange(); ResetRange();
} }
#endif

View File

@ -24,8 +24,6 @@
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
const double qDrawPlot::PLOT_TIMER_MS = DEFAULT_STREAMING_TIMER_IN_MS;
qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector), plot1D_hists(0) { qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector), plot1D_hists(0) {
SetupWidgetWindow(); SetupWidgetWindow();
Initialization(); Initialization();
@ -177,7 +175,7 @@ void qDrawPlot::SetupWidgetWindow() {
IsXYRange[2] = false; IsXYRange[2] = false;
IsXYRange[3] = false; IsXYRange[3] = false;
timerValue = PLOT_TIMER_MS; timerValue = DEFAULT_STREAMING_TIMER_IN_MS;
frameFactor = 0; frameFactor = 0;
isFrameEnabled = false; isFrameEnabled = false;
isTriggerEnabled = false; isTriggerEnabled = false;

File diff suppressed because it is too large Load Diff