mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-15 14:27:13 +02:00
fixed the double plot due to unzooming in gui
This commit is contained in:
@ -68,7 +68,7 @@ public:
|
|||||||
SlsQt2DPlot(QWidget * = NULL);
|
SlsQt2DPlot(QWidget * = NULL);
|
||||||
|
|
||||||
// SlsQt2DHist *GetHistogram(){ return hist; }
|
// SlsQt2DHist *GetHistogram(){ return hist; }
|
||||||
void UnZoom();
|
void UnZoom(bool replot=true);
|
||||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,13 +164,13 @@ void SlsQt2DPlot::SetupZoom(){
|
|||||||
//replot();
|
//replot();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void SlsQt2DPlot::UnZoom(){
|
void SlsQt2DPlot::UnZoom(bool replot){
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
||||||
#else
|
#else
|
||||||
zoomer->setZoomBase(QRectF(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
zoomer->setZoomBase(QRectF(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
||||||
#endif
|
#endif
|
||||||
zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales.
|
zoomer->setZoomBase(replot);//Call replot for the attached plot before initializing the zoomer with its scales.
|
||||||
// zoomer->zoom(0);
|
// zoomer->zoom(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,7 +487,10 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
|||||||
plot2D->GetPlot()->SetXMinMax(-0.5,nPixelsX+0.5);
|
plot2D->GetPlot()->SetXMinMax(-0.5,nPixelsX+0.5);
|
||||||
plot2D->GetPlot()->SetYMinMax(startPixel,endPixel);
|
plot2D->GetPlot()->SetYMinMax(startPixel,endPixel);
|
||||||
plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel);
|
plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel);
|
||||||
plot2D->GetPlot()->UnZoom();
|
if (boxPlot->title() == "Sample Plot")
|
||||||
|
plot2D->GetPlot()->UnZoom();
|
||||||
|
else
|
||||||
|
plot2D->GetPlot()->UnZoom(false);
|
||||||
/*XYRangeChanged = true;*/
|
/*XYRangeChanged = true;*/
|
||||||
boxPlot->setTitle("Old_Plot.raw");
|
boxPlot->setTitle("Old_Plot.raw");
|
||||||
|
|
||||||
@ -856,13 +859,13 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
|||||||
memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double));
|
memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double));
|
||||||
SetHistXAxisTitle("Angles");
|
SetHistXAxisTitle("Angles");
|
||||||
}
|
}
|
||||||
|
plotRequired = true;
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
currentFrame++;
|
currentFrame++;
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Exiting GetData Function " << endl;
|
cout << "Exiting GetData Function " << endl;
|
||||||
#endif
|
#endif
|
||||||
emit UpdatePlotSignal();
|
emit UpdatePlotSignal();
|
||||||
plotRequired = true;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,11 +909,11 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
|||||||
imageTitle = temp_title;
|
imageTitle = temp_title;
|
||||||
//copy data
|
//copy data
|
||||||
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
|
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
|
||||||
|
plotRequired = true;
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
currentFrame++;
|
currentFrame++;
|
||||||
currentScanDivLevel++;
|
currentScanDivLevel++;
|
||||||
emit UpdatePlotSignal();
|
emit UpdatePlotSignal();
|
||||||
plotRequired = true;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//file index
|
//file index
|
||||||
@ -925,11 +928,11 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
|||||||
imageTitle = temp_title;
|
imageTitle = temp_title;
|
||||||
//copy data
|
//copy data
|
||||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||||
|
plotRequired = true;
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
currentFrame++;
|
currentFrame++;
|
||||||
currentScanDivLevel++;
|
currentScanDivLevel++;
|
||||||
emit UpdatePlotSignal();
|
emit UpdatePlotSignal();
|
||||||
plotRequired = true;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//level0
|
//level0
|
||||||
@ -951,10 +954,10 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
|||||||
imageTitle = temp_title;
|
imageTitle = temp_title;
|
||||||
//copy data
|
//copy data
|
||||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||||
|
plotRequired = true;
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
currentFrame++;
|
currentFrame++;
|
||||||
emit UpdatePlotSignal();
|
emit UpdatePlotSignal();
|
||||||
plotRequired = true;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//level1
|
//level1
|
||||||
@ -976,10 +979,10 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
|||||||
imageTitle = temp_title;
|
imageTitle = temp_title;
|
||||||
//copy data
|
//copy data
|
||||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||||
|
plotRequired = true;
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
currentFrame++;
|
currentFrame++;
|
||||||
emit UpdatePlotSignal();
|
emit UpdatePlotSignal();
|
||||||
plotRequired = true;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1169,14 +1172,14 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
|||||||
}
|
}
|
||||||
/* pthread_mutex_unlock(&(last_image_complete_mutex));
|
/* pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||||
}*/
|
}*/
|
||||||
|
plotRequired = true;
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
|
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cprintf(BLUE,"currentframe:%d \tcurrentframeindex:%d\n",currentFrame,currentFrameIndex);
|
cprintf(BLUE,"currentframe:%d \tcurrentframeindex:%d\n",currentFrame,currentFrameIndex);
|
||||||
#endif
|
#endif
|
||||||
emit UpdatePlotSignal();
|
|
||||||
plotRequired = true;
|
|
||||||
currentFrame++;
|
currentFrame++;
|
||||||
|
emit UpdatePlotSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user