mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 08:10:02 +02:00
WIP
This commit is contained in:
parent
a4fa9ff480
commit
e4a86e544a
@ -20,11 +20,7 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
|
||||
bool xIsLog,yIsLog;
|
||||
|
||||
public:
|
||||
#if QWT_VERSION < 0x060100
|
||||
SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
|
||||
#else
|
||||
SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
|
||||
#endif
|
||||
SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
|
||||
setTrackerMode(AlwaysOn);
|
||||
xIsLog=yIsLog=0;
|
||||
}
|
||||
@ -48,25 +44,15 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
|
||||
bool SetLogY(bool yes) { return yIsLog=yes;}
|
||||
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
|
||||
#else
|
||||
using QwtPlotPicker::trackerText;
|
||||
|
||||
using QwtPlotPicker::trackerText;
|
||||
virtual QwtText trackerText(const QPoint &pos) const{
|
||||
#endif
|
||||
QColor bg(Qt::white);
|
||||
|
||||
#if QT_VERSION >= 0x040300
|
||||
bg.setAlpha(200);
|
||||
#endif
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
#else
|
||||
QwtText text = QwtPlotPicker::trackerText(pos);
|
||||
#endif
|
||||
text.setBackgroundBrush( QBrush( bg ));
|
||||
return text;
|
||||
QColor bg(Qt::white);
|
||||
bg.setAlpha(200);
|
||||
QwtText text = QwtPlotPicker::trackerText(pos);
|
||||
text.setBackgroundBrush( QBrush( bg ));
|
||||
return text;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -77,9 +77,7 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
return (QwtRasterData*) this;
|
||||
}
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);}
|
||||
#else
|
||||
|
||||
virtual QwtInterval range() const{ return QwtInterval(z_min,z_max);}
|
||||
virtual QwtInterval interval(Qt::Axis axis) const {
|
||||
switch (axis){
|
||||
@ -93,7 +91,7 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
return QwtInterval(z_min,z_max);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -85,13 +85,8 @@ private:
|
||||
|
||||
QwtLinearColorMap* colorMapLinearScale{nullptr};
|
||||
QwtLinearColorMap* colorMapLogScale{nullptr};
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtValueList* contourLevelsLinear{nullptr};
|
||||
QwtValueList* contourLevelsLog{nullptr};
|
||||
#else
|
||||
QList<double> contourLevelsLinear;
|
||||
QList<double> contourLevelsLog;
|
||||
#endif
|
||||
bool disableZoom{false};
|
||||
int isLog;
|
||||
};
|
||||
|
@ -25,11 +25,8 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
|
||||
SlsQt2DHist* hist;
|
||||
|
||||
public:
|
||||
#if QWT_VERSION < 0x060100
|
||||
SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
|
||||
#else
|
||||
|
||||
SlsQt2DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
|
||||
#endif
|
||||
setTrackerMode(AlwaysOn);
|
||||
}
|
||||
|
||||
@ -38,15 +35,11 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
|
||||
}
|
||||
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
|
||||
#else
|
||||
|
||||
virtual QwtText trackerTextF(const QPointF &pos) const{
|
||||
#endif
|
||||
QColor bg(Qt::white);
|
||||
#if QT_VERSION >= 0x040300
|
||||
bg.setAlpha(200);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
@ -57,12 +50,10 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
|
||||
sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y()));
|
||||
text.setText(t);
|
||||
}else {
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
#else
|
||||
|
||||
QPoint p=pos.toPoint();
|
||||
QwtText text = QwtPlotZoomer::trackerText(p);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
text.setBackgroundBrush( QBrush( bg ));
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include "qwt_symbol.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#if QWT_VERSION >= 0x060100
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine //hmm
|
||||
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
||||
Initailize();
|
||||
@ -138,11 +138,8 @@ void SlsQtH1D::setSymbolMarkers(bool isMarker) {
|
||||
marker->setStyle(QwtSymbol::Cross);
|
||||
marker->setSize(5, 5);
|
||||
}
|
||||
#if QWT_VERSION < 0x060000
|
||||
setSymbol(*marker);
|
||||
#else
|
||||
setSymbol(marker);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
||||
@ -173,11 +170,9 @@ void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
||||
firstYgt0 = y[i];
|
||||
}
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
setRawData(x, y, ndata);
|
||||
#else
|
||||
|
||||
setRawSamples(x, y, ndata);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||
@ -206,12 +201,8 @@ void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||
if (y[b] > 0 && (firstYgt0 < 0 || firstYgt0 > y[b]))
|
||||
firstYgt0 = y[b];
|
||||
}
|
||||
|
||||
// #if QWT_VERSION<0x060000
|
||||
// setRawData(x,y,ndata);
|
||||
// #else
|
||||
setRawSamples(x, y, ndata);
|
||||
// #endif
|
||||
|
||||
}
|
||||
|
||||
int SlsQtH1D::SetUpArrays(int n) {
|
||||
@ -554,45 +545,24 @@ void SlsQt1DPlot::alignScales() {
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::UnknownStuff() {
|
||||
#if QWT_VERSION < 0x060000
|
||||
// Disable polygon clipping
|
||||
//not supported for version 6
|
||||
QwtPainter::setDeviceClipping(false);
|
||||
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
|
||||
canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
|
||||
#else
|
||||
// We don't need the cache here
|
||||
((QwtPlotCanvas *)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#ifdef Q_WS_X11
|
||||
// Qt::WA_PaintOnScreen is only supported for X11, but leads
|
||||
// to substantial bugs with Qt 4.2.x/Windows
|
||||
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||
void SlsQt1DPlot::DisableZoom(bool disable) {
|
||||
if (disableZoom != disable) {
|
||||
disableZoom = disable;
|
||||
#ifdef VERBOSE
|
||||
if (disable)
|
||||
std::cout << "Disabling zoom\n";
|
||||
else
|
||||
std::cout << "Enabling zoom\n";
|
||||
#endif
|
||||
if (disable) {
|
||||
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)
|
||||
@ -600,11 +570,7 @@ void SlsQt1DPlot::DisableZoom(bool disable) {
|
||||
} 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)
|
||||
|
@ -34,43 +34,27 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
|
||||
|
||||
if(plot()){
|
||||
if(xIsLog){
|
||||
#if QWT_VERSION < 0x50200
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound();
|
||||
#elif QWT_VERSION < 0x060100
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound();
|
||||
#else
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
||||
#endif
|
||||
if(xmin_curr<xmin) xmin_curr=xmin;
|
||||
if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width;
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
||||
if(xmin_curr<xmin)
|
||||
xmin_curr=xmin;
|
||||
if(xmax_curr>xmin+x_width)
|
||||
xmax_curr=xmin+x_width;
|
||||
plot()->setAxisScale(QwtPlot::xBottom,xmin_curr,xmax_curr);
|
||||
}
|
||||
if(yIsLog){
|
||||
#if QWT_VERSION < 0x50200
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound();
|
||||
#elif QWT_VERSION < 0x060100
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound();
|
||||
#else
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
||||
#endif
|
||||
if(ymin_curr<ymin) ymin_curr=ymin;
|
||||
if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width;
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
||||
if(ymin_curr<ymin)
|
||||
ymin_curr=ymin;
|
||||
if(ymax_curr>ymin+y_width)
|
||||
ymax_curr=ymin+y_width;
|
||||
plot()->setAxisScale(QwtPlot::yLeft,ymin_curr,ymax_curr);
|
||||
}
|
||||
plot()->replot();
|
||||
}
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width));
|
||||
#else
|
||||
setZoomBase(QRectF(xmin,ymin,x_width,y_width));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(SlsQtH1D* h){
|
||||
|
@ -55,16 +55,8 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl
|
||||
if(x_min!=xmin||x_max!=xmax||y_min!=ymin||y_max!=ymax){
|
||||
x_min=xmin;x_max=xmax;
|
||||
y_min=ymin;y_max=ymax;
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
setBoundingRect(QRectF(xmin,ymin,x_max-x_min,y_max-y_min));
|
||||
#else
|
||||
setInterval( Qt::XAxis,QwtInterval(xmin,xmax));
|
||||
setInterval( Qt::YAxis,QwtInterval(ymin,ymax));
|
||||
// setInterval( Qt::ZAxis,QwtInterval(zmin,zmax));
|
||||
//setInterval( Qt::ZAxis,QwtInterval(0.,1.));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if(nbinsx*nbinsy<1){
|
||||
@ -107,12 +99,7 @@ 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(){
|
||||
@ -131,11 +118,8 @@ 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;
|
||||
}
|
||||
|
@ -21,32 +21,21 @@
|
||||
|
||||
|
||||
|
||||
#if QWT_VERSION >= 0x060100
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine //hmm remove?
|
||||
|
||||
|
||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
isLog = 0;
|
||||
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
|
||||
d_spectrogram = new QwtPlotSpectrogram();
|
||||
|
||||
hist = new SlsQt2DHist();
|
||||
SetupZoom();
|
||||
SetupColorMap();
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setData(*hist);
|
||||
#else
|
||||
d_spectrogram->setData(hist);
|
||||
#endif
|
||||
|
||||
d_spectrogram->attach(this);
|
||||
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
|
||||
FillTestPlot();
|
||||
Update();
|
||||
}
|
||||
@ -57,25 +46,11 @@ SlsQt2DPlot::~SlsQt2DPlot() {
|
||||
d_spectrogram->detach();
|
||||
//delete d_spectrogram;
|
||||
}
|
||||
if (hist) {
|
||||
delete hist;
|
||||
}
|
||||
if (colorMapLinearScale)
|
||||
delete colorMapLinearScale;
|
||||
if (colorMapLogScale)
|
||||
delete colorMapLogScale;
|
||||
|
||||
|
||||
if (zoomer)
|
||||
delete zoomer;
|
||||
if (panner)
|
||||
delete panner;
|
||||
#if QWT_VERSION<0x060000
|
||||
if (contourLevelsLinear)
|
||||
delete contourLevelsLinear;
|
||||
if (contourLevelsLog)
|
||||
delete contourLevelsLog;
|
||||
#endif
|
||||
delete hist;
|
||||
delete colorMapLinearScale;
|
||||
delete colorMapLogScale;
|
||||
delete zoomer;
|
||||
delete panner;
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetTitle(QString title) {
|
||||
@ -120,40 +95,16 @@ void SlsQt2DPlot::SetZFont(const QFont& f) {
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetupColorMap() {
|
||||
|
||||
colorMapLinearScale = myColourMap(0);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(colorMapLinearScale);
|
||||
#endif
|
||||
|
||||
colorMapLogScale = myColourMap(1);
|
||||
#if QWT_VERSION < 0x060000
|
||||
contourLevelsLinear = new QwtValueList();
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(*contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
;
|
||||
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
|
||||
//
|
||||
#if QWT_VERSION < 0x060000
|
||||
contourLevelsLog = new QwtValueList();
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(*contourLevelsLog) += (pow(10, 2 * level / 10.0) - 1) / 99.0 * 10;
|
||||
|
||||
#else
|
||||
;
|
||||
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(contourLevelsLog) += (pow(10, 2 * level / 10.0) - 1) / 99.0 * 10;
|
||||
#endif
|
||||
|
||||
|
||||
// A color bar on the right axis
|
||||
rightAxis = axisWidget(QwtPlot::yRight);
|
||||
@ -225,23 +176,14 @@ void SlsQt2DPlot::SetupZoom() {
|
||||
}*/
|
||||
|
||||
void SlsQt2DPlot::UnZoom(bool replot) {
|
||||
#if QWT_VERSION < 0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(), hist->GetYMin(), hist->GetXMax() - hist->GetXMin(), hist->GetYMax() - hist->GetYMin()));
|
||||
#else
|
||||
|
||||
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(), hist->GetXMax() - hist->GetXMin(), hist->GetYMax() - hist->GetYMin()));
|
||||
#endif
|
||||
zoomer->setZoomBase(replot); //Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
// zoomer->zoom(0);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width, double y_width) {
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(xmin, ymin, x_width, y_width));
|
||||
|
||||
#else
|
||||
zoomer->setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||
@ -330,28 +272,16 @@ QwtLinearColorMap *SlsQt2DPlot::myColourMap(int log) {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
rightAxis->setColorMap(zInterval, myColourMap(isLog));
|
||||
#endif
|
||||
|
||||
if (!zoomer->zoomRectIndex())
|
||||
UnZoom();
|
||||
#if QWT_VERSION < 0x060000
|
||||
setAxisScale(QwtPlot::yRight, d_spectrogram->data().range().minValue(),
|
||||
d_spectrogram->data().range().maxValue());
|
||||
#else
|
||||
//cprintf(MAGENTA, "zmin:%f zmax:%f\n", zInterval.minValue(), zInterval.maxValue());
|
||||
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue());
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
#endif
|
||||
replot();
|
||||
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetInterpolate(bool enable) {
|
||||
@ -387,63 +317,20 @@ void SlsQt2DPlot::SetZRange(bool isMin, bool isMax, double min, double max){
|
||||
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(myColourMap(isLog));
|
||||
#endif
|
||||
setAxisScaleEngine(QwtPlot::yRight, new QwtLog10ScaleEngine);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLog);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLog);
|
||||
#endif
|
||||
} else {
|
||||
isLog = 0;
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
#endif
|
||||
|
||||
setAxisScaleEngine(QwtPlot::yRight, new QwtLinearScaleEngine);
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
}
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::showSpectrogram(bool on) {
|
||||
// static int io=0;
|
||||
// FillTestPlot(io++);
|
||||
d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, on);
|
||||
d_spectrogram->setDefaultContourPen(on ? QPen() : QPen(Qt::NoPen));
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void SlsQt2DPlot::printPlot(){
|
||||
QPrinter printer;
|
||||
printer.setOrientation(QPrinter::Landscape);
|
||||
#if QT_VERSION < 0x040000
|
||||
printer.setColorMode(QPrinter::Color);
|
||||
printer.setOutputFileName("spectrogram.ps");
|
||||
if (printer.setup())
|
||||
#else
|
||||
printer.setOutputFileName("spectrogram.pdf");
|
||||
QPrintDialog dialog(&printer);
|
||||
if ( dialog.exec() )
|
||||
#endif
|
||||
{
|
||||
print(printer);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user