From f201a6a32b313567f4647966d6a6c9c1fb22fe26 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 15 Nov 2012 11:18:56 +0000 Subject: [PATCH] for receiver, display frame number since not in filename git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@112 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDrawPlot.h | 7 ++++-- slsDetectorGui/src/qDrawPlot.cpp | 39 +++++++++++++++++++----------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 99b3102b1..f53cfdf99 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -192,10 +192,10 @@ int ResetDaqForGui(); static void* DataStartAcquireThread(void *this_pointer); /** This is called by the detector class to copy the data it jus acquired */ -static int GetDataCallBack(detectorData *data, void *this_pointer); +static int GetDataCallBack(detectorData *data, int fIndex, void *this_pointer); /** This is called by the GetDataCallBack function to copy the data */ -int GetData(detectorData *data); +int GetData(detectorData *data, int fIndex); /** This is called by detector class when acquisition is finished * @param currentProgress current progress of measurement @@ -463,6 +463,9 @@ bool backwardScanPlot; /**if files will be saved and index increased*/ bool fileSaveEnable; +/** true if receiver online*/ +bool receiver; + signals: void UpdatingPlotFinished(); void InterpolateSignal(bool); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index de541d503..9f4d386a0 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -108,6 +108,8 @@ void qDrawPlot::SetupWidgetWindow(){ currentFileIndex = 0; currentFrameIndex = 0; + + receiver=false; // This is so that it initially stop and plots running = 1; for(int i=0;isetReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) + receiver=true; + cout << "Starting new acquisition threadddd ...." << endl; // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits @@ -524,8 +529,8 @@ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ - ((qDrawPlot*)this_pointer)->GetData(data); +int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointer){ + ((qDrawPlot*)this_pointer)->GetData(data,fIndex); return 0; } @@ -533,7 +538,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ //------------------------------------------------------------------------------------------------------------------------------------------------- -int qDrawPlot::GetData(detectorData *data){ +int qDrawPlot::GetData(detectorData *data,int fIndex){ #ifdef VERYVERBOSE cout << "******Entering GetDatafunction********" << endl; #endif @@ -551,10 +556,16 @@ int qDrawPlot::GetData(detectorData *data){ if(!plotEnable) return 0; // secondary title necessary to differentiate between frames when not saving data - /*char temp_title[2000]; - if(fileSaveEnable) strcpy(temp_title,""); - else sprintf(temp_title,"#%d",currentFrame); - */ + char temp_title[2000]; + if(receiver){ + //findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file. + if(fIndex==-1) fIndex=currentFrame; + sprintf(temp_title,"#%d",fIndex); + }else{ + if(fileSaveEnable) strcpy(temp_title,""); + else sprintf(temp_title,"#%d",currentFrame); + } + //angle plotting if(anglePlot){ @@ -563,7 +574,7 @@ int qDrawPlot::GetData(detectorData *data){ //set title plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); // Title - /*histTitle[0] = temp_title;*/ + histTitle[0] = temp_title; if(data->angles==NULL){ cout<<"\n\nWARNING:RETURNED NULL instead of angles."<values,nPixelsX*sizeof(double)); pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -658,7 +669,7 @@ int qDrawPlot::GetData(detectorData *data){ if(currentFrameIndex == 0) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title - /*imageTitle = temp_title;*/ + imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -686,7 +697,7 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs0; lastImageNumber= currentFrame+1; //title - /*imageTitle = temp_title;*/ + imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -712,7 +723,7 @@ int qDrawPlot::GetData(detectorData *data){ currentScanValue = cs1; lastImageNumber= currentFrame+1; //title - /*imageTitle = temp_title;*/ + imageTitle = temp_title; //copy data for(unsigned int px=0;pxvalues[px]; pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -734,7 +745,7 @@ int qDrawPlot::GetData(detectorData *data){ //1d if(plot_in_scope==1){ // Titles - /*histTitle[0] = temp_title;*/ + histTitle[0] = temp_title; // Persistency if(currentPersistency < persistency)currentPersistency++; else currentPersistency=persistency; @@ -748,7 +759,7 @@ int qDrawPlot::GetData(detectorData *data){ //2d else{cout<