mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 04:29:22 +01:00
interval between plots work
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@18 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@@ -57,8 +57,8 @@ public:
|
||||
* @param value time
|
||||
* returns time value in ns
|
||||
*/
|
||||
static float getNSTime(timeUnit unit, float value){
|
||||
float valueNS=value;
|
||||
static double getNSTime(timeUnit unit, double value){
|
||||
double valueNS=value;
|
||||
switch(unit){
|
||||
case HOURS: valueNS*=60;
|
||||
case MINUTES: valueNS*=60;
|
||||
@@ -78,12 +78,12 @@ public:
|
||||
* @param value time in seconds
|
||||
* returns the corresponding time value
|
||||
*/
|
||||
static float getCorrectTime(timeUnit& unit, float value){
|
||||
static double getCorrectTime(timeUnit& unit, double value){
|
||||
int intUnit = (int)SECONDS;
|
||||
|
||||
/** hr, min, sec */
|
||||
if(value>=1){
|
||||
float newVal = value;
|
||||
double newVal = value;
|
||||
while((newVal>=1)&&(intUnit>=(int)HOURS)){
|
||||
/** value retains the old value */
|
||||
value = newVal;
|
||||
@@ -105,16 +105,31 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**displays an warning message
|
||||
* @param warningMessage the message to be displayed
|
||||
* @param source is the tab or the source of the warning
|
||||
* */
|
||||
static void WarningMessage(string warningMessage,string source)
|
||||
{
|
||||
static QMessageBox* warningBox;
|
||||
source.append(": WARNING");
|
||||
warningBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(warningMessage.c_str()),QMessageBox::Ok, warningBox);
|
||||
warningBox->exec();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**displays an error message
|
||||
* @param errorMessage the message to be displayed
|
||||
* @param source is the tab or the source of the error
|
||||
* */
|
||||
static void ErrorMessage(string errorMessage,char source[])
|
||||
static void ErrorMessage(string errorMessage,string source)
|
||||
{
|
||||
static QMessageBox* errorBox;
|
||||
errorBox= new QMessageBox(QMessageBox::Warning,source,tr(errorMessage.c_str()),QMessageBox::Ok, errorBox);
|
||||
source.append(": ERROR");
|
||||
errorBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(errorMessage.c_str()),QMessageBox::Ok, errorBox);
|
||||
errorBox->exec();
|
||||
}
|
||||
|
||||
@@ -124,13 +139,25 @@ public:
|
||||
* @param infoMessage the message to be displayed
|
||||
* @param source is the tab or the source of the information
|
||||
* */
|
||||
static void InfoMessage(string infoMessage,char source[])
|
||||
static void InfoMessage(string infoMessage,string source)
|
||||
{
|
||||
static QMessageBox* msgBox;
|
||||
msgBox= new QMessageBox(QMessageBox::Information,source,tr(infoMessage.c_str()),QMessageBox::Ok, msgBox);
|
||||
source.append(": INFORMATION");
|
||||
msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(infoMessage.c_str()),QMessageBox::Ok, msgBox);
|
||||
msgBox->exec();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/** range of x and y axes
|
||||
*/
|
||||
enum range{
|
||||
XMINIMUM,
|
||||
XMAXIMUM,
|
||||
YMINIMUM,
|
||||
YMAXIMUM
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
};
|
||||
|
||||
@@ -14,17 +14,19 @@ class slsDetectorUtils;
|
||||
/** Qt Project Class Headers */
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
#include "qDefs.h"
|
||||
class SlsQt1DPlot;
|
||||
class SlsQt2DPlotLayout;
|
||||
class qCloneWidget;
|
||||
/** Qt Include Headers */
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QTimer>
|
||||
#include <QString>
|
||||
|
||||
/** C++ Include Headers */
|
||||
|
||||
#define MAX_1DPLOTS 10
|
||||
|
||||
|
||||
@@ -40,50 +42,57 @@ public:
|
||||
/** Destructor */
|
||||
~qDrawPlot();
|
||||
|
||||
/**is an acquisition running */
|
||||
/**is an acquisition running , need it to prevent measurement tab
|
||||
* from being refreshed when switching tabs during acquisition */
|
||||
bool isRunning(){return running;};
|
||||
/** 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;};
|
||||
|
||||
/** 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;}
|
||||
/** Disables zoom if any of the axes range are checked and fixed with a value */
|
||||
void DisableZoom(bool disable);
|
||||
/** Enables plot from the plot tab*/
|
||||
void EnablePlot(bool enable);
|
||||
/** To know whether 1d started*/
|
||||
bool DoesPlotExist(){return plotExists;};
|
||||
|
||||
/** Its a reminder to update plot to set the xy range
|
||||
* This is done only when there is a plot to update */
|
||||
void SetXYRange(bool changed){XYRangeChanged = changed;};
|
||||
/**Sets the min/max for x/y
|
||||
* @param val is the value to be set
|
||||
* @param xy is xmin,xmax,ymin or ymax */
|
||||
void SetXYRangeValues(double val,qDefs::range xy){XYRangeValues[xy]=val;};
|
||||
/**Sets if min/max for x/y is enabled
|
||||
* @param changed is if this has been changed
|
||||
* @param xy is xmin,xmax,ymin or ymax */
|
||||
void IsXYRangeValues(bool changed,qDefs::range xy){IsXYRange[xy]=changed;};
|
||||
|
||||
/** Get minimum Plot timer - between plots */
|
||||
double GetMinimumPlotTimer(){return PLOT_TIMER_MS;};
|
||||
/** Set Plot timer - between plots in ms*/
|
||||
void SetPlotTimer(double time){timerValue = time;};
|
||||
/** Set Plot frame factor - between plots */
|
||||
void SetFrameFactor(int frame){frameFactor = frame;};
|
||||
|
||||
/** 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);
|
||||
/** Set number of measurements
|
||||
* @param num number of measurements to be set */
|
||||
void setNumMeasurements(int num);
|
||||
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
@@ -171,14 +180,40 @@ private:
|
||||
double* yvalues[MAX_1DPLOTS];
|
||||
/** temporary Image Values in 2D */
|
||||
double* image_data;
|
||||
//bool gui_acquisition_thread_running;
|
||||
|
||||
/**persistency to be reached*/
|
||||
int persistency;
|
||||
/** persistency takes time to reach as it increases per frame
|
||||
* this is the current one */
|
||||
int currentPersistency;
|
||||
/** to update the progress for each getData() so that
|
||||
* measurement tab can request on a timer basis*/
|
||||
int progress;
|
||||
/**If plot is enabled from plot tab*/
|
||||
bool plotEnable;
|
||||
bool plotExists;
|
||||
|
||||
|
||||
/**if an acquisition is running, so as not to refresh tab
|
||||
* and also to update plot only if running (while creating clones)*/
|
||||
bool running;
|
||||
|
||||
/** if the min/max of x and y has been changed,
|
||||
* to notify while plotting */
|
||||
bool XYRangeChanged;
|
||||
/**the specific min/max of x/y*/
|
||||
double XYRangeValues[4];
|
||||
/**if the specific min/max of x/y is enabled */
|
||||
bool IsXYRange[4];
|
||||
|
||||
/** Default timer between plots*/
|
||||
static const double PLOT_TIMER_MS = 500;
|
||||
/** Specific timer value between plots */
|
||||
double timerValue;
|
||||
/** every nth frame when to plot */
|
||||
int frameFactor;
|
||||
bool plotLock;
|
||||
|
||||
|
||||
/** Initializes all its members and the thread */
|
||||
void Initialization();
|
||||
/** Sets up the widget */
|
||||
@@ -214,9 +249,6 @@ private:
|
||||
|
||||
|
||||
public slots:
|
||||
/** Set number of measurements
|
||||
* @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 */
|
||||
void SelectPlot(int i=2);
|
||||
@@ -250,6 +282,7 @@ void StartDaq(bool start);
|
||||
void CloneCloseEvent(int id);
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
void UpdatingPlotFinished();
|
||||
void InterpolateSignal(bool);
|
||||
@@ -258,7 +291,6 @@ void LogzSignal(bool);
|
||||
void SetZRangeSignal(double,double);
|
||||
void EnableZRangeSignal(bool);
|
||||
void SetCurrentMeasurementSignal(int);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,10 @@ private:
|
||||
|
||||
QTimer *progressTimer;
|
||||
|
||||
int numMeasurement;
|
||||
|
||||
int currentMeasurement;
|
||||
|
||||
/** methods */
|
||||
/** Sets up the widget
|
||||
*/
|
||||
@@ -91,6 +95,10 @@ void UpdateFinished();
|
||||
void SetCurrentMeasurement(int val);
|
||||
|
||||
private slots:
|
||||
/** Set number of measurements
|
||||
* @param num number of measurements to be set */
|
||||
void setNumMeasurements(int num);
|
||||
|
||||
/** Set file name
|
||||
* @param fName name of file
|
||||
*/
|
||||
@@ -150,6 +158,7 @@ signals:
|
||||
|
||||
void StartSignal();
|
||||
void StopSignal();
|
||||
void CheckPlotIntervalSignal();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +70,8 @@ void SaveLog();
|
||||
/** Clear Log to File*/
|
||||
void ClearLog();
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
class slsDetectorUtils;
|
||||
/** Qt Project Class Headers */
|
||||
class qDrawPlot;
|
||||
/** Qt Include Headers */
|
||||
#include <QStackedLayout>
|
||||
|
||||
/**
|
||||
*@short sets up the Plot parameters
|
||||
@@ -33,6 +35,9 @@ public:
|
||||
*/
|
||||
~qTabPlot();
|
||||
|
||||
/** To refresh and update widgets
|
||||
*/
|
||||
void Refresh();
|
||||
|
||||
|
||||
private:
|
||||
@@ -45,6 +50,11 @@ private:
|
||||
/** 1d/2d plot */
|
||||
bool isOneD;
|
||||
|
||||
QStackedLayout* stackedLayout;
|
||||
QSpinBox *spinNthFrame;
|
||||
QDoubleSpinBox *spinTimeGap;
|
||||
QComboBox *comboTimeGapUnit;
|
||||
|
||||
/** some Default Values */
|
||||
static QString defaultPlotTitle;
|
||||
static QString defaultHistXAxisTitle;
|
||||
@@ -66,7 +76,10 @@ private:
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
/** Set frequency between plots
|
||||
* returns 0 if there were no errors(important
|
||||
* while editing acquisition period in measurement tab) */
|
||||
int SetFrequency();
|
||||
|
||||
|
||||
|
||||
@@ -94,8 +107,7 @@ void SetZRange();
|
||||
void EnableZRange();
|
||||
/** Set Plot to none, data graph, histogram*/
|
||||
void SetPlot();
|
||||
/** Enable Histogram */
|
||||
void EnableHistogram(bool enable);
|
||||
|
||||
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
|
||||
Reference in New Issue
Block a user