SpikeStream Nemo Plugin  0.2
RasterView.cpp
Go to the documentation of this file.
00001 //SpikeStream includes
00002 #include "RasterView.h"
00003 using namespace spikestream;
00004 
00005 //Qwt includes
00006 #include <qwt_color_map.h>
00007 
00008 //Qt includes
00009 #include <QDebug>
00010 
00011 
00013 RasterView::RasterView (RasterModel* rasterModel, QWidget* parent) : QwtPlot( parent ){
00014         //Store reference to data
00015         this->rasterModel = rasterModel;
00016 
00017         //Set up the spectrogram
00018         qwtSpectrogram = new QwtPlotSpectrogram();
00019         qwtSpectrogram->setDisplayMode(QwtPlotSpectrogram::ContourMode, false);
00020         QwtLinearColorMap colorMap();
00021         //qwtSpectrogram->setColorMap(colorMap);
00022         qwtSpectrogram->setData(*rasterModel);
00023         qwtSpectrogram->attach(this);
00024 
00025         //setAxisScale(QwtPlot::yRight, d_spectrogram->data().range().minValue(), d_spectrogram->data().range().maxValue() );
00026         //enableAxis(QwtPlot::yRight);
00027 
00028         //Only show major markings on axes
00029         setAxisMaxMinor(QwtPlot::yLeft, 0);
00030         setAxisMaxMinor(QwtPlot::xBottom, 0);
00031 
00032         rescale();
00033 //      plotLayout()->setAlignCanvasToScales(true);
00034 
00035         //Change canvas background
00036         setCanvasBackground(Qt::white);
00037 
00038         //Set titles
00039         //setAxisTitle(QwtPlot::yRight, "Information Integration");
00040 
00041         //Change fonts
00042         QFont axisFont("Arial", 12, QFont::Normal);
00043         setAxisFont(QwtPlot::yLeft, axisFont);
00044         setAxisFont(QwtPlot::xBottom, axisFont);
00045 
00046         // Avoid jumping when labels with more/less digits appear/disappear when scrolling vertically
00047 //      const QFontMetrics fm(axisWidget(QwtPlot::yLeft)->font());
00048 //      QwtScaleDraw *sd = axisScaleDraw(QwtPlot::yLeft);
00049 //      sd->setMinimumExtent( fm.width("100.00") );
00050 
00051         // Show the plots
00052         replot();
00053 }
00054 
00055 
00057 RasterView::~RasterView(){
00058 }
00059 
00060 
00061 /*----------------------------------------------------------*/
00062 /*-----                 PUBLIC METHODS                 -----*/
00063 /*----------------------------------------------------------*/
00064 
00066 void RasterView::rescale(){
00067         setAxisScale(QwtPlot::xBottom, rasterModel->getMinX(), rasterModel->getMaxX(), 1);
00068         setAxisScale(QwtPlot::yLeft, rasterModel->getMinY(),rasterModel->getMaxY(), 1);
00069 }
00070 
00071 
00074 void RasterView::printPlot() {
00075 //      QPrinter printer;
00076 //      printer.setOrientation(QPrinter::Landscape);
00077 //      printer.setOutputFileName("/tmp/spectrogram.pdf");
00078 //      QPrintDialog dialog(&printer);
00079 //      if ( dialog.exec() ){
00080 //              print(printer);
00081 //      }
00082 }
 All Classes Files Functions Variables Typedefs Defines