mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-10 12:00:43 +02:00
All the ranges of the axes work properly without zooming in and out each time
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@11 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -520,12 +520,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gated</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trigger Exposure</string>
|
||||
<string>Trigger Exposure Series</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -538,6 +533,11 @@
|
||||
<string>Trigger Readout</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gated with Fixed Number</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gated with Start Trigger</string>
|
||||
|
@ -37,7 +37,7 @@
|
||||
<x>10</x>
|
||||
<y>135</y>
|
||||
<width>751</width>
|
||||
<height>136</height>
|
||||
<height>141</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
@ -603,10 +603,6 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>gridLayoutWidget_3</zorder>
|
||||
<zorder>btnClear</zorder>
|
||||
<zorder>btnClear</zorder>
|
||||
<zorder>btnClear</zorder>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="boxSave">
|
||||
<property name="geometry">
|
||||
|
@ -13,6 +13,7 @@ class slsDetectorUtils;
|
||||
#include "detectorData.h"
|
||||
/** Qt Project Class Headers */
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
class SlsQt1DPlot;
|
||||
class SlsQt2DPlotLayout;
|
||||
class qCloneWidget;
|
||||
@ -34,50 +35,51 @@ class qDrawPlot:public QWidget{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** \short The constructor
|
||||
*/
|
||||
/** \short The constructor */
|
||||
qDrawPlot(QWidget *parent,slsDetectorUtils*& detector);
|
||||
|
||||
/** Destructor
|
||||
*/
|
||||
/** Destructor */
|
||||
~qDrawPlot();
|
||||
|
||||
/** Number of x axis pixels */
|
||||
int GetPixelsX(){return nPixelsX;};
|
||||
/** Number of y axis pixels */
|
||||
int GetPixelsY(){return nPixelsY;};
|
||||
/** sets plot Title */
|
||||
void SetPlotTitle(QString title) {boxPlot->setTitle(title);}
|
||||
/** sets 1D X Axis Title */
|
||||
void SetHistXAxisTitle(QString title) {histXAxisTitle = title;}
|
||||
/** sets 1D Y Axis Title */
|
||||
void SetHistYAxisTitle(QString title) {histYAxisTitle = title;}
|
||||
/** sets 2D X Axis Title */
|
||||
void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;}
|
||||
/** sets 2D Y Axis Title */
|
||||
void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;}
|
||||
/** sets 2D Z Axis Title */
|
||||
void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;}
|
||||
/** Sets X min and max */
|
||||
void SetXMinMax(double min,double max) {if(plot_in_scope==1)plot1D->SetXMinMax(min,max); else plot2D->GetPlot()->SetXMinMax(min,max);};
|
||||
/** Sets Y min and max */
|
||||
void SetYMinMax(double min,double max) {if(plot_in_scope==1)plot1D->SetYMinMax(min,max); else plot2D->GetPlot()->SetYMinMax(min,max);};
|
||||
/** Gets X min */
|
||||
double GetXMinimum(){if(plot_in_scope==1)return plot1D->GetXMinimum(); else return plot2D->GetPlot()->GetXMinimum();};
|
||||
/** Gets X max */
|
||||
double GetXMaximum(){if(plot_in_scope==1)return plot1D->GetXMaximum(); else return plot2D->GetPlot()->GetXMaximum();};
|
||||
/** Gets Y min */
|
||||
double GetYMinimum(){if(plot_in_scope==1)return plot1D->GetYMinimum(); else return plot2D->GetPlot()->GetYMinimum();};
|
||||
/** Gets Y max */
|
||||
double GetYMaximum(){if(plot_in_scope==1)return plot1D->GetYMaximum(); else return plot2D->GetPlot()->GetYMaximum();};
|
||||
/** Disables zoom if any of the axes range are checked and fixed with a value */
|
||||
void DisableZoom(bool disable);
|
||||
/** gets the progress of acquisition to the measurement tab*/
|
||||
int GetProgress(){return progress;};
|
||||
|
||||
|
||||
/** Starts or stop acquisition
|
||||
* Calls startDaq() function
|
||||
* @param stop_if_running is 0 to stop acquisition and 1 to start acquisition
|
||||
*/
|
||||
void StartStopDaqToggle(bool stop_if_running=0);
|
||||
|
||||
/** sets plot Title */
|
||||
void SetPlotTitle(QString title) {boxPlot->setTitle(title);}
|
||||
/** sets 1D X Axis Title */
|
||||
void SetHistXAxisTitle(QString title) {histXAxisTitle = title;}
|
||||
/** sets 1D Y Axis Title */
|
||||
void SetHistYAxisTitle(QString title) {histYAxisTitle = title;}
|
||||
/** sets 2D X Axis Title */
|
||||
void SetImageXAxisTitle(QString title) {imageXAxisTitle = title;}
|
||||
/** sets 2D Y Axis Title */
|
||||
void SetImageYAxisTitle(QString title) {imageYAxisTitle = title;}
|
||||
/** sets 2D Z Axis Title */
|
||||
void SetImageZAxisTitle(QString title) {imageZAxisTitle = title;}
|
||||
|
||||
void SetHistXAxisScale(double min,double max){plot1D->SetXAxisScale(min,max);};
|
||||
void SetHistYAxisScale(double min,double max){plot1D->SetYAxisScale(min,max);};
|
||||
int GetPixelsX(){return nPixelsX;};
|
||||
int GetPixelsY(){return nPixelsY;};
|
||||
void Unzoom1D(){plot1D->UnZoom();};
|
||||
double GetHistXAxisLowerBound(){return plot1D->GetXAxisLowerBound();};
|
||||
double GetHistXAxisUpperBound(){return plot1D->GetXAxisUpperBound();};
|
||||
double GetHistYAxisLowerBound(){return plot1D->GetYAxisLowerBound();};
|
||||
double GetHistYAxisUpperBound(){return plot1D->GetYAxisUpperBound();};
|
||||
|
||||
/** Disables zoom if any of the axes range are checked and fixed with a value */
|
||||
void DisableZoom(bool disable);
|
||||
|
||||
|
||||
/** gets the progress of acquisition to the measurement tab*/
|
||||
int GetProgress(){return progress;};
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
slsDetectorUtils *myDet;
|
||||
@ -97,7 +99,6 @@ private:
|
||||
QTimer* plot_update_timer;
|
||||
|
||||
|
||||
|
||||
/** 1D object */
|
||||
SlsQt1DPlot* plot1D;
|
||||
/** 2D object */
|
||||
@ -106,7 +107,6 @@ private:
|
||||
QVector<SlsQtH1D*> plot1D_hists;
|
||||
|
||||
|
||||
|
||||
/** Number of Measurements */
|
||||
int numberOfMeasurements;
|
||||
/** currentFrame */
|
||||
@ -126,20 +126,20 @@ private:
|
||||
static pthread_mutex_t last_image_complete_mutex;
|
||||
|
||||
/**variables for histograms */
|
||||
/** Title in 2D */
|
||||
std::string imageTitle;
|
||||
/** X Axis Title in 2D */
|
||||
QString imageXAxisTitle;
|
||||
/** Y Axis Title in 2D */
|
||||
QString imageYAxisTitle;
|
||||
/** Z Axis Title in 2D */
|
||||
QString imageZAxisTitle;
|
||||
/** Title for all the graphs in 1D */
|
||||
static std::string histTitle[MAX_1DPLOTS];
|
||||
/** X Axis Title in 1D */
|
||||
QString histXAxisTitle;
|
||||
/** Y Axis Title in 1D */
|
||||
QString histYAxisTitle;
|
||||
/** Title for all the graphs in 1D */
|
||||
static std::string histTitle[MAX_1DPLOTS];
|
||||
/** Title in 2D */
|
||||
static std::string imageTitle;
|
||||
/** 1D or 2D */
|
||||
static unsigned int plot_in_scope;
|
||||
/** Number of Pixels in X Axis */
|
||||
@ -169,117 +169,85 @@ private:
|
||||
static int progress;
|
||||
static bool plotEnable;
|
||||
|
||||
|
||||
/** */
|
||||
int LockLastImageArray() {return pthread_mutex_lock(&last_image_complete_mutex); }
|
||||
/** */
|
||||
int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete_mutex);}
|
||||
/** */
|
||||
int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;}
|
||||
/** */
|
||||
int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;}
|
||||
|
||||
/** */
|
||||
const char* GetImageTitle() {return imageTitle.c_str();}
|
||||
/** */
|
||||
const char* GetHistTitle(int i) {return (i>=0&&i<MAX_1DPLOTS) ? histTitle[i].c_str():0;} //int for hist number
|
||||
/** */
|
||||
double* GetHistYAxis(int i) {return (i>=0&&i<MAX_1DPLOTS) ? histYAxis[i]:0;} //int for hist number
|
||||
|
||||
|
||||
|
||||
/** Initializes all its members and the thread */
|
||||
void Initialization();
|
||||
|
||||
/** Sets up the widget */
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** */
|
||||
|
||||
/** Gets the image title */
|
||||
const char* GetImageTitle() {return imageTitle.c_str();}
|
||||
/** Gets the hist title for a 1D plot */
|
||||
const char* GetHistTitle(int i) {return (i>=0&&i<MAX_1DPLOTS) ? histTitle[i].c_str():0;} //int for hist number
|
||||
/** Gets the y axis value for the hist in 1D plot */
|
||||
double* GetHistYAxis(int i) {return (i>=0&&i<MAX_1DPLOTS) ? histYAxis[i]:0;} //int for hist number
|
||||
|
||||
|
||||
/** Locks the image to update plot */
|
||||
int LockLastImageArray() {return pthread_mutex_lock(&last_image_complete_mutex); }
|
||||
/** Unocks the image to update plot */
|
||||
int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete_mutex);}
|
||||
/** Starts the acquisition */
|
||||
int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;}
|
||||
/** Stops the acquisition */
|
||||
int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;}
|
||||
/** Starts/stops Acquisition Thread */
|
||||
bool StartOrStopThread(bool start);
|
||||
/** Resets the acquisition parameter like lastimagenumber */
|
||||
int ResetDaqForGui();
|
||||
|
||||
/**acquisition thread stuff */
|
||||
/** */
|
||||
bool StartOrStopThread(bool start);
|
||||
|
||||
/** */
|
||||
/** The function which is called when start acquisition thread is created */
|
||||
static void* DataStartAcquireThread(void *this_pointer);
|
||||
|
||||
/** */
|
||||
/** This is called by the detector class to copt the data it jus acquired */
|
||||
static int GetDataCallBack(detectorData *data);
|
||||
|
||||
|
||||
public slots:
|
||||
/** Set number of measurements
|
||||
* @param num number of measurements to be set
|
||||
*/
|
||||
* @param num number of measurements to be set */
|
||||
void setNumMeasurements(int num);
|
||||
|
||||
/** To select 1D or 2D plot
|
||||
* @param i is 1 for 1D, else 2D plot
|
||||
*/
|
||||
@param i is 1 for 1D, else 2D plot */
|
||||
void SelectPlot(int i=2);
|
||||
|
||||
/** To select 1D plot
|
||||
*/
|
||||
/** To select 1D plot */
|
||||
void Select1DPlot() {SelectPlot(1);}
|
||||
|
||||
/** To select 2D plot
|
||||
*/
|
||||
/** To select 2D plot */
|
||||
void Select2DPlot() {SelectPlot(2);}
|
||||
|
||||
/** To clear plot
|
||||
*/
|
||||
/** To clear plot */
|
||||
void Clear1DPlot();
|
||||
|
||||
/** Creates a clone of the plot
|
||||
* */
|
||||
/** Creates a clone of the plot */
|
||||
void ClonePlot();
|
||||
|
||||
/** Closes all the clone plots
|
||||
* */
|
||||
/** Closes all the clone plots */
|
||||
void CloseClones();
|
||||
|
||||
/** To Save plot
|
||||
* @param FName full name of file
|
||||
* */
|
||||
@param FName full name of file */
|
||||
void SavePlot(QString FName);
|
||||
|
||||
/** Sets persistency from plot tab */
|
||||
void SetPersistency(int val);
|
||||
|
||||
/** Enables plot */
|
||||
void EnablePlot(bool enable);
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
/** To update plot
|
||||
*/
|
||||
/** To update plot */
|
||||
void UpdatePlot();
|
||||
|
||||
/** To stop updating plot
|
||||
*/
|
||||
/** To stop updating plot */
|
||||
void StopUpdatePlot();
|
||||
|
||||
/** To start or stop acquisition
|
||||
* @param start is 1 to start and 0 to stop acquisition
|
||||
*/
|
||||
* @param start is 1 to start and 0 to stop acquisition */
|
||||
void StartDaq(bool start);
|
||||
|
||||
/** To set the reference to zero after closing a clone
|
||||
* @param id is the id of the clone
|
||||
*/
|
||||
* @param id is the id of the clone */
|
||||
void CloneCloseEvent(int id);
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
void UpdatingPlotFinished();
|
||||
void InterpolateSignal(bool);
|
||||
void ContourSignal(bool);
|
||||
void LogzSignal(bool);
|
||||
|
||||
|
||||
void SetZRangeSignal(double,double);
|
||||
void EnableZRangeSignal(bool);
|
||||
|
||||
};
|
||||
|
||||
|
@ -59,9 +59,6 @@ private:
|
||||
/** Sets up all the slots and signals */
|
||||
void Initialization();
|
||||
|
||||
/** Enables/Disables all the widgets */
|
||||
void Enable(bool enable);
|
||||
|
||||
|
||||
private slots:
|
||||
/** To Expand the Action Widget */
|
||||
|
@ -43,9 +43,6 @@ private:
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** Enables/Disables all the widgets
|
||||
*/
|
||||
void Enable(bool enable);
|
||||
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,7 @@ private:
|
||||
/** The Plot widget */
|
||||
qDrawPlot *myPlot;
|
||||
|
||||
enum{None, Auto, Gated, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated_Start, Trigger_Window, NumTimingModes};
|
||||
enum{None, Auto, Trigger_Exp_Series, Trigger_Frame, Trigger_Readout, Gated, Gated_Start, Trigger_Window, NumTimingModes};
|
||||
|
||||
QTimer *progressTimer;
|
||||
|
||||
|
@ -87,16 +87,20 @@ void SetTitles();
|
||||
void EnableTitles();
|
||||
/** Enables range of the axes */
|
||||
void EnableRange();
|
||||
/** Sets the range of the axes */
|
||||
/** Sets the range of the x and y axes */
|
||||
void SetAxesRange();
|
||||
|
||||
/** Sets the range of the z axis */
|
||||
void SetZRange();
|
||||
/** Enables the range of the z axis */
|
||||
void EnableZRange();
|
||||
/** Save Plot */
|
||||
void SavePlot();
|
||||
|
||||
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
|
||||
void SetZRangeSignal(double,double);
|
||||
void EnableZRangeSignal(bool);
|
||||
};
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ OBJECTS_DIR = objs
|
||||
UI_HEADERS_DIR = forms/include
|
||||
|
||||
DEFINES += VERBOSE
|
||||
|
||||
|
||||
target.path += $(DESTDIR)
|
||||
documentation.path = /$(DOCPATH)
|
||||
|
@ -2,7 +2,13 @@
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
* Modifications:
|
||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
|
||||
* without using mouse control:
|
||||
* DisableZoom,
|
||||
* SetXMinMax,SetYMinMax,
|
||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||
* */
|
||||
|
||||
#ifndef SLSQT1DPLOT_H
|
||||
#define SLSQT1DPLOT_H
|
||||
@ -12,6 +18,8 @@
|
||||
#include <qwt_plot_marker.h>
|
||||
#include <qwt_scale_div.h>
|
||||
#include "SlsQt1DZoomer.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class QPen;
|
||||
class SlsQt1DPlot;
|
||||
@ -104,14 +112,18 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void InsertVLine(double v);
|
||||
void RemoveVLine();
|
||||
|
||||
void DisableZoom(bool disableZoom);
|
||||
|
||||
void SetXAxisScale(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYAxisScale(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXAxisLowerBound(){return axisScaleDiv(QwtPlot::xBottom)->lowerBound();};
|
||||
double GetXAxisUpperBound(){return axisScaleDiv(QwtPlot::xBottom)->upperBound();};
|
||||
double GetYAxisLowerBound(){return axisScaleDiv(QwtPlot::yLeft)->lowerBound();};
|
||||
double GetYAxisUpperBound(){return axisScaleDiv(QwtPlot::yLeft)->upperBound(); };
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||
use zooming functionality without mouse control*/
|
||||
void DisableZoom(bool disableZoom);
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist_list->Hist()->GetXMin();};
|
||||
double GetXMaximum(){return hist_list->Hist()->GetXMax();};
|
||||
double GetYMinimum(){return hist_list->Hist()->GetYMin();};
|
||||
double GetYMaximum(){return hist_list->Hist()->GetYMax();};
|
||||
/**---*/
|
||||
|
||||
|
||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
||||
|
@ -2,6 +2,12 @@
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* Modifications:
|
||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
|
||||
* without using mouse control:
|
||||
* DisableZoom,
|
||||
* SetXMinMax,SetYMinMax,
|
||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||
*/
|
||||
|
||||
|
||||
@ -43,10 +49,22 @@ public:
|
||||
SlsQt2DPlot(QWidget * = NULL);
|
||||
|
||||
// SlsQt2DHist *GetHistogram(){ return hist; }
|
||||
|
||||
void UnZoom();
|
||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||
|
||||
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||
use zooming functionality without mouse control*/
|
||||
void DisableZoom(bool disableZoom);
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist->GetXMin();};
|
||||
double GetXMaximum(){return hist->GetXMax();};
|
||||
double GetYMinimum(){return hist->GetYMin();};
|
||||
double GetYMaximum(){return hist->GetYMax();};
|
||||
/**---*/
|
||||
|
||||
|
||||
double GetZMinimum(){ return hist->GetMinimum();}
|
||||
double GetZMaximum(){ return hist->GetMaximum();}
|
||||
void SetZMinMax(double zmin=0,double zmax=-1);
|
||||
|
@ -1,6 +1,10 @@
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* @comments
|
||||
* 19.06.2012 All modifications with the Ian flag has been made since
|
||||
* z_range_ne and the buttons are defined in another class.
|
||||
* Logz button and z_range_ne have wrappers to connect them
|
||||
*/
|
||||
|
||||
|
||||
@ -15,7 +19,7 @@
|
||||
|
||||
class QGridLayout;
|
||||
class QString;
|
||||
|
||||
class QToolButton;
|
||||
|
||||
|
||||
class SlsQt2DPlotLayout: public QGroupBox{
|
||||
@ -26,33 +30,42 @@ public:
|
||||
SlsQt2DPlotLayout(QWidget * = NULL);
|
||||
~SlsQt2DPlotLayout();
|
||||
|
||||
SlsQt2DPlot* GetPlot() {return the_plot;}
|
||||
SlsQt2DPlot* GetPlot(){return the_plot;}
|
||||
void SetXTitle(QString st);
|
||||
void SetYTitle(QString st);
|
||||
void SetZTitle(QString st);
|
||||
void UpdateNKeepSetRangeIfSet();
|
||||
|
||||
void UpdateNKeepSetRangeIfSet();
|
||||
|
||||
private:
|
||||
QGridLayout* the_layout;
|
||||
SlsQt2DPlot* the_plot;
|
||||
QGridLayout* the_layout;
|
||||
QToolButton* btnInterpolate;
|
||||
QToolButton* btnContour;
|
||||
QToolButton* btnLogz;
|
||||
SlsQt2DPlot* the_plot;
|
||||
SlsQtNumberEntry* z_range_ne;
|
||||
|
||||
SlsQtNumberEntry* z_range_ne;
|
||||
|
||||
bool logsChecked;
|
||||
#ifndef IAN
|
||||
bool zRangeChecked;
|
||||
#endif
|
||||
|
||||
void CreateTheButtons();
|
||||
void ConnectSignalsAndSlots();
|
||||
|
||||
void Layout();
|
||||
|
||||
public slots:
|
||||
void SetZScaleToLog(bool yes);
|
||||
void ResetRange();
|
||||
void SetTitle(QString st);
|
||||
|
||||
#ifndef IAN
|
||||
void SetZRange(double,double);
|
||||
void EnableZRange(bool enable);
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void InterpolateSignal(bool);
|
||||
void ContourSignal(bool);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -457,6 +457,8 @@ void SlsQt1DPlot::UnknownStuff(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||
void SlsQt1DPlot::DisableZoom(bool disableZoom){
|
||||
#ifdef VERBOSE
|
||||
if(disableZoom) cout<<"Disabling zoom"<<endl;
|
||||
|
@ -72,7 +72,6 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl
|
||||
ny=nbinsy;
|
||||
nb=nx*ny;
|
||||
data[nb]=0;//set over flow to zero
|
||||
|
||||
if(d){
|
||||
memcpy(data,d,nb*sizeof(double));
|
||||
SetMinMax(zmin,zmax);
|
||||
|
@ -129,8 +129,14 @@ void SlsQt2DPlot::SetupZoom(){
|
||||
zoomer->setTrackerPen(c);
|
||||
}
|
||||
|
||||
/*void SlsQt2DPlot::CompletelyUnZoom(){
|
||||
setAxisScale(QwtPlot::xBottom,hist->GetXMin(),hist->GetXMin()+(hist->GetXMax()-hist->GetXMin()));
|
||||
setAxisScale(QwtPlot::yLeft,hist->GetYMin(),hist->GetYMin()+(hist->GetYMax()-hist->GetYMin()));
|
||||
zoomer->setZoomBase();
|
||||
//replot();
|
||||
}*/
|
||||
|
||||
void SlsQt2DPlot::UnZoom(){
|
||||
|
||||
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(),hist->GetYMin(),hist->GetXMax()-hist->GetXMin(),hist->GetYMax()-hist->GetYMin()));
|
||||
|
||||
zoomer->setZoomBase();//Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
@ -147,7 +153,7 @@ void SlsQt2DPlot::SetZMinMax(double zmin,double zmax){
|
||||
|
||||
|
||||
void SlsQt2DPlot::Update(){
|
||||
rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap());
|
||||
rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap());
|
||||
if(!zoomer->zoomRectIndex()) UnZoom();
|
||||
setAxisScale(QwtPlot::yRight,d_spectrogram->data().range().minValue(),
|
||||
d_spectrogram->data().range().maxValue());
|
||||
@ -190,6 +196,36 @@ void SlsQt2DPlot::LogZ(bool on){
|
||||
|
||||
}
|
||||
|
||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||
void SlsQt2DPlot::DisableZoom(bool disableZoom){
|
||||
#ifdef VERBOSE
|
||||
if(disableZoom) cout<<"Disabling zoom"<<endl;
|
||||
else cout<<"Enabling zoom"<<endl;
|
||||
#endif
|
||||
if(disableZoom){
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::NoButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::NoButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::NoButton);
|
||||
}else {
|
||||
if(zoomer){
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,Qt::LeftButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
|
||||
}
|
||||
if(panner) panner->setMouseButton(Qt::MidButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include <qtoolbutton.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qgridlayout.h>
|
||||
#include <qlabel.h>
|
||||
@ -17,96 +17,180 @@
|
||||
using namespace std;
|
||||
|
||||
SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
||||
the_layout=0;
|
||||
the_plot = new SlsQt2DPlot(this);
|
||||
the_layout=0;
|
||||
the_plot = new SlsQt2DPlot(this);
|
||||
|
||||
z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2);
|
||||
// z_range_ne->SetNDecimalsOfDoubleValidators(2);
|
||||
z_range_ne->setFixedWidth(402);
|
||||
z_range_ne->hide();
|
||||
z_range_ne = new SlsQtNumberEntry(this,1,"Set the z axis range from",2,"to",2);
|
||||
z_range_ne->setFixedWidth(402);
|
||||
#ifndef IAN
|
||||
zRangeChecked = false;
|
||||
z_range_ne->hide();
|
||||
#endif
|
||||
|
||||
logsChecked = false;
|
||||
|
||||
Layout();
|
||||
ConnectSignalsAndSlots();
|
||||
CreateTheButtons();
|
||||
Layout();
|
||||
ConnectSignalsAndSlots();
|
||||
}
|
||||
|
||||
SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
||||
|
||||
if(the_layout) delete the_layout;
|
||||
if(the_layout) delete the_layout;
|
||||
|
||||
|
||||
delete the_plot;
|
||||
delete z_range_ne;
|
||||
delete the_plot;
|
||||
delete z_range_ne;
|
||||
}
|
||||
|
||||
|
||||
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->setText("Log Scale (Z)");
|
||||
btnLogz->setCheckable(true);
|
||||
btnLogz->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
#ifndef IAN
|
||||
btnLogz->hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::Layout(){
|
||||
if(the_layout) delete the_layout;
|
||||
the_layout = new QGridLayout(this);
|
||||
the_layout->addWidget(the_plot,2,1,3,3);
|
||||
the_layout->addWidget(z_range_ne,5,1,1,3);
|
||||
if(the_layout) delete the_layout;
|
||||
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);
|
||||
#endif
|
||||
the_layout->addWidget(the_plot,2,1,3,3);
|
||||
the_layout->addWidget(z_range_ne,5,1,1,3);
|
||||
#ifdef IAN
|
||||
the_layout->setMargin(12);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
||||
#ifndef IAN
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)), the_plot, SLOT(InterpolatedPlot(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), the_plot, SLOT(showContour(bool)));
|
||||
connect(z_range_ne, SIGNAL(CheckBoxChanged(bool)), this, SLOT(ResetRange()));
|
||||
connect(z_range_ne, SIGNAL(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange()));
|
||||
|
||||
#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(AValueChanged(SlsQtNumberEntry*)), this, SLOT(ResetRange()));
|
||||
btnLogz->setChecked(false);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::UpdateNKeepSetRangeIfSet(){
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
//just reset histogram range before update
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
}
|
||||
|
||||
the_plot->Update();
|
||||
#ifdef IAN
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
#else
|
||||
if(zRangeChecked){
|
||||
#endif
|
||||
//just reset histogram range before update
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
}
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::ResetRange(){
|
||||
//refind z limits
|
||||
the_plot->SetZMinMax();
|
||||
if(logsChecked) the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
//refind z limits
|
||||
the_plot->SetZMinMax();
|
||||
if(btnLogz->isChecked()) the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
#ifdef IAN
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
#else
|
||||
if(zRangeChecked){cout<<"entering:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
#endif
|
||||
//first time check validity
|
||||
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);cout<<"isok 0:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
if(!z_range_ne->IsValueOk(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);cout<<"isok1:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0); cout<<"setrange:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1); cout<<"setrange:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
|
||||
if(z_range_ne->CheckBoxState()){
|
||||
//first time check validity
|
||||
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(1)||same) z_range_ne->SetValue(the_plot->GetZMaximum(),1);
|
||||
|
||||
z_range_ne->SetRange(the_plot->GetZMinimum(),z_range_ne->GetValue(1),0);
|
||||
z_range_ne->SetRange(z_range_ne->GetValue(0),the_plot->GetZMaximum(),1);
|
||||
|
||||
//set histogram range
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1));
|
||||
}
|
||||
|
||||
the_plot->Update();
|
||||
//set histogram range
|
||||
the_plot->SetZMinMax(z_range_ne->GetValue(0),z_range_ne->GetValue(1)); cout<<"setminmax:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
}
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetZScaleToLog(bool yes){
|
||||
logsChecked=yes;
|
||||
the_plot->LogZ(yes);
|
||||
ResetRange();
|
||||
#ifndef IAN
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting ZScale to log:"<<yes<<endl;
|
||||
#endif
|
||||
btnLogz->setChecked(yes);
|
||||
#endif
|
||||
the_plot->LogZ(yes);
|
||||
ResetRange();
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetXTitle(QString st){
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetYTitle(QString st){
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
|
||||
#ifndef IAN
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
|
||||
#else
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(st);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetTitle(QString st){
|
||||
setTitle(st);
|
||||
|
||||
#ifndef IAN
|
||||
void SlsQt2DPlotLayout::SetZRange(double zmin, double zmax){
|
||||
#ifdef VERBOSE
|
||||
cout<<"zmin:"<<zmin<<"\tzmax:"<<zmax<<endl;
|
||||
#endif
|
||||
z_range_ne->SetNumber(zmin,0);
|
||||
z_range_ne->SetNumber(zmax,1);
|
||||
cout<<"\n\nthe valuessssssssssssssss:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
ResetRange();
|
||||
cout<<"finaaaal valueeeeeeees:"<<z_range_ne->GetValue(0)<<"\t"<<z_range_ne->GetValue(1)<<endl;
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::EnableZRange(bool enable){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Z Range Enable to "<<enable<<endl;
|
||||
#endif
|
||||
zRangeChecked = enable;
|
||||
ResetRange();
|
||||
}
|
||||
#endif
|
||||
|
@ -253,7 +253,7 @@ double SlsQtNumberEntry::SetNumber(double v,int which_number_field){
|
||||
}
|
||||
if(validator_double[i]){
|
||||
QString s = QString::number(v);
|
||||
validator_double[i]->fixup(s);
|
||||
validator_double[i]->fixup(s);
|
||||
num_field[i]->setText(s);
|
||||
}
|
||||
}else if(spin_box[i]){
|
||||
@ -267,7 +267,7 @@ double SlsQtNumberEntry::SetNumber(double v,int which_number_field){
|
||||
void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
if(min>max){
|
||||
cout<<"Waring: SetRange(int,int) no effect min > max"<<endl;
|
||||
cout<<"Warning: SetRange(int,int) no effect min > max"<<endl;
|
||||
}else{
|
||||
if(validator_int[i]) validator_int[i]->setRange(min,max);
|
||||
if(validator_double[i]) validator_double[i]->setRange(min,max,validator_double[i]->decimals());
|
||||
@ -280,7 +280,7 @@ void SlsQtNumberEntry::SetRange(int min, int max,int which_number_field){
|
||||
void SlsQtNumberEntry::SetRange(double min, double max,int which_number_field){
|
||||
int i = (which_number_field<0||which_number_field>1) ? 0:which_number_field;
|
||||
if(min>max){
|
||||
cout<<"Waring: SetRange(double,double) no effect min >= max"<<endl;
|
||||
cout<<"Warning: SetRange(double,double) no effect min >= max"<<endl;
|
||||
}else{
|
||||
if(validator_int[i]) cout<<"Waring can not call SetRange(double,double) with \"int\" type Validator"<<endl;
|
||||
if(validator_double[i]) validator_double[i]->setRange(min,max,validator_double[i]->decimals());
|
||||
|
@ -27,7 +27,7 @@ int main (int argc, char **argv) {
|
||||
QApplication *theApp = new QApplication(argc, argv);
|
||||
qDetectorMain *det=new qDetectorMain(argc, argv, theApp,0);
|
||||
det->show();
|
||||
theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit()));
|
||||
//theApp->connect( theApp, SIGNAL(lastWindowClosed()), theApp, SLOT(quit()));
|
||||
return theApp->exec();
|
||||
}
|
||||
|
||||
@ -355,6 +355,7 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){
|
||||
centralwidget->setMaximumHeight(heightCentralWidget);
|
||||
}
|
||||
}
|
||||
event->accept();
|
||||
#ifdef VERBOSE
|
||||
cout<<"height:"<<height()<<endl;
|
||||
cout<<"dockWidgetPlot height:"<<dockWidgetPlot->height()<<endl;
|
||||
|
@ -7,7 +7,6 @@
|
||||
/** Qt Project Class Headers */
|
||||
#include "qDrawPlot.h"
|
||||
#include "qCloneWidget.h"
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
/** Project Class Headers */
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
@ -35,18 +34,23 @@ int qDrawPlot::number_of_exposures;
|
||||
//double acquisitionTime;
|
||||
pthread_mutex_t qDrawPlot::last_image_complete_mutex;
|
||||
//std::string imageTitle;
|
||||
std::string qDrawPlot::histTitle[MAX_1DPLOTS];
|
||||
|
||||
unsigned int qDrawPlot::plot_in_scope;
|
||||
unsigned int qDrawPlot::nPixelsX;
|
||||
unsigned int qDrawPlot::nPixelsY;
|
||||
unsigned int qDrawPlot::lastImageNumber;
|
||||
|
||||
string qDrawPlot::histTitle[MAX_1DPLOTS];
|
||||
unsigned int qDrawPlot::nHists;
|
||||
int qDrawPlot::histNBins;
|
||||
double* qDrawPlot::histXAxis;
|
||||
double* qDrawPlot::histYAxis[MAX_1DPLOTS];
|
||||
double* qDrawPlot::lastImageArray;
|
||||
double* qDrawPlot::yvalues[MAX_1DPLOTS];
|
||||
double* qDrawPlot::histYAxis[MAX_1DPLOTS];
|
||||
|
||||
string qDrawPlot::imageTitle;
|
||||
double* qDrawPlot::lastImageArray;
|
||||
double* qDrawPlot::image_data;
|
||||
|
||||
bool qDrawPlot::gui_acquisition_thread_running;
|
||||
int qDrawPlot::persistency;
|
||||
int qDrawPlot::currentPersistency;
|
||||
@ -160,9 +164,13 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
|
||||
|
||||
void qDrawPlot::Initialization(){
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)), plot2D, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
|
||||
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
|
||||
connect(this, SIGNAL(InterpolateSignal(bool)),plot2D, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
|
||||
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
|
||||
connect(this, SIGNAL(EnableZRangeSignal(bool)),plot2D, SLOT(EnableZRange(bool)));
|
||||
|
||||
connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -226,7 +234,6 @@ int qDrawPlot::ResetDaqForGui(){
|
||||
|
||||
bool qDrawPlot::StartOrStopThread(bool start){
|
||||
static pthread_t gui_acquisition_thread;
|
||||
static pthread_t gui_start_acquire_thread;
|
||||
static pthread_mutex_t gui_acquisition_start_stop_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
pthread_mutex_lock(&gui_acquisition_start_stop_mutex);
|
||||
@ -235,7 +242,7 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
cout<<"Stopping current acquisition thread ...."<<endl;
|
||||
stop_signal = 1;
|
||||
myDet->stopAcquisition();
|
||||
//pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits
|
||||
pthread_join(gui_acquisition_thread,NULL); //wait until he's finished, ie. exits
|
||||
gui_acquisition_thread_running = 0;
|
||||
}
|
||||
|
||||
@ -253,12 +260,13 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
if(!histYAxis[0]) histYAxis[0] = new double [nPixelsX];
|
||||
|
||||
|
||||
Clear1DPlot();
|
||||
if(plot_in_scope==1) Clear1DPlot();
|
||||
cout<<"Starting new acquisition thread ...."<<endl;
|
||||
/** Setting the callback function to get data from software client*/
|
||||
myDet->registerDataCallback(&(GetDataCallBack));
|
||||
/** Start acquiring data from server */
|
||||
pthread_create(&gui_start_acquire_thread, NULL,DataStartAcquireThread, (void*) this);
|
||||
pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this);
|
||||
/** This is later reset to zero when all the plotting is done */
|
||||
gui_acquisition_thread_running=1;
|
||||
cout<<"Started acquiring"<<endl;
|
||||
}
|
||||
@ -267,6 +275,7 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void* qDrawPlot::DataStartAcquireThread(void *this_pointer){
|
||||
((qDrawPlot*)this_pointer)->myDet->acquire(1);
|
||||
return this_pointer;
|
||||
@ -274,6 +283,7 @@ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){
|
||||
|
||||
|
||||
|
||||
|
||||
int qDrawPlot::GetDataCallBack(detectorData *data){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Entering GetDataCallBack function"<<endl;
|
||||
@ -286,45 +296,54 @@ int qDrawPlot::GetDataCallBack(detectorData *data){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Persistency */
|
||||
if(currentPersistency < persistency)currentPersistency++;
|
||||
else currentPersistency=persistency;
|
||||
for(int i=currentPersistency;i>0;i--)
|
||||
memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double));
|
||||
nHists = currentPersistency+1;
|
||||
/** Get data from client */
|
||||
memcpy(yvalues[0],data->values,nPixelsX*sizeof(double));
|
||||
|
||||
/** Get data from client */
|
||||
/**1d*/
|
||||
// if(plot_in_scope==1){
|
||||
if(plot_in_scope==1){
|
||||
/** Persistency */
|
||||
if(currentPersistency < persistency)currentPersistency++;
|
||||
else currentPersistency=persistency;
|
||||
for(int i=currentPersistency;i>0;i--)
|
||||
memcpy(yvalues[i],yvalues[i-1],nPixelsX*sizeof(double));
|
||||
nHists = currentPersistency+1;
|
||||
memcpy(yvalues[0],data->values,nPixelsX*sizeof(double));
|
||||
}
|
||||
/**2d*/
|
||||
else{
|
||||
for(unsigned int px=0;px<nPixelsX;px++)
|
||||
for(unsigned int py=0;py<nPixelsY;py++)
|
||||
image_data[py*nPixelsX+px] = sqrt(pow(currentFrame+1,2)*pow(double(px)-nPixelsX/2,2)/pow(nPixelsX/2,2)/pow(number_of_exposures+1,2) + pow(double(py)-nPixelsY/2,2)/pow(nPixelsY/2,2))/sqrt(2);
|
||||
}
|
||||
|
||||
|
||||
if((currentFrame)<(number_of_exposures)){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Reading in image: "<<currentFrame+1<<endl;
|
||||
#endif
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
char temp_title[2000];
|
||||
/** only if you got the lock, do u need to remember lastimagenumber to plot*/
|
||||
lastImageNumber= currentFrame+1;
|
||||
/** Titles*/
|
||||
stringstream s;
|
||||
s<<"Frame "<<currentFrame;
|
||||
histTitle[0]=s.str();
|
||||
/** copy data*/
|
||||
|
||||
//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double));
|
||||
for(int i=currentPersistency;i>0;i--)
|
||||
memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
|
||||
memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double));
|
||||
/**1d*/
|
||||
if(plot_in_scope==1){
|
||||
/** Titles*/
|
||||
sprintf(temp_title,"Frame %d",currentFrame); histTitle[0] = temp_title;
|
||||
/** copy data*/
|
||||
//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double));
|
||||
for(int i=currentPersistency;i>0;i--)
|
||||
memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
|
||||
memcpy(histYAxis[0],yvalues[0],nPixelsX*sizeof(double));
|
||||
}
|
||||
/**2d*/
|
||||
else{
|
||||
sprintf(temp_title,"Image Number %d",currentFrame); imageTitle = temp_title;
|
||||
memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double));
|
||||
}
|
||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||
}
|
||||
|
||||
currentFrame++;
|
||||
}
|
||||
//}
|
||||
///**2d*/
|
||||
//else{
|
||||
// ;
|
||||
//}
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Exiting GetDataCallBack function"<<endl;
|
||||
#endif
|
||||
@ -332,15 +351,6 @@ int qDrawPlot::GetDataCallBack(detectorData *data){
|
||||
}
|
||||
|
||||
|
||||
void qDrawPlot::SetPersistency(int val){
|
||||
for(int i=0;i<=val;i++){
|
||||
if(!yvalues[i]) yvalues[i] = new double [nPixelsX];
|
||||
if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX];
|
||||
}
|
||||
persistency = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::setNumMeasurements(int num){
|
||||
numberOfMeasurements = num;
|
||||
@ -380,7 +390,6 @@ void qDrawPlot::Clear1DPlot(){
|
||||
|
||||
|
||||
void qDrawPlot::UpdatePlot(){
|
||||
//emit UpdatingPlot();
|
||||
static int last_plot_number = 0;
|
||||
|
||||
plot_update_timer->stop();
|
||||
@ -395,7 +404,7 @@ void qDrawPlot::UpdatePlot(){
|
||||
Clear1DPlot();
|
||||
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
||||
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
|
||||
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||
for(int hist_num=0;hist_num<(int)nHists;hist_num++){
|
||||
SlsQtH1D* h;
|
||||
if(hist_num+1>plot1D_hists.size()){
|
||||
plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num)));
|
||||
@ -408,16 +417,12 @@ void qDrawPlot::UpdatePlot(){
|
||||
h->Attach(plot1D);
|
||||
|
||||
}
|
||||
//plot1D->UnZoom();
|
||||
//if(first){plot1D->UnZoom();first = !first;}
|
||||
//plot1D->SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//2-d plot stuff
|
||||
if(lastImageArray){
|
||||
if(lastImageNumber&&last_plot_number!=lastImageNumber && //there is a new plot
|
||||
if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot
|
||||
nPixelsX>0&&nPixelsY>0){
|
||||
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
|
||||
//as it inherits a widget
|
||||
@ -532,6 +537,17 @@ void qDrawPlot::SavePlot(QString FName){
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::SetPersistency(int val){
|
||||
for(int i=0;i<=val;i++){
|
||||
if(!yvalues[i]) yvalues[i] = new double [nPixelsX];
|
||||
if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX];
|
||||
}
|
||||
persistency = val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qDrawPlot::EnablePlot(bool enable){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Plotting set to:"<<enable<<endl;
|
||||
@ -547,6 +563,6 @@ void qDrawPlot::EnablePlot(bool enable){
|
||||
void qDrawPlot::DisableZoom(bool disable){
|
||||
if(plot_in_scope==1)
|
||||
plot1D->DisableZoom(disable);
|
||||
///disable zoom
|
||||
|
||||
else
|
||||
plot2D->GetPlot()->DisableZoom(disable);
|
||||
}
|
||||
|
@ -102,14 +102,6 @@ void qTabActions::Initialization(){
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabActions::Enable(bool enable){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabActions::Expand(QAbstractButton *button ){
|
||||
int index = group->id(button);
|
||||
/** Collapse */
|
||||
|
@ -47,9 +47,3 @@ void qTabDeveloper::Initialization(){
|
||||
|
||||
|
||||
|
||||
void qTabDeveloper::Enable(bool enable){
|
||||
//this->setEnabled(enable);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,32 +76,29 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
|
||||
switch(myDet->getDetectorsType()){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
item[(int)Gated]->setEnabled(true);
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Frame]->setEnabled(false);
|
||||
item[(int)Trigger_Readout]->setEnabled(true);
|
||||
item[(int)Gated]->setEnabled(true);
|
||||
item[(int)Gated_Start]->setEnabled(true);
|
||||
item[(int)Trigger_Window]->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)Gated]->setEnabled(false);
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Frame]->setEnabled(true);
|
||||
item[(int)Trigger_Readout]->setEnabled(false);
|
||||
item[(int)Gated]->setEnabled(false);
|
||||
item[(int)Gated_Start]->setEnabled(false);
|
||||
item[(int)Trigger_Window]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
item[(int)Gated]->setEnabled(false);
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
item[(int)Trigger_Frame]->setEnabled(false);
|
||||
item[(int)Trigger_Readout]->setEnabled(false);
|
||||
item[(int)Gated]->setEnabled(false);
|
||||
item[(int)Gated_Start]->setEnabled(false);
|
||||
item[(int)Trigger_Window]->setEnabled(false);
|
||||
break;
|
||||
/* case slsDetectorDefs::PICASSO:
|
||||
case slsDetectorDefs::PILATUS:
|
||||
case slsDetectorDefs::AGIPD:*/
|
||||
default:
|
||||
cout<<"ERROR: Detector Type is Generic"<<endl;
|
||||
exit(-1);
|
||||
@ -190,19 +187,6 @@ void qTabMeasurement::Enable(bool enable){
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::UpdateFinished(){
|
||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
btnStartStop->setText("Start");
|
||||
//btnStartStop->setStyleSheet("color:green");
|
||||
//btnStartStop->setStyleSheet("background:rgb(239,239,239)");
|
||||
Enable(1);
|
||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
UpdateProgress();
|
||||
progressTimer->stop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::setFileName(const QString& fName){
|
||||
myDet->setFileName(fName.toAscii().data());
|
||||
#ifdef VERBOSE
|
||||
@ -252,6 +236,29 @@ void qTabMeasurement::startStopAcquisition(){
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::UpdateFinished(){
|
||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
btnStartStop->setText("Start");
|
||||
//btnStartStop->setStyleSheet("color:green");
|
||||
//btnStartStop->setStyleSheet("background:rgb(239,239,239)");
|
||||
Enable(1);
|
||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||
UpdateProgress();
|
||||
progressTimer->stop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::UpdateProgress(){
|
||||
progressBar->setValue(myPlot->GetProgress());
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::setNumFrames(int val){
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val);
|
||||
#ifdef VERBOSE
|
||||
@ -263,8 +270,8 @@ void qTabMeasurement::setNumFrames(int val){
|
||||
|
||||
void qTabMeasurement::setExposureTime(){
|
||||
int64_t exptimeNS;
|
||||
/** Get the 64 bit value of timer**/
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
/** Get the value of timer in ns **/
|
||||
exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting acquisition time to " << exptimeNS << " clocks" << endl;
|
||||
#endif
|
||||
@ -272,7 +279,7 @@ void qTabMeasurement::setExposureTime(){
|
||||
|
||||
if(lblPeriod->isEnabled()){
|
||||
int64_t acqtimeNS;
|
||||
acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
if(exptimeNS>acqtimeNS) {
|
||||
lblNote->show();
|
||||
lblPeriod->setPalette(lblNote->palette());
|
||||
@ -290,15 +297,15 @@ void qTabMeasurement::setExposureTime(){
|
||||
|
||||
void qTabMeasurement::setAcquisitionPeriod(){
|
||||
int64_t acqtimeNS;
|
||||
/** Get the 64 bit value of timer**/
|
||||
acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
/** Get the value of timer in ns **/
|
||||
acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks" << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,acqtimeNS);
|
||||
|
||||
int64_t exptimeNS;
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
if(exptimeNS>acqtimeNS){
|
||||
lblNote->show();
|
||||
lblPeriod->setPalette(lblNote->palette());
|
||||
@ -327,8 +334,8 @@ void qTabMeasurement::setNumTriggers(int val){
|
||||
|
||||
void qTabMeasurement::setDelay(){
|
||||
int64_t exptimeNS;
|
||||
/** Get the 64 bit value of timer**/
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value());
|
||||
/** Get the value of timer in ns **/
|
||||
exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting delay after trigger to " << exptimeNS << " clocks" << endl;
|
||||
#endif
|
||||
@ -356,13 +363,6 @@ void qTabMeasurement::setNumProbes(int val){
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::UpdateProgress(){
|
||||
progressBar->setValue(myPlot->GetProgress());
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabMeasurement::setTimingMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
@ -381,43 +381,43 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
|
||||
|
||||
switch(mode){
|
||||
case None:
|
||||
case None:/** Exposure Time */
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
break;
|
||||
case Auto:
|
||||
case Auto:/** Number of Frames, Exposure Time, Acquisition Period */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
break;
|
||||
case Gated:
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
break;
|
||||
case Trigger_Exp_Series:
|
||||
case Trigger_Exp_Series:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
|
||||
break;
|
||||
case Trigger_Readout:
|
||||
case Trigger_Frame:/** Exposure Time, Number of Triggers */
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
break;
|
||||
case Trigger_Readout:/** Number of Frames, Exposure Time, Acquisition Period, Delay */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
lblDelay->setEnabled(true); spinDelay->setEnabled(true); comboDelayUnit->setEnabled(true);
|
||||
break;
|
||||
case Gated_Start:
|
||||
case Gated:/** Number of Frames, Number of Gates */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
break;
|
||||
case Gated_Start:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates */
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
break;
|
||||
case Trigger_Frame:
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
break;
|
||||
case Trigger_Window:
|
||||
case Trigger_Window:/** Number of Triggers */
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
@ -425,7 +425,7 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if(mode!=None){
|
||||
if(mode!=None){/** Number of Probes */
|
||||
if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){
|
||||
lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true);
|
||||
}
|
||||
@ -466,8 +466,8 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
comboPeriodUnit->setCurrentIndex(qDefs::SECONDS);
|
||||
|
||||
int64_t exptimeNS,acqtimeNS;
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
exptimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
acqtimeNS = (int64_t)qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
if(exptimeNS>acqtimeNS) {
|
||||
lblNote->show();
|
||||
lblPeriod->setPalette(lblNote->palette());
|
||||
|
@ -30,14 +30,17 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent,slsDetectorUtils*& detector, qDrawPlot*& plot):QWidget(parent),myDet(detector),myPlot(plot){
|
||||
setupUi(this);
|
||||
if(myDet)
|
||||
{
|
||||
// wherever you choose plot do all these steps
|
||||
//This also selects the text if unchecked
|
||||
//includes setupwidgetwindow
|
||||
//SelectPlot(1);
|
||||
//switch(myDet->detectorytype)
|
||||
Select1DPlot(true);
|
||||
if(myDet){
|
||||
SetupWidgetWindow();
|
||||
/** Depending on whether the detector is 1d or 2d*/
|
||||
switch(myDet->getDetectorsType()){
|
||||
case slsDetectorDefs::MYTHEN: Select1DPlot(true); break;
|
||||
case slsDetectorDefs::EIGER: Select1DPlot(false);break;
|
||||
case slsDetectorDefs::GOTTHARD: Select1DPlot(true);break;
|
||||
default:
|
||||
cout<<"ERROR: Detector Type is Generic"<<endl;
|
||||
exit(-1);
|
||||
}
|
||||
Initialization();
|
||||
}
|
||||
}
|
||||
@ -67,12 +70,12 @@ void qTabPlot::SetupWidgetWindow(){
|
||||
dispXMax->setEnabled(false);
|
||||
dispYMax->setEnabled(false);
|
||||
dispZMax->setEnabled(false);
|
||||
/* dispXMin->setValidator(new QDoubleValidator(dispXMin));
|
||||
dispXMin->setValidator(new QDoubleValidator(dispXMin));
|
||||
dispYMin->setValidator(new QDoubleValidator(dispYMin));
|
||||
dispZMin->setValidator(new QDoubleValidator(dispZMin));
|
||||
dispXMax->setValidator(new QDoubleValidator(dispXMax));
|
||||
dispYMax->setValidator(new QDoubleValidator(dispYMax));
|
||||
dispZMax->setValidator(new QDoubleValidator(dispZMax));*/
|
||||
dispZMax->setValidator(new QDoubleValidator(dispZMax));
|
||||
}
|
||||
|
||||
|
||||
@ -119,6 +122,8 @@ void qTabPlot::Initialization(){
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool)));
|
||||
|
||||
|
||||
/** Plot Axis **/
|
||||
connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
|
||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
|
||||
@ -133,15 +138,17 @@ void qTabPlot::Initialization(){
|
||||
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
||||
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
||||
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
||||
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableRange()));
|
||||
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
|
||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
|
||||
connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool)));
|
||||
|
||||
connect(dispXMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
|
||||
connect(dispXMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
|
||||
connect(dispYMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
|
||||
connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
|
||||
connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
|
||||
connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
|
||||
connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange()));
|
||||
connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange()));
|
||||
connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double)));
|
||||
|
||||
/** Common Buttons*/
|
||||
connect(btnClear, SIGNAL(clicked()), myPlot, SLOT(Clear1DPlot()));
|
||||
@ -169,7 +176,6 @@ void qTabPlot::EnablePersistency(bool enable){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabPlot::SetTitles(){
|
||||
int oneD = box1D->isEnabled();
|
||||
/** Plot Title*/
|
||||
@ -236,87 +242,60 @@ void qTabPlot::EnableTitles(){
|
||||
|
||||
void qTabPlot::EnableRange(){
|
||||
bool disableZoom = false;
|
||||
if(!chkXMin->isChecked()) {dispXMin->setText(""); dispXMin->setEnabled(false);}
|
||||
else {disableZoom = true; dispXMin->setEnabled(true); }
|
||||
if(!chkXMax->isChecked()) {dispXMax->setText(""); dispXMax->setEnabled(false);}
|
||||
else {disableZoom = true; dispXMax->setEnabled(true); }
|
||||
if(!chkYMin->isChecked()) {dispYMin->setText(""); dispYMin->setEnabled(false);}
|
||||
else {disableZoom = true; dispYMin->setEnabled(true); }
|
||||
if(!chkYMax->isChecked()) {dispYMax->setText(""); dispYMax->setEnabled(false);}
|
||||
else {disableZoom = true; dispYMax->setEnabled(true); }
|
||||
if(!chkZMin->isChecked()) {dispZMin->setText(""); dispZMin->setEnabled(false);}
|
||||
else {disableZoom = true; dispZMin->setEnabled(true); }
|
||||
if(!chkZMax->isChecked()) {dispZMax->setText(""); dispZMax->setEnabled(false);}
|
||||
else {disableZoom = true; dispZMax->setEnabled(true); }
|
||||
if(!chkXMin->isChecked()) dispXMin->setEnabled(false);
|
||||
else{disableZoom = true; dispXMin->setEnabled(true); }
|
||||
if(!chkXMax->isChecked()) dispXMax->setEnabled(false);
|
||||
else{disableZoom = true; dispXMax->setEnabled(true); }
|
||||
if(!chkYMin->isChecked()) dispYMin->setEnabled(false);
|
||||
else{disableZoom = true; dispYMin->setEnabled(true); }
|
||||
if(!chkYMax->isChecked()) dispYMax->setEnabled(false);
|
||||
else{disableZoom = true; dispYMax->setEnabled(true); }
|
||||
|
||||
myPlot->DisableZoom(disableZoom);
|
||||
emit DisableZoomSignal(disableZoom);
|
||||
SetAxesRange();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabPlot::SetAxesRange(){
|
||||
double xmin,xmax,ymin,ymax,zmin,zmax;
|
||||
int oneD = box1D->isEnabled();
|
||||
//should be filled for 2d as well
|
||||
if(!dispXMin->text().isEmpty()) xmin = dispXMin->text().toDouble();
|
||||
else { if(oneD) xmin = myPlot->GetHistXAxisLowerBound();}
|
||||
if(!dispXMax->text().isEmpty()) xmax = dispXMax->text().toDouble();
|
||||
else { if(oneD) xmax = myPlot->GetHistXAxisUpperBound();}
|
||||
if(!dispYMin->text().isEmpty()) ymin = dispYMin->text().toDouble();
|
||||
else { if(oneD) ymin = myPlot->GetHistYAxisLowerBound();}
|
||||
if(!dispYMax->text().isEmpty()) ymax = dispYMax->text().toDouble();
|
||||
else { if(oneD) ymax = myPlot->GetHistYAxisUpperBound();}
|
||||
if(!dispZMin->text().isEmpty()) zmin = dispZMin->text().toDouble();
|
||||
if(!dispZMax->text().isEmpty()) zmax = dispZMax->text().toDouble();
|
||||
//should be filled for 2d as well
|
||||
if(oneD){
|
||||
myPlot->SetHistXAxisScale(xmin,xmax);
|
||||
myPlot->SetHistYAxisScale(ymin,ymax);
|
||||
}
|
||||
double xmin=0,xmax=0,ymin=0,ymax=0;
|
||||
|
||||
/** If disabled, get the min or max range of the plot as default */
|
||||
if((dispXMin->isEnabled())&&(!dispXMin->text().isEmpty()))
|
||||
xmin = dispXMin->text().toDouble();
|
||||
else xmin = myPlot->GetXMinimum();
|
||||
if((dispXMax->isEnabled())&&(!dispXMax->text().isEmpty()))
|
||||
xmax = dispXMax->text().toDouble();
|
||||
else xmax = myPlot->GetXMaximum();
|
||||
if((dispYMin->isEnabled())&&(!dispYMin->text().isEmpty()))
|
||||
ymin = dispYMin->text().toDouble();
|
||||
else ymin = myPlot->GetYMinimum();
|
||||
if((dispYMax->isEnabled())&&(!dispYMax->text().isEmpty()))
|
||||
ymax = dispYMax->text().toDouble();
|
||||
else ymax = myPlot->GetYMaximum();
|
||||
|
||||
/** Setting the range*/
|
||||
myPlot->SetXMinMax(xmin,xmax);
|
||||
myPlot->SetYMinMax(ymin,ymax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabPlot::SetZRange(){
|
||||
emit SetZRangeSignal(dispZMin->text().toDouble(),dispZMax->text().toDouble());
|
||||
}
|
||||
|
||||
void qTabPlot::EnableZRange(){
|
||||
dispZMin->setEnabled(chkZMin->isChecked());
|
||||
dispZMax->setEnabled(chkZMax->isChecked());
|
||||
emit EnableZRangeSignal((chkZMin->isChecked())||(chkZMax->isChecked()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabPlot::SavePlot(){
|
||||
QString fullFileName = QString(myDet->getFilePath().c_str())+'/'+dispFName->text()+comboFormat->currentText();
|
||||
myPlot->SavePlot(fullFileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//dispzmin... when unchecked, unzoom and get lower and upper bound... when checked just set lower and upper bound
|
||||
|
||||
/*
|
||||
|
||||
#include "SlsQtValidators.h"
|
||||
|
||||
class QDoubleValidator;
|
||||
SlsQtDoubleValidator* validator_double[2];
|
||||
|
||||
|
||||
|
||||
|
||||
validator_double = new SlsQtDoubleValidator(num_field);
|
||||
num_field->setValidator(validator_double);
|
||||
//default settings
|
||||
validator_double->setDecimals(3);
|
||||
double v= num_field->text().toDouble(ok););
|
||||
is ok 1? for correct conversion
|
||||
|
||||
QString s = QString::number(v);
|
||||
validator_double->fixup(s);
|
||||
num_field->setText(s);
|
||||
|
||||
|
||||
num_field[i]->setAlignment(Qt::AlignRight);
|
||||
|
||||
|
||||
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered()));
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user