mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-04 03:40:04 +02:00
Some problems with LogZ solved, but stil crashing when unsetting logZ
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@103 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
3e979fdece
commit
07ff5ce42d
@ -54,7 +54,7 @@ private:
|
||||
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
|
||||
QwtLinearColorMap* myColourMap(int log=0);
|
||||
|
||||
|
||||
int isLog;
|
||||
|
||||
|
||||
public:
|
||||
|
@ -105,7 +105,12 @@ void SlsQt2DHist::SetMinMax(double zmin,double zmax){
|
||||
if(z_min>0) z_min/=1.02; else z_min*=1.02;
|
||||
if(z_max>0) z_max*=1.02; else z_max/=1.02;
|
||||
}
|
||||
#if QWT_VERSION<0x060000
|
||||
;
|
||||
#else
|
||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
double SlsQt2DHist::GetMean(){
|
||||
@ -124,6 +129,12 @@ double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){
|
||||
for(int i=0;i<nb;i++){
|
||||
if(data[i]>0 && data[i]<z_min) z_min=data[i];
|
||||
}
|
||||
#if QWT_VERSION<0x060000
|
||||
;
|
||||
#else
|
||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
||||
#endif
|
||||
|
||||
return z_min;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
using namespace std;
|
||||
|
||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){
|
||||
isLog=0;
|
||||
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
@ -67,7 +68,6 @@ void SlsQt2DPlot::SetupColorMap(){
|
||||
d_spectrogram->setColorMap(colorMapLinearScale );
|
||||
#endif
|
||||
|
||||
|
||||
colorMapLogScale = myColourMap(1);
|
||||
#if QWT_VERSION<0x060000
|
||||
contourLevelsLinear = new QwtValueList();
|
||||
@ -75,7 +75,7 @@ void SlsQt2DPlot::SetupColorMap(){
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
;
|
||||
// contourLevelsLinear = new QList();
|
||||
|
||||
for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
@ -88,7 +88,7 @@ void SlsQt2DPlot::SetupColorMap(){
|
||||
|
||||
#else
|
||||
;
|
||||
// contourLevelsLog = new QList();
|
||||
|
||||
for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10;
|
||||
#endif
|
||||
|
||||
@ -235,14 +235,12 @@ void SlsQt2DPlot::Update(){
|
||||
#if QWT_VERSION<0x060000
|
||||
rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap());
|
||||
#else
|
||||
if (isLog)
|
||||
hist->SetMinimumToFirstGreaterThanZero();
|
||||
|
||||
// const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );
|
||||
const QwtInterval zInterval = hist->range();
|
||||
const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );
|
||||
|
||||
QVector<double> colourStops =((QwtLinearColorMap*)d_spectrogram->colorMap())->colorStops();
|
||||
QwtLinearColorMap* copyMap = myColourMap(colourStops);
|
||||
|
||||
rightAxis->setColorMap(zInterval,copyMap);
|
||||
rightAxis->setColorMap(zInterval,myColourMap(isLog));
|
||||
|
||||
#endif
|
||||
|
||||
@ -257,10 +255,14 @@ void SlsQt2DPlot::Update(){
|
||||
|
||||
|
||||
setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue());
|
||||
cout << "axis scale set" << endl;
|
||||
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
cout << "layout" << endl;
|
||||
#endif
|
||||
cout << "going to replot" << endl;
|
||||
replot();
|
||||
cout << "done" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -286,11 +288,12 @@ void SlsQt2DPlot::InterpolatedPlot(bool on){
|
||||
|
||||
void SlsQt2DPlot::LogZ(bool on){
|
||||
if(on){
|
||||
isLog=1;
|
||||
//if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero();
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLogScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(colorMapLogScale);
|
||||
d_spectrogram->setColorMap(myColorMap(isLog));
|
||||
#endif
|
||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine);
|
||||
#if QWT_VERSION<0x060000
|
||||
@ -299,17 +302,24 @@ void SlsQt2DPlot::LogZ(bool on){
|
||||
d_spectrogram->setContourLevels(contourLevelsLog);
|
||||
#endif
|
||||
}else{
|
||||
isLog=0;
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(colorMapLinearScale);
|
||||
d_spectrogram->setColorMap(myColorMap(isLog));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine);
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
|
||||
}
|
||||
Update();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user