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(QVector<double> colourStops);
|
||||||
QwtLinearColorMap* myColourMap(int log=0);
|
QwtLinearColorMap* myColourMap(int log=0);
|
||||||
|
|
||||||
|
int isLog;
|
||||||
|
|
||||||
|
|
||||||
public:
|
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_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(z_max>0) z_max*=1.02; else z_max/=1.02;
|
||||||
}
|
}
|
||||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
#if QWT_VERSION<0x060000
|
||||||
|
;
|
||||||
|
#else
|
||||||
|
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double SlsQt2DHist::GetMean(){
|
double SlsQt2DHist::GetMean(){
|
||||||
@ -122,8 +127,14 @@ double SlsQt2DHist::GetMean(){
|
|||||||
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){
|
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){
|
||||||
z_min=abs(z_max)+1;
|
z_min=abs(z_max)+1;
|
||||||
for(int i=0;i<nb;i++){
|
for(int i=0;i<nb;i++){
|
||||||
if(data[i]>0&&data[i]<z_min) z_min=data[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;
|
return z_min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){
|
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){
|
||||||
|
isLog=0;
|
||||||
|
|
||||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||||
@ -61,12 +62,11 @@ void SlsQt2DPlot::SetupColorMap(){
|
|||||||
|
|
||||||
|
|
||||||
colorMapLinearScale = myColourMap(0);
|
colorMapLinearScale = myColourMap(0);
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
d_spectrogram->setColorMap(*colorMapLinearScale );
|
||||||
#else
|
#else
|
||||||
d_spectrogram->setColorMap(colorMapLinearScale);
|
d_spectrogram->setColorMap(colorMapLinearScale );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
colorMapLogScale = myColourMap(1);
|
colorMapLogScale = myColourMap(1);
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
@ -75,7 +75,7 @@ void SlsQt2DPlot::SetupColorMap(){
|
|||||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||||
#else
|
#else
|
||||||
;
|
;
|
||||||
// contourLevelsLinear = new QList();
|
|
||||||
for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLinear) += level;
|
for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLinear) += level;
|
||||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||||
#endif
|
#endif
|
||||||
@ -88,7 +88,7 @@ void SlsQt2DPlot::SetupColorMap(){
|
|||||||
|
|
||||||
#else
|
#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;
|
for(double level=0.5;level<10.0;level+=1.0 ) (contourLevelsLog) += (pow(10,2*level/10.0)-1)/99.0 * 10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -235,15 +235,13 @@ void SlsQt2DPlot::Update(){
|
|||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap());
|
rightAxis->setColorMap(d_spectrogram->data().range(),d_spectrogram->colorMap());
|
||||||
#else
|
#else
|
||||||
|
if (isLog)
|
||||||
|
hist->SetMinimumToFirstGreaterThanZero();
|
||||||
|
|
||||||
// const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );
|
const QwtInterval zInterval = d_spectrogram->data()->interval( Qt::ZAxis );
|
||||||
const QwtInterval zInterval = hist->range();
|
|
||||||
|
|
||||||
QVector<double> colourStops =((QwtLinearColorMap*)d_spectrogram->colorMap())->colorStops();
|
|
||||||
QwtLinearColorMap* copyMap = myColourMap(colourStops);
|
|
||||||
|
|
||||||
rightAxis->setColorMap(zInterval,copyMap);
|
|
||||||
|
|
||||||
|
rightAxis->setColorMap(zInterval,myColourMap(isLog));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!zoomer->zoomRectIndex()) UnZoom();
|
if(!zoomer->zoomRectIndex()) UnZoom();
|
||||||
@ -257,10 +255,14 @@ void SlsQt2DPlot::Update(){
|
|||||||
|
|
||||||
|
|
||||||
setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue());
|
setAxisScale(QwtPlot::yRight,zInterval.minValue(), zInterval.maxValue());
|
||||||
|
cout << "axis scale set" << endl;
|
||||||
|
|
||||||
plotLayout()->setAlignCanvasToScales(true);
|
plotLayout()->setAlignCanvasToScales(true);
|
||||||
|
cout << "layout" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
cout << "going to replot" << endl;
|
||||||
replot();
|
replot();
|
||||||
|
cout << "done" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -285,12 +287,13 @@ void SlsQt2DPlot::InterpolatedPlot(bool on){
|
|||||||
|
|
||||||
|
|
||||||
void SlsQt2DPlot::LogZ(bool on){
|
void SlsQt2DPlot::LogZ(bool on){
|
||||||
if(on){
|
if(on){
|
||||||
|
isLog=1;
|
||||||
//if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero();
|
//if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero();
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
d_spectrogram->setColorMap(*colorMapLogScale);
|
d_spectrogram->setColorMap(*colorMapLogScale);
|
||||||
#else
|
#else
|
||||||
d_spectrogram->setColorMap(colorMapLogScale);
|
d_spectrogram->setColorMap(myColorMap(isLog));
|
||||||
#endif
|
#endif
|
||||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine);
|
setAxisScaleEngine(QwtPlot::yRight,new QwtLog10ScaleEngine);
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
@ -298,18 +301,25 @@ void SlsQt2DPlot::LogZ(bool on){
|
|||||||
#else
|
#else
|
||||||
d_spectrogram->setContourLevels(contourLevelsLog);
|
d_spectrogram->setContourLevels(contourLevelsLog);
|
||||||
#endif
|
#endif
|
||||||
}else{
|
}else{
|
||||||
|
isLog=0;
|
||||||
|
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||||
#else
|
#else
|
||||||
d_spectrogram->setColorMap(colorMapLinearScale);
|
d_spectrogram->setColorMap(myColorMap(isLog));
|
||||||
#endif
|
#endif
|
||||||
setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine);
|
|
||||||
|
|
||||||
|
|
||||||
|
setAxisScaleEngine(QwtPlot::yRight,new QwtLinearScaleEngine);
|
||||||
|
|
||||||
#if QWT_VERSION<0x060000
|
#if QWT_VERSION<0x060000
|
||||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||||
#else
|
#else
|
||||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
Update();
|
Update();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user