mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
WIP
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include "SlsQt2DPlot.h"
|
||||
|
||||
@ -9,45 +9,38 @@ class QGridLayout;
|
||||
class QString;
|
||||
class QToolButton;
|
||||
|
||||
class SlsQt2DPlotLayout : public QGroupBox {
|
||||
Q_OBJECT
|
||||
|
||||
class SlsQt2DPlotLayout: public QGroupBox{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
SlsQt2DPlotLayout(QWidget * = NULL);
|
||||
~SlsQt2DPlotLayout();
|
||||
|
||||
SlsQt2DPlot* GetPlot(){return the_plot;}
|
||||
void SetXTitle(QString st);
|
||||
void SetYTitle(QString st);
|
||||
void SetZTitle(QString st);
|
||||
void KeepZRangeIfSet();
|
||||
// recalculate zmin and zmax from plot and update z range
|
||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||
void SetInterpolate(bool enable);
|
||||
void SetContour(bool enable);
|
||||
void SetLogz(bool enable);
|
||||
|
||||
private:
|
||||
QGridLayout* the_layout;
|
||||
QToolButton* btnInterpolate;
|
||||
QToolButton* btnContour;
|
||||
QToolButton* btnLogz;
|
||||
SlsQt2DPlot* the_plot;
|
||||
SlsQt2DPlot *GetPlot();
|
||||
void SetXTitle(QString st);
|
||||
void SetYTitle(QString st);
|
||||
void SetZTitle(QString st);
|
||||
void SetInterpolate(bool enable);
|
||||
void SetContour(bool enable);
|
||||
void SetLogz(bool enable);
|
||||
void KeepZRangeIfSet();
|
||||
// recalculate zmin and zmax from plot and update z range
|
||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||
public slots:
|
||||
void UpdateZRange(double min, double max);
|
||||
|
||||
private:
|
||||
void Layout();
|
||||
|
||||
QGridLayout *the_layout;
|
||||
QToolButton *btnInterpolate;
|
||||
QToolButton *btnContour;
|
||||
QToolButton *btnLogz;
|
||||
SlsQt2DPlot *the_plot;
|
||||
|
||||
bool isLog;
|
||||
double zmin;
|
||||
double zmax;
|
||||
bool isZmin;
|
||||
bool isZmax;
|
||||
|
||||
public slots:
|
||||
void SetZScaleToLog(bool enable);
|
||||
void ResetRange();
|
||||
|
||||
// update z range
|
||||
void UpdateZRange(double min, double max) ;
|
||||
|
||||
};
|
||||
|
@ -25,14 +25,48 @@ SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
||||
delete the_plot;
|
||||
}
|
||||
|
||||
SlsQt2DPlot* SlsQt2DPlotLayout::GetPlot(){
|
||||
return the_plot;
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetXTitle(QString st){
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetYTitle(QString st){
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetInterpolate(bool enable) {
|
||||
the_plot->InterpolatedPlot(enable);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetContour(bool enable) {
|
||||
the_plot->showContour(enable);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetLogz(bool enable) {
|
||||
isLog = enable;
|
||||
the_plot->LogZ(enable);
|
||||
SetZRange(isZmin, isZmax, zmin, zmax);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::Layout(){
|
||||
if(the_layout) delete the_layout;
|
||||
the_layout = new QGridLayout(this);
|
||||
the_layout->addWidget(the_plot,2,0,3,3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
||||
UpdateZRange(zmin, zmax);
|
||||
}
|
||||
@ -47,7 +81,6 @@ void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max
|
||||
UpdateZRange(min, max);
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
||||
if(isLog) {
|
||||
the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||
@ -68,35 +101,3 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
||||
the_plot->Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetInterpolate(bool enable) {
|
||||
the_plot->InterpolatedPlot(enable);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetContour(bool enable) {
|
||||
the_plot->showContour(enable);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetLogz(bool enable) {
|
||||
isLog = enable;
|
||||
the_plot->LogZ(enable);
|
||||
SetZRange(isZmin, isZmax, zmin, zmax);
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlotLayout::SetXTitle(QString st){
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetYTitle(QString st){
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZTitle(QString st){
|
||||
QwtText title(st);
|
||||
title.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
|
||||
}
|
||||
|
Reference in New Issue
Block a user