fixed the double plot due to unzooming in gui

This commit is contained in:
Dhanya Maliakal 2017-11-13 15:25:49 +01:00
parent a250565f44
commit 409519a3db
3 changed files with 14 additions and 11 deletions

View File

@ -68,7 +68,7 @@ public:
SlsQt2DPlot(QWidget * = NULL);
// SlsQt2DHist *GetHistogram(){ return hist; }
void UnZoom();
void UnZoom(bool replot=true);
void SetZoom(double xmin,double ymin,double x_width,double y_width);

View File

@ -164,13 +164,13 @@ void SlsQt2DPlot::SetupZoom(){
//replot();
}*/
void SlsQt2DPlot::UnZoom(){
void SlsQt2DPlot::UnZoom(bool replot){
#if QWT_VERSION<0x060000
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
#else
zoomer->setZoomBase(QRectF(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
#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);
}

View File

@ -487,7 +487,10 @@ bool qDrawPlot::StartOrStopThread(bool start){
plot2D->GetPlot()->SetXMinMax(-0.5,nPixelsX+0.5);
plot2D->GetPlot()->SetYMinMax(startPixel,endPixel);
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;*/
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));
SetHistXAxisTitle("Angles");
}
plotRequired = true;
UnlockLastImageArray();
currentFrame++;
#ifdef VERYVERBOSE
cout << "Exiting GetData Function " << endl;
#endif
emit UpdatePlotSignal();
plotRequired = true;
return 0;
}
@ -906,11 +909,11 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
imageTitle = temp_title;
//copy data
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
plotRequired = true;
UnlockLastImageArray();
currentFrame++;
currentScanDivLevel++;
emit UpdatePlotSignal();
plotRequired = true;
return 0;
}
//file index
@ -925,11 +928,11 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
imageTitle = temp_title;
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
plotRequired = true;
UnlockLastImageArray();
currentFrame++;
currentScanDivLevel++;
emit UpdatePlotSignal();
plotRequired = true;
return 0;
}
//level0
@ -951,10 +954,10 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
imageTitle = temp_title;
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
plotRequired = true;
UnlockLastImageArray();
currentFrame++;
emit UpdatePlotSignal();
plotRequired = true;
return 0;
}
//level1
@ -976,10 +979,10 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
imageTitle = temp_title;
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
plotRequired = true;
UnlockLastImageArray();
currentFrame++;
emit UpdatePlotSignal();
plotRequired = true;
return 0;
}
@ -1169,14 +1172,14 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
}
/* pthread_mutex_unlock(&(last_image_complete_mutex));
}*/
plotRequired = true;
UnlockLastImageArray();
#ifdef VERYVERBOSE
cprintf(BLUE,"currentframe:%d \tcurrentframeindex:%d\n",currentFrame,currentFrameIndex);
#endif
emit UpdatePlotSignal();
plotRequired = true;
currentFrame++;
emit UpdatePlotSignal();
}