mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
fixed gain plot, aspect ratio, 1/4size of mainplat, keeping limits also for gain plot at start up, removing gain plot titles
This commit is contained in:
parent
277dc2cfd9
commit
069d044e17
@ -320,8 +320,8 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
|
|
||||||
plotLayout = new QGridLayout(boxPlot);
|
plotLayout = new QGridLayout(boxPlot);
|
||||||
plotLayout->setContentsMargins(0,0,0,0);
|
plotLayout->setContentsMargins(0,0,0,0);
|
||||||
plotLayout->addWidget(plot1D,0,0,3,3);
|
plotLayout->addWidget(plot1D,0,0,4,4);
|
||||||
plotLayout->addWidget(plot2D,0,0,3,3);
|
plotLayout->addWidget(plot2D,0,0,4,4);
|
||||||
|
|
||||||
|
|
||||||
//gainplot
|
//gainplot
|
||||||
@ -333,11 +333,11 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
gainplot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
gainplot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||||
gainplot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,gainImageArray);
|
gainplot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,gainImageArray);
|
||||||
gainplot2D->setTitle(GetImageTitle());
|
gainplot2D->setTitle(GetImageTitle());
|
||||||
gainplot2D->SetXTitle(imageXAxisTitle);
|
|
||||||
gainplot2D->SetYTitle(imageYAxisTitle);
|
|
||||||
gainplot2D->SetZTitle(QString("Gain ") + imageZAxisTitle);
|
|
||||||
gainplot2D->setAlignment(Qt::AlignLeft);
|
gainplot2D->setAlignment(Qt::AlignLeft);
|
||||||
plotLayout->addWidget(gainplot2D,1,3,1,1);
|
gainplot2D->GetPlot()->enableAxis(0,false);
|
||||||
|
gainplot2D->GetPlot()->enableAxis(1,false);
|
||||||
|
gainplot2D->GetPlot()->enableAxis(2,false);
|
||||||
|
plotLayout->addWidget(gainplot2D,0,4,1,1);
|
||||||
gainplot2D->hide();
|
gainplot2D->hide();
|
||||||
gainPlotEnable = false;
|
gainPlotEnable = false;
|
||||||
|
|
||||||
@ -1500,10 +1500,6 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
if (gainPlotEnable) {
|
if (gainPlotEnable) {
|
||||||
gainplot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,gainImageArray);
|
gainplot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,gainImageArray);
|
||||||
gainplot2D->setTitle(GetImageTitle());
|
gainplot2D->setTitle(GetImageTitle());
|
||||||
gainplot2D->SetXTitle(imageXAxisTitle);
|
|
||||||
gainplot2D->SetYTitle(imageYAxisTitle);
|
|
||||||
gainplot2D->SetZTitle(QString("Gain ") + imageZAxisTitle);
|
|
||||||
|
|
||||||
gainplot2D->show();
|
gainplot2D->show();
|
||||||
}else {
|
}else {
|
||||||
gainplot2D->hide();
|
gainplot2D->hide();
|
||||||
@ -1517,16 +1513,18 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum();
|
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum();
|
||||||
plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||||
plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||||
if (gainPlotEnable) {
|
gainplot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||||
gainplot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
gainplot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||||
gainplot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
|
||||||
}
|
|
||||||
XYRangeChanged = false;
|
XYRangeChanged = false;
|
||||||
}
|
}
|
||||||
plot2D->GetPlot()->Update();
|
plot2D->GetPlot()->Update();
|
||||||
if (gainPlotEnable) {
|
if (gainPlotEnable) {
|
||||||
gainplot2D->GetPlot()->Update();
|
gainplot2D->GetPlot()->Update();
|
||||||
}
|
gainplot2D->setFixedWidth(plot2D->width()/4);
|
||||||
|
gainplot2D->setFixedHeight(plot2D->height()/4);
|
||||||
|
gainplot2D->show();
|
||||||
|
}else
|
||||||
|
gainplot2D->hide();
|
||||||
//Display Statistics
|
//Display Statistics
|
||||||
if(displayStatistics){
|
if(displayStatistics){
|
||||||
double min=0,max=0,sum=0;
|
double min=0,max=0,sum=0;
|
||||||
|
@ -539,20 +539,40 @@ void qTabPlot::maintainAspectRatio(int axis) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if x changed: y adjusted, y changed: x adjusted, aspect ratio clicked: larger one adjusted
|
// if x changed: y adjusted, y changed: x adjusted, aspect ratio clicked: larger one adjusted
|
||||||
|
double newval=0;
|
||||||
switch(axis) {
|
switch(axis) {
|
||||||
case 0:
|
case 0:
|
||||||
//change x
|
//change x
|
||||||
dispXMax->setText(QString::number(idealAspectratio * (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]) + ranges[qDefs::XMINIMUM]));
|
newval = idealAspectratio * (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]) + ranges[qDefs::XMINIMUM];
|
||||||
|
if (newval <= myPlot->GetXMaximum()) {
|
||||||
|
dispXMax->setText(QString::number(newval));
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cprintf(BLUE,"new xmax: %f\n",dispXMax->text().toDouble());
|
cprintf(BLUE,"new xmax: %f\n",newval);
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
newval = ranges[qDefs::XMAXIMUM] - (idealAspectratio * (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]));
|
||||||
|
dispXMin->setText(QString::number(newval));
|
||||||
|
#ifdef VERYVERBOSE
|
||||||
|
cprintf(BLUE,"new xmin: %f\n",newval);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// change y
|
// change y
|
||||||
dispYMax->setText(QString::number(((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / idealAspectratio) + ranges[qDefs::YMINIMUM]));
|
newval = ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / idealAspectratio) + ranges[qDefs::YMINIMUM];
|
||||||
|
if (newval <= myPlot->GetYMaximum()) {
|
||||||
|
dispYMax->setText(QString::number(newval));
|
||||||
|
//#ifdef VERYVERBOSE
|
||||||
|
cprintf(BLUE,"new ymax: %f\n",newval);
|
||||||
|
//#endif
|
||||||
|
} else {
|
||||||
|
newval = ranges[qDefs::YMAXIMUM] - ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / idealAspectratio);
|
||||||
|
dispYMin->setText(QString::number(newval));
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cprintf(BLUE,"new ymax: %f\n",dispYMax->text().toDouble());
|
cprintf(BLUE,"new ymin: %f\n",newval);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -694,6 +714,22 @@ void qTabPlot::SetXAxisRange(){
|
|||||||
cout << "Setting X Axis Range" << endl;
|
cout << "Setting X Axis Range" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
|
||||||
|
if (dispXMin->text().toDouble() < myPlot->GetXMinimum()) {
|
||||||
|
qDefs::Message(qDefs::WARNING,"Outside Plot Range","qTabPlot::CheckZRange");
|
||||||
|
dispXMin->setText(QString::number(myPlot->GetXMinimum()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dispXMax->text().toDouble() > myPlot->GetXMaximum()) {
|
||||||
|
qDefs::Message(qDefs::WARNING,"Outside Plot Range","qTabPlot::CheckZRange");
|
||||||
|
dispXMax->setText(QString::number(myPlot->GetXMaximum()));
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXAxisRange()));
|
||||||
|
|
||||||
// keeping aspect ratio
|
// keeping aspect ratio
|
||||||
if (chkAspectRatio->isChecked()) {
|
if (chkAspectRatio->isChecked()) {
|
||||||
maintainAspectRatio(1);
|
maintainAspectRatio(1);
|
||||||
@ -709,9 +745,26 @@ void qTabPlot::SetXAxisRange(){
|
|||||||
|
|
||||||
void qTabPlot::SetYAxisRange(){
|
void qTabPlot::SetYAxisRange(){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting X Axis Range" << endl;
|
cout << "Setting Y Axis Range" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
|
||||||
|
if (dispYMin->text().toDouble() < myPlot->GetYMinimum()) {
|
||||||
|
qDefs::Message(qDefs::WARNING,"Outside Plot Range","qTabPlot::CheckZRange");
|
||||||
|
dispYMin->setText(QString::number(myPlot->GetYMinimum()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dispYMax->text().toDouble() > myPlot->GetYMaximum()) {
|
||||||
|
qDefs::Message(qDefs::WARNING,"Outside Plot Range","qTabPlot::CheckZRange");
|
||||||
|
dispYMax->setText(QString::number(myPlot->GetYMaximum()));
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYAxisRange()));
|
||||||
|
|
||||||
|
|
||||||
// keeping aspect ratio
|
// keeping aspect ratio
|
||||||
if (chkAspectRatio->isChecked()) {
|
if (chkAspectRatio->isChecked()) {
|
||||||
maintainAspectRatio(0);
|
maintainAspectRatio(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user