mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Setting axes range and enabling/disabling zooming functionalities successfull
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@10 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_plot_marker.h>
|
||||
|
||||
#include <qwt_scale_div.h>
|
||||
#include "SlsQt1DZoomer.h"
|
||||
|
||||
class QPen;
|
||||
@ -104,6 +104,15 @@ 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(); };
|
||||
|
||||
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);}
|
||||
|
||||
|
@ -52,9 +52,22 @@ int SlsQtH1D::SetLineColor(int c){
|
||||
static int last_color = 1;
|
||||
if(c<0) c=(last_color+1)%3;
|
||||
|
||||
if(c==0) pen_ptr->setColor(Qt::black);
|
||||
switch(c){
|
||||
case 0: pen_ptr->setColor(Qt::black); break;
|
||||
case 1: pen_ptr->setColor(Qt::red); break;
|
||||
case 2: pen_ptr->setColor(Qt::blue); break;
|
||||
case 3: pen_ptr->setColor(Qt::green); break;
|
||||
case 4: pen_ptr->setColor(Qt::magenta); break;
|
||||
case 5: pen_ptr->setColor(Qt::cyan); break;
|
||||
case 6: pen_ptr->setColor(Qt::darkYellow); break;
|
||||
case 7: pen_ptr->setColor(Qt::gray); break;
|
||||
case 8: pen_ptr->setColor(Qt::darkBlue); break;
|
||||
case 9: pen_ptr->setColor(Qt::darkGreen); break;
|
||||
case 10: pen_ptr->setColor(Qt::darkMagenta); break;
|
||||
}
|
||||
/* if(c==0) pen_ptr->setColor(Qt::black);
|
||||
else if(c==1) pen_ptr->setColor(Qt::red);
|
||||
else pen_ptr->setColor(Qt::blue);
|
||||
else pen_ptr->setColor(Qt::blue);*/
|
||||
|
||||
setPen(*pen_ptr);
|
||||
|
||||
@ -281,7 +294,8 @@ void SlsQt1DPlot::CalculateNResetZoomBase(){
|
||||
void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D* h){
|
||||
hist_list->Add(h);
|
||||
CalculateNResetZoomBase();
|
||||
if(!hist_list->Next()) UnZoom();
|
||||
//commented out by dhanya to take off zooming every hist in 1d plots
|
||||
//if(!hist_list->Next()) UnZoom();
|
||||
Update();
|
||||
}
|
||||
|
||||
@ -300,10 +314,14 @@ void SlsQt1DPlot::SetTitle(const char* title){
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetXTitle(const char* title){
|
||||
setAxisTitle(QwtPlot::xBottom,title);
|
||||
QwtText t(title);
|
||||
t.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
setAxisTitle(QwtPlot::xBottom,t);
|
||||
}
|
||||
void SlsQt1DPlot::SetYTitle(const char* title){
|
||||
setAxisTitle(QwtPlot::yLeft,title);
|
||||
QwtText t(title);
|
||||
t.setFont(QFont("Sans Serif",11,QFont::Normal));
|
||||
setAxisTitle(QwtPlot::yLeft,t);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetLogX(bool yes){ SetLog(QwtPlot::xBottom,yes);}
|
||||
@ -438,3 +456,37 @@ void SlsQt1DPlot::UnknownStuff(){
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SlsQt1DPlot::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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user